help clang to find its own intrinsic headers (this issue appears to be fixed in clang 3.4+)

bump version to 0.5
This commit is contained in:
Thomas Pöchtrager 2013-12-02 19:37:37 +01:00
parent d957737e0f
commit 65944f3394
4 changed files with 45 additions and 1 deletions

View File

@ -1,3 +1,6 @@
0.5:
- fixed: help clang to find its own intrinsic headers (this issue appears to be fixed in clang 3.4+)
0.4:
- added: gcc support
- added: a workaround for buggish unistd.h headers, no more need to edit /usr/include/unistd.h

View File

@ -1,5 +1,7 @@
#!/usr/bin/env bash
pushd "${0%/*}" &>/dev/null
export LC_ALL="C"
export CC=clang
export CXX=clang++
@ -20,7 +22,7 @@ OSX_VERSION_MIN=10.5
LINKER_VERSION=134.9
# Don't change this
OSXCROSS_VERSION=0.4
OSXCROSS_VERSION=0.5
function require
{
@ -199,6 +201,7 @@ mv -f SDKs/*$SDK_VERSION* $SDK_DIR
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk
set +e
ln -s $SDK_DIR/MacOSX$SDK_VERSION.sdk/System/Library/Frameworks/Kernel.framework/Versions/A/Headers/std*.h usr/include 2>/dev/null
$BASE_DIR/oclang/find_intrinsic_headers.sh $SDK_DIR/MacOSX$SDK_VERSION.sdk
set -e
popd

View File

@ -0,0 +1,32 @@
#!/usr/bin/env bash
# help clang to find its own intrinsic headers
# this issue appears to be fixed in 3.4+
pushd "${0%/*}" &>/dev/null
set -e
SDK_DIR="$1"
test -n "$SDK_DIR" || { echo "no SDK directory given" && exit 1; }
test -e "$SDK_DIR" || { echo "$SDK_DIR does not exist" && exit 1; }
CLANG_VERSION=`echo "int main(){printf(\"%d.%d\",__clang_major__,__clang_minor__);return 0;}" | clang -xc -ansi -otest - 2>/dev/null && ./test && rm test`
CLANG_DIR=`dirname \`which clang\``
CLANG_INTRIN_DIR="$CLANG_DIR/../include/clang/$CLANG_VERSION/include"
test ! -e "$CLANG_INTRIN_DIR" && CLANG_INTRIN_DIR="$CLANG_DIR/../lib/clang/$CLANG_VERSION/include"
test -e "$CLANG_INTRIN_DIR" || { echo "can not find clang intrinsics directory" && exit 1; }
test -f "$CLANG_INTRIN_DIR/xmmintrin.h" || { echo "xmmintrin.h does not exist in $CLANG_INTRIN_DIR" && exit 1; }
echo "found clang intrinsic headers: $CLANG_INTRIN_DIR"
ln -sf $CLANG_INTRIN_DIR/float.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/*intrin*.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/mm*.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/*va*.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/*cpu*.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/*math*.h $SDK_DIR/usr/include
ln -sf $CLANG_INTRIN_DIR/*iso*.h $SDK_DIR/usr/include

View File

@ -36,6 +36,12 @@ CPLUSINC2=$OSXCROSS_SDK/usr/include/c++/4.0.0
CPLUSINC3=$OSXCROSS_SDK/usr/include/c++/4.0.0/$ARCH2-apple-darwin9
TARGET=$ARCH1-apple-$OSXCROSS_TARGET
XMMINTRIN=`readlink "$STDINC/xmmintrin.h"`
if [ $? -eq 0 ] && [ ! -f "$XMMINTRIN" ]; then
echo "oclang error: dead intrinsic link found - please re-run ./build.sh" 1>&2
exit 1
fi
$COMPILER $OSXCROSS_TARGET_OPTION $TARGET -isysroot $OSXCROSS_SDK \
-isystem $STDINC -isystem $CPLUSINC1 -isystem $CPLUSINC2 -isystem $CPLUSINC3 \
$OSX_VERSION_MIN_OPT -mlinker-version=$OSXCROSS_LINKER_VERSION $OSXCROSS_OPT_ARGS \