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
23
CHANGELOG
@ -1,3 +1,26 @@
|
|||||||
|
/****************************** v1.0 *********************************/
|
||||||
|
|
||||||
|
Changed:
|
||||||
|
* Updated cctools to 921
|
||||||
|
* Updated ld64 to 409.12
|
||||||
|
|
||||||
|
* Support has been removed for:
|
||||||
|
-> Platform:
|
||||||
|
--> Cygwin and all BSDs besides FreeBSD
|
||||||
|
-> Other:
|
||||||
|
--> Building OSXCross with GCC is no longer possible due to
|
||||||
|
extensive use of clang extensions in ld64.
|
||||||
|
|
||||||
|
* cctools, ld64 and apple-libtapi are now git clone'd and no longer
|
||||||
|
come with OSXCross itself.
|
||||||
|
|
||||||
|
* wrapper: Added support for MacOS 10.14 SDK
|
||||||
|
|
||||||
|
Added:
|
||||||
|
* Support for TAPIv2 nand TAPIv3 stubs
|
||||||
|
* gen_sdk_package_pbzx.sh: Supports latest Xcode images
|
||||||
|
|
||||||
|
|
||||||
/****************************** v0.15 ********************************/
|
/****************************** v0.15 ********************************/
|
||||||
|
|
||||||
Changed:
|
Changed:
|
||||||
|
137
README.CYGWIN.md
@ -1,137 +0,0 @@
|
|||||||
## STEP BY STEP INSTALLATION GUIDE: ##
|
|
||||||
|
|
||||||
#### Step 1: ####
|
|
||||||
|
|
||||||
Get [Cygwin](https://cygwin.com):
|
|
||||||
|
|
||||||
32-Bit: https://cygwin.com/setup-x86.exe
|
|
||||||
64-Bit: https://cygwin.com/setup-x86_64.exe
|
|
||||||
|
|
||||||
Note: *You can compile for 64-bit in a 32-bit environment.*
|
|
||||||
|
|
||||||
Click on setup-*.exe and install the following packages:
|
|
||||||
|
|
||||||
`git`, `make`, `clang`, `gcc-core`, `gcc-objc`, `gcc-g++`,
|
|
||||||
`patch`, `wget`, `libuuid-devel`, `openssl` and `pkg-config`
|
|
||||||
|
|
||||||
For LTO support you will also need:
|
|
||||||
|
|
||||||
`libllvm-devel`, `libllvm`, `libedit` and `libffi`
|
|
||||||
|
|
||||||
The Cygwin package of libLLVM lacks the LTO library, but you can create that dll
|
|
||||||
by issuing the following command:
|
|
||||||
|
|
||||||
`./tools/gen_cyglto_dll.sh`
|
|
||||||
|
|
||||||
#### Step 2: ####
|
|
||||||
|
|
||||||
Open the Cygwin shell:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/2.png)
|
|
||||||
|
|
||||||
#### Step 3: ####
|
|
||||||
|
|
||||||
Clone the OSXCross repository:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/3.png)
|
|
||||||
|
|
||||||
#### Step 4: ####
|
|
||||||
|
|
||||||
Get the Mac OS X SDK and move it into
|
|
||||||
`C:\Cygwin*\home\<User>\osxcross\tarballs`.
|
|
||||||
|
|
||||||
Please see [README](README.md) for more.
|
|
||||||
|
|
||||||
#### Step 5: ####
|
|
||||||
|
|
||||||
Build OSXCross:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/5_1.png)
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/5_2.png)
|
|
||||||
|
|
||||||
#### Step 6: ####
|
|
||||||
|
|
||||||
Add the printed target/bin path to your `~/.bashrc`:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/6.png)
|
|
||||||
|
|
||||||
#### Step 7: ####
|
|
||||||
|
|
||||||
Restart the Cygwin shell:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/7.png)
|
|
||||||
|
|
||||||
#### Step 8: ####
|
|
||||||
|
|
||||||
Verify target/bin is in PATH:
|
|
||||||
|
|
||||||
![](images/cygwin/osxcross/8.png)
|
|
||||||
|
|
||||||
All done!
|
|
||||||
|
|
||||||
## OPTIONAL: ##
|
|
||||||
|
|
||||||
### Compiler-RT ###
|
|
||||||
|
|
||||||
Please see [README.COMPILER-RT](README.COMPILER-RT.md) for more.
|
|
||||||
|
|
||||||
#### Step 1: ####
|
|
||||||
|
|
||||||
Build Compiler-RT:
|
|
||||||
|
|
||||||
![](images/cygwin/compiler-rt/1.png)
|
|
||||||
|
|
||||||
#### Step 2: ####
|
|
||||||
|
|
||||||
Execute the printed commands:
|
|
||||||
|
|
||||||
![](images/cygwin/compiler-rt/2.png)
|
|
||||||
|
|
||||||
![](images/cygwin/compiler-rt/3.png)
|
|
||||||
|
|
||||||
#### Step 3: ####
|
|
||||||
|
|
||||||
Verify Compiler-RT works:
|
|
||||||
|
|
||||||
![](images/cygwin/compiler-rt/4.png)
|
|
||||||
|
|
||||||
## EXAMPLE USAGE: ###
|
|
||||||
|
|
||||||
### osxcross-macports ###
|
|
||||||
|
|
||||||
Please see [README.MACPORTS](README.MACPORTS.md) for more.
|
|
||||||
|
|
||||||
#### Step 1: ####
|
|
||||||
|
|
||||||
Change the deployment target to >= 10.7:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/1.png)
|
|
||||||
|
|
||||||
#### Step 2: ####
|
|
||||||
|
|
||||||
Restart the Cygwin shell:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/2.png)
|
|
||||||
|
|
||||||
#### Step 3: ####
|
|
||||||
|
|
||||||
Let's install libgeoip:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/3.png)
|
|
||||||
|
|
||||||
#### Step 4: ####
|
|
||||||
|
|
||||||
Write a simple test program:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/4.png)
|
|
||||||
|
|
||||||
#### Step 5: ####
|
|
||||||
|
|
||||||
Compile the test program:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/5.png)
|
|
||||||
|
|
||||||
... or the xcrun way:
|
|
||||||
|
|
||||||
![](images/cygwin/macports/6.png)
|
|
55
README.md
@ -3,7 +3,7 @@
|
|||||||
### WHAT IS THE GOAL OF OSXCROSS? ###
|
### WHAT IS THE GOAL OF OSXCROSS? ###
|
||||||
|
|
||||||
The goal of OSXCross is to provide a well working OS X cross toolchain for
|
The goal of OSXCross is to provide a well working OS X cross toolchain for
|
||||||
Linux, \*BSD, and Cygwin.
|
Linux and FreeBSD.
|
||||||
|
|
||||||
### HOW DOES IT WORK? ###
|
### HOW DOES IT WORK? ###
|
||||||
|
|
||||||
@ -40,28 +40,23 @@ See [README.MACPORTS](README.MACPORTS.md) for more.
|
|||||||
|
|
||||||
### INSTALLATION: ###
|
### INSTALLATION: ###
|
||||||
|
|
||||||
*Windows/Cygwin users should follow [README.CYGWIN](README.CYGWIN.md).*
|
|
||||||
|
|
||||||
Move your
|
Move your
|
||||||
[packaged SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk)
|
[packaged SDK](https://github.com/tpoechtrager/osxcross#packaging-the-sdk)
|
||||||
to the tarballs/ directory.
|
to the tarballs/ directory.
|
||||||
|
|
||||||
Then ensure you have the following installed on your system:
|
Then ensure you have the following installed on your system:
|
||||||
|
|
||||||
`Clang 3.2+`, `patch`, `libxml2-devel` (<=10.6 only) and the `bash shell`.
|
`Clang 3.4+`, `cmake`, `git`, `patch`, `Python`, `libssl-devel` (openssl)
|
||||||
|
`lzma-devel`, `libxml2-devel`(<=10.6 only) and the `bash shell`.
|
||||||
|
|
||||||
You can run 'sudo tools/get\_dependencies.sh' to get these (and the
|
You can run 'sudo tools/get\_dependencies.sh' to get these (and the
|
||||||
optional packages) automatically.
|
optional packages) automatically. (outdated)
|
||||||
|
|
||||||
*Optional:*
|
*Optional:*
|
||||||
|
|
||||||
- `llvm-devel`: For Link Time Optimization support
|
- `llvm-devel`: For Link Time Optimization support
|
||||||
|
- `llvm-devel`: For ld64 `-bitcode_bundle` support
|
||||||
- `uuid-devel`: For ld64 `-random_uuid` support
|
- `uuid-devel`: For ld64 `-random_uuid` support
|
||||||
- `llvm-devel` + `xar-devel`: For ld64 `-bitcode_bundle` support
|
|
||||||
|
|
||||||
You can find xar [here](https://github.com/mackyle/xar).
|
|
||||||
Do not install libxar-dev on Ubuntu, it's a different package.
|
|
||||||
|
|
||||||
|
|
||||||
##### Building Clang #####
|
##### Building Clang #####
|
||||||
|
|
||||||
@ -159,35 +154,48 @@ use these variants unless you know what you're doing.
|
|||||||
|
|
||||||
##### Packaging the SDK on Mac OS X: #####
|
##### Packaging the SDK on Mac OS X: #####
|
||||||
|
|
||||||
1. [Download [Xcode](https://download.developer.apple.com/Developer_Tools/Xcode_7.3/Xcode_7.3.dmg) \*\*]
|
1. [Download [Xcode](https://developer.apple.com/download/more/) \*\*]
|
||||||
2. [Mount Xcode.dmg (Open With -> DiskImageMounter) \*\*\*]
|
2. [Mount Xcode.dmg (Open With -> DiskImageMounter) \*\*\*]
|
||||||
3. Run: `./tools/gen_sdk_package.sh` (from the OSXCross package)
|
3. Run: `./tools/gen_sdk_package.sh` (from the OSXCross package)
|
||||||
4. Copy the packaged SDK (\*.tar.\* or \*.pkg) on a USB Stick
|
4. Copy the packaged SDK (\*.tar.\* or \*.pkg) on a USB Stick
|
||||||
5. (On Linux/BSD) Copy or move the SDK into the tarballs/ directory of
|
5. (On Linux/BSD) Copy or move the SDK into the tarballs/ directory of
|
||||||
OSXCross.
|
OSXCross.
|
||||||
|
|
||||||
\*\* Xcode up to 7.3.x is known to work.
|
\*\*
|
||||||
|
Xcode up to 10.2.x is known to work.
|
||||||
|
Use Firefox if you have problems with signing in.
|
||||||
|
|
||||||
\*\*\* If you get a dialog with a crossed circle, ignore it. You don't need
|
\*\*\*
|
||||||
to install Xcode.
|
If you get a dialog with a crossed circle, ignore it.
|
||||||
|
You don't need to install Xcode.
|
||||||
|
|
||||||
Step 1. and 2. can be skipped if you have Xcode installed.
|
Step 1. and 2. can be skipped if you have Xcode installed.
|
||||||
|
|
||||||
##### Packing the SDK on Linux, Method 1 (works up to Xcode 7.3): #####
|
##### Packing the SDK on Linux, Method 1 (Xcode > 8.0): #####
|
||||||
|
|
||||||
|
This method may require up to 20 GB of free disk space.
|
||||||
|
An SSD is recommended for this method.
|
||||||
|
|
||||||
|
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
|
||||||
|
2. Install ...
|
||||||
|
3. Run `./tools/gen_sdk_package_pbzx.sh <xcode>.xip`
|
||||||
|
4. Copy or move the SDK into the tarballs/ directory
|
||||||
|
|
||||||
|
##### Packing the SDK on Linux, Method 2 (works up to Xcode 7.3): #####
|
||||||
|
|
||||||
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
|
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
|
||||||
2. Install `cmake`, `libxml2-dev` and `fuse`
|
2. Install `cmake`, `libxml2-dev` and `fuse`
|
||||||
3. Run `./tools/gen_sdk_package_darling_dmg.sh <xcode>.dmg`
|
3. Run `./tools/gen_sdk_package_darling_dmg.sh <xcode>.dmg`
|
||||||
4. Copy or move the SDK into the tarballs/ directory
|
4. Copy or move the SDK into the tarballs/ directory
|
||||||
|
|
||||||
##### Packing the SDK on Linux, Cygwin (and others), Method 2 (works up to Xcode 7.2): #####
|
##### Packing the SDK on Linux (and others), Method 3 (works up to Xcode 7.2): #####
|
||||||
|
|
||||||
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
|
1. Download Xcode like described in 'Packaging the SDK on Mac OS X'
|
||||||
2. Ensure you have `clang` and `make` installed
|
2. Ensure you have `clang` and `make` installed
|
||||||
3. Run `./tools/gen_sdk_package_p7zip.sh <xcode>.dmg`
|
3. Run `./tools/gen_sdk_package_p7zip.sh <xcode>.dmg`
|
||||||
4. Copy or move the SDK into the tarballs/ directory
|
4. Copy or move the SDK into the tarballs/ directory
|
||||||
|
|
||||||
##### Packing the SDK on Linux, Method 3 (works up to Xcode 4.2): #####
|
##### Packing the SDK on Linux, Method 4 (works up to Xcode 4.2): #####
|
||||||
|
|
||||||
1. Download Xcode 4.2 for Snow Leopard
|
1. Download Xcode 4.2 for Snow Leopard
|
||||||
2. Ensure you are downloading the "Snow Leopard" version
|
2. Ensure you are downloading the "Snow Leopard" version
|
||||||
@ -248,20 +256,23 @@ Usage Examples:
|
|||||||
* C++98: `o32-clang++ -stdlib=libc++ test.cpp -o test`
|
* C++98: `o32-clang++ -stdlib=libc++ test.cpp -o test`
|
||||||
* C++11: `o32-clang++ -stdlib=libc++ -std=c++11 test1.cpp -o test`
|
* C++11: `o32-clang++ -stdlib=libc++ -std=c++11 test1.cpp -o test`
|
||||||
* C++14: `o32-clang++ -stdlib=libc++ -std=c++14 test1.cpp -o test`
|
* C++14: `o32-clang++ -stdlib=libc++ -std=c++14 test1.cpp -o test`
|
||||||
* C++1z: `o32-clang++ -stdlib=libc++ -std=c++1z test1.cpp -o test`
|
* C++17: `o32-clang++ -stdlib=libc++ -std=c++17 test1.cpp -o test`
|
||||||
|
* C++2a: `o32-clang++ -stdlib=libc++ -std=c++2a test1.cpp -o test`
|
||||||
|
|
||||||
* Clang (shortcut):
|
* Clang (shortcut):
|
||||||
|
|
||||||
* C++98: `o32-clang++-libc++ test.cpp -o test`
|
* C++98: `o32-clang++-libc++ test.cpp -o test`
|
||||||
* C++11: `o32-clang++-libc++ -std=c++11 test.cpp -o test`
|
* C++11: `o32-clang++-libc++ -std=c++11 test.cpp -o test`
|
||||||
* C++14: `o32-clang++-libc++ -std=c++14 test.cpp -o test`
|
* C++14: `o32-clang++-libc++ -std=c++14 test.cpp -o test`
|
||||||
* C++1z: `o32-clang++-libc++ -std=c++1z test.cpp -o test`
|
* C++17: `o32-clang++-libc++ -std=c++17 test.cpp -o test`
|
||||||
|
* C++2a: `o32-clang++-libc++ -std=c++2a test.cpp -o test`
|
||||||
|
|
||||||
* GCC
|
* GCC
|
||||||
|
|
||||||
* C++11: `o32-g++-libc++ -std=c++11 test.cpp`
|
* C++11: `o32-g++-libc++ -std=c++11 test.cpp`
|
||||||
* C++14: `o32-g++-libc++ -std=c++14 test.cpp -o test`
|
* C++14: `o32-g++-libc++ -std=c++14 test.cpp -o test`
|
||||||
* C++1z: `o32-g++-libc++ -std=c++1z test.cpp -o test`
|
* C++17: `o32-g++-libc++ -std=c++17 test.cpp -o test`
|
||||||
|
* C++2a: `o32-g++-libc++ -std=c++2a test.cpp -o test`
|
||||||
|
|
||||||
##### Building test1.cpp and test2.cpp with LTO (Link Time Optimization): #####
|
##### Building test1.cpp and test2.cpp with LTO (Link Time Optimization): #####
|
||||||
|
|
||||||
@ -281,7 +292,9 @@ Usage Examples:
|
|||||||
|
|
||||||
### DEPLOYMENT TARGET: ###
|
### DEPLOYMENT TARGET: ###
|
||||||
|
|
||||||
The default deployment target is `Mac OS X 10.5`.
|
The default deployment target is:
|
||||||
|
SDK <= 10.13: `Mac OS X 10.5`
|
||||||
|
SDK >= 10.14: `Mac OS X 10.9`
|
||||||
|
|
||||||
However, there are several ways to override the default value:
|
However, there are several ways to override the default value:
|
||||||
|
|
||||||
|
321
build.sh
@ -5,62 +5,12 @@
|
|||||||
# This script requires the OS X SDK and the Clang/LLVM compiler.
|
# This script requires the OS X SDK and the Clang/LLVM compiler.
|
||||||
#
|
#
|
||||||
|
|
||||||
|
OSXCROSS_VERSION=1.0
|
||||||
|
|
||||||
pushd "${0%/*}" &>/dev/null
|
pushd "${0%/*}" &>/dev/null
|
||||||
|
|
||||||
source tools/tools.sh
|
source tools/tools.sh
|
||||||
|
|
||||||
# find sdk version to use
|
|
||||||
function guess_sdk_version()
|
|
||||||
{
|
|
||||||
tmp1=
|
|
||||||
tmp2=
|
|
||||||
tmp3=
|
|
||||||
file=
|
|
||||||
sdk=
|
|
||||||
guess_sdk_version_result=
|
|
||||||
sdkcount=$(find -L 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 -L tarballs/ -type f | 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 -L tarballs/ -type f | 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
|
|
||||||
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 [ -f "$file" ] && [ $(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
|
if [ $SDK_VERSION ]; then
|
||||||
echo 'SDK VERSION set in environment variable:' $SDK_VERSION
|
echo 'SDK VERSION set in environment variable:' $SDK_VERSION
|
||||||
test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u
|
test $SDK_VERSION = 10.4 && SDK_VERSION=10.4u
|
||||||
@ -70,34 +20,28 @@ else
|
|||||||
fi
|
fi
|
||||||
verify_sdk_version $SDK_VERSION
|
verify_sdk_version $SDK_VERSION
|
||||||
|
|
||||||
|
case $SDK_VERSION in
|
||||||
|
10.4*) TARGET=darwin8; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.4; ;;
|
||||||
|
10.5*) TARGET=darwin9; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.6*) TARGET=darwin10; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.7*) TARGET=darwin11; X86_64H_SUPPORTED=0; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.8*) TARGET=darwin12; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.9*) TARGET=darwin13; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.10*) TARGET=darwin14; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=0; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.11*) TARGET=darwin15; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.12*) TARGET=darwin16; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.13*) TARGET=darwin17; X86_64H_SUPPORTED=1; I386_SUPPORTED=1; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.5; ;;
|
||||||
|
10.14*) TARGET=darwin18; X86_64H_SUPPORTED=1; I386_SUPPORTED=0; NEED_TAPI_SUPPORT=1; OSX_VERSION_MIN_INT=10.9; ;;
|
||||||
|
*) echo "Unsupported SDK"; exit 1 ;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Minimum targeted OS X version
|
# Minimum targeted OS X version
|
||||||
# Must be <= SDK_VERSION
|
# Must be <= SDK_VERSION
|
||||||
if [ -z "$OSX_VERSION_MIN" ]; then
|
if [ -n "$OSX_VERSION_MIN_INT" -a -z "$OSX_VERSION_MIN" ]; then
|
||||||
if [ $SDK_VERSION = 10.4u ]; then
|
OSX_VERSION_MIN=$OSX_VERSION_MIN_INT
|
||||||
OSX_VERSION_MIN=10.4
|
|
||||||
else
|
|
||||||
OSX_VERSION_MIN=10.5
|
|
||||||
fi
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
OSXCROSS_VERSION=0.15
|
|
||||||
|
|
||||||
X86_64H_SUPPORTED=0
|
|
||||||
|
|
||||||
case $SDK_VERSION in
|
|
||||||
10.4*) TARGET=darwin8 ;;
|
|
||||||
10.5*) TARGET=darwin9 ;;
|
|
||||||
10.6*) TARGET=darwin10 ;;
|
|
||||||
10.7*) TARGET=darwin11 ;;
|
|
||||||
10.8*) TARGET=darwin12; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.9*) TARGET=darwin13; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.10*) TARGET=darwin14; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.11*) TARGET=darwin15; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.12*) TARGET=darwin16; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.13*) TARGET=darwin17; X86_64H_SUPPORTED=1; ;;
|
|
||||||
10.14*) TARGET=darwin18; X86_64H_SUPPORTED=1; ;;
|
|
||||||
*) echo "Invalid SDK Version" && exit 1 ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
export TARGET
|
export TARGET
|
||||||
|
|
||||||
@ -122,45 +66,60 @@ mkdir -p $BUILD_DIR
|
|||||||
mkdir -p $TARGET_DIR
|
mkdir -p $TARGET_DIR
|
||||||
mkdir -p $SDK_DIR
|
mkdir -p $SDK_DIR
|
||||||
|
|
||||||
require $CC
|
source $BASE_DIR/tools/trap_exit.sh
|
||||||
require $CXX
|
|
||||||
|
|
||||||
require clang
|
|
||||||
require patch
|
|
||||||
require gunzip
|
|
||||||
|
|
||||||
pushd $BUILD_DIR &>/dev/null
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
function remove_locks()
|
|
||||||
{
|
|
||||||
rm -rf $BUILD_DIR/have_cctools*
|
|
||||||
}
|
|
||||||
|
|
||||||
source $BASE_DIR/tools/trap_exit.sh
|
|
||||||
|
|
||||||
# CCTOOLS
|
OLD_SDK_VERSION=$(cat .oc_sdk_version 2>/dev/null || echo "")
|
||||||
CCTOOLS_PATCH_REV=0
|
echo -n "$SDK_VERSION" > .oc_sdk_version
|
||||||
LINKER_VERSION=274.2
|
|
||||||
CCTOOLS="cctools-895-ld64-$LINKER_VERSION"
|
|
||||||
CCTOOLS_TARBALL=$(ls $TARBALL_DIR/$CCTOOLS*.tar.* | head -n1)
|
|
||||||
CCTOOLS_REVHASH=$(echo $(basename "$CCTOOLS_TARBALL") | tr '_' '\n' | \
|
|
||||||
tr '.' '\n' | tail -n3 | head -n1)
|
|
||||||
|
|
||||||
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}" ]; then
|
if [ "$SDK_VERSION" != "$OLD_SDK_VERSION" ]; then
|
||||||
|
# SDK Version has changed. -> Rebuild everything.
|
||||||
|
rm -f .*_build_complete
|
||||||
|
fi
|
||||||
|
|
||||||
rm -rf cctools*
|
# XAR
|
||||||
rm -rf xar*
|
|
||||||
|
|
||||||
extract $CCTOOLS_TARBALL 1
|
build_xar
|
||||||
|
|
||||||
pushd cctools*/cctools &>/dev/null
|
# XAR END
|
||||||
pushd .. &>/dev/null
|
|
||||||
./tools/fix_unistd_issue.sh 1>/dev/null
|
|
||||||
|
## Apple TAPI Library ##
|
||||||
|
|
||||||
|
if [ $NEED_TAPI_SUPPORT -eq 1 ]; then
|
||||||
|
get_sources https://github.com/tpoechtrager/apple-libtapi.git 1000.10.8
|
||||||
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
|
INSTALLPREFIX=$TARGET_DIR ./build.sh
|
||||||
|
./install.sh
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
patch -p0 < $PATCH_DIR/cctools-ld64-1.patch
|
build_success
|
||||||
patch -p0 < $PATCH_DIR/cctools-ld64-2.patch
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
## cctools and ld64 ##
|
||||||
|
|
||||||
|
echo "TODO: --with-xar=..."
|
||||||
|
|
||||||
|
get_sources https://github.com/tpoechtrager/cctools-port.git 921-ld64-409.12
|
||||||
|
|
||||||
|
LINKER_VERSION=$(cat \
|
||||||
|
$CURRENT_BUILD_PROJECT_NAME/cctools/ld64/src/3rd/helper.c | \
|
||||||
|
grep ldVersionString | head -n1 | awk '{print $6}' | tr ':' '\n' | \
|
||||||
|
tr '\\' '\n' | tr '-' '\n' | tr '\n' ' '| awk '{print $3}')
|
||||||
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME/cctools &>/dev/null
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET "
|
CONFFLAGS="--prefix=$TARGET_DIR --target=x86_64-apple-$TARGET "
|
||||||
|
if [ $NEED_TAPI_SUPPORT -eq 1 ]; then
|
||||||
|
CONFFLAGS+="--with-libtapi=$TARGET_DIR "
|
||||||
|
fi
|
||||||
[ -z "$USE_CLANG_AS" ] && CONFFLAGS+="--disable-clang-as "
|
[ -z "$USE_CLANG_AS" ] && CONFFLAGS+="--disable-clang-as "
|
||||||
[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+="--disable-lto-support "
|
[ -n "$DISABLE_LTO_SUPPORT" ] && CONFFLAGS+="--disable-lto-support "
|
||||||
# https://github.com/tpoechtrager/osxcross/issues/156
|
# https://github.com/tpoechtrager/osxcross/issues/156
|
||||||
@ -178,105 +137,38 @@ if [ $X86_64H_SUPPORTED -eq 1 ]; then
|
|||||||
create_symlink $CCTOOL $CCTOOL_X86_64H
|
create_symlink $CCTOOL $CCTOOL_X86_64H
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||||
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')
|
||||||
create_symlink $CCTOOL $CCTOOL_I386
|
create_symlink $CCTOOL $CCTOOL_I386
|
||||||
done
|
done
|
||||||
popd &>/dev/null
|
|
||||||
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
# CCTOOLS END
|
popd &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
# MacPorts symlinks
|
|
||||||
pushd $TARGET_DIR/bin &>/dev/null # The BSD ln command doesn't support '-r'
|
## MacPorts ##
|
||||||
|
|
||||||
|
pushd $TARGET_DIR/bin &>/dev/null
|
||||||
create_symlink $BASE_DIR/tools/osxcross-macports osxcross-macports
|
create_symlink $BASE_DIR/tools/osxcross-macports osxcross-macports
|
||||||
create_symlink $BASE_DIR/tools/osxcross-macports osxcross-mp
|
create_symlink $BASE_DIR/tools/osxcross-macports osxcross-mp
|
||||||
create_symlink $BASE_DIR/tools/osxcross-macports omp
|
create_symlink $BASE_DIR/tools/osxcross-macports omp
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
|
## Extract SDK and move it to $SDK_DIR ##
|
||||||
|
|
||||||
SDK=$(ls $TARBALL_DIR/MacOSX$SDK_VERSION*)
|
SDK=$(ls $TARBALL_DIR/MacOSX$SDK_VERSION*)
|
||||||
|
|
||||||
# XAR
|
|
||||||
if [[ $SDK == *.pkg ]]; then
|
|
||||||
|
|
||||||
set +e
|
|
||||||
which xar &>/dev/null
|
|
||||||
NEED_XAR=$?
|
|
||||||
set -e
|
|
||||||
|
|
||||||
if [ $NEED_XAR -ne 0 ]; then
|
|
||||||
|
|
||||||
extract $TARBALL_DIR/xar*.tar.gz 2
|
|
||||||
|
|
||||||
pushd xar* &>/dev/null
|
|
||||||
if [ $PLATFORM == "NetBSD" ]; then
|
|
||||||
patch -p0 -l < $PATCH_DIR/xar-netbsd.patch
|
|
||||||
fi
|
|
||||||
patch -p0 < $PATCH_DIR/xar-ext2.patch
|
|
||||||
# https://github.com/tpoechtrager/osxcross/issues/109
|
|
||||||
ac_cv_lib_crypto_OpenSSL_add_all_ciphers=yes \
|
|
||||||
CFLAGS+=" -w" \
|
|
||||||
./configure --prefix=$TARGET_DIR
|
|
||||||
$MAKE -j$JOBS
|
|
||||||
$MAKE install -j$JOBS
|
|
||||||
popd &>/dev/null
|
|
||||||
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
# XAR END
|
|
||||||
|
|
||||||
if [ ! -f "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}" ]; 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
|
|
||||||
}
|
|
||||||
|
|
||||||
check_cctools i386
|
|
||||||
check_cctools x86_64
|
|
||||||
|
|
||||||
touch "have_cctools_${CCTOOLS_REVHASH}_$TARGET_${CCTOOLS_PATCH_REV}"
|
|
||||||
|
|
||||||
echo ""
|
|
||||||
|
|
||||||
fi # HAVE_CCTOOLS
|
|
||||||
|
|
||||||
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 ""
|
|
||||||
if [ -z "$UNATTENDED" ]; then
|
|
||||||
read -p "Press enter to continue"
|
|
||||||
else
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
ls $TARBALL_DIR/MacOSX$SDK_VERSION* &>/dev/null
|
|
||||||
done
|
|
||||||
set -e
|
|
||||||
|
|
||||||
extract $SDK 1 1
|
extract $SDK 1 1
|
||||||
|
|
||||||
rm -rf $SDK_DIR/MacOSX$SDK_VERSION* 2>/dev/null
|
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
|
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
|
else
|
||||||
mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR
|
mv -f *OSX*$SDK_VERSION*sdk* $SDK_DIR
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
## Fix broken SDKs ##
|
||||||
|
|
||||||
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
|
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
|
||||||
set +e
|
set +e
|
||||||
create_symlink \
|
create_symlink \
|
||||||
@ -289,14 +181,12 @@ popd &>/dev/null
|
|||||||
|
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
OSXCROSS_CONF="$TARGET_DIR/bin/osxcross-conf"
|
## Wrapper ##
|
||||||
OSXCROSS_ENV="$TARGET_DIR/bin/osxcross-env"
|
|
||||||
|
|
||||||
rm -f $OSXCROSS_CONF $OSXCROSS_ENV
|
build_msg "wrapper"
|
||||||
|
|
||||||
echo "compiling wrapper ..."
|
|
||||||
|
|
||||||
export X86_64H_SUPPORTED
|
export X86_64H_SUPPORTED
|
||||||
|
export I386_SUPPORTED
|
||||||
|
|
||||||
export OSXCROSS_VERSION
|
export OSXCROSS_VERSION
|
||||||
export OSXCROSS_TARGET=$TARGET
|
export OSXCROSS_TARGET=$TARGET
|
||||||
@ -304,6 +194,10 @@ export OSXCROSS_OSX_VERSION_MIN=$OSX_VERSION_MIN
|
|||||||
export OSXCROSS_LINKER_VERSION=$LINKER_VERSION
|
export OSXCROSS_LINKER_VERSION=$LINKER_VERSION
|
||||||
export OSXCROSS_BUILD_DIR=$BUILD_DIR
|
export OSXCROSS_BUILD_DIR=$BUILD_DIR
|
||||||
|
|
||||||
|
OSXCROSS_CONF="$TARGET_DIR/bin/osxcross-conf"
|
||||||
|
OSXCROSS_ENV="$TARGET_DIR/bin/osxcross-env"
|
||||||
|
rm -f $OSXCROSS_CONF $OSXCROSS_ENV
|
||||||
|
|
||||||
if [ "$PLATFORM" != "Darwin" ]; then
|
if [ "$PLATFORM" != "Darwin" ]; then
|
||||||
# libLTO.so
|
# libLTO.so
|
||||||
set +e
|
set +e
|
||||||
@ -314,6 +208,7 @@ fi
|
|||||||
|
|
||||||
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
$BASE_DIR/wrapper/build.sh 1>/dev/null
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
if [ $(osxcross-cmp ${SDK_VERSION/u/} "<" $OSX_VERSION_MIN) -eq 1 ]; then
|
if [ $(osxcross-cmp ${SDK_VERSION/u/} "<" $OSX_VERSION_MIN) -eq 1 ]; then
|
||||||
@ -326,9 +221,7 @@ elif [ $(osxcross-cmp $OSX_VERSION_MIN "<" 10.4) -eq 1 ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# CMAKE
|
## CMake ##
|
||||||
|
|
||||||
echo "installing CMake"
|
|
||||||
|
|
||||||
cp -f "$BASE_DIR/tools/toolchain.cmake" "$TARGET_DIR/"
|
cp -f "$BASE_DIR/tools/toolchain.cmake" "$TARGET_DIR/"
|
||||||
cp -f "$BASE_DIR/tools/osxcross-cmake" "$TARGET_DIR/bin/"
|
cp -f "$BASE_DIR/tools/osxcross-cmake" "$TARGET_DIR/bin/"
|
||||||
@ -336,28 +229,46 @@ chmod 755 "$TARGET_DIR/bin/osxcross-cmake"
|
|||||||
create_symlink osxcross-cmake "$TARGET_DIR/bin/i386-apple-$TARGET-cmake"
|
create_symlink osxcross-cmake "$TARGET_DIR/bin/i386-apple-$TARGET-cmake"
|
||||||
create_symlink osxcross-cmake "$TARGET_DIR/bin/x86_64-apple-$TARGET-cmake"
|
create_symlink osxcross-cmake "$TARGET_DIR/bin/x86_64-apple-$TARGET-cmake"
|
||||||
|
|
||||||
# CMAKE END
|
## Compiler test ##
|
||||||
|
|
||||||
unset MACOSX_DEPLOYMENT_TARGET
|
unset MACOSX_DEPLOYMENT_TARGET
|
||||||
|
|
||||||
test_compiler o32-clang $BASE_DIR/oclang/test.c
|
|
||||||
test_compiler o64-clang $BASE_DIR/oclang/test.c
|
|
||||||
|
|
||||||
test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
|
|
||||||
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
|
|
||||||
|
|
||||||
if [ $(osxcross-cmp ${SDK_VERSION/u/} ">=" 10.7) -eq 1 ]; then
|
if [ $(osxcross-cmp ${SDK_VERSION/u/} ">=" 10.7) -eq 1 ]; then
|
||||||
if [ ! -d "$SDK_DIR/MacOSX$SDK_VERSION.sdk/usr/include/c++/v1" ]; then
|
pushd $SDK_DIR/MacOSX$SDK_VERSION.sdk &>/dev/null
|
||||||
|
if [ ! -f "usr/include/c++/v1/vector" ]; then
|
||||||
echo ""
|
echo ""
|
||||||
echo -n "Given SDK does not contain libc++ headers "
|
echo -n "Given SDK does not contain libc++ headers "
|
||||||
echo "(-stdlib=libc++ test may fail)"
|
echo "(-stdlib=libc++ test may fail)"
|
||||||
echo -n "You may want to re-package your SDK using "
|
echo -n "You may want to re-package your SDK using "
|
||||||
echo "'tools/gen_sdk_package.sh' on OS X"
|
echo "'tools/gen_sdk_package.sh' on OS X"
|
||||||
fi
|
fi
|
||||||
echo ""
|
if [ -f "usr/include/c++/v1/__hash_table" ]; then
|
||||||
test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
if [ $(osxcross-cmp $SDK_VERSION ">=" 10.7) -eq 1 ]; then
|
||||||
test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
if [ $(osxcross-cmp $SDK_VERSION "<=" 10.12) -eq 1 ]; then
|
||||||
|
# https://github.com/tpoechtrager/osxcross/issues/171
|
||||||
|
set +e
|
||||||
|
patch -N -p1 -r /dev/null < $PATCH_DIR/libcxx__hash_table.patch
|
||||||
|
set -e
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
popd &>/dev/null
|
||||||
|
echo ""
|
||||||
|
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||||
|
test_compiler_cxx11 o32-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||||
|
fi
|
||||||
|
test_compiler_cxx11 o64-clang++ $BASE_DIR/oclang/test_libcxx.cpp
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||||
|
test_compiler o32-clang $BASE_DIR/oclang/test.c
|
||||||
|
test_compiler o32-clang++ $BASE_DIR/oclang/test.cpp
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_compiler o64-clang $BASE_DIR/oclang/test.c
|
||||||
|
test_compiler o64-clang++ $BASE_DIR/oclang/test.cpp
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo "Do not forget to add"
|
echo "Do not forget to add"
|
||||||
@ -376,3 +287,15 @@ echo "Example 2: CC=i386-apple-$TARGET-clang ./configure --host=i386-apple-$TARG
|
|||||||
echo "Example 3: o64-clang -Wall test.c -o test"
|
echo "Example 3: o64-clang -Wall test.c -o test"
|
||||||
echo "Example 4: x86_64-apple-$TARGET-strip -x test"
|
echo "Example 4: x86_64-apple-$TARGET-strip -x test"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
if [ $I386_SUPPORTED -eq 0 ]; then
|
||||||
|
echo "Your SDK does not support i386 anymore."
|
||||||
|
echo "Use <= 10.13 SDK if you rely on i386 support."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $(osxcross-cmp ${SDK_VERSION/u/} ">=" 10.14) -eq 1 ]; then
|
||||||
|
echo "Your SDK does not support libstdc++ anymore."
|
||||||
|
echo "Use <= 10.13 SDK if you rely on libstdc++ support."
|
||||||
|
echo ""
|
||||||
|
fi
|
||||||
|
@ -16,8 +16,6 @@ if [ $PLATFORM == "Darwin" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
require git
|
|
||||||
|
|
||||||
CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \
|
CLANG_VERSION=$(echo "__clang_major__ __clang_minor__ __clang_patchlevel__" | \
|
||||||
xcrun clang -xc -E - | tail -n1 | tr ' ' '.')
|
xcrun clang -xc -E - | tail -n1 | tr ' ' '.')
|
||||||
|
|
||||||
@ -31,12 +29,6 @@ CLANG_LIB_DIR=$(clang -print-search-dirs | grep "libraries: =" | \
|
|||||||
tr '=' ' ' | tr ':' ' ' | awk '{print $2}')
|
tr '=' ' ' | tr ':' ' ' | awk '{print $2}')
|
||||||
|
|
||||||
VERSION=$(echo "${CLANG_LIB_DIR}" | tr '/' '\n' | tail -n1)
|
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_INCLUDE_DIR="${CLANG_LIB_DIR}/include"
|
||||||
CLANG_DARWIN_LIB_DIR="${CLANG_LIB_DIR}/lib/darwin"
|
CLANG_DARWIN_LIB_DIR="${CLANG_LIB_DIR}/lib/darwin"
|
||||||
|
|
||||||
@ -54,9 +46,9 @@ case $CLANG_VERSION in
|
|||||||
4.0*) BRANCH=release_40; USE_CMAKE=1; ;;
|
4.0*) BRANCH=release_40; USE_CMAKE=1; ;;
|
||||||
5.0*) BRANCH=release_50; USE_CMAKE=1; ;;
|
5.0*) BRANCH=release_50; USE_CMAKE=1; ;;
|
||||||
6.0*) BRANCH=release_60; USE_CMAKE=1; ;;
|
6.0*) BRANCH=release_60; USE_CMAKE=1; ;;
|
||||||
7.0*) BRANCH=release_70; USE_CMAKE=1; ;;
|
7.* ) BRANCH=release_70; USE_CMAKE=1; ;;
|
||||||
8.0*) BRANCH=release_80; USE_CMAKE=1; ;;
|
8.* ) BRANCH=release_80; USE_CMAKE=1; ;;
|
||||||
9.0*) BRANCH=master; USE_CMAKE=1; ;;
|
9.* ) BRANCH=master; USE_CMAKE=1; ;;
|
||||||
* ) echo "Unsupported Clang version, must be >= 3.2 and <= 9.0" 1>&2; exit 1;
|
* ) echo "Unsupported Clang version, must be >= 3.2 and <= 9.0" 1>&2; exit 1;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
@ -75,19 +67,17 @@ fi
|
|||||||
|
|
||||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
if [ ! -e compiler-rt/.clone_complete ]; then
|
FULL_CLONE=1 \
|
||||||
rm -rf compiler-rt
|
get_sources https://git.llvm.org/git/compiler-rt.git $BRANCH
|
||||||
git clone http://llvm.org/git/compiler-rt.git
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
|
|
||||||
|
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.11) -eq 1 ]; then
|
||||||
|
# https://github.com/tpoechtrager/osxcross/issues/178
|
||||||
|
patch -p1 < $PATCH_DIR/compiler-rt_clock-gettime.patch
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd compiler-rt &>/dev/null
|
|
||||||
|
|
||||||
git reset --hard
|
|
||||||
git clean -fdx
|
|
||||||
git checkout $BRANCH
|
|
||||||
touch .clone_complete
|
|
||||||
git pull
|
|
||||||
|
|
||||||
EXTRA_MAKE_FLAGS=""
|
EXTRA_MAKE_FLAGS=""
|
||||||
if [ -n "$OCDEBUG" ]; then
|
if [ -n "$OCDEBUG" ]; then
|
||||||
EXTRA_MAKE_FLAGS+="VERBOSE=1 "
|
EXTRA_MAKE_FLAGS+="VERBOSE=1 "
|
||||||
@ -95,19 +85,16 @@ fi
|
|||||||
|
|
||||||
export OSXCROSS_NO_X86_64H_DEPLOYMENT_TARGET_WARNING=1
|
export OSXCROSS_NO_X86_64H_DEPLOYMENT_TARGET_WARNING=1
|
||||||
|
|
||||||
|
|
||||||
if [ $USE_CMAKE -eq 1 ]; then
|
if [ $USE_CMAKE -eq 1 ]; then
|
||||||
|
|
||||||
### CMAKE ###
|
### CMAKE ###
|
||||||
|
|
||||||
require cmake
|
|
||||||
|
|
||||||
$SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path/'\
|
$SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name}.internal Path/'\
|
||||||
\ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name}.internal --show-sdk-path/g' \
|
\ \ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name}.internal --show-sdk-path/g' \
|
||||||
cmake/Modules/CompilerRTDarwinUtils.cmake
|
cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||||
|
|
||||||
$SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name} Path/'\
|
$SED -i 's/COMMAND xcodebuild -version -sdk ${sdk_name} Path/'\
|
||||||
\ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name} --show-sdk-path/g' \
|
\ \ \ \ \ \ \ 'COMMAND xcrun -sdk ${sdk_name} --show-sdk-path/g' \
|
||||||
cmake/Modules/CompilerRTDarwinUtils.cmake
|
cmake/Modules/CompilerRTDarwinUtils.cmake
|
||||||
|
|
||||||
$SED -i "s/COMMAND lipo /COMMAND xcrun lipo /g" \
|
$SED -i "s/COMMAND lipo /COMMAND xcrun lipo /g" \
|
||||||
@ -122,10 +109,9 @@ if [ $USE_CMAKE -eq 1 ]; then
|
|||||||
mkdir build
|
mkdir build
|
||||||
pushd build &>/dev/null
|
pushd build &>/dev/null
|
||||||
|
|
||||||
CC=$(xcrun -f clang) CXX=$(xcrun -f clang++) cmake .. \
|
CC=$(xcrun -f clang) CXX=$(xcrun -f clang++) $CMAKE .. \
|
||||||
-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin \
|
-DCMAKE_BUILD_TYPE=Release -DCMAKE_SYSTEM_NAME=Darwin \
|
||||||
-DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) -DCMAKE_AR=$(xcrun -f ar) \
|
-DCMAKE_OSX_SYSROOT=$(xcrun --show-sdk-path) -DCMAKE_AR=$(xcrun -f ar)
|
||||||
-DCOMPILER_RT_BUILD_XRAY=OFF
|
|
||||||
|
|
||||||
$MAKE -j $JOBS $EXTRA_MAKE_FLAGS
|
$MAKE -j $JOBS $EXTRA_MAKE_FLAGS
|
||||||
|
|
||||||
@ -163,6 +149,13 @@ else
|
|||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
build_success
|
||||||
|
fi
|
||||||
|
|
||||||
|
# We must re-build every time. git clean -fdx
|
||||||
|
# removes the libraries.
|
||||||
|
rm -f $BUILD_DIR/.compiler-rt_build_complete
|
||||||
|
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
@ -172,16 +165,14 @@ echo ""
|
|||||||
|
|
||||||
echo "mkdir -p ${CLANG_INCLUDE_DIR}"
|
echo "mkdir -p ${CLANG_INCLUDE_DIR}"
|
||||||
echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}"
|
echo "mkdir -p ${CLANG_DARWIN_LIB_DIR}"
|
||||||
echo "cp -rv $PWD/include/sanitizer ${CLANG_INCLUDE_DIR}"
|
echo "cp -rv $BUILD_DIR/compiler-rt/include/sanitizer ${CLANG_INCLUDE_DIR}"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if [ $USE_CMAKE -eq 1 ]; then
|
if [ $USE_CMAKE -eq 1 ]; then
|
||||||
|
|
||||||
### CMAKE ###
|
### CMAKE ###
|
||||||
|
|
||||||
echo "cp -v $PWD/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}"
|
echo "cp -v $BUILD_DIR/compiler-rt/build/lib/darwin/*.a ${CLANG_DARWIN_LIB_DIR}"
|
||||||
echo "cp -v $PWD/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}"
|
echo "cp -v $BUILD_DIR/compiler-rt/build/lib/darwin/*.dylib ${CLANG_DARWIN_LIB_DIR}"
|
||||||
|
|
||||||
### CMAKE END ###
|
### CMAKE END ###
|
||||||
|
|
||||||
|
43
build_gcc.sh
@ -20,7 +20,7 @@ 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++)
|
||||||
if [ -z "$GCC_VERSION" ]; then
|
if [ -z "$GCC_VERSION" ]; then
|
||||||
GCC_VERSION=8.2.0
|
GCC_VERSION=9.1.0
|
||||||
#GCC_VERSION=5-20140928 # snapshot
|
#GCC_VERSION=5-20140928 # snapshot
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -42,16 +42,16 @@ if [ ! -f "have_gcc_${GCC_VERSION}_${OSXCROSS_TARGET}" ]; then
|
|||||||
|
|
||||||
pushd $OSXCROSS_TARBALL_DIR &>/dev/null
|
pushd $OSXCROSS_TARBALL_DIR &>/dev/null
|
||||||
if [[ $GCC_VERSION != *-* ]]; then
|
if [[ $GCC_VERSION != *-* ]]; then
|
||||||
wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz"
|
wget -c "$GCC_MIRROR/releases/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||||
else
|
else
|
||||||
wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.gz"
|
wget -c "$GCC_MIRROR/snapshots/$GCC_VERSION/gcc-$GCC_VERSION.tar.xz"
|
||||||
fi
|
fi
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
echo "cleaning up ..."
|
echo "cleaning up ..."
|
||||||
rm -rf gcc* 2>/dev/null
|
rm -rf gcc* 2>/dev/null
|
||||||
|
|
||||||
extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.gz" 1
|
extract "$OSXCROSS_TARBALL_DIR/gcc-$GCC_VERSION.tar.xz" 1
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
pushd gcc*$GCC_VERSION* &>/dev/null
|
pushd gcc*$GCC_VERSION* &>/dev/null
|
||||||
@ -102,14 +102,18 @@ if [ -n "$ENABLE_FORTRAN" ]; then
|
|||||||
LANGS+=",fortran"
|
LANGS+=",fortran"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||||
|
EXTRACONFFLAGS+="--with-multilib-list=m32,m64 --enable-multilib "
|
||||||
|
else
|
||||||
|
EXTRACONFFLAGS+="--disable-multilib "
|
||||||
|
fi
|
||||||
|
|
||||||
../configure \
|
../configure \
|
||||||
--target=x86_64-apple-$OSXCROSS_TARGET \
|
--target=x86_64-apple-$OSXCROSS_TARGET \
|
||||||
--with-sysroot=$OSXCROSS_SDK \
|
--with-sysroot=$OSXCROSS_SDK \
|
||||||
--disable-nls \
|
--disable-nls \
|
||||||
--enable-languages=$LANGS \
|
--enable-languages=$LANGS \
|
||||||
--without-headers \
|
--without-headers \
|
||||||
--enable-multilib \
|
|
||||||
--with-multilib-list=m32,m64 \
|
|
||||||
--enable-lto \
|
--enable-lto \
|
||||||
--enable-checking=release \
|
--enable-checking=release \
|
||||||
--disable-libstdcxx-pch \
|
--disable-libstdcxx-pch \
|
||||||
@ -146,18 +150,21 @@ source tools/tools.sh
|
|||||||
|
|
||||||
pushd $OSXCROSS_TARGET_DIR/bin &>/dev/null
|
pushd $OSXCROSS_TARGET_DIR/bin &>/dev/null
|
||||||
|
|
||||||
if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX ]; then
|
|
||||||
mv x86_64-apple-$OSXCROSS_TARGET-gcc$EXESUFFIX \
|
|
||||||
x86_64-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX
|
|
||||||
|
|
||||||
mv x86_64-apple-$OSXCROSS_TARGET-g++$EXESUFFIX \
|
if [ ! -f i386-apple-$OSXCROSS_TARGET-base-gcc ]; then
|
||||||
x86_64-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX
|
mv x86_64-apple-$OSXCROSS_TARGET-gcc \
|
||||||
|
x86_64-apple-$OSXCROSS_TARGET-base-gcc
|
||||||
|
|
||||||
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX \
|
mv x86_64-apple-$OSXCROSS_TARGET-g++ \
|
||||||
i386-apple-$OSXCROSS_TARGET-base-gcc$EXESUFFIX
|
x86_64-apple-$OSXCROSS_TARGET-base-g++
|
||||||
|
|
||||||
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX \
|
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||||
i386-apple-$OSXCROSS_TARGET-base-g++$EXESUFFIX
|
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-gcc \
|
||||||
|
i386-apple-$OSXCROSS_TARGET-base-gcc
|
||||||
|
|
||||||
|
create_symlink x86_64-apple-$OSXCROSS_TARGET-base-g++ \
|
||||||
|
i386-apple-$OSXCROSS_TARGET-base-g++
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "compiling wrapper ..."
|
echo "compiling wrapper ..."
|
||||||
@ -175,10 +182,12 @@ popd &>/dev/null # wrapper dir
|
|||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
|
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION "<=" 10.13) -eq 1 ]; then
|
||||||
test_compiler o32-gcc $BASE_DIR/oclang/test.c
|
test_compiler o32-gcc $BASE_DIR/oclang/test.c
|
||||||
test_compiler o64-gcc $BASE_DIR/oclang/test.c
|
|
||||||
|
|
||||||
test_compiler o32-g++ $BASE_DIR/oclang/test.cpp
|
test_compiler o32-g++ $BASE_DIR/oclang/test.cpp
|
||||||
|
fi
|
||||||
|
|
||||||
|
test_compiler o64-gcc $BASE_DIR/oclang/test.c
|
||||||
test_compiler o64-g++ $BASE_DIR/oclang/test.cpp
|
test_compiler o64-g++ $BASE_DIR/oclang/test.cpp
|
||||||
|
|
||||||
echo ""
|
echo ""
|
||||||
|
@ -16,27 +16,22 @@ require cmake
|
|||||||
|
|
||||||
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
pushd $OSXCROSS_BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
if [ ! -e llvm-dsymutil/.clone_complete ]; then
|
get_sources https://github.com/tpoechtrager/llvm-dsymutil.git master
|
||||||
rm -rf llvm-dsymutil
|
|
||||||
# Vanilla llvm-dsymutil with a few patches on top for OSXCross
|
|
||||||
git clone https://github.com/tpoechtrager/llvm-dsymutil.git --depth 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
pushd llvm-dsymutil &>/dev/null
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
git clean -fdx
|
|
||||||
touch .clone_complete
|
|
||||||
git pull
|
|
||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
pushd build &>/dev/null
|
pushd build &>/dev/null
|
||||||
|
|
||||||
cmake .. \
|
$CMAKE .. \
|
||||||
-DCMAKE_BUILD_TYPE=Release \
|
-DCMAKE_BUILD_TYPE=Release \
|
||||||
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
|
-DLLVM_TARGETS_TO_BUILD="X86;ARM;AArch64" \
|
||||||
-DLLVM_ENABLE_ASSERTIONS=Off
|
-DLLVM_ENABLE_ASSERTIONS=Off
|
||||||
|
|
||||||
$MAKE -f tools/dsymutil/Makefile -j$JOBS
|
$MAKE -f tools/dsymutil/Makefile -j$JOBS
|
||||||
cp bin/llvm-dsymutil $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil
|
cp bin/llvm-dsymutil $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil
|
||||||
|
|
||||||
echo "installed llvm-dsymutil to $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil"
|
echo "installed llvm-dsymutil to $OSXCROSS_TARGET_DIR/bin/osxcross-llvm-dsymutil"
|
||||||
|
|
||||||
|
build_success
|
||||||
|
fi
|
||||||
|
Before Width: | Height: | Size: 4.5 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 8.7 KiB |
Before Width: | Height: | Size: 7.5 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 12 KiB |
Before Width: | Height: | Size: 11 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 4.1 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 7.2 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 7.6 KiB |
@ -2,6 +2,7 @@
|
|||||||
#include <thread>
|
#include <thread>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
--- ld64/src/3rd/helper_backup.h 2013-02-24 11:26:01.159718369 -0800
|
|
||||||
+++ ld64/src/3rd/helper.h 2013-02-24 11:27:22.107716807 -0800
|
|
||||||
@@ -1,6 +1,10 @@
|
|
||||||
#ifndef _HELPER_H
|
|
||||||
#define _HELPER_H
|
|
||||||
|
|
||||||
+#ifdef __cplusplus
|
|
||||||
+extern "C" {
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#include <mach/mach_time.h>
|
|
||||||
#include <mach/mach_host.h>
|
|
||||||
#include <mach/host_info.h>
|
|
||||||
@@ -30,4 +34,8 @@
|
|
||||||
|
|
||||||
uint64_t mach_absolute_time(void);
|
|
||||||
|
|
||||||
+#ifdef __cplusplus
|
|
||||||
+}
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
#endif
|
|
@ -1,11 +0,0 @@
|
|||||||
--- ld64/src/ld/Snapshot.cpp 2013-10-02 20:08:31.672088145 +0200
|
|
||||||
+++ ld64/src/ld/Snapshot.cpp 2013-10-02 20:08:42.330088934 +0200
|
|
||||||
@@ -15,7 +15,7 @@
|
|
||||||
#include <sys/stat.h>
|
|
||||||
#include <libgen.h>
|
|
||||||
#include <time.h>
|
|
||||||
-#include <Block.h>
|
|
||||||
+#include <BlocksRuntime/Block.h>
|
|
||||||
|
|
||||||
#include "Snapshot.h"
|
|
||||||
#include "Options.h"
|
|
30
patches/compiler-rt_clock-gettime.patch
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
diff -crB --new-file /home/thomas/tmp/compiler-rt/include/time.h compiler-rt/include/time.h
|
||||||
|
*** /home/thomas/tmp/compiler-rt/include/time.h 1970-01-01 01:00:00.000000000 +0100
|
||||||
|
--- compiler-rt/include/time.h 2019-06-01 15:42:13.006343150 +0200
|
||||||
|
***************
|
||||||
|
*** 0 ****
|
||||||
|
--- 1,24 ----
|
||||||
|
+ #ifndef __TIME_H_INCLUDE_HACK__
|
||||||
|
+ #define __TIME_H_INCLUDE_HACK__
|
||||||
|
+ #ifdef __MACH__
|
||||||
|
+ /* https://stackoverflow.com/a/17112198/1392778 */
|
||||||
|
+ #include_next <time.h>
|
||||||
|
+ #include <mach/mach_time.h>
|
||||||
|
+ #define CLOCK_REALTIME 0
|
||||||
|
+ #define CLOCK_MONOTONIC 0
|
||||||
|
+ typedef int clockid_t;
|
||||||
|
+ static int clock_gettime(clockid_t clk_id, struct timespec *t){
|
||||||
|
+ mach_timebase_info_data_t timebase;
|
||||||
|
+ mach_timebase_info(&timebase);
|
||||||
|
+ uint64_t time;
|
||||||
|
+ time = mach_absolute_time();
|
||||||
|
+ double nseconds = ((double)time * (double)timebase.numer)/((double)timebase.denom);
|
||||||
|
+ double seconds = ((double)time * (double)timebase.numer)/((double)timebase.denom * 1e9);
|
||||||
|
+ t->tv_sec = seconds;
|
||||||
|
+ t->tv_nsec = nseconds;
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ #else
|
||||||
|
+ #include_next <time.h>
|
||||||
|
+ #endif
|
||||||
|
+ #endif
|
19
patches/libcxx__hash_table.patch
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
--- a/usr/include/c++/v1/__hash_table 2019-01-10 10:05:42.219730024 +0000
|
||||||
|
+++ b/usr/include/c++/v1/__hash_table 2019-01-10 10:09:08.881538038 +0000
|
||||||
|
@@ -1164,6 +1164,7 @@
|
||||||
|
_NOEXCEPT_(
|
||||||
|
is_nothrow_default_constructible<__bucket_list>::value &&
|
||||||
|
is_nothrow_default_constructible<__first_node>::value &&
|
||||||
|
+ is_nothrow_default_constructible<__node_allocator>::value &&
|
||||||
|
is_nothrow_default_constructible<hasher>::value &&
|
||||||
|
is_nothrow_default_constructible<key_equal>::value)
|
||||||
|
: __p2_(0),
|
||||||
|
@@ -1232,6 +1233,7 @@
|
||||||
|
_NOEXCEPT_(
|
||||||
|
is_nothrow_move_constructible<__bucket_list>::value &&
|
||||||
|
is_nothrow_move_constructible<__first_node>::value &&
|
||||||
|
+ is_nothrow_move_constructible<__node_allocator>::value &&
|
||||||
|
is_nothrow_move_constructible<hasher>::value &&
|
||||||
|
is_nothrow_move_constructible<key_equal>::value)
|
||||||
|
: __bucket_list_(_VSTD::move(__u.__bucket_list_)),
|
||||||
|
|
@ -1,24 +0,0 @@
|
|||||||
--- lib/ext2.c.orig
|
|
||||||
+++ lib/ext2.c
|
|
||||||
@@ -139,8 +139,10 @@
|
|
||||||
if(! (flags & ~EXT2_NOCOMPR_FL) )
|
|
||||||
x_addprop(f, "NoCompBlock");
|
|
||||||
#endif
|
|
||||||
+#ifdef EXT2_ECOMPR_FL
|
|
||||||
if(! (flags & ~EXT2_ECOMPR_FL) )
|
|
||||||
x_addprop(f, "CompError");
|
|
||||||
+#endif
|
|
||||||
if(! (flags & ~EXT2_BTREE_FL) )
|
|
||||||
x_addprop(f, "BTree");
|
|
||||||
if(! (flags & ~EXT2_INDEX_FL) )
|
|
||||||
@@ -225,8 +227,10 @@
|
|
||||||
if( e2prop_get(f, "NoCompBlock", (char **)&tmp) == 0 )
|
|
||||||
flags |= EXT2_NOCOMPR_FL ;
|
|
||||||
#endif
|
|
||||||
+#ifdef EXT2_ECOMPR_FL
|
|
||||||
if( e2prop_get(f, "CompError", (char **)&tmp) == 0 )
|
|
||||||
flags |= EXT2_ECOMPR_FL ;
|
|
||||||
+#endif
|
|
||||||
if( e2prop_get(f, "BTree", (char **)&tmp) == 0 )
|
|
||||||
flags |= EXT2_BTREE_FL ;
|
|
||||||
if( e2prop_get(f, "HashIndexed", (char **)&tmp) == 0 )
|
|
@ -1,92 +0,0 @@
|
|||||||
--- lib/linuxattr.c
|
|
||||||
+++ lib/linuxattr.c
|
|
||||||
@@ -52,9 +52,7 @@
|
|
||||||
#include <sys/param.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#ifdef HAVE_SYS_STATFS_H /* Nonexistant future OS needs this */
|
|
||||||
-#include <sys/statfs.h>
|
|
||||||
-#endif
|
|
||||||
+#include <sys/statvfs.h>
|
|
||||||
|
|
||||||
#ifdef HAVE_SYS_MOUNT_H
|
|
||||||
#include <sys/mount.h>
|
|
||||||
@@ -138,7 +136,7 @@
|
|
||||||
#if defined(HAVE_SYS_XATTR_H) && defined(HAVE_LGETXATTR) && !defined(__APPLE__)
|
|
||||||
char *i, *buf = NULL;
|
|
||||||
int ret, retval=0, bufsz = 1024;
|
|
||||||
- struct statfs sfs;
|
|
||||||
+ struct statvfs sfs;
|
|
||||||
char *fsname = NULL;
|
|
||||||
struct _linuxattr_context context;
|
|
||||||
|
|
||||||
@@ -165,8 +163,9 @@
|
|
||||||
if( ret == 0 ) goto BAIL;
|
|
||||||
|
|
||||||
memset(&sfs, 0, sizeof(sfs));
|
|
||||||
- statfs(file, &sfs);
|
|
||||||
+ statvfs(file, &sfs);
|
|
||||||
|
|
||||||
+#if 0
|
|
||||||
switch(sfs.f_type) {
|
|
||||||
case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */
|
|
||||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
|
||||||
@@ -174,6 +173,15 @@
|
|
||||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
|
||||||
default: retval=0; goto BAIL;
|
|
||||||
};
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ fsname = sfs.f_fstypename;
|
|
||||||
+
|
|
||||||
+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") &&
|
|
||||||
+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) {
|
|
||||||
+ retval=0;
|
|
||||||
+ goto BAIL;
|
|
||||||
+ }
|
|
||||||
|
|
||||||
for( i=buf; (i-buf) < ret; i += strlen(i)+1 ) {
|
|
||||||
xar_ea_t e;
|
|
||||||
@@ -202,7 +210,7 @@
|
|
||||||
{
|
|
||||||
#if defined HAVE_SYS_XATTR_H && defined(HAVE_LSETXATTR) && !defined(__APPLE__)
|
|
||||||
const char *fsname = "bogus";
|
|
||||||
- struct statfs sfs;
|
|
||||||
+ struct statvfs sfs;
|
|
||||||
int eaopt = 0;
|
|
||||||
struct _linuxattr_context context;
|
|
||||||
xar_prop_t p;
|
|
||||||
@@ -217,19 +225,31 @@
|
|
||||||
/* Check for EA extraction behavior */
|
|
||||||
|
|
||||||
memset(&sfs, 0, sizeof(sfs));
|
|
||||||
- if( statfs(file, &sfs) != 0 ) {
|
|
||||||
+ if( statvfs(file, &sfs) != 0 ) {
|
|
||||||
char *tmp, *bname;
|
|
||||||
tmp = strdup(file);
|
|
||||||
bname = dirname(tmp);
|
|
||||||
- statfs(bname, &sfs);
|
|
||||||
+ statvfs(bname, &sfs);
|
|
||||||
free(tmp);
|
|
||||||
}
|
|
||||||
+#if 0
|
|
||||||
switch(sfs.f_type) {
|
|
||||||
case EXT3_SUPER_MAGIC: fsname = "ext3"; break; /* assume ext3 */
|
|
||||||
case JFS_SUPER_MAGIC: fsname = "jfs" ; break;
|
|
||||||
case REISERFS_SUPER_MAGIC:fsname = "reiser" ; break;
|
|
||||||
case XFS_SUPER_MAGIC: fsname = "xfs" ; break;
|
|
||||||
};
|
|
||||||
+#endif
|
|
||||||
+
|
|
||||||
+ {
|
|
||||||
+ const char *pp = fsname;
|
|
||||||
+ fsname = sfs.f_fstypename;
|
|
||||||
+
|
|
||||||
+ if(strcmp(fsname, "ext3") && strcmp(fsname, "jfs") &&
|
|
||||||
+ strcmp(fsname, "reiser") && strcmp(fsname, "xfs")) {
|
|
||||||
+ fsname = pp;
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
|
|
||||||
for(p = xar_prop_pfirst(f); p; p = xar_prop_pnext(p)) {
|
|
||||||
const char *fs = NULL;
|
|
0
tarballs/.keepme
Normal file
@ -1,64 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
#
|
|
||||||
# Build and install the LTO library, which the Cygwin package of
|
|
||||||
# libLLVM is lacking.
|
|
||||||
#
|
|
||||||
|
|
||||||
pushd "${0%/*}/.." &>/dev/null
|
|
||||||
source tools/tools.sh
|
|
||||||
|
|
||||||
if [[ $PLATFORM != CYGWIN* ]]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
LLVM_CONFIG="llvm-config"
|
|
||||||
|
|
||||||
CXXFLAGS="$($LLVM_CONFIG --cxxflags) -fno-PIC"
|
|
||||||
LDFLAGS="$($LLVM_CONFIG --cxxflags) -Wl,-s"
|
|
||||||
INCDIR=$($LLVM_CONFIG --includedir)
|
|
||||||
LIBDIR=$($LLVM_CONFIG --libdir)
|
|
||||||
LIBS=$($LLVM_CONFIG --libs all)
|
|
||||||
SYSLIBS="$($LLVM_CONFIG --system-libs) -ledit -lffi"
|
|
||||||
|
|
||||||
VERSION=$($LLVM_CONFIG --version | awk -F \. {'print $1$2'} | sed 's/svn//g')
|
|
||||||
|
|
||||||
set -e
|
|
||||||
TMP=$(mktemp -d)
|
|
||||||
set +e
|
|
||||||
|
|
||||||
pushd $TMP &>/dev/null
|
|
||||||
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.cpp
|
|
||||||
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/LTODisassembler.cpp
|
|
||||||
wget https://raw.githubusercontent.com/llvm-mirror/llvm/release_$VERSION/tools/lto/lto.exports
|
|
||||||
|
|
||||||
echo "{" > cyglto.exports
|
|
||||||
echo " global:" >> cyglto.exports
|
|
||||||
while read p; do
|
|
||||||
echo " $p;" >> cyglto.exports
|
|
||||||
done < lto.exports
|
|
||||||
echo " LLVM*;" >> cyglto.exports
|
|
||||||
echo " local: *;" >> cyglto.exports
|
|
||||||
echo "};" >> cyglto.exports
|
|
||||||
|
|
||||||
if [ $ARCH == "x86_64" ]; then
|
|
||||||
# https://github.com/tpoechtrager/osxcross/issues/91
|
|
||||||
mkdir -p llvm/LTO
|
|
||||||
echo "#undef off_t" > llvm/LTO/LTOModule.h
|
|
||||||
echo "#define off_t long long" >> llvm/LTO/LTOModule.h
|
|
||||||
echo "#include_next \"llvm/LTO/LTOModule.h\"" >> llvm/LTO/LTOModule.h
|
|
||||||
CXXFLAGS="-I $TMP $CXXFLAGS"
|
|
||||||
fi
|
|
||||||
|
|
||||||
popd &>/dev/null
|
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
g++ -shared \
|
|
||||||
-L$LIBDIR -I$INCDIR $CXXFLAGS $LDFLAGS \
|
|
||||||
$TMP/lto.cpp $TMP/LTODisassembler.cpp -Wl,-version-script,$TMP/cyglto.exports \
|
|
||||||
-Wl,--whole-archive $LIBS -Wl,--no-whole-archive $SYSLIBS \
|
|
||||||
-o /bin/cygLTO.dll -Wl,--out-implib,/lib/libLTO.dll.a
|
|
||||||
|
|
||||||
rm -rf $TMP
|
|
||||||
|
|
||||||
popd &>/dev/null
|
|
@ -5,6 +5,69 @@
|
|||||||
|
|
||||||
export LC_ALL=C
|
export LC_ALL=C
|
||||||
|
|
||||||
|
|
||||||
|
which gnutar &>/dev/null
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
TAR=gnutar
|
||||||
|
else
|
||||||
|
TAR=tar
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if [ -z "$SDK_COMPRESSOR" ]; then
|
||||||
|
which xz &>/dev/null
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
SDK_COMPRESSOR=xz
|
||||||
|
SDK_EXT="tar.xz"
|
||||||
|
else
|
||||||
|
SDK_COMPRESSOR=bzip2
|
||||||
|
SDK_EXT="tar.bz2"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
case $SDK_COMPRESSOR in
|
||||||
|
"gz")
|
||||||
|
SDK_COMPRESSOR=gzip
|
||||||
|
SDK_EXT=".tar.gz"
|
||||||
|
;;
|
||||||
|
"bzip2")
|
||||||
|
SDK_EXT=".tar.bz2"
|
||||||
|
;;
|
||||||
|
"xz")
|
||||||
|
SDK_EXT=".tar.xz"
|
||||||
|
;;
|
||||||
|
"zip")
|
||||||
|
SDK_EXT=".zip"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "error: unknown compressor \"$SDK_COMPRESSOR\"" >&2
|
||||||
|
exit 1
|
||||||
|
esac
|
||||||
|
|
||||||
|
function compress()
|
||||||
|
{
|
||||||
|
case $SDK_COMPRESSOR in
|
||||||
|
"zip")
|
||||||
|
$SDK_COMPRESSOR -q -5 -r - $1 > $2 ;;
|
||||||
|
*)
|
||||||
|
tar cf - $1 | $SDK_COMPRESSOR -5 - > $2 ;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function rreadlink()
|
||||||
|
{
|
||||||
|
if [ ! -h "$1" ]; then
|
||||||
|
echo "$1"
|
||||||
|
else
|
||||||
|
local link="$(expr "$(command ls -ld -- "$1")" : '.*-> \(.*\)$')"
|
||||||
|
cd $(dirname $1)
|
||||||
|
rreadlink "$link" | sed "s|^\([^/].*\)\$|$(dirname $1)/\1|"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function set_xcode_dir()
|
function set_xcode_dir()
|
||||||
{
|
{
|
||||||
local tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | grep -v "beta" | head -n1)
|
local tmp=$(ls $1 2>/dev/null | grep "^Xcode.*.app" | grep -v "beta" | head -n1)
|
||||||
@ -18,17 +81,18 @@ function set_xcode_dir()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if [ $(uname -s) != "Darwin" ]; then
|
if [ $(uname -s) != "Darwin" ]; then
|
||||||
if [ -z "$XCODEDIR" ]; then
|
if [ -z "$XCODEDIR" ]; then
|
||||||
echo "This script must be run on OS X" 1>&2
|
echo "This script must be run on OS X" 1>&2
|
||||||
echo "... Or with XCODEDIR=... on Linux" 1>&2
|
echo "... Or with XCODEDIR=... on Linux" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
case $XCODEDIR in
|
case "$XCODEDIR" in
|
||||||
/*) ;;
|
/*) ;;
|
||||||
*) XCODEDIR="$PWD/$XCODEDIR" ;;
|
*) XCODEDIR="$PWD/$XCODEDIR" ;;
|
||||||
esac
|
esac
|
||||||
set_xcode_dir $XCODEDIR
|
set_xcode_dir "$XCODEDIR"
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | grep -v "beta" | head -n1)
|
set_xcode_dir $(echo /Volumes/Xcode* | tr ' ' '\n' | grep -v "beta" | head -n1)
|
||||||
@ -47,7 +111,7 @@ else
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -d $XCODEDIR ]; then
|
if [ ! -d "$XCODEDIR" ]; then
|
||||||
echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" 1>&2
|
echo "cannot find Xcode (XCODEDIR=$XCODEDIR)" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@ -56,27 +120,9 @@ echo -e "found Xcode: $XCODEDIR"
|
|||||||
|
|
||||||
WDIR=$(pwd)
|
WDIR=$(pwd)
|
||||||
|
|
||||||
which gnutar &>/dev/null
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
TAR=gnutar
|
|
||||||
else
|
|
||||||
TAR=tar
|
|
||||||
fi
|
|
||||||
|
|
||||||
which xz &>/dev/null
|
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
|
||||||
COMPRESSOR=xz
|
|
||||||
PKGEXT="tar.xz"
|
|
||||||
else
|
|
||||||
COMPRESSOR=bzip2
|
|
||||||
PKGEXT="tar.bz2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
pushd $XCODEDIR &>/dev/null
|
pushd "$XCODEDIR" &>/dev/null
|
||||||
|
|
||||||
if [ -d "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
|
if [ -d "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ]; then
|
||||||
pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null
|
pushd "Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" &>/dev/null
|
||||||
@ -97,7 +143,7 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pushd $SDKDIR &>/dev/null
|
pushd "$SDKDIR" &>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
@ -128,9 +174,11 @@ for SDK in $SDKS; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
|
TMP=$(mktemp -d /tmp/XXXXXXXXXXX)
|
||||||
cp -r $SDK $TMP &>/dev/null || true
|
cp -r $(rreadlink $SDK) $TMP/$SDK &>/dev/null || true
|
||||||
|
|
||||||
pushd $XCODEDIR &>/dev/null
|
pushd "$XCODEDIR" &>/dev/null
|
||||||
|
|
||||||
|
mkdir -p $TMP/$SDK/usr/include/c++
|
||||||
|
|
||||||
# libc++ headers for C++11/C++14
|
# libc++ headers for C++11/C++14
|
||||||
if [ -d $LIBCXXDIR1 ]; then
|
if [ -d $LIBCXXDIR1 ]; then
|
||||||
@ -147,7 +195,7 @@ for SDK in $SDKS; do
|
|||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
pushd $TMP &>/dev/null
|
pushd $TMP &>/dev/null
|
||||||
$TAR -cf - * | $COMPRESSOR -9 -c - > "$WDIR/$SDK.$PKGEXT"
|
compress "*" "$WDIR/$SDK$SDK_EXT"
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
rm -rf $TMP
|
rm -rf $TMP
|
||||||
|
@ -24,15 +24,9 @@ fi
|
|||||||
|
|
||||||
mkdir -p $BUILD_DIR
|
mkdir -p $BUILD_DIR
|
||||||
|
|
||||||
require git
|
|
||||||
require cmake
|
|
||||||
require $MAKE
|
|
||||||
require modinfo
|
require modinfo
|
||||||
require fusermount
|
require fusermount
|
||||||
|
|
||||||
[ -n "$CC" ] && require $CC
|
|
||||||
[ -n "$CXX" ] && require $CXX
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
command -v lsb_release 2>&1 > /dev/null
|
command -v lsb_release 2>&1 > /dev/null
|
||||||
@ -53,41 +47,34 @@ set -e
|
|||||||
|
|
||||||
pushd $BUILD_DIR &>/dev/null
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
if [ ! -f $TARGET_DIR/SDK/tools/bin/darling-dmg ]; then
|
FULL_CLONE=1 \
|
||||||
rm -f have_darling_dmg
|
get_sources https://github.com/LubosD/darling-dmg.git master
|
||||||
fi
|
|
||||||
|
|
||||||
DARLING_DMG_REV="991a1c19d67e30ad1099fc871c4f9e702dd4d489"
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
if [ ! -f "have_darling_dmg_$DARLING_DMG_REV" ]; then
|
git reset --hard 5f64bc9a3795e0a1c307e9beb099f9035fdd864f
|
||||||
|
|
||||||
rm -rf darling-dmg*
|
|
||||||
git clone https://github.com/LubosD/darling-dmg.git
|
|
||||||
pushd darling-dmg &>/dev/null
|
|
||||||
git reset --hard $DARLING_DMG_REV
|
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
pushd build &>/dev/null
|
pushd build &>/dev/null
|
||||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR/SDK/tools
|
$CMAKE .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$TARGET_DIR_SDK_TOOLS
|
||||||
$MAKE -j $JOBS install
|
$MAKE -j $JOBS install
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
build_success
|
||||||
touch "have_darling_dmg_$DARLING_DMG_REV"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd &>/dev/null # build dir
|
popd &>/dev/null # build dir
|
||||||
|
|
||||||
TMP=$(mktemp -d /tmp/XXXXXXXXX)
|
TMP=$(mktemp -d /tmp/XXXXXXXXX)
|
||||||
|
|
||||||
function cleanup() {
|
function cleanup()
|
||||||
|
{
|
||||||
fusermount -u $TMP || true
|
fusermount -u $TMP || true
|
||||||
rm -rf $TMP
|
rm -rf $TMP
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/SDK/tools/lib \
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR_SDK_TOOLS/lib \
|
||||||
$TARGET_DIR/SDK/tools/bin/darling-dmg $1 $TMP
|
$TARGET_DIR/SDK/tools/bin/darling-dmg $1 $TMP
|
||||||
|
|
||||||
XCODEDIR=$TMP ./tools/gen_sdk_package.sh
|
XCODEDIR=$TMP ./tools/gen_sdk_package.sh
|
||||||
|
@ -40,55 +40,36 @@ if [ ! -f $TARGET_DIR/SDK/tools/bin/7z ]; then
|
|||||||
rm -f have_p7zip
|
rm -f have_p7zip
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "have_p7zip" ]; then
|
|
||||||
|
|
||||||
rm -rf p7zip*
|
get_sources https://github.com/tpoechtrager/p7zip.git master
|
||||||
git clone https://github.com/tpoechtrager/p7zip.git
|
|
||||||
pushd p7zip &>/dev/null
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
|
|
||||||
if [ -n "$CC" ] && [ -n "$CXX" ]; then
|
if [ -n "$CC" ] && [ -n "$CXX" ]; then
|
||||||
[[ $CC == *clang* ]] && CC="$CC -Qunused-arguments"
|
[[ $CC == *clang* ]] && CC="$CC -Qunused-arguments"
|
||||||
[[ $CXX == *clang* ]] && CXX="$CXX -Qunused-arguments"
|
[[ $CXX == *clang* ]] && CXX="$CXX -Qunused-arguments"
|
||||||
$MAKE 7z -j $JOBS CC="$CC" CXX="$CXX -std=gnu++03"
|
$MAKE 7z -j $JOBS CC="$CC" CXX="$CXX -std=gnu++98"
|
||||||
else
|
else
|
||||||
$MAKE 7z -j $JOBS CXX="c++ -std=gnu++03"
|
$MAKE 7z -j $JOBS CXX="c++ -std=gnu++98"
|
||||||
fi
|
fi
|
||||||
$MAKE install DEST_HOME=$TARGET_DIR/SDK/tools
|
|
||||||
find $TARGET_DIR/SDK/tools/share -type f -exec chmod 0664 {} \;
|
$MAKE install DEST_HOME=$TARGET_DIR_SDK_TOOLS
|
||||||
find $TARGET_DIR/SDK/tools/share -type d -exec chmod 0775 {} \;
|
find $TARGET_DIR_SDK_TOOLS/share -type f -exec chmod 0664 {} \;
|
||||||
|
find $TARGET_DIR_SDK_TOOLS/share -type d -exec chmod 0775 {} \;
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
build_success
|
||||||
touch "have_p7zip"
|
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
#/tmp is prone to run out of space
|
create_tmp_dir
|
||||||
#TMP=$(mktemp -d /tmp/XXXXXXXXX)
|
|
||||||
|
|
||||||
for i in {1..100}; do
|
pushd $TMP_DIR &>/dev/null
|
||||||
TMP="tmp_$RANDOM"
|
|
||||||
[ -e $TMP ] && continue
|
|
||||||
mkdir $TMP && break
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ! -d $TMP ]; then
|
|
||||||
echo "cannot create $PWD/$TMP directory" 1>&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
function cleanup() {
|
|
||||||
popd &>/dev/null || true
|
|
||||||
rm -rf $TMP
|
|
||||||
}
|
|
||||||
|
|
||||||
trap cleanup EXIT
|
|
||||||
|
|
||||||
pushd $TMP &>/dev/null
|
|
||||||
|
|
||||||
set +e
|
set +e
|
||||||
|
|
||||||
$TARGET_DIR/SDK/tools/bin/7z x \
|
$TARGET_DIR_SDK_TOOLS/bin/7z x \
|
||||||
$XCODEDMG \
|
$XCODEDMG \
|
||||||
"*/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform" \
|
"*/Xcode*.app/Contents/Developer/Platforms/MacOSX.platform" \
|
||||||
"*/Xcode*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
|
"*/Xcode*.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain"
|
||||||
@ -96,7 +77,7 @@ $TARGET_DIR/SDK/tools/bin/7z x \
|
|||||||
[ $? -ne 0 -a $? -ne 2 ] && exit 1
|
[ $? -ne 0 -a $? -ne 2 ] && exit 1
|
||||||
|
|
||||||
if [ -z "$(ls -A)" ]; then
|
if [ -z "$(ls -A)" ]; then
|
||||||
$TARGET_DIR/SDK/tools/bin/7z x $XCODEDMG "*/Packages/MacOSX*.pkg"
|
$TARGET_DIR_SDK_TOOLS/bin/7z x $XCODEDMG "*/Packages/MacOSX*.pkg"
|
||||||
[ $? -ne 0 -a $? -ne 2 ] && exit 1
|
[ $? -ne 0 -a $? -ne 2 ] && exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -106,5 +87,5 @@ set -e
|
|||||||
|
|
||||||
popd &>/dev/null
|
popd &>/dev/null
|
||||||
|
|
||||||
XCODEDIR="$TMP/$(ls $TMP | grep "code" | head -n1)" \
|
XCODEDIR="$TMP_DIR/$(ls $TMP_DIR | grep "code" | head -n1)" \
|
||||||
./tools/gen_sdk_package.sh
|
./tools/gen_sdk_package.sh
|
||||||
|
53
tools/gen_sdk_package_pbzx.sh
Executable file
@ -0,0 +1,53 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
pushd "${0%/*}/.." &>/dev/null
|
||||||
|
source tools/tools.sh
|
||||||
|
|
||||||
|
require cpio
|
||||||
|
|
||||||
|
if [ $PLATFORM == "Darwin" ]; then
|
||||||
|
echo "Use gen_sdk_package.sh on Mac OS X" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -eq 0 ]; then
|
||||||
|
echo "Usage: $0 <xcode.xip>" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mkdir -p $BUILD_DIR
|
||||||
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
|
build_xar
|
||||||
|
|
||||||
|
get_sources https://github.com/tpoechtrager/pbzx.git master
|
||||||
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME &>/dev/null
|
||||||
|
mkdir -p $TARGET_DIR_SDK_TOOLS/bin
|
||||||
|
verbose_cmd $CC -I $TARGET_DIR/include -L $TARGET_DIR/lib pbzx.c \
|
||||||
|
-o $TARGET_DIR_SDK_TOOLS/bin/pbzx -llzma -lxar \
|
||||||
|
-Wl,-rpath,$TARGET_DIR/lib
|
||||||
|
build_success
|
||||||
|
popd &>/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
create_tmp_dir
|
||||||
|
|
||||||
|
pushd $TMP_DIR &>/dev/null
|
||||||
|
|
||||||
|
echo "Extracting $1 (this may take several minutes) ..."
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/lib \
|
||||||
|
verbose_cmd "$TARGET_DIR/bin/xar -xf $1 -C $TMP_DIR"
|
||||||
|
|
||||||
|
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TARGET_DIR/lib \
|
||||||
|
verbose_cmd "$TARGET_DIR/SDK/tools/bin/pbzx -n Content | cpio -i"
|
||||||
|
|
||||||
|
popd &>/dev/null # TMP_DIR
|
||||||
|
popd &>/dev/null # BUILD_DIR
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
XCODEDIR=$TMP_DIR \
|
||||||
|
./tools/gen_sdk_package.sh
|
@ -83,6 +83,8 @@ case $MACOSX_DEPLOYMENT_TARGET in
|
|||||||
10.10* ) OSXVERSION="darwin_14" ;;
|
10.10* ) OSXVERSION="darwin_14" ;;
|
||||||
10.11* ) OSXVERSION="darwin_15" ;;
|
10.11* ) OSXVERSION="darwin_15" ;;
|
||||||
10.12* ) OSXVERSION="darwin_16" ;;
|
10.12* ) OSXVERSION="darwin_16" ;;
|
||||||
|
10.13* ) OSXVERSION="darwin_17" ;;
|
||||||
|
10.14* ) OSXVERSION="darwin_18" ;;
|
||||||
* ) unsupportedDepTarget ;;
|
* ) unsupportedDepTarget ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
356
tools/tools.sh
@ -7,6 +7,7 @@ BASE_DIR=$PWD
|
|||||||
TARBALL_DIR=$BASE_DIR/tarballs
|
TARBALL_DIR=$BASE_DIR/tarballs
|
||||||
BUILD_DIR=$BASE_DIR/build
|
BUILD_DIR=$BASE_DIR/build
|
||||||
TARGET_DIR=$BASE_DIR/target
|
TARGET_DIR=$BASE_DIR/target
|
||||||
|
TARGET_DIR_SDK_TOOLS=$TARGET_DIR/SDK/tools
|
||||||
PATCH_DIR=$BASE_DIR/patches
|
PATCH_DIR=$BASE_DIR/patches
|
||||||
SDK_DIR=$TARGET_DIR/SDK
|
SDK_DIR=$TARGET_DIR/SDK
|
||||||
|
|
||||||
@ -14,71 +15,29 @@ PLATFORM=$(uname -s)
|
|||||||
ARCH=$(uname -m)
|
ARCH=$(uname -m)
|
||||||
SCRIPT=$(basename $0)
|
SCRIPT=$(basename $0)
|
||||||
|
|
||||||
if [ -z "$USESYSTEMCOMPILER" ]; then
|
if [ $PLATFORM == CYGWIN* ]; then
|
||||||
# Default to gcc on some OSs rather than clang due to either
|
echo "Cygwin is no longer supported." 1>&2
|
||||||
# libstdc++ issues (clang uses an outdated version on those)
|
|
||||||
# or some other incompatibilities
|
|
||||||
|
|
||||||
case "$PLATFORM" in
|
|
||||||
CYGWIN* | DragonFly )
|
|
||||||
cc=gcc
|
|
||||||
cxx=g++
|
|
||||||
;;
|
|
||||||
OpenBSD )
|
|
||||||
cc=egcc
|
|
||||||
cxx=eg++
|
|
||||||
;;
|
|
||||||
Darwin )
|
|
||||||
cc=clang
|
|
||||||
cxx=clang++
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
case "$ARCH" in
|
|
||||||
arm* )
|
|
||||||
cc=gcc
|
|
||||||
cxx=g++
|
|
||||||
;;
|
|
||||||
* )
|
|
||||||
cc=clang
|
|
||||||
cxx=clang++
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
[ -z "$CC" ] && export CC=$cc
|
|
||||||
[ -z "$CXX" ] && export CXX=$cxx
|
|
||||||
elif [ -n "$CC" -o -n "$CXX" ]; then
|
|
||||||
echo "CC/CXX should not be set, continuing in 5 seconds..." 1>&2
|
|
||||||
sleep 5
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# enable debug messages
|
|
||||||
[ -n "$OCDEBUG" ] && set -x
|
|
||||||
|
|
||||||
if [[ $SCRIPT != *wrapper/build.sh ]]; then
|
|
||||||
# how many concurrent jobs should be used for compiling?
|
|
||||||
if [ -z "$JOBS" ]; then
|
|
||||||
JOBS=$(tools/get_cpu_count.sh || echo 1)
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $SCRIPT != "build.sh" -a \
|
|
||||||
$SCRIPT != "build_clang.sh" -a \
|
|
||||||
$SCRIPT != "mount_xcode_image.sh" -a \
|
|
||||||
$SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \
|
|
||||||
$SCRIPT != "gen_sdk_package_p7zip.sh" -a \
|
|
||||||
$SCRIPT != "gen_cyglto_dll.sh" ]; then
|
|
||||||
res=$(tools/osxcross_conf.sh)
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -n "you must run ./build.sh first before you can start "
|
|
||||||
echo "building $DESC"
|
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
eval "$res"
|
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then
|
||||||
|
MAKE=gmake
|
||||||
|
SED=gsed
|
||||||
|
else
|
||||||
|
MAKE=make
|
||||||
|
SED=sed
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CC" ]; then
|
||||||
|
export CC="clang"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CXX" ]; then
|
||||||
|
export CXX="clang++"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z "$CMAKE" ]; then
|
||||||
|
CMAKE="cmake"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
function require()
|
function require()
|
||||||
@ -99,16 +58,95 @@ function require()
|
|||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $PLATFORM == *BSD ]] || [ $PLATFORM == "DragonFly" ]; then
|
|
||||||
MAKE=gmake
|
|
||||||
SED=gsed
|
|
||||||
else
|
|
||||||
MAKE=make
|
|
||||||
SED=sed
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
require $CC
|
||||||
|
require $CXX
|
||||||
require $SED
|
require $SED
|
||||||
require $MAKE
|
require $MAKE
|
||||||
|
require $CMAKE
|
||||||
|
require patch
|
||||||
|
require gunzip
|
||||||
|
|
||||||
|
|
||||||
|
# enable debug messages
|
||||||
|
[ -n "$OCDEBUG" ] && set -x
|
||||||
|
|
||||||
|
if [[ $SCRIPT != *wrapper/build.sh ]]; then
|
||||||
|
# how many concurrent jobs should be used for compiling?
|
||||||
|
if [ -z "$JOBS" ]; then
|
||||||
|
JOBS=$(tools/get_cpu_count.sh || echo 1)
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $SCRIPT != "build.sh" -a \
|
||||||
|
$SCRIPT != "build_clang.sh" -a \
|
||||||
|
$SCRIPT != "mount_xcode_image.sh" -a \
|
||||||
|
$SCRIPT != "gen_sdk_package_darling_dmg.sh" -a \
|
||||||
|
$SCRIPT != "gen_sdk_package_p7zip.sh" -a \
|
||||||
|
$SCRIPT != "gen_sdk_package_pbzx.sh" ]; then
|
||||||
|
res=$(tools/osxcross_conf.sh)
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo -n "you must run ./build.sh first before you can start "
|
||||||
|
echo "building $DESC"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval "$res"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
# find sdk version to use
|
||||||
|
function guess_sdk_version()
|
||||||
|
{
|
||||||
|
tmp1=
|
||||||
|
tmp2=
|
||||||
|
tmp3=
|
||||||
|
file=
|
||||||
|
sdk=
|
||||||
|
guess_sdk_version_result=
|
||||||
|
sdkcount=$(find -L 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 -L tarballs/ -type f | 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 -L tarballs/ -type f | 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
|
||||||
|
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 [ -f "$file" ] && [ $(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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function extract()
|
function extract()
|
||||||
{
|
{
|
||||||
@ -147,21 +185,171 @@ function extract()
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [[ $PLATFORM == CYGWIN* ]]; then
|
|
||||||
|
|
||||||
function create_symlink()
|
function cleanup_tmp_dir()
|
||||||
{
|
{
|
||||||
cp -f $1 $2
|
if [ -n "$OC_KEEP_TMP_DIR" ]; then
|
||||||
|
echo "Not removing $TMP_DIR ..."
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
echo "Removing $TMP_DIR ..."
|
||||||
|
rm -rf $TMP_DIR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function create_tmp_dir()
|
||||||
|
{
|
||||||
|
mkdir -p $BUILD_DIR
|
||||||
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
local tmp
|
||||||
|
|
||||||
|
for i in {1..100}; do
|
||||||
|
tmp="tmp_$RANDOM"
|
||||||
|
[ -e $tmp ] && continue
|
||||||
|
mkdir $tmp && break
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ ! -d $tmp ]; then
|
||||||
|
echo "cannot create $BUILD_DIR/$tmp directory" 1>&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
TMP_DIR=$BUILD_DIR/$tmp
|
||||||
|
trap cleanup_tmp_dir EXIT
|
||||||
|
|
||||||
|
popd &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
# f_res=1 = something has changed upstream
|
||||||
|
# f_res=0 = nothing has changed
|
||||||
|
|
||||||
|
function git_clone_repository
|
||||||
|
{
|
||||||
|
local url=$1
|
||||||
|
local branch=$2
|
||||||
|
local project_name=$3
|
||||||
|
|
||||||
|
if [ -n "$TP_OSXCROSS_DEV" ]; then
|
||||||
|
# copy files from local working directory
|
||||||
|
rm -rf $project_name
|
||||||
|
cp -r $TP_OSXCROSS_DEV/$project_name .
|
||||||
|
if [ -e ${project_name}/.git ]; then
|
||||||
|
pushd $project_name &>/dev/null
|
||||||
|
git clean -fdx &>/dev/null
|
||||||
|
popd &>/dev/null
|
||||||
|
fi
|
||||||
|
f_res=1
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d $project_name ]; then
|
||||||
|
local args=""
|
||||||
|
if [ -z "$FULL_CLONE" ] && [ $branch == "master" ]; then
|
||||||
|
args="--depth 1"
|
||||||
|
fi
|
||||||
|
git clone $url $args
|
||||||
|
fi
|
||||||
|
|
||||||
|
pushd $project_name &>/dev/null
|
||||||
|
|
||||||
|
git reset --hard &>/dev/null
|
||||||
|
git clean -fdx &>/dev/null
|
||||||
|
git fetch origin
|
||||||
|
git checkout $branch
|
||||||
|
git pull origin $branch
|
||||||
|
|
||||||
|
local new_hash=$(git rev-parse HEAD)
|
||||||
|
local old_hash=""
|
||||||
|
local hash_file="$BUILD_DIR/.${project_name}_git_hash"
|
||||||
|
|
||||||
|
if [ -f $hash_file ]; then
|
||||||
|
old_hash=$(cat $hash_file)
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo -n $new_hash > $hash_file
|
||||||
|
|
||||||
|
if [ "$old_hash" != "$new_hash" ]; then
|
||||||
|
f_res=1
|
||||||
else
|
else
|
||||||
|
f_res=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
function get_project_name_from_url()
|
||||||
|
{
|
||||||
|
local url=$1
|
||||||
|
local project_name
|
||||||
|
project_name=$(basename $url)
|
||||||
|
project_name=${project_name/\.git/}
|
||||||
|
echo -n $project_name
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_success()
|
||||||
|
{
|
||||||
|
local project_name=$1
|
||||||
|
touch "$BUILD_DIR/.${CURRENT_BUILD_PROJECT_NAME}_build_complete"
|
||||||
|
unset CURRENT_BUILD_PROJECT_NAME
|
||||||
|
}
|
||||||
|
|
||||||
|
function build_msg()
|
||||||
|
{
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
echo "## Building $1 ($2) ##"
|
||||||
|
else
|
||||||
|
echo "## Building $1 ##"
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo ""
|
||||||
|
}
|
||||||
|
|
||||||
|
# f_res=1 = build the project
|
||||||
|
# f_res=0 = nothing to do
|
||||||
|
|
||||||
|
function get_sources()
|
||||||
|
{
|
||||||
|
local url=$1
|
||||||
|
local branch=$2
|
||||||
|
local project_name=$(get_project_name_from_url $url)
|
||||||
|
local build_complete_file="$BUILD_DIR/.${project_name}_build_complete"
|
||||||
|
|
||||||
|
CURRENT_BUILD_PROJECT_NAME=$project_name
|
||||||
|
|
||||||
|
build_msg $project_name $branch
|
||||||
|
|
||||||
|
if [[ "$SKIP_BUILD" == *$project_name* ]]; then
|
||||||
|
f_res=0
|
||||||
|
return
|
||||||
|
fi
|
||||||
|
|
||||||
|
git_clone_repository $url $branch $project_name
|
||||||
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
rm -f $build_complete_file
|
||||||
|
f_res=1
|
||||||
|
else
|
||||||
|
# nothing has changed upstream
|
||||||
|
|
||||||
|
if [ -f $build_complete_file ]; then
|
||||||
|
echo ""
|
||||||
|
echo "## Nothing to do ##"
|
||||||
|
echo ""
|
||||||
|
f_res=0
|
||||||
|
else
|
||||||
|
rm -f $build_complete_file
|
||||||
|
f_res=1
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function create_symlink()
|
function create_symlink()
|
||||||
{
|
{
|
||||||
ln -sf $1 $2
|
ln -sf $1 $2
|
||||||
}
|
}
|
||||||
|
|
||||||
fi
|
|
||||||
|
|
||||||
function verbose_cmd()
|
function verbose_cmd()
|
||||||
{
|
{
|
||||||
@ -169,6 +357,7 @@ function verbose_cmd()
|
|||||||
eval "$@"
|
eval "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function test_compiler()
|
function test_compiler()
|
||||||
{
|
{
|
||||||
echo -ne "testing $1 ... "
|
echo -ne "testing $1 ... "
|
||||||
@ -191,5 +380,28 @@ function test_compiler_cxx11()
|
|||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
## Also used in gen_sdk_package_pbzx.sh ##
|
||||||
|
|
||||||
|
function build_xar()
|
||||||
|
{
|
||||||
|
pushd $BUILD_DIR &>/dev/null
|
||||||
|
|
||||||
|
get_sources https://github.com/tpoechtrager/xar.git master
|
||||||
|
|
||||||
|
if [ $f_res -eq 1 ]; then
|
||||||
|
pushd $CURRENT_BUILD_PROJECT_NAME/xar &>/dev/null
|
||||||
|
CFLAGS+=" -w" \
|
||||||
|
./configure --prefix=$TARGET_DIR
|
||||||
|
$MAKE -j$JOBS
|
||||||
|
$MAKE install -j$JOBS
|
||||||
|
popd &>/dev/null
|
||||||
|
build_success
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd &>/dev/null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# exit on error
|
# exit on error
|
||||||
set -e
|
set -e
|
||||||
|
@ -18,12 +18,10 @@ function _exit()
|
|||||||
echo ""
|
echo ""
|
||||||
echo "exiting with abnormal exit code ($EC)"
|
echo "exiting with abnormal exit code ($EC)"
|
||||||
test -n "$OCDEBUG" || echo "run 'OCDEBUG=1 ./$SCRIPT' to enable debug messages"
|
test -n "$OCDEBUG" || echo "run 'OCDEBUG=1 ./$SCRIPT' to enable debug messages"
|
||||||
declare -f -F remove_locks &>/dev/null && \
|
if [ -n "$CURRENT_BUILD_PROJECT_NAME" ]; then
|
||||||
{
|
## Build failed. Rebuild everything ##
|
||||||
echo "removing stale locks..."
|
rm -f "build/*_built_successfully"
|
||||||
remove_locks
|
fi
|
||||||
}
|
|
||||||
echo "if it is happening the first time, then just re-run the script"
|
|
||||||
echo ""
|
echo ""
|
||||||
test $SCRIPT = "build.sh" && check_for_bug_1242300
|
test $SCRIPT = "build.sh" && check_for_bug_1242300
|
||||||
fi
|
fi
|
||||||
|
@ -9,19 +9,34 @@ set +e
|
|||||||
if [ -z "$OSXCROSS_VERSION" ]; then
|
if [ -z "$OSXCROSS_VERSION" ]; then
|
||||||
eval $(../target/bin/osxcross-conf 2>/dev/null)
|
eval $(../target/bin/osxcross-conf 2>/dev/null)
|
||||||
|
|
||||||
if [ -n "$OSXCROSS_SDK_VERSION" ] &&
|
if [ -n "$OSXCROSS_SDK_VERSION" ]; then
|
||||||
[ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then
|
if [ -z "$X86_64H_SUPPORTED" ]; then
|
||||||
|
if [ $(osxcross-cmp $OSXCROSS_SDK_VERSION ">=" 10.8) -eq 1 ]; then
|
||||||
X86_64H_SUPPORTED=1
|
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
|
||||||
fi
|
fi
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
if [[ $PLATFORM == CYGWIN* ]]; then
|
if [ -z "$I386_SUPPORTED" ]; then
|
||||||
EXESUFFIX=".exe"
|
I386_SUPPORTED=1
|
||||||
else
|
|
||||||
EXESUFFIX=""
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ -z "$X86_64H_SUPPORTED" ]; then
|
||||||
|
X86_64H_SUPPORTED=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
function create_wrapper_link
|
function create_wrapper_link
|
||||||
{
|
{
|
||||||
# arg 1:
|
# arg 1:
|
||||||
@ -40,32 +55,37 @@ function create_wrapper_link
|
|||||||
# -> x86_64h-apple-darwinXX-osxcross
|
# -> x86_64h-apple-darwinXX-osxcross
|
||||||
|
|
||||||
if [ $# -ge 2 ] && [ $2 -eq 1 ]; then
|
if [ $# -ge 2 ] && [ $2 -eq 1 ]; then
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
"${1}${EXESUFFIX}"
|
"${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||||
"i386-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}"
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
|
"i386-apple-${OSXCROSS_TARGET}-${1}"
|
||||||
|
fi
|
||||||
|
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
"x86_64-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}"
|
"x86_64-apple-${OSXCROSS_TARGET}-${1}"
|
||||||
|
|
||||||
if [ -n "$X86_64H_SUPPORTED" ] && [ $X86_64H_SUPPORTED -eq 1 ] &&
|
if [ $X86_64H_SUPPORTED -eq 1 ] &&
|
||||||
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
|
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
"x86_64h-apple-${OSXCROSS_TARGET}-${1}${EXESUFFIX}"
|
"x86_64h-apple-${OSXCROSS_TARGET}-${1}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $# -ge 2 ] && [ $2 -eq 2 ]; then
|
if [ $# -ge 2 ] && [ $2 -eq 2 ]; then
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
if [ $I386_SUPPORTED -eq 1 ]; then
|
||||||
"o32-${1}${EXESUFFIX}"
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
"o32-${1}"
|
||||||
"o64-${1}${EXESUFFIX}"
|
fi
|
||||||
|
|
||||||
if [ -n "$X86_64H_SUPPORTED" ] && [ $X86_64H_SUPPORTED -eq 1 ] &&
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
|
"o64-${1}"
|
||||||
|
|
||||||
|
if [ $X86_64H_SUPPORTED -eq 1 ] &&
|
||||||
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
|
([[ $1 != gcc* ]] && [[ $1 != g++* ]] && [[ $1 != *gstdc++ ]]); then
|
||||||
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper${EXESUFFIX}" \
|
verbose_cmd create_symlink "${TARGETTRIPLE}-wrapper" \
|
||||||
"o64h-${1}${EXESUFFIX}"
|
"o64h-${1}"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -123,7 +143,7 @@ if [ -n "$BWCOMPILEONLY" ]; then
|
|||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
verbose_cmd mv wrapper "${TARGET_DIR}/bin/${TARGETTRIPLE}-wrapper${EXESUFFIX}"
|
verbose_cmd mv wrapper "${TARGET_DIR}/bin/${TARGETTRIPLE}-wrapper"
|
||||||
|
|
||||||
pushd "../target/bin" &>/dev/null
|
pushd "../target/bin" &>/dev/null
|
||||||
|
|
||||||
|
@ -61,9 +61,10 @@ int dsymutil(int argc, char **argv, Target &target) {
|
|||||||
debug = 1;
|
debug = 1;
|
||||||
} else {
|
} else {
|
||||||
if (!realPath("osxcross-llvm-dsymutil", dsymutil) &&
|
if (!realPath("osxcross-llvm-dsymutil", dsymutil) &&
|
||||||
!realPath("llvm-dsymutil", dsymutil)) {
|
!realPath("llvm-dsymutil", dsymutil) &&
|
||||||
|
!realPath("dsymutil", dsymutil)) {
|
||||||
if (debug)
|
if (debug)
|
||||||
dbg << "dsymutil: cannot find [osxcross-]llvm-dsymutil in PATH"
|
dbg << "dsymutil: cannot find [osxcross-][llvm-]dsymutil in PATH"
|
||||||
<< dbg.endl();
|
<< dbg.endl();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -89,9 +90,7 @@ int dsymutil(int argc, char **argv, Target &target) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLVMDsymutilVersionStr += constexprStrLen("LLVM version ");
|
LLVMDsymutilVersionStr += constexprStrLen("LLVM version ");
|
||||||
|
|
||||||
LLVMDsymutilVersion = parseLLVMVersion(LLVMDsymutilVersionStr);
|
LLVMDsymutilVersion = parseLLVMVersion(LLVMDsymutilVersionStr);
|
||||||
|
|
||||||
constexpr LLVMVersion RequiredLLVMDsymutilVersion(3, 8);
|
constexpr LLVMVersion RequiredLLVMDsymutilVersion(3, 8);
|
||||||
|
|
||||||
if (LLVMDsymutilVersion < RequiredLLVMDsymutilVersion) {
|
if (LLVMDsymutilVersion < RequiredLLVMDsymutilVersion) {
|
||||||
|
@ -228,12 +228,13 @@ bool Target::hasLibCXX() const { return getSDKOSNum() >= OSVersion(10, 7); }
|
|||||||
|
|
||||||
bool Target::libCXXIsDefaultCXXLib() const {
|
bool Target::libCXXIsDefaultCXXLib() const {
|
||||||
OSVersion OSNum = this->OSNum;
|
OSVersion OSNum = this->OSNum;
|
||||||
|
OSVersion SDKOSNum = getSDKOSNum();
|
||||||
|
|
||||||
if (!OSNum.Num())
|
if (!OSNum.Num())
|
||||||
OSNum = getSDKOSNum();
|
OSNum = SDKOSNum;
|
||||||
|
|
||||||
return stdlib != libstdcxx && hasLibCXX() && !isGCC() &&
|
return stdlib != libstdcxx && hasLibCXX() && !isGCC() &&
|
||||||
OSNum >= OSVersion(10, 9);
|
(OSNum >= OSVersion(10, 9) || SDKOSNum >= OSVersion(10, 14));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Target::isCXX() {
|
bool Target::isCXX() {
|
||||||
@ -506,14 +507,18 @@ bool Target::setup() {
|
|||||||
|
|
||||||
if (!OSNum.Num()) {
|
if (!OSNum.Num()) {
|
||||||
if (haveArch(Arch::x86_64h)) {
|
if (haveArch(Arch::x86_64h)) {
|
||||||
OSNum = OSVersion(10, 8); // Default to 10.8 for x86_64h
|
// Default to >= 10.8 for x86_64h
|
||||||
|
OSVersion defaultMinTarget = getDefaultMinTarget();
|
||||||
|
std::max(defaultMinTarget, OSVersion(10, 8));
|
||||||
if (SDKOSNum < OSNum) {
|
if (SDKOSNum < OSNum) {
|
||||||
err << "'" << getArchName(arch) << "' requires Mac OS X SDK "
|
err << "'" << getArchName(arch) << "' requires Mac OS X SDK "
|
||||||
<< OSNum.shortStr() << " (or later)" << err.endl();
|
<< OSNum.shortStr() << " (or later)" << err.endl();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (stdlib == StdLib::libcxx) {
|
} else if (stdlib == StdLib::libcxx) {
|
||||||
OSNum = OSVersion(10, 7); // Default to 10.7 for libc++
|
// Default to >= 10.7 for libc++
|
||||||
|
OSVersion defaultMinTarget = getDefaultMinTarget();
|
||||||
|
OSNum = std::max(defaultMinTarget, OSVersion(10, 7));
|
||||||
} else {
|
} else {
|
||||||
OSNum = getDefaultMinTarget();
|
OSNum = getDefaultMinTarget();
|
||||||
}
|
}
|
||||||
@ -550,6 +555,20 @@ bool Target::setup() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (SDKOSNum >= OSVersion(10, 14)) {
|
||||||
|
if (!isGCC() && !usegcclibs && stdlib == StdLib::libstdcxx) {
|
||||||
|
err << "Mac OS X SDK '>= 10.14' does not support libstdc++ anymore"
|
||||||
|
<< err.endl();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (haveArch(Arch::i386)) {
|
||||||
|
err << "Mac OS X SDK '>= 10.14' does not support i386 anymore"
|
||||||
|
<< err.endl();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (OSNum > SDKOSNum) {
|
if (OSNum > SDKOSNum) {
|
||||||
err << "targeted OS X version must be <= " << SDKOSNum.Str() << " (SDK)"
|
err << "targeted OS X version must be <= " << SDKOSNum.Str() << " (SDK)"
|
||||||
<< err.endl();
|
<< err.endl();
|
||||||
@ -702,8 +721,11 @@ bool Target::setup() {
|
|||||||
if (!isGCH()) {
|
if (!isGCH()) {
|
||||||
fargs.push_back("-lc");
|
fargs.push_back("-lc");
|
||||||
fargs.push_back("-lc++");
|
fargs.push_back("-lc++");
|
||||||
|
if (SDKOSNum <= OSVersion(10, 13)) {
|
||||||
|
// SDK 10.14 does not have -lgcc_s anymore
|
||||||
fargs.push_back("-lgcc_s.10.5");
|
fargs.push_back("-lgcc_s.10.5");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (stdlib != StdLib::libcxx && !isGCH() &&
|
} else if (stdlib != StdLib::libcxx && !isGCH() &&
|
||||||
!getenv("OSXCROSS_GCC_NO_STATIC_RUNTIME")) {
|
!getenv("OSXCROSS_GCC_NO_STATIC_RUNTIME")) {
|
||||||
fargs.push_back("-static-libgcc");
|
fargs.push_back("-static-libgcc");
|
||||||
|