mirror of
https://github.com/Relintai/osxcross.git
synced 2025-02-03 22:45:56 +01:00
cleanup
This commit is contained in:
parent
ac4ae7f079
commit
1c6e42e2f2
@ -21,7 +21,7 @@ Basically everything you can build on OS X with clang/gcc should build with this
|
|||||||
### PACKET MANAGERS ###
|
### PACKET MANAGERS ###
|
||||||
|
|
||||||
OSXCross comes with a minimalistic MacPorts Packet Manager.
|
OSXCross comes with a minimalistic MacPorts Packet Manager.
|
||||||
Please see [README.MACPORTS](https://github.com/tpoechtrager/osxcross/blob/master/README.MACPORTS.md) for more.
|
Please see [README.MACPORTS](README.MACPORTS.md) for more.
|
||||||
|
|
||||||
### INSTALLATION: ###
|
### INSTALLATION: ###
|
||||||
|
|
||||||
|
9
build.sh
9
build.sh
@ -26,8 +26,8 @@ function guess_sdk_version()
|
|||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
sdk=$(find -L tarballs/ -type f | grep MacOSX)
|
sdk=$(find -L tarballs/ -type f | grep MacOSX)
|
||||||
tmp2=$(echo ${sdk/bz2/} | sed s/[^0-9.]//g)
|
tmp2=$(echo ${sdk/bz2/} | $SED s/[^0-9.]//g)
|
||||||
tmp3=$(echo $tmp2 | sed s/\\\.*$//g)
|
tmp3=$(echo $tmp2 | $SED s/\\\.*$//g)
|
||||||
guess_sdk_version_result=$tmp3
|
guess_sdk_version_result=$tmp3
|
||||||
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'$(basename $sdk)
|
echo 'found SDK version' $guess_sdk_version_result 'at tarballs/'$(basename $sdk)
|
||||||
fi
|
fi
|
||||||
@ -117,7 +117,6 @@ require $CXX
|
|||||||
|
|
||||||
require clang
|
require clang
|
||||||
require patch
|
require patch
|
||||||
require sed
|
|
||||||
require gunzip
|
require gunzip
|
||||||
|
|
||||||
pushd $BUILD_DIR &>/dev/null
|
pushd $BUILD_DIR &>/dev/null
|
||||||
@ -188,12 +187,12 @@ CCTOOLS=$(find . -name "x86_64-apple-darwin*")
|
|||||||
CCTOOLS=($CCTOOLS)
|
CCTOOLS=($CCTOOLS)
|
||||||
if [ $X86_64H_SUPPORTED -eq 1 ]; then
|
if [ $X86_64H_SUPPORTED -eq 1 ]; then
|
||||||
for CCTOOL in ${CCTOOLS[@]}; do
|
for CCTOOL in ${CCTOOLS[@]}; do
|
||||||
CCTOOL_X86_64H=$(echo "$CCTOOL" | sed 's/x86_64/x86_64h/g')
|
CCTOOL_X86_64H=$(echo "$CCTOOL" | $SED 's/x86_64/x86_64h/g')
|
||||||
ln -sf $CCTOOL $CCTOOL_X86_64H
|
ln -sf $CCTOOL $CCTOOL_X86_64H
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
for CCTOOL in ${CCTOOLS[@]}; do
|
for CCTOOL in ${CCTOOLS[@]}; do
|
||||||
CCTOOL_I386=$(echo "$CCTOOL" | sed 's/x86_64/i386/g')
|
CCTOOL_I386=$(echo "$CCTOOL" | $SED 's/x86_64/i386/g')
|
||||||
ln -sf $CCTOOL $CCTOOL_I386
|
ln -sf $CCTOOL $CCTOOL_I386
|
||||||
done
|
done
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
@ -6,7 +6,7 @@ DESC=binutils
|
|||||||
USESYSTEMCOMPILER=1
|
USESYSTEMCOMPILER=1
|
||||||
source tools/tools.sh
|
source tools/tools.sh
|
||||||
|
|
||||||
`tools/osxcross_conf.sh`
|
eval $(tools/osxcross_conf.sh)
|
||||||
|
|
||||||
# binutils version to build
|
# binutils version to build
|
||||||
BINUTILS_VERSION=2.25
|
BINUTILS_VERSION=2.25
|
||||||
|
@ -10,7 +10,6 @@ if [ $PLATFORM == "Darwin" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
require git
|
require git
|
||||||
require $MAKE
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
@ -31,35 +30,24 @@ set -e
|
|||||||
CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \
|
CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \
|
||||||
clang -xc -E - | tail -n1 | tr ' ' '.')
|
clang -xc -E - | tail -n1 | tr ' ' '.')
|
||||||
|
|
||||||
if [[ $PLATFORM == CYGWIN* ]] && [[ $(which clang) == "/usr/bin/clang" ]]; then
|
|
||||||
CLANG_LIB_DIR="/usr/lib/clang/$(uname -m)-pc-cygwin"
|
|
||||||
else
|
|
||||||
set +e
|
|
||||||
which llvm-config &>/dev/null && { CLANG_LIB_DIR=$(llvm-config --libdir); }
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ -z "$CLANG_LIB_DIR" ]; then
|
|
||||||
require $READLINK
|
|
||||||
CLANG_LIB_DIR="$(dirname $($READLINK -f $(which clang)))/../lib"
|
|
||||||
fi
|
|
||||||
|
|
||||||
CLANG_LIB_DIR+="/clang"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -d "$CLANG_LIB_DIR" ]; then
|
|
||||||
echo "$CLANG_LIB_DIR does not exist!" 1>&2
|
|
||||||
echo "Installing llvm-dev may help" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Drop patch level for <= 3.3.
|
# Drop patch level for <= 3.3.
|
||||||
if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then
|
if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then
|
||||||
CLANG_VERSION=$(echo $CLANG_VERSION | tr '.' ' ' |
|
CLANG_VERSION=$(echo $CLANG_VERSION | tr '.' ' ' |
|
||||||
awk '{print $1, $2}' | tr ' ' '.')
|
awk '{print $1, $2}' | tr ' ' '.')
|
||||||
fi
|
fi
|
||||||
|
|
||||||
CLANG_INCLUDE_DIR="${CLANG_LIB_DIR}/${CLANG_VERSION}/include"
|
CLANG_LIB_DIR=$(clang -print-search-dirs | grep "libraries: =" | \
|
||||||
CLANG_DARWIN_LIB_DIR="${CLANG_LIB_DIR}/${CLANG_VERSION}/lib/darwin"
|
tr '=' ' ' | tr ':' ' ' | awk '{print $2}')
|
||||||
|
|
||||||
|
VERSION=$(echo "${CLANG_LIB_DIR}" | tr '/' '\n' | tail -n1)
|
||||||
|
|
||||||
|
if [ $VERSION != $CLANG_VERSION ]; then
|
||||||
|
echo "sanity check failed: $VERSION != ${CLANG_VERSION}" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CLANG_INCLUDE_DIR="${CLANG_LIB_DIR}/include"
|
||||||
|
CLANG_DARWIN_LIB_DIR="${CLANG_LIB_DIR}/lib/darwin"
|
||||||
|
|
||||||
case $CLANG_VERSION in
|
case $CLANG_VERSION in
|
||||||
3.2*) BRANCH=release_32 ;;
|
3.2*) BRANCH=release_32 ;;
|
||||||
@ -95,7 +83,7 @@ $SED -i "s/Configs += asan_iossim_dynamic//g" make/platform/clang_darwin.mk
|
|||||||
|
|
||||||
# Unbreak the -Werror build.
|
# Unbreak the -Werror build.
|
||||||
if [ -f lib/asan/asan_mac.h ]; then
|
if [ -f lib/asan/asan_mac.h ]; then
|
||||||
sed -i "s/ASAN__MAC_H/ASAN_MAC_H/g" lib/asan/asan_mac.h
|
$SED -i "s/ASAN__MAC_H/ASAN_MAC_H/g" lib/asan/asan_mac.h
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $(osxcross-cmp $CLANG_VERSION ">=" 3.5) -eq 1 ]; then
|
if [ $(osxcross-cmp $CLANG_VERSION ">=" 3.5) -eq 1 ]; then
|
||||||
@ -111,12 +99,12 @@ then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
EXTRA_MAKE_FLAGS="LIPO=\"xcrun lipo\""
|
EXTRA_MAKE_FLAGS="LIPO=\"$(xcrun -f lipo)\""
|
||||||
|
|
||||||
if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then
|
if [ $(osxcross-cmp $CLANG_VERSION "<=" 3.3) -eq 1 ]; then
|
||||||
EXTRA_MAKE_FLAGS+=" AR=\"xcrun ar\""
|
EXTRA_MAKE_FLAGS+=" AR=\"$(xcrun -f ar)\""
|
||||||
EXTRA_MAKE_FLAGS+=" RANLIB=\"xcrun ranlib\""
|
EXTRA_MAKE_FLAGS+=" RANLIB=\"$(xcrun -f ranlib)\""
|
||||||
EXTRA_MAKE_FLAGS+=" CC=\"xcrun clang\""
|
EXTRA_MAKE_FLAGS+=" CC=\"$(xcrun -f clang)\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$OCDEBUG" ]; then
|
if [ -n "$OCDEBUG" ]; then
|
||||||
@ -135,8 +123,8 @@ echo ""
|
|||||||
echo "Please run the following commands by hand to install compiler-rt:"
|
echo "Please run the following commands by hand to install compiler-rt:"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
echo "mkdir -p ${CLANG_LIB_DIR}/${CLANG_VERSION}/include"
|
echo "mkdir -p ${CLANG_INCLUDE_DIR}"
|
||||||
echo "mkdir -p ${CLANG_LIB_DIR}/${CLANG_VERSION}/lib/darwin"
|
echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}"
|
||||||
echo "cp -r $PWD/include/sanitizer ${CLANG_INCLUDE_DIR}"
|
echo "cp -r $PWD/include/sanitizer ${CLANG_INCLUDE_DIR}"
|
||||||
|
|
||||||
pushd "clang_darwin" &>/dev/null
|
pushd "clang_darwin" &>/dev/null
|
||||||
|
@ -8,7 +8,7 @@ DESC=gcc
|
|||||||
USESYSTEMCOMPILER=1
|
USESYSTEMCOMPILER=1
|
||||||
source tools/tools.sh
|
source tools/tools.sh
|
||||||
|
|
||||||
`tools/osxcross_conf.sh`
|
eval $(tools/osxcross_conf.sh)
|
||||||
|
|
||||||
# GCC version to build
|
# GCC version to build
|
||||||
# (<4.7 will not work properly with libc++)
|
# (<4.7 will not work properly with libc++)
|
||||||
|
@ -15,4 +15,4 @@ esac
|
|||||||
|
|
||||||
[ ! -f $prog ] && cc cpucount.c -o cpucount &>/dev/null
|
[ ! -f $prog ] && cc cpucount.c -o cpucount &>/dev/null
|
||||||
|
|
||||||
eval "./${prog}"
|
./$prog
|
||||||
|
@ -59,7 +59,9 @@ test -n "$OCDEBUG" && set -x
|
|||||||
|
|
||||||
if [[ $SCRIPT != *wrapper/build.sh ]]; then
|
if [[ $SCRIPT != *wrapper/build.sh ]]; then
|
||||||
# how many concurrent jobs should be used for compiling?
|
# how many concurrent jobs should be used for compiling?
|
||||||
JOBS=${JOBS:=$(tools/get_cpu_count.sh)}
|
if [ -z "$JOBS" ]; then
|
||||||
|
JOBS=$(tools/get_cpu_count.sh || echo 1)
|
||||||
|
fi
|
||||||
|
|
||||||
if [ $SCRIPT != "build.sh" -a $SCRIPT != "build_clang.sh" -a \
|
if [ $SCRIPT != "build.sh" -a $SCRIPT != "build_clang.sh" -a \
|
||||||
$SCRIPT != "mount_xcode_image.sh" -a \
|
$SCRIPT != "mount_xcode_image.sh" -a \
|
||||||
@ -95,22 +97,12 @@ function require()
|
|||||||
|
|
||||||
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then
|
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then
|
||||||
MAKE=gmake
|
MAKE=gmake
|
||||||
else
|
|
||||||
MAKE=make
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ $PLATFORM == OpenBSD ]]; then
|
|
||||||
SED=gsed
|
SED=gsed
|
||||||
else
|
else
|
||||||
|
MAKE=make
|
||||||
SED=sed
|
SED=sed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "Darwin" ]; then
|
|
||||||
READLINK=greadlink
|
|
||||||
else
|
|
||||||
READLINK=readlink
|
|
||||||
fi
|
|
||||||
|
|
||||||
require $SED
|
require $SED
|
||||||
require $MAKE
|
require $MAKE
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user