From 1611ccd07a9760868f89cc4d70d1b1f8aad17c59 Mon Sep 17 00:00:00 2001 From: Squibid Date: Tue, 29 Apr 2025 16:49:48 -0500 Subject: [PATCH] update build system --- Makefile | 33 +++++++++++++++++++++++++++++++++ README.md | 5 +++++ build.sh | 28 ---------------------------- 3 files changed, 38 insertions(+), 28 deletions(-) create mode 100644 Makefile delete mode 100755 build.sh diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..3199734 --- /dev/null +++ b/Makefile @@ -0,0 +1,33 @@ +BUILDDIR := ./void-packages +TEMPLATES := $(shell find srcpkgs/* -maxdepth 0 -type d) +PACKAGES := $(addprefix $(BUILDDIR)/,$(notdir $(TEMPLATES))) + +all: sync $(PACKAGES) + +$(info TEMPLATES: $(TEMPLATES)) +$(info PACKAGES: $(PACKAGES)) + +$(BUILDDIR)/%: srcpkgs/% + @echo "Building package: $<" + @rm -rf $(BUILDDIR)/srcpkgs/$< + @cp -ru $< $(BUILDDIR)/srcpkgs/ + @-cd $(BUILDDIR) && ./xbps-src clean $< + @-cd $(BUILDDIR) && ./xbps-src pkg $< || echo "Warning: Failed to build $<" + @mkdir -p ./dest + @-cp -u $(BUILDDIR)/hostdir/binpkgs/*.xbps ./dest/ + @-cp $(BUILDDIR)/hostdir/binpkgs/x86_64-repodata ./dest/ + +sync: sync-build +sync-fetch: + test -d $(BUILDDIR) || git clone --depth=1 https://github.com/void-linux/void-packages.git $^ +sync-update: sync-fetch + @cd $(BUILDDIR) && git pull +sync-build: sync-update + @cd $(BUILDDIR) && ./xbps-src binary-bootstrap +sync-clean: + rm -rf $(BUILDDIR) + +build-clean: + rm -rf ./dest + +clean: sync-clean build-clean diff --git a/README.md b/README.md index 1ddfe2e..520b754 100644 --- a/README.md +++ b/README.md @@ -6,3 +6,8 @@ To install the packages in this repo make a file called: ```conf repository=https://voidpkgs.squi.bid ``` + +## Building +To add a template to the repository make a template in the srcpkgs directory. +To build all packages run `make` to choose a specific one run +`make TEMPLATES=srcpkgs/your_package_name`. diff --git a/build.sh b/build.sh deleted file mode 100755 index 7d364e7..0000000 --- a/build.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/sh -# a small script to help me compile all packages and push them to my server - -set -e # exit asap - -# cleanup previous build -if [ "$1" = "clean" ]; then - rm -rf ./dest ./void-packages - exit 0 -fi - -mkdir -p ./dest -[ ! -d void-packages ] && git clone --depth 1 https://github.com/void-linux/void-packages.git -./void-packages/xbps-src binary-bootstrap - -for f in srcpkgs/*; do - cp ./"$f" ./void-packages/"$f" -ruf - ./void-packages/xbps-src pkg "$f" - cp ./void-packages/hostdir/binpkgs/*.xbps ./dest/ -u -done - -# copy repodata after building all packages -cp ./void-packages/hostdir/binpkgs/x86_64-repodata ./dest/ - -# tell the builder to sign their packages -printf "\n\n\033[1;31mRun the following commands:\033[m\n" -printf 'xbps-rindex -s ./dest --privkey \033[31m/path/to/key\033[m --signedby \033[31m"Name "\033[m\n' -printf 'xbps-rindex -S ./dest/* --privkey \033[31m/path/to/key\033[m\n'