Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update osx_cc_wrappers #89

Merged
merged 1 commit into from
Nov 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 20 additions & 8 deletions cc/private/toolchain/osx_cc_wrapper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,33 @@ LIBS=
LIB_DIRS=
RPATHS=
OUTPUT=
# let parse the option list
for i in "$@"; do

function parse_option() {
local -r opt="$1"
if [[ "${OUTPUT}" = "1" ]]; then
OUTPUT=$i
elif [[ "$i" =~ ^-l(.*)$ ]]; then
OUTPUT=$opt
elif [[ "$opt" =~ ^-l(.*)$ ]]; then
LIBS="${BASH_REMATCH[1]} $LIBS"
elif [[ "$i" =~ ^-L(.*)$ ]]; then
elif [[ "$opt" =~ ^-L(.*)$ ]]; then
LIB_DIRS="${BASH_REMATCH[1]} $LIB_DIRS"
elif [[ "$i" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
elif [[ "$opt" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
RPATHS="${BASH_REMATCH[1]} ${RPATHS}"
elif [[ "$i" = "-o" ]]; then
elif [[ "$opt" = "-o" ]]; then
# output is coming
OUTPUT=1
fi
}

# let parse the option list
for i in "$@"; do
if [[ "$i" = @* ]]; then
while IFS= read -r opt
do
parse_option "$opt"
done < "${i:1}" || exit 1
else
parse_option "$i"
fi
done

# Call gcc
Expand Down Expand Up @@ -101,4 +114,3 @@ for rpath in ${RPATHS}; do
fi
done
done

27 changes: 20 additions & 7 deletions cc/private/toolchain/osx_cc_wrapper.sh.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,20 +33,33 @@ LIBS=
LIB_DIRS=
RPATHS=
OUTPUT=
# let parse the option list
for i in "$@"; do

function parse_option() {
local -r opt="$1"
if [[ "${OUTPUT}" = "1" ]]; then
OUTPUT=$i
elif [[ "$i" =~ ^-l(.*)$ ]]; then
OUTPUT=$opt
elif [[ "$opt" =~ ^-l(.*)$ ]]; then
LIBS="${BASH_REMATCH[1]} $LIBS"
elif [[ "$i" =~ ^-L(.*)$ ]]; then
elif [[ "$opt" =~ ^-L(.*)$ ]]; then
LIB_DIRS="${BASH_REMATCH[1]} $LIB_DIRS"
elif [[ "$i" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
elif [[ "$opt" =~ ^-Wl,-rpath,\@loader_path/(.*)$ ]]; then
RPATHS="${BASH_REMATCH[1]} ${RPATHS}"
elif [[ "$i" = "-o" ]]; then
elif [[ "$opt" = "-o" ]]; then
# output is coming
OUTPUT=1
fi
}

# let parse the option list
for i in "$@"; do
if [[ "$i" = @* ]]; then
while IFS= read -r opt
do
parse_option "$opt"
done < "${i:1}" || exit 1
else
parse_option "$i"
fi
done

# Set-up the environment
Expand Down