From 475d9da71611494d4356ce62a311243b9b9bf401 Mon Sep 17 00:00:00 2001
From: P. J. McDermott <pjm@nac.net>
Date: Sun, 07 Apr 2013 14:11:39 -0400
Subject: Add some binary package metadata.

---
diff --git a/.gitignore b/.gitignore
index e8832d3..3668ef4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,5 +4,11 @@
 *~
 Session.vim
 
+# Generated files
+cpp-*-*-*-*.pkg/
+gcc-*-*-*-*.pkg/
+g++-*-*-*-*.pkg/
+targets
+
 # Work area
 tmp/
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 "${@}"
diff --git a/cpp-4.7.pkg.in/control b/cpp-4.7.pkg.in/control
new file mode 100644
index 0000000..084d4ef
--- /dev/null
+++ b/cpp-4.7.pkg.in/control
@@ -0,0 +1,8 @@
+Architecture: i686-any-any core-any-any k8-any-any amd64-any-any @PKG_TARGET_ARCH@
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version},
+ libmpc.2, libmpfr.4, libgmp.10, libz.1
+Suggests: gcc-4.7-locales (>= ${Binary-Version})
+Description: GNU C preprocessor
+ A macro processor that is used automatically by the C compiler to transform
+ programs before actual compilation.
diff --git a/g++-4.7.pkg.in/control b/g++-4.7.pkg.in/control
new file mode 100644
index 0000000..02b586d
--- /dev/null
+++ b/g++-4.7.pkg.in/control
@@ -0,0 +1,6 @@
+Architecture: i686-any-any core-any-any k8-any-any amd64-any-any @PKG_TARGET_ARCH@
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version},
+Suggests: gcc-4.7-locales (>= ${Binary-Version})
+Description: GNU C compiler
+ The C language front end for the GNU compiler collection.
diff --git a/gcc-4.7-common.pkg/control b/gcc-4.7-common.pkg/control
new file mode 100644
index 0000000..a439637
--- /dev/null
+++ b/gcc-4.7-common.pkg/control
@@ -0,0 +1,4 @@
+Architecture: all
+Platform: all
+Description: GNU compiler collection - common files
+ This package provides documentation for the gcc-4.7 source package.
diff --git a/gcc-4.7-common.pkg/docs b/gcc-4.7-common.pkg/docs
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/gcc-4.7-common.pkg/docs
diff --git a/gcc-4.7-locales.pkg/control b/gcc-4.7-locales.pkg/control
new file mode 100644
index 0000000..3f50a4b
--- /dev/null
+++ b/gcc-4.7-locales.pkg/control
@@ -0,0 +1,5 @@
+Architecture: all
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version})
+Description: GNU compiler collection - locales
+ This package provides native language support for the GNU compiler collection.
diff --git a/gcc-4.7.pkg.in/control b/gcc-4.7.pkg.in/control
new file mode 100644
index 0000000..a0fd2b1
--- /dev/null
+++ b/gcc-4.7.pkg.in/control
@@ -0,0 +1,6 @@
+Architecture: i686-any-any core-any-any k8-any-any amd64-any-any @PKG_TARGET_ARCH@
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version},
+Suggests: gcc-4.7-locales (>= ${Binary-Version})
+Description: GNU C++ compiler
+ The C++ language front end for the GNU compiler collection.
diff --git a/libgcc.1.pkg/control b/libgcc.1.pkg/control
new file mode 100644
index 0000000..c8dd515
--- /dev/null
+++ b/libgcc.1.pkg/control
@@ -0,0 +1,7 @@
+Architecture: any
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version})
+Description: GCC low-level runtime library
+ This package provides libgcc, a low-level runtime library that contains
+ routines for arithmetic operations not performed by the host processor,
+ exception handling, instruction cache clearing, and stack segment iteration.
diff --git a/libstdc++.6.pkg/control b/libstdc++.6.pkg/control
new file mode 100644
index 0000000..6887fcb
--- /dev/null
+++ b/libstdc++.6.pkg/control
@@ -0,0 +1,5 @@
+Architecture: any
+Platform: all
+Depends: gcc-4.7-common (= ${Binary-Version}), libgcc.1
+Description: GNU C++ library
+ This package provides the GNU Standard C++ Library v3.
diff --git a/targets.in b/targets.in
new file mode 100644
index 0000000..23ed530
--- /dev/null
+++ b/targets.in
@@ -0,0 +1,5 @@
+core-linux-eglibc
+i686-linux-eglibc
+i686-kfreebsd-eglibc
+cortexa8-linux-eglibc
+amd64-linux-eglibc
--
cgit v0.9.1