summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2013-04-07 14:11:39 (EDT)
committer P. J. McDermott <pjm@nac.net>2013-04-07 14:11:39 (EDT)
commit475d9da71611494d4356ce62a311243b9b9bf401 (patch)
tree525aef83955c49b2ef288ce72bc51a97d6d1a4f8 /config
parent09cc3b9c7e43523df2b2a3285cea00cd5625e22d (diff)
Add some binary package metadata.
Diffstat (limited to 'config')
-rwxr-xr-xconfig59
1 files changed, 59 insertions, 0 deletions
diff --git a/config b/config
new file mode 100755
index 0000000..fee7e81
--- /dev/null
+++ b/config
@@ -0,0 +1,59 @@
+#! /bin/sh
+
+set -e
+
+TPL_PKGS='gcc-4.7 cpp-4.7 g++-4.7'
+
+main()
+{
+ case "${1}" in
+ clean)
+ clean
+ ;;
+ *)
+ if [ -z "${PKG_TARGETS}" ]; then
+ PKG_TARGETS="$(cat targets.in)"
+ fi
+ >targets
+ for arch in ${PKG_TARGETS}; do
+ PKG_TARGET_ARCH="${arch}" configure_build
+ printf '%s\n' "${arch}" >>targets
+ done
+ ;;
+ esac
+}
+
+msg()
+{
+ printf 'gcc-4.7 config: '
+ printf "${@}"
+ printf '\n'
+}
+
+configure_build()
+{
+ # Generate a sed script to edit files.
+ _ss=
+ for _name in TARGET_ARCH; do
+ _ss="${_ss}s&@PKG_${_name}@&$(eval echo \$\{PKG_${_name}\})&;"
+ done
+
+ # Write metadata for <pkgbase>-<target> packages.
+ for _pkg in ${TPL_PKGS}; do
+ mkdir -p "${_pkg}-${PKG_TARGET_ARCH}.pkg"
+ sed "${_ss}" "${_pkg}.pkg.in/control" \
+ >"${_pkg}-${PKG_TARGET_ARCH}.pkg/control"
+ msg 'Metadata for package "%s" generated.' \
+ "${_pkg}-${PKG_TARGET_ARCH}"
+ done
+}
+
+clean()
+{
+ # Remove generated metadata for <pkgbase>-<target> packages.
+ for _pkg in ${TPL_PKGS}; do
+ rm -Rf "${_pkg}"-*-*-*.pkg/
+ done
+}
+
+main "${@}"