From 1c4edc13b7892d7a5f04ced44e0327a9c144ad76 Mon Sep 17 00:00:00 2001 From: Hal Emmerich Date: Fri, 12 Jun 2020 20:23:04 -0500 Subject: [PATCH] refine make system for packages --- makefile | 15 ++++++++------- packages/filesystem/font-source-code-pro/makefile | 10 +++++++--- packages/filesystem/{filesystem.make => makefile} | 5 ++++- packages/filesystem/xsecurelock/makefile | 14 +++++++------- packages/initramfs/makefile | 5 +++++ packages/kernel/makefile | 5 +++++ packages/makefile | 15 +++++++++++++++ packages/packaging-readme.md | 6 ++++++ scripts/buildFilesystem.sh | 1 + scripts/common.mk | 11 +++++++++++ 10 files changed, 69 insertions(+), 18 deletions(-) rename packages/filesystem/{filesystem.make => makefile} (60%) create mode 100644 packages/initramfs/makefile create mode 100644 packages/kernel/makefile create mode 100644 packages/makefile create mode 100755 scripts/common.mk diff --git a/makefile b/makefile index de5484e..2804f14 100644 --- a/makefile +++ b/makefile @@ -23,13 +23,9 @@ endif OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-c201.img BASE=$(OUTNAME)-BASE +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk -PRAWNOS_ROOT := $(shell pwd) -PBUILDER_CHROOT=$(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz -PBUILDER_RC=$(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc - -# Otherwise errors are ignored when output is piped to tee: -SHELL=/bin/bash -o pipefail #Usage: #run make image @@ -123,6 +119,11 @@ filesystem: [ -f $(BASE) ] || ./scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) 2>&1 | tee build/logs/fs-log.txt +#:::::::::::::::::::::::::::::: packages :::::::::::::::::::::::::::::::: +.PHONY: packages +packages: + cd packages && $(MAKE) + #:::::::::::::::::::::::::::::: image management :::::::::::::::::::::::::: .PHONY: kernel_inject @@ -152,7 +153,7 @@ image: pbuilder_create: $(MAKE) $(PBUILDER_CHROOT) -$(PBUILDER_CHROOT): $(PBUILDER_RC) +$(PBUILDER_CHROOT): pbuilder create --basetgz $(PBUILDER_CHROOT) --configfile $(PBUILDER_RC) #TODO: should only update if not updated for a day diff --git a/packages/filesystem/font-source-code-pro/makefile b/packages/filesystem/font-source-code-pro/makefile index 5ecd0ff..70e958c 100644 --- a/packages/filesystem/font-source-code-pro/makefile +++ b/packages/filesystem/font-source-code-pro/makefile @@ -1,7 +1,11 @@ -all: font-source-code-pro-deb +#import all shared make vars +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk -.PHONY: font-source-code-pro-deb -font-source-code-pro-deb: +VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) + +font-source-code-pro_$(VERSION)_all.deb: + @echo Building $@ cd src/; debuild -us -uc .PHONY: clean diff --git a/packages/filesystem/filesystem.make b/packages/filesystem/makefile similarity index 60% rename from packages/filesystem/filesystem.make rename to packages/filesystem/makefile index a889a7a..0da5639 100644 --- a/packages/filesystem/filesystem.make +++ b/packages/filesystem/makefile @@ -1,3 +1,6 @@ +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk + SUBDIRS = $(shell ls -d */) all: @@ -9,4 +12,4 @@ all: clean: for dir in $(SUBDIRS) ; do \ make clean -C $$dir ; \ - done \ No newline at end of file + done diff --git a/packages/filesystem/xsecurelock/makefile b/packages/filesystem/xsecurelock/makefile index df2a529..a373b11 100644 --- a/packages/filesystem/xsecurelock/makefile +++ b/packages/filesystem/xsecurelock/makefile @@ -1,12 +1,12 @@ -SHELL := /bin/bash -PRAWNOS_ROOT := $(shell cd ../../../; pwd) -PBUILDER_CHROOT=$(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz -PBUILDER_RC=$(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc +#import all shared make vars +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk -all: xsecurelock-deb -.PHONY: xsecurelock-deb -xsecurelock-deb: +VERSION := $(shell cd src/; dpkg-parsechangelog --show-field Version) + +xsecurelock_$(VERSION)_armhf.deb: + @echo Building $@ cd src/; pdebuild --configfile $(PBUILDER_RC) \ --buildresult .. \ -- \ diff --git a/packages/initramfs/makefile b/packages/initramfs/makefile new file mode 100644 index 0000000..cd1346a --- /dev/null +++ b/packages/initramfs/makefile @@ -0,0 +1,5 @@ +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk + +all: + @echo TODO diff --git a/packages/kernel/makefile b/packages/kernel/makefile new file mode 100644 index 0000000..cd1346a --- /dev/null +++ b/packages/kernel/makefile @@ -0,0 +1,5 @@ +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk + +all: + @echo TODO diff --git a/packages/makefile b/packages/makefile new file mode 100644 index 0000000..0da5639 --- /dev/null +++ b/packages/makefile @@ -0,0 +1,15 @@ +PRAWNOS_ROOT := $(shell git rev-parse --show-toplevel) +include $(PRAWNOS_ROOT)/scripts/common.mk + +SUBDIRS = $(shell ls -d */) + +all: + for dir in $(SUBDIRS) ; do \ + make -C $$dir ; \ + done + + +clean: + for dir in $(SUBDIRS) ; do \ + make clean -C $$dir ; \ + done diff --git a/packages/packaging-readme.md b/packages/packaging-readme.md index af08642..bf60179 100644 --- a/packages/packaging-readme.md +++ b/packages/packaging-readme.md @@ -42,6 +42,12 @@ make ``` the resulting .deb will be in that same folder when the build is complete +All packages can be built by running +``` +make +``` +from the packages directory + ### Uploading packages New packages, and package updates can upload to `deb.prawnos.com` by maintainers first by building and then running diff --git a/scripts/buildFilesystem.sh b/scripts/buildFilesystem.sh index dcf726e..5d84690 100755 --- a/scripts/buildFilesystem.sh +++ b/scripts/buildFilesystem.sh @@ -248,6 +248,7 @@ chroot $outmnt apt install -y libinput-tools xdotool build-essential PRAWN_ROOT=$(pwd) cd $XSECURELOCK_PATH && make cd $PRAWN_ROOT +#TODO: replace with cd packages && make install $outmnt/var/cache/apt/archives/ cp $XSECURELOCK_PATH/xsecurelock_*_armhf.deb $outmnt/var/cache/apt/archives/ chroot $outmnt apt install -y -d xsecurelock diff --git a/scripts/common.mk b/scripts/common.mk new file mode 100755 index 0000000..7cc3cb4 --- /dev/null +++ b/scripts/common.mk @@ -0,0 +1,11 @@ +ifndef COMMON_MK +COMMON_MK := 1 + +#Place all shared make vars below +#========================================================================================= +PBUILDER_CHROOT := $(PRAWNOS_ROOT)/build/prawnos-pbuilder-armhf-base.tgz +PBUILDER_RC := $(PRAWNOS_ROOT)/resources/BuildResources/pbuilder/prawnos-pbuilder.rc +# Otherwise errors are ignored when output is piped to tee: +SHELL := /bin/bash -o pipefail +#========================================================================================= +endif # COMMON_MK