mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-08 02:55:56 +01:00
use two space indents
This commit is contained in:
parent
84377413a5
commit
c0b2cf103d
194
build.sh
194
build.sh
@ -7,60 +7,60 @@ source tools/tools.sh
|
||||
# find sdk version to use
|
||||
function guess_sdk_version()
|
||||
{
|
||||
tmp1=
|
||||
tmp2=
|
||||
tmp3=
|
||||
file=
|
||||
sdk=
|
||||
guess_sdk_version_result=
|
||||
sdkcount=`find tarballs/ -type f | grep MacOSX | wc -l`
|
||||
if [ $sdkcount -eq 0 ]; then
|
||||
echo no SDK found in 'tarballs/'. please see README.md
|
||||
exit 1
|
||||
elif [ $sdkcount -gt 1 ]; then
|
||||
sdks=`find tarballs/ | grep MacOSX`
|
||||
for sdk in $sdks; do echo $sdk; done
|
||||
echo 'more than one MacOSX SDK tarball found. please set'
|
||||
echo 'SDK_VERSION environment variable for the one you want'
|
||||
echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)'
|
||||
exit 1
|
||||
else
|
||||
sdk=`find tarballs/ | grep MacOSX`
|
||||
tmp2=`echo ${sdk/bz2/} | sed s/[^0-9.]//g`
|
||||
tmp3=`echo $tmp2 | sed s/\\\.*$//g`
|
||||
guess_sdk_version_result=$tmp3
|
||||
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'`basename $sdk`
|
||||
tmp1=
|
||||
tmp2=
|
||||
tmp3=
|
||||
file=
|
||||
sdk=
|
||||
guess_sdk_version_result=
|
||||
sdkcount=`find tarballs/ -type f | grep MacOSX | wc -l`
|
||||
if [ $sdkcount -eq 0 ]; then
|
||||
echo no SDK found in 'tarballs/'. please see README.md
|
||||
exit 1
|
||||
elif [ $sdkcount -gt 1 ]; then
|
||||
sdks=`find tarballs/ | grep MacOSX`
|
||||
for sdk in $sdks; do echo $sdk; done
|
||||
echo 'more than one MacOSX SDK tarball found. please set'
|
||||
echo 'SDK_VERSION environment variable for the one you want'
|
||||
echo '(for example: SDK_VERSION=10.x [OSX_VERSION_MIN=10.x] ./build.sh)'
|
||||
exit 1
|
||||
else
|
||||
sdk=`find tarballs/ | grep MacOSX`
|
||||
tmp2=`echo ${sdk/bz2/} | sed s/[^0-9.]//g`
|
||||
tmp3=`echo $tmp2 | sed s/\\\.*$//g`
|
||||
guess_sdk_version_result=$tmp3
|
||||
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'`basename $sdk`
|
||||
fi
|
||||
if [ $guess_sdk_version_result ]; then
|
||||
if [ $guess_sdk_version_result = 10.4 ]; then
|
||||
guess_sdk_version_result=10.4u
|
||||
fi
|
||||
if [ $guess_sdk_version_result ]; then
|
||||
if [ $guess_sdk_version_result = 10.4 ]; then
|
||||
guess_sdk_version_result=10.4u
|
||||
fi
|
||||
fi
|
||||
export guess_sdk_version_result
|
||||
fi
|
||||
export guess_sdk_version_result
|
||||
}
|
||||
|
||||
# make sure there is actually a file with the given SDK_VERSION
|
||||
function verify_sdk_version()
|
||||
{
|
||||
sdkv=$1
|
||||
for file in tarballs/*; do
|
||||
if [ `echo $file | grep OSX.*$sdkv` ]; then
|
||||
echo "verified at "$file
|
||||
sdk=$file
|
||||
fi
|
||||
done
|
||||
if [ ! $sdk ] ; then
|
||||
echo cant find SDK for OSX $sdkv in tarballs. exiting
|
||||
exit
|
||||
sdkv=$1
|
||||
for file in tarballs/*; do
|
||||
if [ `echo $file | grep OSX.*$sdkv` ]; then
|
||||
echo "verified at "$file
|
||||
sdk=$file
|
||||
fi
|
||||
done
|
||||
if [ ! $sdk ] ; then
|
||||
echo cant find SDK for OSX $sdkv in tarballs. exiting
|
||||
exit
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $SDK_VERSION ]; then
|
||||
echo 'SDK VERSION set in environment variable:' $SDK_VERSION
|
||||
test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u
|
||||
echo 'SDK VERSION set in environment variable:' $SDK_VERSION
|
||||
test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u
|
||||
else
|
||||
guess_sdk_version
|
||||
SDK_VERSION=$guess_sdk_version_result
|
||||
guess_sdk_version
|
||||
SDK_VERSION=$guess_sdk_version_result
|
||||
fi
|
||||
verify_sdk_version $SDK_VERSION
|
||||
|
||||
@ -69,11 +69,11 @@ verify_sdk_version $SDK_VERSION
|
||||
# You can comment this variable out,
|
||||
# if you want to use the compiler's default value
|
||||
if [ -z "$OSX_VERSION_MIN" ]; then
|
||||
if [ $SDK_VERSION = 10.4u ]; then
|
||||
OSX_VERSION_MIN=10.4
|
||||
else
|
||||
OSX_VERSION_MIN=10.5
|
||||
fi
|
||||
if [ $SDK_VERSION = 10.4u ]; then
|
||||
OSX_VERSION_MIN=10.4
|
||||
else
|
||||
OSX_VERSION_MIN=10.5
|
||||
fi
|
||||
fi
|
||||
|
||||
# ld version
|
||||
@ -89,17 +89,17 @@ PATCH_DIR=$BASE_DIR/patches
|
||||
SDK_DIR=$TARGET_DIR/SDK
|
||||
|
||||
if [ -z "$OSX_VERSION_MIN" ]; then
|
||||
OSX_VERSION_MIN="default"
|
||||
OSX_VERSION_MIN="default"
|
||||
fi
|
||||
|
||||
case $SDK_VERSION in
|
||||
10.4*) TARGET=darwin8 ;;
|
||||
10.5*) TARGET=darwin9 ;;
|
||||
10.6*) TARGET=darwin10 ;;
|
||||
10.7*) TARGET=darwin11 ;;
|
||||
10.8*) TARGET=darwin12 ;;
|
||||
10.9*) TARGET=darwin13 ;;
|
||||
*) echo "Invalid SDK Version" && exit 1 ;;
|
||||
10.4*) TARGET=darwin8 ;;
|
||||
10.5*) TARGET=darwin9 ;;
|
||||
10.6*) TARGET=darwin10 ;;
|
||||
10.7*) TARGET=darwin11 ;;
|
||||
10.8*) TARGET=darwin12 ;;
|
||||
10.9*) TARGET=darwin13 ;;
|
||||
*) echo "Invalid SDK Version" && exit 1 ;;
|
||||
esac
|
||||
|
||||
echo ""
|
||||
@ -138,16 +138,16 @@ pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
{
|
||||
rm -rf $BUILD_DIR/have_cctools*
|
||||
rm -rf $BUILD_DIR/have_cctools*
|
||||
}
|
||||
|
||||
source $BASE_DIR/tools/trap_exit.sh
|
||||
|
||||
if [ "`ls $TARBALL_DIR/cctools*.tar.* | wc -l | tr -d ' '`" != "1" ]; then
|
||||
echo ""
|
||||
echo "There should only be one cctools*.tar.* archive in the tarballs directory"
|
||||
echo ""
|
||||
exit 1
|
||||
echo ""
|
||||
echo "There should only be one cctools*.tar.* archive in the tarballs directory"
|
||||
echo ""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
|
||||
@ -183,8 +183,8 @@ pushd $TARGET_DIR/bin &>/dev/null
|
||||
CCTOOLS=`find . -name "x86_64-apple-darwin*"`
|
||||
CCTOOLS=($CCTOOLS)
|
||||
for CCTOOL in ${CCTOOLS[@]}; do
|
||||
CCTOOL_I386=`echo "$CCTOOL" | sed 's/x86_64/i386/g'`
|
||||
ln -sf $CCTOOL $CCTOOL_I386
|
||||
CCTOOL_I386=`echo "$CCTOOL" | sed 's/x86_64/i386/g'`
|
||||
ln -sf $CCTOOL $CCTOOL_I386
|
||||
done
|
||||
popd &>/dev/null
|
||||
|
||||
@ -239,12 +239,12 @@ if [ ! -f "have_cctools_$TARGET" ]; then
|
||||
|
||||
function check_cctools()
|
||||
{
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-lipo" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ld" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-nm" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ar" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ranlib" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-strip" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-lipo" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ld" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-nm" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ar" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-ranlib" ] || exit 1
|
||||
[ -f "/$TARGET_DIR/bin/$1-apple-$TARGET-strip" ] || exit 1
|
||||
}
|
||||
|
||||
check_cctools i386
|
||||
@ -260,15 +260,15 @@ set +e
|
||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
||||
while [ $? -ne 0 ]
|
||||
do
|
||||
echo ""
|
||||
echo "Get the MacOSX$SDK_VERSION SDK and move it into $TARBALL_DIR"
|
||||
echo "(see README for SDK download links)"
|
||||
echo ""
|
||||
echo "You can press ctrl-c to break the build process,"
|
||||
echo "if you restart ./build.sh then we will continue from here"
|
||||
echo ""
|
||||
read -p "Press enter to continue"
|
||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
||||
echo ""
|
||||
echo "Get the MacOSX$SDK_VERSION SDK and move it into $TARBALL_DIR"
|
||||
echo "(see README for SDK download links)"
|
||||
echo ""
|
||||
echo "You can press ctrl-c to break the build process,"
|
||||
echo "if you restart ./build.sh then we will continue from here"
|
||||
echo ""
|
||||
read -p "Press enter to continue"
|
||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
||||
done
|
||||
set -e
|
||||
|
||||
@ -277,9 +277,9 @@ extract $SDK 1 1
|
||||
rm -rf $SDK_DIR/MacOSX$SDK_VERSION* 2>/dev/null
|
||||
|
||||
if [ "`ls -l SDKs/*$SDK_VERSION* 2>/dev/null | wc -l | tr -d ' '`" != "0" ]; then
|
||||
mv -f SDKs/*$SDK_VERSION* $SDK_DIR
|
||||
mv -f SDKs/*$SDK_VERSION* $SDK_DIR
|
||||
else
|
||||
mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR
|
||||
mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR
|
||||
fi
|
||||
|
||||
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
|
||||
@ -372,20 +372,20 @@ echo ""
|
||||
|
||||
if [ -n $OSX_VERSION_MIN ]; then
|
||||
if [ `echo "${SDK_VERSION/u/}<$OSX_VERSION_MIN" | bc -l` -eq 1 ]; then
|
||||
echo "OSX_VERSION_MIN must be <= SDK_VERSION"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
echo "OSX_VERSION_MIN must be <= SDK_VERSION"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
elif [ `echo "$OSX_VERSION_MIN<10.4" | bc -l` -eq 1 ]; then
|
||||
echo "OSX_VERSION_MIN must be >= 10.4"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
echo "OSX_VERSION_MIN must be >= 10.4"
|
||||
trap "" EXIT
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ `echo "${SDK_VERSION/u/}>=10.9" | bc -l` -eq 1 ] && ( [ $OSX_VERSION_MIN == "default" ] ||
|
||||
[ `echo "$OSX_VERSION_MIN>=10.9" | bc -l` -eq 1 ] );
|
||||
then
|
||||
export SCRIPT=`basename $0`
|
||||
./build_libcxx.sh || exit 0
|
||||
export SCRIPT=`basename $0`
|
||||
./build_libcxx.sh || exit 0
|
||||
fi
|
||||
fi # OSX_VERSION_MIN set
|
||||
|
||||
@ -396,16 +396,16 @@ test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
|
||||
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
|
||||
|
||||
if [ `echo "${SDK_VERSION/u/}>=10.7" | bc -l` -eq 1 ]; then
|
||||
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
|
||||
echo ""
|
||||
echo -n "Given SDK does not contain libc++ headers "
|
||||
echo "(-stdlib=libc++ test may fail)"
|
||||
echo -n "You may want to re-package your SDK using "
|
||||
echo "'tools/gen_sdk_package.sh' on OS X"
|
||||
fi
|
||||
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
|
||||
echo ""
|
||||
test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||
test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||
echo -n "Given SDK does not contain libc++ headers "
|
||||
echo "(-stdlib=libc++ test may fail)"
|
||||
echo -n "You may want to re-package your SDK using "
|
||||
echo "'tools/gen_sdk_package.sh' on OS X"
|
||||
fi
|
||||
echo ""
|
||||
test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||
test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
38
build_gcc.sh
38
build_gcc.sh
@ -22,7 +22,7 @@ pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||
|
||||
function remove_locks()
|
||||
{
|
||||
rm -rf $OSXCROSS_BUILD_DIR/have_gcc*
|
||||
rm -rf $OSXCROSS_BUILD_DIR/have_gcc*
|
||||
}
|
||||
|
||||
source $BASE_DIR/tools/trap_exit.sh
|
||||
@ -48,23 +48,23 @@ mkdir -p build
|
||||
pushd build &>/dev/null
|
||||
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
export CPATH="/usr/local/include:/usr/pkg/include:$CPATH"
|
||||
export LDFLAGS="-L/usr/local/lib -L/usr/pkg/lib $LDFLAGS"
|
||||
export LD_LIBRARY_PATH="/usr/local/lib:/usr/pkg/lib:$LD_LIBRARY_PATH"
|
||||
export CPATH="/usr/local/include:/usr/pkg/include:$CPATH"
|
||||
export LDFLAGS="-L/usr/local/lib -L/usr/pkg/lib $LDFLAGS"
|
||||
export LD_LIBRARY_PATH="/usr/local/lib:/usr/pkg/lib:$LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
../configure \
|
||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||
--with-ld=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-ld \
|
||||
--with-as=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-as \
|
||||
--with-sysroot=$OSXCROSS_SDK \
|
||||
--disable-nls \
|
||||
--enable-languages=c,c++,objc,obj-c++ \
|
||||
--without-headers \
|
||||
--enable-multilib \
|
||||
--enable-lto \
|
||||
--enable-checking=release \
|
||||
--prefix=$OSXCROSS_TARGET_DIR
|
||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||
--with-ld=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-ld \
|
||||
--with-as=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-as \
|
||||
--with-sysroot=$OSXCROSS_SDK \
|
||||
--disable-nls \
|
||||
--enable-languages=c,c++,objc,obj-c++ \
|
||||
--without-headers \
|
||||
--enable-multilib \
|
||||
--enable-lto \
|
||||
--enable-checking=release \
|
||||
--prefix=$OSXCROSS_TARGET_DIR
|
||||
|
||||
$MAKE -j$JOBS
|
||||
$MAKE install -j$JOBS
|
||||
@ -87,11 +87,11 @@ WRAPPER_DIR=`dirname $WRAPPER`
|
||||
pushd $WRAPPER_DIR &>/dev/null
|
||||
|
||||
if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc ]; then
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-gcc x86_64-apple-$OSXCROSS_TARGET-base-gcc
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-g++ x86_64-apple-$OSXCROSS_TARGET-base-g++
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-gcc x86_64-apple-$OSXCROSS_TARGET-base-gcc
|
||||
mv x86_64-apple-$OSXCROSS_TARGET-g++ x86_64-apple-$OSXCROSS_TARGET-base-g++
|
||||
|
||||
ln -sf x86_64-apple-$OSXCROSS_TARGET-base-gcc i386-apple-$OSXCROSS_TARGET-base-gcc
|
||||
ln -sf x86_64-apple-$OSXCROSS_TARGET-base-g++ i386-apple-$OSXCROSS_TARGET-base-g++
|
||||
ln -sf x86_64-apple-$OSXCROSS_TARGET-base-gcc i386-apple-$OSXCROSS_TARGET-base-gcc
|
||||
ln -sf x86_64-apple-$OSXCROSS_TARGET-base-g++ i386-apple-$OSXCROSS_TARGET-base-g++
|
||||
fi
|
||||
|
||||
ln -sf $WRAPPER_SCRIPT o32-gcc
|
||||
|
56
package.sh
56
package.sh
@ -5,10 +5,10 @@ set -ex
|
||||
test -z "$COMPRESSLEVEL" && COMPRESSLEVEL=9
|
||||
|
||||
if [ -n "$BINARYPACKAGE" ]; then
|
||||
SUFFIX=""
|
||||
SUFFIX=""
|
||||
else
|
||||
SUFFIX="_src"
|
||||
BINARYPACKAGE="0"
|
||||
SUFFIX="_src"
|
||||
BINARYPACKAGE="0"
|
||||
fi
|
||||
|
||||
TMPDIR=`mktemp -d`
|
||||
@ -24,40 +24,40 @@ mkdir osxcross
|
||||
pushd osxcross
|
||||
|
||||
if [ $BINARYPACKAGE != "1" ]; then
|
||||
cp -r $BASEDIR/tarballs .
|
||||
cp -r $BASEDIR/patches .
|
||||
cp -r $BASEDIR/tools .
|
||||
cp -r $BASEDIR/oclang .
|
||||
cp -r $BASEDIR/ogcc .
|
||||
cp -r $BASEDIR/tarballs .
|
||||
cp -r $BASEDIR/patches .
|
||||
cp -r $BASEDIR/tools .
|
||||
cp -r $BASEDIR/oclang .
|
||||
cp -r $BASEDIR/ogcc .
|
||||
else
|
||||
ldd `ls $BASEDIR/target/bin/x86_64-apple-darwin*-ld | head -n1` | grep "libLTO.so" &>/dev/null && \
|
||||
echo "-->> WARNING: ld is linked dynamically against libLTO.so! Consider recompiling with DISABLE_LTO_SUPPORT=1 <<--" && \
|
||||
sleep 5
|
||||
ldd `ls $BASEDIR/target/bin/x86_64-apple-darwin*-ld | head -n1` | grep "libLTO.so" &>/dev/null && \
|
||||
echo "-->> WARNING: ld is linked dynamically against libLTO.so! Consider recompiling with DISABLE_LTO_SUPPORT=1 <<--" && \
|
||||
sleep 5
|
||||
|
||||
cp -r $BASEDIR/target/* .
|
||||
cp $BASEDIR/build/cctools*/cctools/APPLE_LICENSE CCTOOLS.LICENSE
|
||||
cp $BASEDIR/oclang/find_intrinsic_headers.sh bin/osxcross-fix-intrinsic-headers
|
||||
cp -r $BASEDIR/target/* .
|
||||
cp $BASEDIR/build/cctools*/cctools/APPLE_LICENSE CCTOOLS.LICENSE
|
||||
cp $BASEDIR/oclang/find_intrinsic_headers.sh bin/osxcross-fix-intrinsic-headers
|
||||
|
||||
READMEINSTALL="README_INSTALL"
|
||||
READMEINSTALL="README_INSTALL"
|
||||
|
||||
echo "- BINARY INSTALLATION INSTRUCTIONS -" > $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "Add " >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo " \`<absolute path>/bin/osxcross-env\`" >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "To your ~/.profile or ~/.bashrc," >> $READMEINSTALL
|
||||
echo "then restart your shell session." >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "That's it." >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "- BINARY INSTALLATION INSTRUCTIONS -" > $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "Add " >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo " \`<absolute path>/bin/osxcross-env\`" >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "To your ~/.profile or ~/.bashrc," >> $READMEINSTALL
|
||||
echo "then restart your shell session." >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
echo "That's it." >> $READMEINSTALL
|
||||
echo "" >> $READMEINSTALL
|
||||
fi
|
||||
|
||||
find $BASEDIR -maxdepth 1 -type f -print0 | xargs -0 -i cp {} .
|
||||
|
||||
if [ $BINARYPACKAGE == "1" ]; then
|
||||
rm -f *.sh
|
||||
rm -f TODO
|
||||
rm -f *.sh
|
||||
rm -f TODO
|
||||
fi
|
||||
|
||||
rm -rf tarballs/gcc*
|
||||
|
119
tools/cpucount.c
119
tools/cpucount.c
@ -1,39 +1,43 @@
|
||||
/*
|
||||
* Copyright (C) 2012 by Thomas Poechtrager
|
||||
* t.poechtrager@gmail.com
|
||||
*
|
||||
* OSXCross is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* OSXCross is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Foobar. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
/***********************************************************************
|
||||
* OSXCross *
|
||||
* Copyright (C) 2013, 2014 by Thomas Poechtrager *
|
||||
* t.poechtrager@gmail.com *
|
||||
* *
|
||||
* This program is free software; you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License *
|
||||
* as published by the Free Software Foundation; either version 2 *
|
||||
* of the License, or (at your option) any later version. *
|
||||
* *
|
||||
* This program is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with this program; if not, write to the Free Software *
|
||||
* Foundation, Inc., *
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
|
||||
***********************************************************************/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#ifdef __CYGWIN__
|
||||
#define WIN32
|
||||
#endif //__CYGWIN__
|
||||
#endif /* __CYGWIN__ */
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
#endif //WIN32
|
||||
#endif /* WIN32 */
|
||||
|
||||
#ifdef __linux__
|
||||
#define __USE_GNU
|
||||
#include <sched.h>
|
||||
#undef __USE_GNU
|
||||
#endif //__linux__
|
||||
#endif /* __linux__ */
|
||||
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__APPLE__)
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
@ -41,59 +45,56 @@
|
||||
|
||||
#ifndef HW_AVAILCPU
|
||||
#define HW_AVAILCPU 25
|
||||
#endif //HW_AVAILCPU
|
||||
#endif //BSD
|
||||
#endif /* HW_AVAILCPU */
|
||||
#endif /* BSD */
|
||||
|
||||
int getcpucount()
|
||||
{
|
||||
int getcpucount() {
|
||||
#ifdef WIN32
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
SYSTEM_INFO sysinfo;
|
||||
GetSystemInfo(&sysinfo);
|
||||
|
||||
return sysinfo.dwNumberOfProcessors;
|
||||
return sysinfo.dwNumberOfProcessors;
|
||||
#else
|
||||
#ifdef __linux__
|
||||
cpu_set_t cs;
|
||||
int i, cpucount = 0;
|
||||
cpu_set_t cs;
|
||||
int i, cpucount = 0;
|
||||
|
||||
CPU_ZERO(&cs);
|
||||
sched_getaffinity(0, sizeof(cs), &cs);
|
||||
CPU_ZERO(&cs);
|
||||
sched_getaffinity(0, sizeof(cs), &cs);
|
||||
|
||||
for(i = 0; i < 128; i++)
|
||||
{
|
||||
if(CPU_ISSET(i, &cs))
|
||||
cpucount++;
|
||||
}
|
||||
for (i = 0; i < 128; i++) {
|
||||
if (CPU_ISSET(i, &cs))
|
||||
cpucount++;
|
||||
}
|
||||
|
||||
return cpucount ? cpucount : 1;
|
||||
return cpucount ? cpucount : 1;
|
||||
#else
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__APPLE__)
|
||||
int cpucount = 0;
|
||||
int mib[4];
|
||||
size_t len = sizeof(cpucount);
|
||||
#if defined(__FreeBSD__) || defined(__NetBSD__) || \
|
||||
defined(__OpenBSD__) || defined(__APPLE__)
|
||||
int cpucount = 0;
|
||||
int mib[4];
|
||||
size_t len = sizeof(cpucount);
|
||||
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_AVAILCPU;
|
||||
mib[0] = CTL_HW;
|
||||
mib[1] = HW_AVAILCPU;
|
||||
|
||||
sysctl(mib, 2, &cpucount, &len, NULL, 0);
|
||||
|
||||
if (cpucount < 1) {
|
||||
mib[1] = HW_NCPU;
|
||||
sysctl(mib, 2, &cpucount, &len, NULL, 0);
|
||||
}
|
||||
|
||||
if(cpucount < 1)
|
||||
{
|
||||
mib[1] = HW_NCPU;
|
||||
sysctl(mib, 2, &cpucount, &len, NULL, 0);
|
||||
}
|
||||
|
||||
return cpucount ? cpucount : 1;
|
||||
return cpucount ? cpucount : 1;
|
||||
#else
|
||||
#warning unknown platform
|
||||
return 1;
|
||||
#endif //BSD
|
||||
#endif //__linux__
|
||||
#endif //WIN32
|
||||
return 1;
|
||||
#endif /* BSD */
|
||||
#endif /* __linux__ */
|
||||
#endif /* WIN32 */
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf("%d\n", getcpucount());
|
||||
return 0;
|
||||
int main(void) {
|
||||
printf("%d\n", getcpucount());
|
||||
return 0;
|
||||
}
|
||||
|
82
tools/gen_sdk_package.sh
Normal file → Executable file
82
tools/gen_sdk_package.sh
Normal file → Executable file
@ -4,22 +4,22 @@
|
||||
# This script must be run on OS X
|
||||
#
|
||||
|
||||
if [ `uname -s` != "Darwin" ]; then
|
||||
echo "This script must be run on OS X"
|
||||
exit 1
|
||||
if [ $(uname -s) != "Darwin" ]; then
|
||||
echo "This script must be run on OS X"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
XCODEDIR=$(ls /Volumes | grep Xcode | head -n1)
|
||||
|
||||
if [ -z "$XCODEDIR" ]; then
|
||||
if [ -d "/Applications/Xcode.app" ]; then
|
||||
XCODEDIR="/Applications/Xcode.app"
|
||||
else
|
||||
echo "please mount Xcode.dmg"
|
||||
exit 1
|
||||
fi
|
||||
if [ -d "/Applications/Xcode.app" ]; then
|
||||
XCODEDIR="/Applications/Xcode.app"
|
||||
else
|
||||
echo "please mount Xcode.dmg"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
XCODEDIR="/Volumes/$XCODEDIR/Xcode.app"
|
||||
XCODEDIR="/Volumes/$XCODEDIR/Xcode.app"
|
||||
fi
|
||||
|
||||
[ ! -d $XCODEDIR ] && exit 1
|
||||
@ -30,36 +30,36 @@ WDIR=$(pwd)
|
||||
which gnutar &>/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
TAR=gnutar
|
||||
TAR=gnutar
|
||||
else
|
||||
TAR=tar
|
||||
TAR=tar
|
||||
fi
|
||||
|
||||
which xz &>/dev/null
|
||||
|
||||
if [ $? -eq 0 ]; then
|
||||
COMPRESSOR=xz
|
||||
PKGEXT="tar.xz"
|
||||
COMPRESSOR=xz
|
||||
PKGEXT="tar.xz"
|
||||
else
|
||||
COMPRESSOR=bzip2
|
||||
PKGEXT="tar.bz2"
|
||||
COMPRESSOR=bzip2
|
||||
PKGEXT="tar.bz2"
|
||||
fi
|
||||
|
||||
set -e
|
||||
|
||||
pushd $XCODEDIR &>/dev/null
|
||||
pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null || {
|
||||
echo "Xcode (or this script) is out of date"
|
||||
echo "trying some magic to find the SDKs anyway ..."
|
||||
echo "Xcode (or this script) is out of date"
|
||||
echo "trying some magic to find the SDKs anyway ..."
|
||||
|
||||
SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1)
|
||||
SDKDIR=$(find . -name SDKs -type d | grep MacOSX | head -n1)
|
||||
|
||||
if [ -z "$SDKDIR" ]; then
|
||||
echo "cannot find SDKs!"
|
||||
exit 1
|
||||
fi
|
||||
if [ -z "$SDKDIR" ]; then
|
||||
echo "cannot find SDKs!"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
pushd $SDKDIR &>/dev/null
|
||||
pushd $SDKDIR &>/dev/null
|
||||
}
|
||||
|
||||
SDKS=$(ls | grep MacOSX)
|
||||
@ -72,30 +72,30 @@ fi
|
||||
LIBCXXDIR="Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/c++/v1"
|
||||
|
||||
for SDK in $SDKS; do
|
||||
echo "packaging ${SDK/.sdk/} SDK (this may take several minutes) ..."
|
||||
echo "packaging ${SDK/.sdk/} SDK (this may take several minutes) ..."
|
||||
|
||||
if [[ $SDK == *.pkg ]]; then
|
||||
cp $SDK $WDIR
|
||||
continue
|
||||
fi
|
||||
if [[ $SDK == *.pkg ]]; then
|
||||
cp $SDK $WDIR
|
||||
continue
|
||||
fi
|
||||
|
||||
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
|
||||
cp -r $SDK $TMP &>/dev/null || true
|
||||
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
|
||||
cp -r $SDK $TMP &>/dev/null || true
|
||||
|
||||
pushd $XCODEDIR &>/dev/null
|
||||
pushd $XCODEDIR &>/dev/null
|
||||
|
||||
# libc++ headers for C++11/C++14
|
||||
if [ -d $LIBCXXDIR ]; then
|
||||
cp -rf $LIBCXXDIR "$TMP/$SDK/usr/include/c++"
|
||||
fi
|
||||
# libc++ headers for C++11/C++14
|
||||
if [ -d $LIBCXXDIR ]; then
|
||||
cp -rf $LIBCXXDIR "$TMP/$SDK/usr/include/c++"
|
||||
fi
|
||||
|
||||
popd &>/dev/null
|
||||
popd &>/dev/null
|
||||
|
||||
pushd $TMP &>/dev/null
|
||||
$TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT"
|
||||
popd &>/dev/null
|
||||
pushd $TMP &>/dev/null
|
||||
$TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT"
|
||||
popd &>/dev/null
|
||||
|
||||
rm -rf $TMP
|
||||
rm -rf $TMP
|
||||
done
|
||||
|
||||
popd &>/dev/null
|
||||
|
114
tools/tools.sh
114
tools/tools.sh
@ -13,91 +13,91 @@ test -n "$OCDEBUG" && set -x
|
||||
JOBS=`tools/get_cpu_count.sh`
|
||||
|
||||
if [ "`basename $0`" != "build.sh" ]; then
|
||||
`tools/osxcross_conf.sh`
|
||||
`tools/osxcross_conf.sh`
|
||||
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "you need to complete ./build.sh first, before you can start building $DESC"
|
||||
exit 1
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "you need to complete ./build.sh first, before you can start building $DESC"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
function require()
|
||||
{
|
||||
set +e
|
||||
set +e
|
||||
which $1 &>/dev/null
|
||||
while [ $? -ne 0 ]
|
||||
do
|
||||
echo ""
|
||||
read -p "Please install $1 then press enter"
|
||||
which $1 &>/dev/null
|
||||
while [ $? -ne 0 ]
|
||||
do
|
||||
echo ""
|
||||
read -p "Please install $1 then press enter"
|
||||
which $1 &>/dev/null
|
||||
done
|
||||
set -e
|
||||
done
|
||||
set -e
|
||||
}
|
||||
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
MAKE=gmake
|
||||
MAKE=gmake
|
||||
else
|
||||
MAKE=make
|
||||
MAKE=make
|
||||
fi
|
||||
|
||||
require $MAKE
|
||||
|
||||
function extract()
|
||||
{
|
||||
test $# -ge 2 -a $# -lt 4 && test $2 -eq 2 && echo ""
|
||||
echo "extracting `basename $1` ..."
|
||||
test $# -ge 2 -a $# -lt 4 && test $2 -eq 2 && echo ""
|
||||
echo "extracting `basename $1` ..."
|
||||
|
||||
local tarflags
|
||||
local tarflags
|
||||
|
||||
tarflags="xf"
|
||||
test -n "$OCDEBUG" && tarflags+="v"
|
||||
tarflags="xf"
|
||||
test -n "$OCDEBUG" && tarflags+="v"
|
||||
|
||||
case $1 in
|
||||
*.pkg)
|
||||
which xar &>/dev/null || exit 1
|
||||
xar -xf $1
|
||||
cat Payload | gunzip -dc | cpio -i 2>/dev/null && rm Payload
|
||||
;;
|
||||
*.tar.xz)
|
||||
xz -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.gz)
|
||||
gunzip -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.bz2)
|
||||
bzip2 -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled archive type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
case $1 in
|
||||
*.pkg)
|
||||
which xar &>/dev/null || exit 1
|
||||
xar -xf $1
|
||||
cat Payload | gunzip -dc | cpio -i 2>/dev/null && rm Payload
|
||||
;;
|
||||
*.tar.xz)
|
||||
xz -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.gz)
|
||||
gunzip -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*.tar.bz2)
|
||||
bzip2 -dc $1 | tar $tarflags -
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled archive type"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ $# -eq 2 -o $# -eq 4 ]; then
|
||||
echo ""
|
||||
fi
|
||||
if [ $# -eq 2 -o $# -eq 4 ]; then
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
function test_compiler()
|
||||
{
|
||||
echo -ne "testing $1 ... "
|
||||
$1 $2 -O2 -Wall -o test
|
||||
rm test
|
||||
echo "works"
|
||||
echo -ne "testing $1 ... "
|
||||
$1 $2 -O2 -Wall -o test
|
||||
rm test
|
||||
echo "works"
|
||||
}
|
||||
|
||||
function test_compiler_cxx11()
|
||||
{
|
||||
set +e
|
||||
echo -ne "testing $1 -stdlib=libc++ -std=c++11 ... "
|
||||
$1 $2 -O2 -stdlib=libc++ -std=c++11 -Wall -o test &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
rm test
|
||||
echo "works"
|
||||
else
|
||||
echo "failed (ignored)"
|
||||
fi
|
||||
set -e
|
||||
set +e
|
||||
echo -ne "testing $1 -stdlib=libc++ -std=c++11 ... "
|
||||
$1 $2 -O2 -stdlib=libc++ -std=c++11 -Wall -o test &>/dev/null
|
||||
if [ $? -eq 0 ]; then
|
||||
rm test
|
||||
echo "works"
|
||||
else
|
||||
echo "failed (ignored)"
|
||||
fi
|
||||
set -e
|
||||
}
|
||||
|
||||
# exit on error
|
||||
|
@ -2,29 +2,28 @@
|
||||
|
||||
function check_for_bug_1242300()
|
||||
{
|
||||
if [ -e /etc/issue ]; then
|
||||
if [ "`grep -i ubuntu.13.10 /etc/issue`" ]; then
|
||||
echo "Ubuntu 13.10 detected. if there was a 'configure:' error"
|
||||
echo "please see https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1242300"
|
||||
fi
|
||||
if [ -e /etc/issue ]; then
|
||||
if [ "`grep -i ubuntu.13.10 /etc/issue`" ]; then
|
||||
echo "Ubuntu 13.10 detected. if there was a 'configure:' error"
|
||||
echo "please see https://bugs.launchpad.net/ubuntu/+source/llvm-defaults/+bug/1242300"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function _exit()
|
||||
{
|
||||
EC=$?
|
||||
if [ $EC -ne 0 ]; then
|
||||
test -z "$SCRIPT" && SCRIPT=`basename $0`
|
||||
echo ""
|
||||
echo "exiting with abnormal exit code ($EC)"
|
||||
test -n "$OCDEBUG" || echo "run 'OCDEBUG=1 ./$SCRIPT' to enable debug messages"
|
||||
echo "removing stale locks..."
|
||||
remove_locks
|
||||
echo "if it is happening the first time, then just re-run the script"
|
||||
echo ""
|
||||
test $SCRIPT = "build.sh" && check_for_bug_1242300
|
||||
fi
|
||||
EC=$?
|
||||
if [ $EC -ne 0 ]; then
|
||||
test -z "$SCRIPT" && SCRIPT=`basename $0`
|
||||
echo ""
|
||||
echo "exiting with abnormal exit code ($EC)"
|
||||
test -n "$OCDEBUG" || echo "run 'OCDEBUG=1 ./$SCRIPT' to enable debug messages"
|
||||
echo "removing stale locks..."
|
||||
remove_locks
|
||||
echo "if it is happening the first time, then just re-run the script"
|
||||
echo ""
|
||||
test $SCRIPT = "build.sh" && check_for_bug_1242300
|
||||
fi
|
||||
}
|
||||
|
||||
trap _exit EXIT
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user