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: '-oc-use-gcc-libs' option (uses './build_gcc.sh' libstdc++)
|
||||||
- added: 10.6 SDK support (10.4-10.9 are all supported now)
|
- added: 10.6 SDK support (10.4-10.9 are all supported now)
|
||||||
- added: 'sw_vers' tool, which is required by some projects
|
- 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: 'osxcross-conf', 'osxcross-env' and the (fake) 'dsymutil' are now implemented in the wrapper
|
||||||
- changed: switched to two-space indents
|
- changed: switched to two-space indents
|
||||||
|
|
||||||
|
34
build.sh
34
build.sh
@ -77,7 +77,11 @@ if [ -z "$OSX_VERSION_MIN" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ld version
|
# 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
|
# Don't change this
|
||||||
OSXCROSS_VERSION=0.7
|
OSXCROSS_VERSION=0.7
|
||||||
@ -126,13 +130,16 @@ mkdir -p $SDK_DIR
|
|||||||
require $CC
|
require $CC
|
||||||
require $CXX
|
require $CXX
|
||||||
require clang
|
require clang
|
||||||
require sed
|
|
||||||
require patch
|
require patch
|
||||||
|
require sed
|
||||||
require gunzip
|
require gunzip
|
||||||
require cpio
|
require cpio
|
||||||
require autogen
|
|
||||||
require automake
|
if [ "$PLATFORM" != "Darwin" ]; then
|
||||||
require libtool
|
require autogen
|
||||||
|
require automake
|
||||||
|
require libtool
|
||||||
|
fi
|
||||||
|
|
||||||
pushd $BUILD_DIR &>/dev/null
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
@ -143,6 +150,8 @@ function remove_locks()
|
|||||||
|
|
||||||
source $BASE_DIR/tools/trap_exit.sh
|
source $BASE_DIR/tools/trap_exit.sh
|
||||||
|
|
||||||
|
# CCTOOLS
|
||||||
|
if [ "$PLATFORM" != "Darwin" ]; then
|
||||||
if [ "`ls $TARBALL_DIR/cctools*.tar.* | wc -l | tr -d ' '`" != "1" ]; then
|
if [ "`ls $TARBALL_DIR/cctools*.tar.* | wc -l | tr -d ' '`" != "1" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo "There should only be one cctools*.tar.* archive in the tarballs directory"
|
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_REVHASH=`ls $TARBALL_DIR/cctools*.tar.* | tr '_' ' ' | tr '.' ' ' | awk '{print $3}'`
|
||||||
|
|
||||||
# CCTOOLS
|
|
||||||
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
|
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET" ]; then
|
||||||
|
|
||||||
rm -rf cctools*
|
rm -rf cctools*
|
||||||
@ -188,6 +196,7 @@ for CCTOOL in ${CCTOOLS[@]}; do
|
|||||||
done
|
done
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
# CCTOOLS END
|
# CCTOOLS END
|
||||||
|
|
||||||
@ -235,6 +244,7 @@ fi
|
|||||||
fi
|
fi
|
||||||
# XAR END
|
# XAR END
|
||||||
|
|
||||||
|
if [ "$PLATFORM" != "Darwin" ]; then
|
||||||
if [ ! -f "have_cctools_$TARGET" ]; then
|
if [ ! -f "have_cctools_$TARGET" ]; then
|
||||||
|
|
||||||
function check_cctools()
|
function check_cctools()
|
||||||
@ -255,6 +265,7 @@ touch "have_cctools_${CCTOOLS_REVHASH}_$TARGET"
|
|||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
fi # HAVE_CCTOOLS
|
fi # HAVE_CCTOOLS
|
||||||
|
fi
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
||||||
@ -303,7 +314,10 @@ export OSX_VERSION_MIN
|
|||||||
export LINKER_VERSION
|
export LINKER_VERSION
|
||||||
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
$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 ""
|
echo ""
|
||||||
|
|
||||||
@ -355,13 +369,13 @@ set -e
|
|||||||
echo ""
|
echo ""
|
||||||
echo "Now add"
|
echo "Now add"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\e[32m\`$OSXCROSS_ENV\`\e[0m"
|
echo -e "\x1B[32m\`$OSXCROSS_ENV\`\x1B[0m"
|
||||||
echo ""
|
echo ""
|
||||||
if [ $HAVE_CSH -eq 1 ]; then
|
if [ $HAVE_CSH -eq 1 ]; then
|
||||||
echo "or in case of csh:"
|
echo "or in case of csh:"
|
||||||
echo ""
|
echo ""
|
||||||
echo -e "\e[32msetenv PATH \`$OSXCROSS_ENV -v=PATH\`\e[0m"
|
echo -e "\x1B[32msetenv PATH \`$OSXCROSS_ENV -v=PATH\`\x1B[0m"
|
||||||
echo -e "\e[32msetenv LD_LIBRARY_PATH \`$OSXCROSS_ENV -v=LD_LIBRARY_PATH\`\e[0m"
|
echo -e "\x1B[32msetenv LD_LIBRARY_PATH \`$OSXCROSS_ENV -v=LD_LIBRARY_PATH\`\x1B[0m"
|
||||||
echo ""
|
echo ""
|
||||||
fi
|
fi
|
||||||
echo "to your ~/.bashrc${CSHRC} or ~/.profile (including the '\`')"
|
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
|
mkdir -p build
|
||||||
pushd build &>/dev/null
|
pushd build &>/dev/null
|
||||||
|
|
||||||
if [[ "`uname -s`" == *BSD ]]; then
|
if [[ $PLATFORM == *BSD ]]; then
|
||||||
export CPATH="/usr/local/include:/usr/pkg/include:$CPATH"
|
export CPATH="/usr/local/include:/usr/pkg/include:$CPATH"
|
||||||
export LDFLAGS="-L/usr/local/lib -L/usr/pkg/lib $LDFLAGS"
|
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 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
|
fi
|
||||||
|
|
||||||
../configure \
|
../configure \
|
||||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
--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 \
|
--with-sysroot=$OSXCROSS_SDK \
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--enable-languages=c,c++,objc,obj-c++ \
|
--enable-languages=c,c++,objc,obj-c++ \
|
||||||
@ -64,7 +73,8 @@ fi
|
|||||||
--enable-multilib \
|
--enable-multilib \
|
||||||
--enable-lto \
|
--enable-lto \
|
||||||
--enable-checking=release \
|
--enable-checking=release \
|
||||||
--prefix=$OSXCROSS_TARGET_DIR
|
--prefix=$OSXCROSS_TARGET_DIR \
|
||||||
|
$EXTRACONFFLAGS
|
||||||
|
|
||||||
$MAKE -j$JOBS
|
$MAKE -j$JOBS
|
||||||
$MAKE install -j$JOBS
|
$MAKE install -j$JOBS
|
||||||
|
@ -9,6 +9,7 @@ export CXX=clang++
|
|||||||
# enable debug messages
|
# enable debug messages
|
||||||
test -n "$OCDEBUG" && set -x
|
test -n "$OCDEBUG" && set -x
|
||||||
|
|
||||||
|
PLATFORM="`uname -s`"
|
||||||
PSCRIPT="`basename $0`"
|
PSCRIPT="`basename $0`"
|
||||||
|
|
||||||
if [[ $PSCRIPT != *wrapper/build.sh ]]; then
|
if [[ $PSCRIPT != *wrapper/build.sh ]]; then
|
||||||
@ -38,7 +39,7 @@ function require()
|
|||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ "`uname -s`" == *BSD ]]; then
|
if [[ $PLATFORM == *BSD ]]; then
|
||||||
MAKE=gmake
|
MAKE=gmake
|
||||||
else
|
else
|
||||||
MAKE=make
|
MAKE=make
|
||||||
@ -82,6 +83,11 @@ function extract()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function get_ld_version()
|
||||||
|
{
|
||||||
|
echo "`ld -v 2>&1 | tr "-" " " | awk '{print $3}' | head -n1`"
|
||||||
|
}
|
||||||
|
|
||||||
function verbose_cmd()
|
function verbose_cmd()
|
||||||
{
|
{
|
||||||
echo "$@"
|
echo "$@"
|
||||||
|
@ -48,7 +48,7 @@ if [ -n "$BWCXX" ]; then
|
|||||||
CXX=$BWCXX
|
CXX=$BWCXX
|
||||||
fi
|
fi
|
||||||
|
|
||||||
[ $PLATFORM = "Darwin" ] && FLAGS+="-framework CoreServices "
|
[ $PLATFORM = "Darwin" ] && FLAGS+="-framework CoreServices -Wno-deprecated "
|
||||||
[ $PLATFORM = "FreeBSD" ] && FLAGS+="-lutil "
|
[ $PLATFORM = "FreeBSD" ] && FLAGS+="-lutil "
|
||||||
|
|
||||||
if [[ $PLATFORM != *Windows ]] && [ $PLATFORM != "Darwin" ]; then
|
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-conf
|
||||||
create_wrapper_link osxcross-env
|
create_wrapper_link osxcross-env
|
||||||
|
|
||||||
create_wrapper_link sw_vers
|
if [ "$PLATFORM" != "Darwin" ]; then
|
||||||
create_wrapper_link i386-apple-$TARGET-sw_vers
|
create_wrapper_link sw_vers
|
||||||
create_wrapper_link x86_64-apple-$TARGET-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 dsymutil
|
||||||
create_wrapper_link i386-apple-$TARGET-dsymutil
|
create_wrapper_link i386-apple-$TARGET-dsymutil
|
||||||
|
@ -840,10 +840,28 @@ struct Target {
|
|||||||
|
|
||||||
if (!check()) {
|
if (!check()) {
|
||||||
dir.str(std::string());
|
dir.str(std::string());
|
||||||
dir << clangbin << "/../include/clang";
|
|
||||||
|
|
||||||
if (!check()) {
|
#ifdef __APPLE__
|
||||||
return false;
|
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())
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1035,6 +1053,7 @@ struct Target {
|
|||||||
fargs.push_back(tmp);
|
fargs.push_back(tmp);
|
||||||
tmp.clear();
|
tmp.clear();
|
||||||
|
|
||||||
|
#ifndef __APPLE__
|
||||||
if (!findClangIntrinsicHeaders(tmp)) {
|
if (!findClangIntrinsicHeaders(tmp)) {
|
||||||
std::cerr << "cannot find clang intrinsic headers, please report this "
|
std::cerr << "cannot find clang intrinsic headers, please report this "
|
||||||
"issue to the OSXCross project" << std::endl;
|
"issue to the OSXCross project" << std::endl;
|
||||||
@ -1044,6 +1063,7 @@ struct Target {
|
|||||||
}
|
}
|
||||||
|
|
||||||
tmp.clear();
|
tmp.clear();
|
||||||
|
#endif
|
||||||
|
|
||||||
fargs.push_back("-isysroot");
|
fargs.push_back("-isysroot");
|
||||||
fargs.push_back(SDKPath);
|
fargs.push_back(SDKPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user