Skip to content

Instantly share code, notes, and snippets.

@tpoechtrager
Created December 31, 2013 08:58
Show Gist options
  • Save tpoechtrager/8194248 to your computer and use it in GitHub Desktop.
Save tpoechtrager/8194248 to your computer and use it in GitHub Desktop.
append '-g0' only if '-gX' is explicitly given
diff --git a/oclang/oclang b/oclang/oclang
index e906814..59cdc96 100755
--- a/oclang/oclang
+++ b/oclang/oclang
@@ -32,6 +32,8 @@ else
USE_LIBCXX=0
fi
+PREVENT_DSYMUTIL_FROM_BEING_RUN=""
+
if [ $# -gt 0 ]; then
for p in "$@"
do
@@ -50,9 +52,12 @@ if [ $# -gt 0 ]; then
if [ "$p" == "-stdlib=libc++" ]; then
USE_LIBCXX=2
fi
-# if [[ "$p" == -g* ]] && [ "$p" != "-g0" ] && [ "$p" != "-ggdb0" ]; then
-# echo -e "\e[1mosxcross \e[35mwarning:\e[0m\e[1m replacing '$p' with '-g0'\e[0m" 1>&2
-# fi
+ if [ "$p" == "-g" ] || [ "$p" == "-g1" ] || [ "$p" == "-g2" ] || \
+ [ "$p" == "-g3" ] || [[ "$p" == -ggdb* ]];
+ then
+ echo -e "\e[1mosxcross \e[35mwarning:\e[0m\e[1m replacing '$p' with '-g0'\e[0m" 1>&2
+ PREVENT_DSYMUTIL_FROM_BEING_RUN="-g0"
+ fi
done
fi
@@ -105,6 +110,6 @@ fi
$COMPILER $OSXCROSS_TARGET_OPTION $TARGET -isysroot $OSXCROSS_SDK \
$CPLUSINC \
$OSX_VERSION_MIN_OPT -mlinker-version=$OSXCROSS_LINKER_VERSION $OSXCROSS_OPT_ARGS \
-${1+"$@"} -g0
+${1+"$@"} $PREVENT_DSYMUTIL_FROM_BEING_RUN
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment