From d99325676d18ae090abc609e0e8fdbf01065f45f Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Fri, 27 Jul 2012 03:38:42 -0400 Subject: Initial commit. --- (limited to 'config') diff --git a/config b/config new file mode 100755 index 0000000..4cddfcd --- /dev/null +++ b/config @@ -0,0 +1,72 @@ +#! /bin/sh + +set -e + +TARGET_PKGS='binutils libbfd-dev' + +main() +{ + case "${1}" in + clean) + clean + ;; + *) + get_config_values + configure_build + ;; + esac +} + +msg() +{ + printf 'binutils config: ' + printf "${@}" + printf '\n' +} + +get_config_values() +{ + if [ -z "${PKG_TARGET_ARCH}" ]; then + msg 'Error: No target architecture specified.' >&2 + exit 1 + fi + + # FIXME: Lookup GNU system type. + export PKG_TARGET_ARCH_GNU=arm-cortex_a8-linux-gnu +} + +configure_build() +{ + # Generate a sed script to edit files. + _ss= + for _name in TARGET_ARCH TARGET_ARCH_GNU; do + _ss="${_ss}s&@PKG_${_name}@&$(eval echo \$\{PKG_${_name}\})&;" + done + + # Write a build makefile with the configuration values. + sed "${_ss}" build.in >build + chmod a+x build + msg '"build" file generated.' + + # Write metadata for - packages. + for _pkg in ${TARGET_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 build makefile. + rm -f build + + # Remove generated metadata for - packages. + for _pkg in ${TARGET_PKGS}; do + rm -Rf "${_pkg}"-*-*-*.pkg/ + done +} + +main "${@}" -- cgit v0.9.1