mirror of
https://github.com/tpoechtrager/osxcross.git
synced 2024-09-11 08:45:25 +03:00
support OS X itself too
This commit is contained in:
parent
f969ed09db
commit
1e8ede1d78
@ -3,6 +3,7 @@
|
||||
- added: '-oc-use-gcc-libs' option (uses './build_gcc.sh' libstdc++)
|
||||
- added: 10.6 SDK support (10.4-10.9 are all supported now)
|
||||
- added: 'sw_vers' tool, which is required by some projects
|
||||
- added: OS X support (as host)
|
||||
- changed: 'osxcross-conf', 'osxcross-env' and the (fake) 'dsymutil' are now implemented in the wrapper
|
||||
- changed: switched to two-space indents
|
||||
|
||||
|
34
build.sh
34
build.sh
@ -77,7 +77,11 @@ if [ -z "$OSX_VERSION_MIN" ]; then
|
||||
fi
|
||||
|
||||
# ld version
|
||||
LINKER_VERSION=134.9
|
||||
if [ "$PLATFORM" == "Darwin" ]; then
|
||||
LINKER_VERSION="`get_ld_version`"
|
||||
else
|
||||
LINKER_VERSION=134.9
|
||||
fi
|
||||
|
||||
# Don't change this
|
||||
OSXCROSS_VERSION=0.7
|
||||
@ -126,13 +130,16 @@ mkdir -p $SDK_DIR
|
||||
require $CC
|
||||
require $CXX
|
||||
require clang
|
||||
require sed
|
||||
require patch
|
||||
require sed
|
||||
require gunzip
|
||||
require cpio
|
||||
require autogen
|
||||
require automake
|
||||
require libtool
|
||||
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
require autogen
|
||||
require automake
|
||||
require libtool
|
||||
fi
|
||||
|
||||
pushd $BUILD_DIR &>/dev/null
|
||||
|
||||
@ -143,6 +150,8 @@ function remove_locks()
|
||||
|
||||
source $BASE_DIR/tools/trap_exit.sh
|
||||
|
||||
# CCTOOLS
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
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"
|
||||
@ -152,7 +161,6 @@ fi
|
||||
|
||||
CCTOOLS_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
|
||||
|
||||
# CCTOOLS
|
||||
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
|
||||
|
||||
rm -rf cctools*
|
||||
@ -188,6 +196,7 @@ for CCTOOL in ${CCTOOLS[@]}; do
|
||||
done
|
||||
popd &>/dev/null
|
||||
|
||||
fi
|
||||
fi
|
||||
# CCTOOLS END
|
||||
|
||||
@ -235,6 +244,7 @@ fi
|
||||
fi
|
||||
# XAR END
|
||||
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
if [ ! -f "have_cctools_$TARGET" ]; then
|
||||
|
||||
function check_cctools()
|
||||
@ -255,6 +265,7 @@ touch "have_cctools_${CCTOOLS_REVHASH}_$TARGET"
|
||||
echo ""
|
||||
|
||||
fi # HAVE_CCTOOLS
|
||||
fi
|
||||
|
||||
set +e
|
||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
||||
@ -303,7 +314,10 @@ export OSX_VERSION_MIN
|
||||
export LINKER_VERSION
|
||||
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
||||
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`cat $BUILD_DIR/cctools*/cctools/tmp/ldpath`" # libLTO.so
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
# libLTO.so
|
||||
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:`cat $BUILD_DIR/cctools*/cctools/tmp/ldpath`"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
|
||||
@ -355,13 +369,13 @@ set -e
|
||||
echo ""
|
||||
echo "Now add"
|
||||
echo ""
|
||||
echo -e "\e[32m\`$OSXCROSS_ENV\`\e[0m"
|
||||
echo -e "\x1B[32m\`$OSXCROSS_ENV\`\x1B[0m"
|
||||
echo ""
|
||||
if [ $HAVE_CSH -eq 1 ]; then
|
||||
echo "or in case of csh:"
|
||||
echo ""
|
||||
echo -e "\e[32msetenv PATH \`$OSXCROSS_ENV -v=PATH\`\e[0m"
|
||||
echo -e "\e[32msetenv LD_LIBRARY_PATH \`$OSXCROSS_ENV -v=LD_LIBRARY_PATH\`\e[0m"
|
||||
echo -e "\x1B[32msetenv PATH \`$OSXCROSS_ENV -v=PATH\`\x1B[0m"
|
||||
echo -e "\x1B[32msetenv LD_LIBRARY_PATH \`$OSXCROSS_ENV -v=LD_LIBRARY_PATH\`\x1B[0m"
|
||||
echo ""
|
||||
fi
|
||||
echo "to your ~/.bashrc${CSHRC} or ~/.profile (including the '\`')"
|
||||
|
18
build_gcc.sh
18
build_gcc.sh
@ -47,16 +47,25 @@ rm -f $OSXCROSS_TARGET_DIR/bin/*-g++*
|
||||
mkdir -p build
|
||||
pushd build &>/dev/null
|
||||
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
if [[ $PLATFORM == *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"
|
||||
elif [ "$PLATFORM" == "Darwin" ]; then
|
||||
export CPATH="/opt/local/include:$CPATH"
|
||||
export LDFLAGS="-L/opt/local/lib $LDFLAGS"
|
||||
export LD_LIBRARY_PATH="/opt/local/lib:$LD_LIBRARY_PATH"
|
||||
fi
|
||||
|
||||
EXTRACONFFLAGS=""
|
||||
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
EXTRACONFFLAGS+="--with-ld=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-ld "
|
||||
EXTRACONFFLAGS+="--with-as=$OSXCROSS_TARGET_DIR/bin/x86_64-apple-$OSXCROSS_TARGET-as "
|
||||
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++ \
|
||||
@ -64,7 +73,8 @@ fi
|
||||
--enable-multilib \
|
||||
--enable-lto \
|
||||
--enable-checking=release \
|
||||
--prefix=$OSXCROSS_TARGET_DIR
|
||||
--prefix=$OSXCROSS_TARGET_DIR \
|
||||
$EXTRACONFFLAGS
|
||||
|
||||
$MAKE -j$JOBS
|
||||
$MAKE install -j$JOBS
|
||||
|
@ -9,6 +9,7 @@ export CXX=clang++
|
||||
# enable debug messages
|
||||
test -n "$OCDEBUG" && set -x
|
||||
|
||||
PLATFORM="`uname -s`"
|
||||
PSCRIPT="`basename $0`"
|
||||
|
||||
if [[ $PSCRIPT != *wrapper/build.sh ]]; then
|
||||
@ -38,7 +39,7 @@ function require()
|
||||
set -e
|
||||
}
|
||||
|
||||
if [[ "`uname -s`" == *BSD ]]; then
|
||||
if [[ $PLATFORM == *BSD ]]; then
|
||||
MAKE=gmake
|
||||
else
|
||||
MAKE=make
|
||||
@ -82,6 +83,11 @@ function extract()
|
||||
fi
|
||||
}
|
||||
|
||||
function get_ld_version()
|
||||
{
|
||||
echo "`ld -v 2>&1 | tr "-" " " | awk '{print $3}' | head -n1`"
|
||||
}
|
||||
|
||||
function verbose_cmd()
|
||||
{
|
||||
echo "$@"
|
||||
|
@ -48,7 +48,7 @@ if [ -n "$BWCXX" ]; then
|
||||
CXX=$BWCXX
|
||||
fi
|
||||
|
||||
[ $PLATFORM = "Darwin" ] && FLAGS+="-framework CoreServices "
|
||||
[ $PLATFORM = "Darwin" ] && FLAGS+="-framework CoreServices -Wno-deprecated "
|
||||
[ $PLATFORM = "FreeBSD" ] && FLAGS+="-lutil "
|
||||
|
||||
if [[ $PLATFORM != *Windows ]] && [ $PLATFORM != "Darwin" ]; then
|
||||
@ -114,9 +114,11 @@ create_wrapper_link x86_64-apple-$TARGET-c++
|
||||
create_wrapper_link osxcross-conf
|
||||
create_wrapper_link osxcross-env
|
||||
|
||||
create_wrapper_link sw_vers
|
||||
create_wrapper_link i386-apple-$TARGET-sw_vers
|
||||
create_wrapper_link x86_64-apple-$TARGET-sw_vers
|
||||
if [ "$PLATFORM" != "Darwin" ]; then
|
||||
create_wrapper_link sw_vers
|
||||
create_wrapper_link i386-apple-$TARGET-sw_vers
|
||||
create_wrapper_link x86_64-apple-$TARGET-sw_vers
|
||||
fi
|
||||
|
||||
create_wrapper_link dsymutil
|
||||
create_wrapper_link i386-apple-$TARGET-dsymutil
|
||||
|
@ -840,9 +840,27 @@ struct Target {
|
||||
|
||||
if (!check()) {
|
||||
dir.str(std::string());
|
||||
|
||||
#ifdef __APPLE__
|
||||
constexpr const char *OSXIntrinDirs[] = {
|
||||
"/Library/Developer/CommandLineTools/usr/lib/clang",
|
||||
"/Applications/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang"
|
||||
};
|
||||
|
||||
for (auto intrindir : OSXIntrinDirs)
|
||||
{
|
||||
dir << intrindir;
|
||||
if (check()) {
|
||||
break;
|
||||
}
|
||||
dir.str(std::string());
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!dir.rdbuf()->in_avail()) {
|
||||
dir << clangbin << "/../include/clang";
|
||||
|
||||
if (!check()) {
|
||||
if (!check())
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -1035,6 +1053,7 @@ struct Target {
|
||||
fargs.push_back(tmp);
|
||||
tmp.clear();
|
||||
|
||||
#ifndef __APPLE__
|
||||
if (!findClangIntrinsicHeaders(tmp)) {
|
||||
std::cerr << "cannot find clang intrinsic headers, please report this "
|
||||
"issue to the OSXCross project" << std::endl;
|
||||
@ -1044,6 +1063,7 @@ struct Target {
|
||||
}
|
||||
|
||||
tmp.clear();
|
||||
#endif
|
||||
|
||||
fargs.push_back("-isysroot");
|
||||
fargs.push_back(SDKPath);
|
||||
|
Loading…
Reference in New Issue
Block a user