root / trunk / util / collect2

Revision 381, 1.7 kB (checked in by saurik, 4 months ago)

Worked around an issue in some package that uses the collection backend to link something that isn't a .o.

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3unset GCC_EXEC_PREFIX
4unset COMPILER_PATH
5
6unset aspen_version_min
7unset macosx_version_min
8unset o
9
10#export | grep 'GCC\|PATH\|PKG'
11
12function parse() {
13    while [[ $# -ne 0 ]]; do
14        if [[ $1 = -maspen-version-min=* ]]; then
15            maspen_version_min=${1#-maspen-version-min=}
16        elif [[ $1 = -mmacosx-version-min=* ]]; then
17            mmacosx_version_min=${1#-mmacosx-version-min=}
18        elif [[ $1 == -o ]]; then
19            if [[ $2 != *.o ]]; then
20                o=$2
21            fi
22            shift
23        fi; shift
24    done
25}
26
27set -e
28
29eval "parse ${COLLECT_GCC_OPTIONS}"
30
31if [[ "${maspen_version_min+@}" || "${mmacosx_version_min+@}" ]]; then
32    darwin=
33else
34    unset darwin
35fi
36
37declare -a flags
38if [[ "${darwin+@}" ]]; then
39    flags[${#flags[@]}]=-no_uuid
40
41    if [[ "${PKG_PATH+@}" ]]; then
42        flags=("${flags[@]}"$({
43            echo "${PKG_PATH}" | tr ':' $'\n'
44
45            for DEP_NAME in libgcc libxml2 sqlite3; do
46                echo "$(PKG_DEST_ "${DEP_NAME}")"
47            done
48        } | while read -r path; do
49            find "${path}" -name '*.dylib' -print0 | while read -r -d $'\0' dylib_file; do
50                dylib_name=${dylib_file#${path}}
51                echo -n " -dylib_file ${dylib_name}:${dylib_file}"
52            done
53
54            echo -n " -dylib_file /usr/lib/libssl.0.9.7.dylib:$(PKG_DEST_ openssl)/usr/lib/libssl.0.9.8.dylib"
55            echo -n " -dylib_file /usr/lib/libcrypto.0.9.7.dylib:$(PKG_DEST_ openssl)/usr/lib/libcrypto.0.9.8.dylib"
56        done))
57    fi
58fi
59
60#echo ::: "$("${COLLECT_GCC}" -print-prog-name=collect2)" "$@" "${flags[@]}"
61"$("${COLLECT_GCC}" -print-prog-name=collect2)" "$@" "${flags[@]}"
62
63if [[ "${o+@}" && "${darwin+@}" ]]; then
64    ldid -T- "$o"
65fi
Note: See TracBrowser for help on using the browser.