From d57b1f0fd4b9a72345bab8d3bc92d50cc634e436 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Fri, 19 Feb 2021 16:09:56 +1300 Subject: [PATCH 1/3] Python Package example --- packages/Makefile | 22 ++++++++++++++++++++++ packages/python/3.9.1/Makefile | 17 +++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 packages/Makefile create mode 100644 packages/python/3.9.1/Makefile diff --git a/packages/Makefile b/packages/Makefile new file mode 100644 index 0000000..56fba4f --- /dev/null +++ b/packages/Makefile @@ -0,0 +1,22 @@ +LANG_NAME=$(or ${NAME},none) +LANG_VERSION=$(or ${VERSION},0.0.0) +LANG_AUTHOR=$(or ${AUTHOR},HexF ) +LANG_DEPS=$(or ${DEPS}) +LANG_BINARY_FILES=$(or ${BINARY_FILES},) + +${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: pkg-info.json package.squashfs + tar czvf $@ $* + +package.squashfs: ${LANG_BINARY_FILES} + mksquashfs $* $@ + +%.json: %.jq + jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@ + +pkg-info.jq: + echo '.language="${LANG_NAME}"' > pkg-info.jq + echo '.version="${LANG_VERSION}"' >> pkg-info.jq + echo '.author="${LANG_AUTHOR}"' >> pkg-info.jq + echo '.dependencies={}' >> pkg-info.jq + $(foreach dep, ${LANG_DEPS}, echo '.dependencies.$(word 1,$(subst =, ,${dep}))="$(word 2,$(subst =, ,${dep}))"' >> pkg-info.jq) + diff --git a/packages/python/3.9.1/Makefile b/packages/python/3.9.1/Makefile new file mode 100644 index 0000000..ebfa3fe --- /dev/null +++ b/packages/python/3.9.1/Makefile @@ -0,0 +1,17 @@ +NAME=python +VERSION=3.9.1 +AUTHOR=Thomas Hobson +DEPS= +BINARY_FILES= + +include ../../Makefile + +bin: + +Python-${VERSION}.tgz: + curl "https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz" -O $@ + +%: %.tgz + tar xzvf $@ + + From e2c8427a7ae33ef284026c50cef6dfd94a9c3762 Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Fri, 19 Feb 2021 16:48:46 +1300 Subject: [PATCH 2/3] Python 3.9.1 Package --- packages/.gitignore | 3 +++ packages/Makefile | 8 ++++++-- packages/python/3.9.1/Makefile | 18 +++++++++++++----- 3 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 packages/.gitignore diff --git a/packages/.gitignore b/packages/.gitignore new file mode 100644 index 0000000..022537b --- /dev/null +++ b/packages/.gitignore @@ -0,0 +1,3 @@ +* +!Makefile +!.gitignore \ No newline at end of file diff --git a/packages/Makefile b/packages/Makefile index 56fba4f..52345bc 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -5,10 +5,10 @@ LANG_DEPS=$(or ${DEPS}) LANG_BINARY_FILES=$(or ${BINARY_FILES},) ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: pkg-info.json package.squashfs - tar czvf $@ $* + tar czvf $@ $? package.squashfs: ${LANG_BINARY_FILES} - mksquashfs $* $@ + mksquashfs $? $@ %.json: %.jq jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@ @@ -20,3 +20,7 @@ pkg-info.jq: echo '.dependencies={}' >> pkg-info.jq $(foreach dep, ${LANG_DEPS}, echo '.dependencies.$(word 1,$(subst =, ,${dep}))="$(word 2,$(subst =, ,${dep}))"' >> pkg-info.jq) +.PHONY: clean +clean: + rm -rf $(filter-out Makefile, $(wildcard *)) + \ No newline at end of file diff --git a/packages/python/3.9.1/Makefile b/packages/python/3.9.1/Makefile index ebfa3fe..d77b69a 100644 --- a/packages/python/3.9.1/Makefile +++ b/packages/python/3.9.1/Makefile @@ -2,16 +2,24 @@ NAME=python VERSION=3.9.1 AUTHOR=Thomas Hobson DEPS= -BINARY_FILES= +BINARY_FILES=out/ run + +MAKE_JOBS=64 include ../../Makefile -bin: +run: + echo "bin/python3.9 $*" > run + +out/: Python-${VERSION}/ + cd $< && ./configure --prefix / + make -j${MAKE_JOBS} -C $< + DESTDIR=../out make -j${MAKE_JOBS} -C $< altinstall Python-${VERSION}.tgz: - curl "https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz" -O $@ + curl "https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz" -o $@ -%: %.tgz - tar xzvf $@ +%/: %.tgz + tar xzvf $< From 36102f22b4ce36cc6ec7a455754549e5c12f431c Mon Sep 17 00:00:00 2001 From: Thomas Hobson Date: Fri, 19 Feb 2021 17:32:35 +1300 Subject: [PATCH 3/3] Python 3.9.1 Package (but better) --- packages/.gitignore | 2 +- packages/Makefile | 12 +++++++----- packages/python/3.9.1/Makefile | 13 ++++++++----- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/packages/.gitignore b/packages/.gitignore index 022537b..a9f5c08 100644 --- a/packages/.gitignore +++ b/packages/.gitignore @@ -1,3 +1,3 @@ * -!Makefile +!**/Makefile !.gitignore \ No newline at end of file diff --git a/packages/Makefile b/packages/Makefile index 52345bc..51218a8 100644 --- a/packages/Makefile +++ b/packages/Makefile @@ -2,14 +2,16 @@ LANG_NAME=$(or ${NAME},none) LANG_VERSION=$(or ${VERSION},0.0.0) LANG_AUTHOR=$(or ${AUTHOR},HexF ) LANG_DEPS=$(or ${DEPS}) -LANG_BINARY_FILES=$(or ${BINARY_FILES},) +LANG_COMPILED=$(or ${COMPILED}, false) -${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: pkg-info.json package.squashfs +LANG_PKG_TARGETS=pkg-info.json ${LANG_NAME}-${LANG_VERSION}/ ${LANG_NAME}-${LANG_VERSION}/environment run + +ifeq (${LANG_COMPILED}, true) +${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) compile +endif +${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) tar czvf $@ $? -package.squashfs: ${LANG_BINARY_FILES} - mksquashfs $? $@ - %.json: %.jq jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@ diff --git a/packages/python/3.9.1/Makefile b/packages/python/3.9.1/Makefile index d77b69a..6854683 100644 --- a/packages/python/3.9.1/Makefile +++ b/packages/python/3.9.1/Makefile @@ -2,22 +2,25 @@ NAME=python VERSION=3.9.1 AUTHOR=Thomas Hobson DEPS= -BINARY_FILES=out/ run +COMPILED=false MAKE_JOBS=64 include ../../Makefile run: - echo "bin/python3.9 $*" > run + echo "python3.9 $*" > run -out/: Python-${VERSION}/ +python-${VERSION}/environment: + echo 'export PATH=$$PWD/python-${VERSION}/bin:$$PATH' > $@ + +python-${VERSION}/: Python-${VERSION}/ cd $< && ./configure --prefix / make -j${MAKE_JOBS} -C $< - DESTDIR=../out make -j${MAKE_JOBS} -C $< altinstall + DESTDIR=../$@ make -j${MAKE_JOBS} -C $< altinstall || true Python-${VERSION}.tgz: - curl "https://www.python.org/ftp/python/${VERSION}/Python-${VERSION}.tgz" -o $@ + curl "https://www.python.org/ftp/python/${VERSION}/$@" -o $@ %/: %.tgz tar xzvf $<