summaryrefslogtreecommitdiff
path: root/configure
diff options
context:
space:
mode:
authorZach van Rijn <me@zv.io>2023-02-04 01:03:24 -0600
committerZach van Rijn <me@zv.io>2024-08-10 06:27:01 +0000
commit8609f79a1f92eb9b553d0928d6c39ec5fbad3c34 (patch)
tree71c8927aebecad3bc9d90d48cda92eefbb0a2a58 /configure
parent6f94d419b70e2881ce6d9c37233b5a13dca61d08 (diff)
downloadpackages-zv/genmake.tar.gz
packages-zv/genmake.tar.bz2
packages-zv/genmake.tar.xz
packages-zv/genmake.zip
scripts/*: add Makefile generator.zv/genmake
This commit adds a few scripts to the packages repository: * configure Typical 'configure' script; run to see usage. * scripts/genmake Generates a top-level 'Makefile' that will either build packages in the correct order, or sleep to simulate package builds. The main purpose of this tool is to enable concurrent package builds, and to provide a framework to analyze build strategies. When a dependency is updated, it is the responsibility of the maintainer to relbump all dependent packages. This tool is intended to facilitate concurrent package builds, not be a comprehensive maintenance tool.
Diffstat (limited to 'configure')
-rwxr-xr-xconfigure103
1 files changed, 103 insertions, 0 deletions
diff --git a/configure b/configure
new file mode 100755
index 000000000..72abed07d
--- /dev/null
+++ b/configure
@@ -0,0 +1,103 @@
+#!/bin/sh -e
+
+HERE="$(dirname $(readlink -f ${0}))";
+
+##
+# Full list of all possible repositories.
+#
+repos=$(grep -v ^# <<EOF
+system
+user
+legacy
+experimental
+EOF
+);
+
+##
+# Do not build any repos by default.
+#
+build="";
+
+##
+# Usage.
+#
+usage ()
+{
+ printf "Usage: %s OPTION [OPTION] ...\n" "${0}";
+
+ printf "\nOptions:\n\n";
+ cat <<"EOF"
+ --simulate Sleep 1 second instead of build
+EOF
+
+ printf "\nRepositories:\n\n";
+ for k in ${repos}; do
+ printf " --enable-%s\n" "${k}";
+ done
+ printf "\n";
+}
+
+##
+# Enable repositories only explicitly.
+#
+_find=;
+_fake=0; # default not a simulation
+for arg; do
+ case "${arg}" in
+ --enable-*)
+ for repo in ${repos}; do
+ _find=0;
+ if test "${arg##*-}" = "${repo}"; then
+ build="${build} ${repo}";
+ _find=1;
+ break;
+ fi
+ done
+ if test ${_find} -eq 0; then
+ printf "E: Repository '%s' is not supported!\n" "${arg##*-}";
+ exit 1;
+ fi
+ ;;
+ --simulate)
+ _fake=1;
+ ;;
+ *)
+ printf "E: Option '%s' is not supported!\n" "${arg}";
+ exit 1;
+ ;;
+ esac
+done
+
+##
+# Sorted order.
+#
+build=$(printf "%s\n" "${build}" | tr ' ' '\n' | sort | uniq | xargs);
+
+##
+# Sanity checks.
+#
+if test "${#build}" -eq 0; then
+ usage;
+ exit 0;
+fi
+
+##
+# Generate Makefile.
+#
+printf "Generating subpackage index ...\n";
+"${HERE}"/scripts/setup;
+printf "Generating dependency list ...\n";
+"${HERE}"/scripts/deplist ${build} | "${HERE}"/scripts/genmake ${_fake};
+
+##
+# Generate report.
+#
+printf "\nSuccess!\n\n";
+
+_numpkgs=$(grep -E '^.*/.*:' "${HERE}"/Makefile | wc -l);
+printf " Packages\t: %s\n" "${_numpkgs}";
+printf "\n";
+
+if test ${_fake} -eq 1; then
+ printf "SIMULATION ONLY! NO PACKAGES WILL BE BUILT!\n\n";
+fi