From 275c6d69c9e7e3e1d4f7ad18354d2471f16458f1 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 18 May 2013 12:25:16 -0400 Subject: Make gcc and g++ target-specific. --- diff --git a/config b/config new file mode 100755 index 0000000..a33c2f2 --- /dev/null +++ b/config @@ -0,0 +1,59 @@ +#! /bin/sh + +set -e + +TPL_PKGS='gcc g++' + +main() +{ + case "${1}" in + clean) + clean + ;; + *) + if [ -z "${PKG_TARGETS}" ]; then + PKG_TARGETS="$(cat targets.in)" + fi + for arch in ${PKG_TARGETS}; do + PKG_TARGET_ARCH="${arch}" configure_build + printf '%s\n' "${arch}" >>targets + done + ;; + esac +} + +msg() +{ + printf 'gcc-defaults 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 - 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" + cp "${_pkg}.pkg.in/files" "${_pkg}-${PKG_TARGET_ARCH}.pkg/files" + msg 'Metadata for package "%s" generated.' \ + "${_pkg}-${PKG_TARGET_ARCH}" + done +} + +clean() +{ + # Remove generated metadata for - packages. + for _pkg in ${TPL_PKGS}; do + rm -Rf "${_pkg}"-*-*-*.pkg/ + done +} + +main "${@}" diff --git a/g++.pkg/control b/g++.pkg.in/control index 573c9d2..7577668 100644 --- a/g++.pkg/control +++ b/g++.pkg.in/control @@ -1,7 +1,7 @@ Package: g++ Architecture: all Depends: cpp (>= 0.1), gcc (>= 0.1), g++-4.6 (>= 4.6.2-1) -Description: GNU C++ compiler +Description: GNU C++ compiler for @PKG_TARGET_ARCH@ This is the GNU C++ compiler, a fairly portable optimizing compiler for C++. . This package depends on the default version of the GNU C++ compiler. diff --git a/g++.pkg/files b/g++.pkg.in/files index e69de29..e69de29 100644 --- a/g++.pkg/files +++ b/g++.pkg.in/files diff --git a/gcc.pkg/control b/gcc.pkg.in/control index b01803c..2f73ff2 100644 --- a/gcc.pkg/control +++ b/gcc.pkg.in/control @@ -1,7 +1,7 @@ Package: gcc Architecture: all Depends: cpp (>= 0.1), gcc-4.6 (>= 4.6.2-1) -Description: GNU C compiler +Description: GNU C compiler for @PKG_TARGET_ARCH@ This is the GNU C compiler, a fairly portable optimizing compiler for C. . This package depends on the default version of the GNU C compiler. diff --git a/gcc.pkg/files b/gcc.pkg.in/files index c075821..c075821 100644 --- a/gcc.pkg/files +++ b/gcc.pkg.in/files diff --git a/gcc.pkg/postinst b/gcc.pkg.in/postinst index 9fd34c0..9fd34c0 100755 --- a/gcc.pkg/postinst +++ b/gcc.pkg.in/postinst diff --git a/gcc.pkg/prerm b/gcc.pkg.in/prerm index 5d0150b..5d0150b 100755 --- a/gcc.pkg/prerm +++ b/gcc.pkg.in/prerm diff --git a/targets.in b/targets.in new file mode 100644 index 0000000..d2bfce2 --- /dev/null +++ b/targets.in @@ -0,0 +1,4 @@ +core-linux-eglibc +i686-linux-eglibc +i686-kfreebsd-eglibc +cortexa8-linux-eglibc -- cgit v0.9.1