diff options
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 103 |
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 |