summaryrefslogtreecommitdiff
path: root/util/collect2
diff options
context:
space:
mode:
authorJay Freeman <saurik@saurik.com>2008-04-06 10:28:29 +0000
committerJay Freeman <saurik@saurik.com>2008-04-06 10:28:29 +0000
commitd699a01fabaa04a1aad60f6ca5777f82ee24839a (patch)
tree1eb62bad23b14a0877c5b9171f2a5f9358c8d592 /util/collect2
parent8a49e427447f40fdd43fc4b5f513b166dd639e2a (diff)
Drastic, sweeping modifications to support iPhone 1.2.0/2.0.
git-svn-id: http://svn.telesphoreo.org/trunk@199 514c082c-b64e-11dc-b46d-3d985efe055d
Diffstat (limited to 'util/collect2')
-rwxr-xr-xutil/collect254
1 files changed, 54 insertions, 0 deletions
diff --git a/util/collect2 b/util/collect2
new file mode 100755
index 000000000..30cacb773
--- /dev/null
+++ b/util/collect2
@@ -0,0 +1,54 @@
+#!/bin/bash
+
+unset GCC_EXEC_PREFIX
+unset COMPILER_PATH
+
+unset aspen_version_min
+unset macosx_version_min
+unset o
+
+#export | grep 'GCC\|PATH\|PKG'
+
+function parse() {
+ while [[ $# -ne 0 ]]; do
+ if [[ $1 = -maspen-version-min=* ]]; then
+ maspen_version_min=${1#-maspen-version-min=}
+ elif [[ $1 = -mmacosx-version-min=* ]]; then
+ mmacosx_version_min=${1#-mmacosx-version-min=}
+ elif [[ $1 == -o ]]; then
+ o=$2
+ shift
+ fi; shift
+ done
+}
+
+set -e
+
+eval "parse ${COLLECT_GCC_OPTIONS}"
+
+if [[ "${maspen_version_min+@}" || "${mmacosx_version_min+@}" ]]; then
+ darwin=
+else
+ unset darwin
+fi
+
+declare -a flags
+if [[ "${darwin+@}" ]]; then
+ flags[${#flags[@]}]=-no_uuid
+
+ if [[ "${PKG_PATH+@}" ]]; then
+ flags=("${flags[@]}"$(echo "${PKG_PATH}:" | while read -r -d ':' path; do
+ find "${path}" -name '*.dylib' -print0 | while read -r -d $'\0' dylib_file; do
+ dylib_name=${dylib_file#${path}}
+ echo " -dylib_file ${dylib_name}:${dylib_file}"
+ done
+ done))
+ fi
+fi
+
+#echo ::: "$("${COLLECT_GCC}" -print-prog-name=collect2)" "$@" "${flags[@]}"
+"$("${COLLECT_GCC}" -print-prog-name=collect2)" "$@" "${flags[@]}"
+
+if [[ "${o+@}" && "${darwin+@}" ]]; then
+ ldid -T- "$o"
+fi