Better python packaging

This commit is contained in:
Thomas Hobson 2021-02-19 18:53:26 +13:00
parent 51b06018c1
commit 4f3e7a536d
No known key found for this signature in database
GPG Key ID: 9F1FD9D87950DB6F
6 changed files with 54 additions and 32 deletions

3
packages/.gitignore vendored
View File

@ -1,3 +0,0 @@
*
!**/Makefile
!.gitignore

View File

@ -10,7 +10,7 @@ ifeq (${LANG_COMPILED}, true)
${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) compile ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) compile
endif endif
${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS) ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz: $(LANG_PKG_TARGETS)
tar czvf $@ $? tar czf $@ $?
%.json: %.jq %.json: %.jq
jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@ jq '$(shell tr '\n' '|' < $<).' <<< "{}" > $@
@ -25,9 +25,16 @@ pkg-info.jq:
%.asc: % %.asc: %
gpg --detach-sig --armor --output $@ $< gpg --detach-sig --armor --output $@ $<
%/: %.tgz
tar xzf $<
.PHONY: clean .PHONY: clean
clean: clean:
rm -rf $(filter-out Makefile, $(wildcard *)) rm -rf $(filter-out Makefile, $(wildcard *))
,PHONY: cleanup
cleanup:
rm -rf $(filter-out ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc, $(filter-out ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz, $(filter-out Makefile, $(wildcard *))))
.PHONY: sign .PHONY: sign
sign: ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc sign: ${LANG_NAME}-${LANG_VERSION}.pkg.tar.gz.asc

1
packages/python/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*/

View File

@ -1,28 +0,0 @@
NAME=python
VERSION=3.9.1
AUTHOR=Thomas Hobson <thomas@hexf.me>
DEPS=
COMPILED=false
MAKE_JOBS=64
include ../../Makefile
run:
echo "python3.9 $*" > run
python-${VERSION}/environment:
echo 'export PATH=$$PWD/python-${VERSION}/bin:$$PATH' > $@
python-${VERSION}/: Python-${VERSION}/
cd $< && ./configure --prefix /
make -j${MAKE_JOBS} -C $<
DESTDIR=../$@ make -j${MAKE_JOBS} -C $< altinstall || true
Python-${VERSION}.tgz:
curl "https://www.python.org/ftp/python/${VERSION}/$@" -o $@
%/: %.tgz
tar xzvf $<

24
packages/python/Makefile Normal file
View File

@ -0,0 +1,24 @@
LANGUAGE=python
VERSIONS=2.7.1 3.9.1
.PHONY: build sign cleanup clean
build: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz,${VERSIONS})
sign: $(patsubst %,%/${LANGUAGE}-%.pkg.tar.gz.asc,${VERSIONS})
clean:
rm -rf ${VERSIONS}
cleanup: $(patsubst %,%/cleanup,${VERSIONS})
%/cleanup: %/Makefile
$(MAKE) -C $(shell dirname $<) cleanup
rm $(shell dirname $<)/Makefile
%/${LANGUAGE}-%.pkg.tar.gz.asc: %/Makefile
$(MAKE) -C $(shell dirname $<) sign
%/${LANGUAGE}-%.pkg.tar.gz: %/Makefile
$(MAKE) -C $(shell dirname $<)
%/Makefile:
@mkdir -p $(shell dirname $@)
@echo 'VERSION=$(patsubst %/Makefile,%,$@)' > $@
@echo 'include ../base.mk' >> $@

21
packages/python/base.mk Normal file
View File

@ -0,0 +1,21 @@
NAME=python
AUTHOR=Thomas Hobson <thomas@hexf.me>
DEPS=
#VERSION=
COMPILED=false
include ../../common.mk
run:
echo 'python$(shell grep -oP "\d+.\d+"<<<${VERSION}) $$*' > run
python-${VERSION}/environment:
echo 'export PATH=$$PWD/${NAME}-${VERSION}/bin:$$PATH' > $@
python-${VERSION}/: Python-${VERSION}/
cd $< && ./configure --prefix /
$(MAKE) -j$(or ${MAKE_JOBS},64) -C $<
DESTDIR=../$@ $(MAKE) -j$(or ${MAKE_JOBS},64) -C $< altinstall || true
Python-${VERSION}.tgz:
curl "https://www.python.org/ftp/python/${VERSION}/$@" -o $@