From 1c0db2166e6ca11e04c8e36ec2d3dd9375841e1b Mon Sep 17 00:00:00 2001 From: PedroEdiaz Date: Sun, 16 Jun 2024 12:33:26 +0600 Subject: [PATCH] First commit: Add Readme and main Makefile --- Makefile | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ README | 38 ++++++++++++++++++++++++++ 2 files changed, 120 insertions(+) create mode 100644 Makefile create mode 100644 README diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..60248e6 --- /dev/null +++ b/Makefile @@ -0,0 +1,82 @@ +# VARIABLES +ARCH=x86_64-musl +CACHEDIR = ${XDG_CACHE_HOME}/xbps-make +BUILDDIR = ${XDG_RUNTIME_DIR}/xbps-make +XBPSDIR = ${XDG_CACHE_HOME}/xbps +POSIX=yes +MAN=yes + +# PROTOTYPES +.SUFFIXES: .d .xbps .src + +.d.src: + mkdir -p ${BUILDDIR} + ${MAKE} -C $< ${CACHEDIR}/`basename $@` + rm -rf ${BUILDDIR} + +.d.xbps: + mkdir -p ${BUILDDIR} + ${MAKE} -C $< ${CACHEDIR}/`basename $@` + rm -rf ${BUILDDIR} + +# Default +help: + cat README + +# BUILD RULES +${CACHEDIR}/${package}.src: ${CACHEDIR} + test -d files && mkdir -p files && cp -R files ${BUILDDIR}/files || true + ${MAKE} -C ${BUILDDIR} -f `pwd`/Makefile prepare + tar -z -cf $@ -C ${BUILDDIR}/build . + +${CACHEDIR}/${package}.xbps: ${CACHEDIR} ${BUILDDIR}/root + xbps-create \ + -A ${ARCH} \ + -n ${package}-${pkgver} \ + -s "${description}" \ + -C "${conflicts}" \ + -D "${dependecies}" \ + -H "${homepage}" \ + -l "${license}" \ + -P "${provides}" \ + -R "${replaces}" \ + --alternatives "${alternatives}" \ + --shlib-provides "${shlib-provides}" \ + --shlib-requires "${shlib-requires}" \ + ${BUILDDIR}/root + mv *.xbps ${XBPSDIR} + xbps-rindex -af ${XBPSDIR}/${package}-${pkgver}.${ARCH}.xbps + +${BUILDDIR}/root: ${BUILDDIR}/build + ${MAKE} -C ${BUILDDIR}/build -f `pwd`/Makefile root=$@ \ + root root-posix-${POSIX} root-man-${MAN} + + test -f `pwd`/postinstall.sh && install -Dm 755 `pwd`/postinstall.sh "$@/var/db/bmpm/${package}.sh" || true + +${BUILDDIR}/build: + mkdir -p $@ + tar -z -xf ${CACHEDIR}/${package}.src -C $@ + +${CACHEDIR}: + mkdir -p $@ + +clean: + rm -r ${BUILDDIR} + +# OPTION BUILDS +root-posix: +root-posix-no: +root-posix-yes: root-posix +root-man: +root-man-yes: root-man +root-man-no: + +# UTIL +DOWNLOAD = curl -sLO +SHA256 = test `sha256sum $@ |sed 's/\s.*//'` = +SHA256D = test `find $@ -type f |xargs sha256sum|sort|sha256sum|sed 's/\s.*//'` = + +GITCLONE = \ + git clone $$url/$$pkg &&\ + git -C $$pkg reset --hard $$commit &&\ + rm -rf $$pkg/.git diff --git a/README b/README new file mode 100644 index 0000000..5429edf --- /dev/null +++ b/README @@ -0,0 +1,38 @@ +xbps-make: xbps Makefiles repository +==================================== +This is a repository of posix Makefiles used to build diferent xbps +packages with one simple generic command and minimum dependecies. +Easy to hack if you don't use xbps, or any other dependecie. + +Usage: + $ make devel/tcc.src (download source) + $ make devel/tcc.xbps (build and make package) + +Options: + MAN=no (Do not install manuals) + POSIX=no (Do not install complice) + BUILDDIR=path (compile .src on path) + CACHEDIR=path (save .src on path) + XBPSDIR=path (save .xbps on path) + +Dependecies: + * xbps + * make + * tar + * gzip + _ curl + _ git + _ sha256 + _ sed + _ find + _ xargs + +Warning: + * This proyect it's used with bmake, other posix make programs + haven't been tested, but it should work, feel free to adapt it + if needed. + * GNU make doesn't work because the "include" command work + diferent than posix make "include" command. + +Licence: + 0BSD - Zero Clause BSD Licence