osxcross/wrapper/build.sh
Thomas Pöchtrager 68bdbd9452 New:
* Added support for TAPIv3 stubs (including "zippering" target)
* Added support for MacOSX SDKs up to 10.14
* Added new SDK packaging script for SDKs that end with ".xip" (tools/gen_sdk_package_pbzx.sh <xcode.xip>) (tested up to Xcode 10.2.1)
* Updated cctools to 921 and ld64 to 409.12

Fixed:
* Implemented fix for https://github.com/tpoechtrager/osxcross/issues/171
* Implemented fix for https://github.com/tpoechtrager/osxcross/issues/178
* Implemented fix for https://github.com/tpoechtrager/osxcross/issues/182

Changed:
* cctools, ld64, apple-libtapi and xar are now "git clone"'d and no longer come with OSXCross.

Removed:
* Support for Cygwin and *BSD (besides FreeBSD)
* Support for building OSXCross with GCC
2019-06-01 19:57:44 +02:00

180 lines
4.2 KiB
Bash
Executable File

#!/usr/bin/env bash
pushd "${0%/*}" &>/dev/null
pushd .. &>/dev/null
source ./tools/tools.sh
popd &>/dev/null
set +e
if [ -z "$OSXCROSS_VERSION" ]; then
eval $(../target/bin/osxcross-conf 2>/dev/null)
if [ -n "$OSXCROSS_SDK_VERSION" ]; then
if [ -z "$X86_64H_SUPPORTED" ]; then
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then
X86_64H_SUPPORTED=1
else
X86_64H_SUPPORTED=0
fi
fi
if [ -z "$I386_SUPPORTED" ]; then
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
I386_SUPPORTED=1
else
I386_SUPPORTED=0
fi
fi
fi
fi
set -e
if [ -z "$I386_SUPPORTED" ]; then
I386_SUPPORTED=1
fi
if [ -z "$X86_64H_SUPPORTED" ]; then
X86_64H_SUPPORTED=0
fi
function create_wrapper_link
{
# arg 1:
# program name
# arg 2:
# 1: create a standalone link and links with the target triple prefix
# 2: create links with target triple prefix and shortcut links such
# as o32, o64, ...
#
# example:
# create_wrapper_link osxcross 1
# creates the following symlinks:
# -> osxcross
# -> i386-apple-darwinXX-osxcross
# -> x86_64-apple-darwinXX-osxcross
# -> x86_64h-apple-darwinXX-osxcross
if [ $# -ge 2 ] && [ $2 -eq 1 ]; then
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"${1}"
fi
if [ $I386_SUPPORTED -eq 1 ]; then
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"i386-apple-${OSXCROSS_TARGET}-${1}"
fi
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"x86_64-apple-${OSXCROSS_TARGET}-${1}"
if [ $X86_64H_SUPPORTED -eq 1 ] &&
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"x86_64h-apple-${OSXCROSS_TARGET}-${1}"
fi
if [ $# -ge 2 ] && [ $2 -eq 2 ]; then
if [ $I386_SUPPORTED -eq 1 ]; then
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"o32-${1}"
fi
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"o64-${1}"
if [ $X86_64H_SUPPORTED -eq 1 ] &&
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
"o64h-${1}"
fi
fi
}
[ -z "$TARGETCOMPILER" ] && TARGETCOMPILER=clang
TARGETTRIPLE=x86_64-apple-${OSXCROSS_TARGET}
FLAGS=""
if [ -n "$BWPLATFORM" ]; then
PLATFORM=$BWPLATFORM
if [ $PLATFORM = "Darwin" -a $(uname -s) != "Darwin" ]; then
CXX=$(xcrun -f clang++)
#CXX=$(xcrun -f g++)
FLAGS+="-fvisibility-inlines-hidden "
elif [ $PLATFORM = "FreeBSD" -a $(uname -s) != "FreeBSD" ]; then
CXX=amd64-pc-freebsd10.1-clang++
#CXX=amd64-pc-freebsd10.1-g++
elif [ $PLATFORM = "NetBSD" -a $(uname -s) != "NetBSD" ]; then
CXX=amd64-pc-netbsd6.1.3-clang++
#CXX=amd64-pc-netbsd6.1.3-g++
fi
[ -z "$BWCOMPILEONLY" ] && BWCOMPILEONLY=1
else
[ -z "$PORTABLE" ] && FLAGS="$CXXFLAGS "
fi
if [ -n "$BWCXX" ]; then
[ "$CXX" != "$BWCXX" ] && echo "using $BWCXX" 1>&2
CXX=$BWCXX
fi
if [ "$PLATFORM" == "Linux" ]; then
FLAGS+="-isystem quirks/include "
fi
function compile_wrapper()
{
mkdir -p ../target ../target/bin
export PLATFORM
export CXX
verbose_cmd $MAKE clean
OSXCROSS_CXXFLAGS="$FLAGS" \
verbose_cmd $MAKE wrapper -j$JOBS
}
compile_wrapper
if [ -n "$BWCOMPILEONLY" ]; then
exit 0
fi
verbose_cmd mv wrapper "${TARGET_DIR}/bin/${TARGETTRIPLE}-wrapper"
pushd "../target/bin" &>/dev/null
if [ $TARGETCOMPILER = "clang" ]; then
create_wrapper_link clang 2
create_wrapper_link clang++ 2
create_wrapper_link clang++-libc++ 2
create_wrapper_link clang++-stdc++ 2
create_wrapper_link clang++-gstdc++ 2
elif [ $TARGETCOMPILER = "gcc" ]; then
create_wrapper_link gcc 2
create_wrapper_link g++ 2
create_wrapper_link g++-libc++ 2
fi
create_wrapper_link cc
create_wrapper_link c++
create_wrapper_link osxcross 1
create_wrapper_link osxcross-conf 1
create_wrapper_link osxcross-env 1
create_wrapper_link osxcross-cmp 1
create_wrapper_link osxcross-man 1
create_wrapper_link pkg-config
if [ "$PLATFORM" != "Darwin" ]; then
create_wrapper_link sw_vers 1
create_wrapper_link dsymutil 1
create_wrapper_link xcrun 1
fi
popd &>/dev/null
popd &>/dev/null