-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from nbeadman/master
Xcode 10 support for OS X 10.13 SDK
- Loading branch information
Showing
3 changed files
with
89 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
*.dmg | ||
*.dmg.part | ||
*.pkg | ||
*.xip | ||
*.app | ||
*.tar.gz | ||
*.tar.xz | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,6 +7,8 @@ | |
# - Jae Liu <ling32945@github> | ||
# - Eric Knibbe <EricFromCanada@github> | ||
# - Chris Roueche <croueche@github> | ||
# - Kris Coppieters <zwettemaan@github> | ||
# - Nick Beadman <[email protected]> / <nbeadman@github> | ||
# | ||
# License: Creative Commons BY-NC-SA 3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/ | ||
# | ||
|
@@ -23,6 +25,7 @@ | |
# 1.9 (16/09/2016): Xcode 8 dropped 10.11 SDK, get it from Xcode 7.3.1 | ||
# 2.0 (02/05/2017): Xcode 8 cannot always link i386 for OS X 10.5, use the Xcode 3 linker for this arch too. Force use of legacy assembler with GCC 4.x. | ||
# 2.1 (17/01/2017): Xcode 9 dropped 10.12 SDK, get it from https://github.com/phracker/MacOSX-SDKs; fix compiling with GNU Ada, and many other fixes | ||
# 2.2 (12/02/2019): Added support for using macOS High Sierra 10.13 SDK from Xcode 9.4.1 for use on Xcode 10/macOS 10.14 Mojave, also changed source of OS X 10.12 SDK to Xcode 8.3.3 | ||
|
||
#set -e # Exit immediately if a command exits with a non-zero status | ||
#set -u # Treat unset variables as an error when substituting. | ||
|
@@ -38,6 +41,7 @@ osx109=0 | |
osx1010=0 | ||
osx1011=0 | ||
osx1012=0 | ||
osx1013=0 | ||
gotoption=0 | ||
error=0 | ||
|
||
|
@@ -94,6 +98,11 @@ while [[ $error = 0 ]] && [[ $# -gt 1 ]]; do | |
gotoption=1 | ||
shift | ||
;; | ||
-osx1013) | ||
osx1013=1 | ||
gotoption=1 | ||
shift | ||
;; | ||
*) | ||
# unknown option or spurious arg | ||
error=1 | ||
|
@@ -113,19 +122,20 @@ if [ $gotoption = 0 ]; then | |
osx1010=1 | ||
osx1011=1 | ||
osx1012=1 | ||
osx1013=1 | ||
fi | ||
|
||
if [ $# != 1 ]; then | ||
# ################################################################################ 80 cols | ||
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta" | ||
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012|-osx1013] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta" | ||
echo "" | ||
echo "Description: Extracts / installs / cleans / uninstalls the following components" | ||
echo "from Xcode 3.2.6, Xcode 4.6.3, Xcode 5.1.1, Xcode 6.4 and Xcode 7.3.1, which" | ||
echo "from Xcode 3.2.6, Xcode 4.6.3, Xcode 5.1.1, Xcode 6.4, Xcode 7.3.1, Xcode 8.3.3 and Xcode 9.4.1 which" | ||
echo "are not available in Xcode >= 4.2:" | ||
echo " - PPC assembler and linker" | ||
echo " - GCC 4.0 and 4.2 compilers and Xcode plugins" | ||
echo " - LLVM-GCC 4.2 compiler and Xcode plugin (Xcode >= 5)" | ||
echo " - Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11" | ||
echo " - Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13" | ||
echo "" | ||
echo "An optional first argument may be provided to limit the operation (by default" | ||
echo "everything is done):" | ||
|
@@ -140,6 +150,7 @@ if [ $# != 1 ]; then | |
echo " -osx1010 : only install OSX 10.10 SDK" | ||
echo " -osx1011 : only install OSX 10.11 SDK" | ||
echo " -osx1012 : only install OSX 10.12 SDK" | ||
echo " -osx1013 : only install OSX 10.13 SDK" | ||
echo "Note that these can be combined. For example, to build and install the 10.9" | ||
echo "and 10.10 SDKs, one could execute:" | ||
echo " $ $0 -osx109 -osx1010 buildpackages" | ||
|
@@ -199,6 +210,8 @@ xc4="$(( compilers + osx107 != 0 ))" | |
xc5="$(( osx108 != 0 ))" | ||
xc6="$(( osx109 + osx1010 != 0 ))" | ||
xc7="$(( osx1011 != 0 ))" | ||
xc8="$(( osx1012 != 0 ))" | ||
xc9="$(( osx1013 != 0 ))" | ||
|
||
# The sole argument is the macOS version (e.g. 10.12) | ||
installSDK() { | ||
|
@@ -213,9 +226,8 @@ installSDK() { | |
(gzip -dc MacOSX${macos}.sdk.tar.xz | (cd "$SDKDIR/SDKs" || exit; tar xf -)) && echo "*** installed MacOSX${macos}.sdk.tar.xz" | ||
else | ||
echo "*** Could not install MacOSX${macos}.sdk" | ||
echo "*** Before installing, either:" | ||
echo "*** Before installing:" | ||
echo "- execute \"$0 buildpackages\"" | ||
echo "- download MacOSX${macos}.sdk.tar.xz from https://github.com/phracker/MacOSX-SDKs/releases and relaunch \"$0 install\"" | ||
exit 1 | ||
fi | ||
touch "$SDKDIR/SDKs/MacOSX${macos}.sdk/legacy" | ||
|
@@ -230,7 +242,7 @@ case $1 in | |
missingdmg=0 | ||
# note: Xcode links from http://stackoverflow.com/questions/10335747/how-to-download-xcode-4-5-6-7-and-get-the-dmg-file/10335943#10335943 | ||
if [ "$xc3" = 1 ] && [ ! -f xcode_3.2.6_and_ios_sdk_4.3.dmg ]; then | ||
echo "*** you should download Xcode 3.2.6. Login to:" | ||
echo "*** You should download Xcode 3.2.6. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg" | ||
|
@@ -240,7 +252,7 @@ case $1 in | |
missingdmg=1 | ||
fi | ||
if [ "$xc4" = 1 ] && [ ! -f xcode4630916281a.dmg ]; then | ||
echo "*** you should download Xcode 4.6.3. Login to:" | ||
echo "*** You should download Xcode 4.6.3. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg" | ||
|
@@ -250,7 +262,7 @@ case $1 in | |
missingdmg=1 | ||
fi | ||
if [ "$xc5" = 1 ] && [ ! -f xcode_5.1.1.dmg ]; then | ||
echo "*** you should download Xcode 5.1.1. Login to:" | ||
echo "*** You should download Xcode 5.1.1. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg" | ||
|
@@ -260,7 +272,7 @@ case $1 in | |
missingdmg=1 | ||
fi | ||
if [ "$xc6" = 1 ] && [ ! -f Xcode_6.4.dmg ]; then | ||
echo "*** you should download Xcode 6.4. Login to:" | ||
echo "*** You should download Xcode 6.4. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg" | ||
|
@@ -270,7 +282,7 @@ case $1 in | |
missingdmg=1 | ||
fi | ||
if [ "$xc7" = 1 ] && [ ! -f Xcode_7.3.1.dmg ]; then | ||
echo "*** you should download Xcode 7.3.1. Login to:" | ||
echo "*** You should download Xcode 7.3.1. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg" | ||
|
@@ -279,10 +291,33 @@ case $1 in | |
echo "and then run this script from within the same directory as the downloaded file" | ||
missingdmg=1 | ||
fi | ||
if [ "$xc8" = 1 ] && [ ! -f Xcode8.3.3.xip ]; then | ||
echo "*** You should download Xcode 8.3.3. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://download.developer.apple.com/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip" | ||
echo "and then run this script from within the same directory as the downloaded file" | ||
missingdmg=1 | ||
fi | ||
if [ "$xc9" = 1 ] && [ ! -f Xcode_9.4.1.xip ]; then | ||
echo "*** You should download Xcode 9.4.1. Login to:" | ||
echo " https://developer.apple.com/downloads/" | ||
echo "then download from:" | ||
echo " https://download.developer.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip" | ||
echo "and then run this script from within the same directory as the downloaded file" | ||
missingdmg=1 | ||
fi | ||
if [ "$missingdmg" = 1 ]; then | ||
echo "*** at least one Xcode distribution is missing, cannot build packages - exiting now" | ||
exit | ||
fi | ||
if [ "$xc8" = 1 ]; then | ||
if [ -e Xcode.app ]; then | ||
echo "*** A stray Xcode.app exists in the XcodeLegacy.sh folder. Remove it then try again." | ||
exit | ||
fi | ||
fi | ||
|
||
MNTDIR="$(mktemp -d mount.XXX)" | ||
ATTACH_OPTS=(-nobrowse -mountroot "$MNTDIR") | ||
if [ "$xc3" = 1 ]; then | ||
|
@@ -548,8 +583,29 @@ EOF | |
fi | ||
hdiutil detach "$MNTDIR/Xcode" -force | ||
fi | ||
if [ "$osx1012" = 1 ]; then | ||
curl -L -O https://github.com/phracker/MacOSX-SDKs/releases/download/10.13/MacOSX10.12.sdk.tar.xz | ||
if [ "$xc8" = 1 ]; then | ||
if [ "$osx1012" = 1 ]; then | ||
echo "Extracting Mac OS X 10.12 SDK from Xcode 8.3.3. Be patient - this will take some time" | ||
open Xcode8.3.3.xip | ||
while [ ! -d Xcode.app ]; do | ||
sleep 5 | ||
done | ||
sleep 5 | ||
( (cd "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" || exit; rm SDKs/MacOSX10.12.sdk; mv SDKs/MacOSX.sdk SDKs/MacOSX10.12.sdk; tar cf - SDKs/MacOSX10.12.sdk) | gzip -c > Xcode1012SDK.tar.gz) && echo "*** Created Xcode1012SDK.tar.gz in directory $(pwd)" | ||
rm -rf Xcode.app | ||
fi | ||
fi | ||
if [ "$xc9" = 1 ]; then | ||
if [ "$osx1013" = 1 ]; then | ||
echo "Extracting Mac OS X 10.13 SDK from Xcode 9.4.1. Be patient - this will take some time" | ||
open Xcode_9.4.1.xip | ||
while [ ! -d Xcode.app ]; do | ||
sleep 5 | ||
done | ||
sleep 5 | ||
( (cd "Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer" || exit; rm SDKs/MacOSX10.13.sdk; mv SDKs/MacOSX.sdk SDKs/MacOSX10.13.sdk; tar cf - SDKs/MacOSX10.13.sdk) | gzip -c > Xcode1013SDK.tar.gz) && echo "*** Created Xcode1013SDK.tar.gz in directory $(pwd)" | ||
rm -rf Xcode.app | ||
fi | ||
fi | ||
rmdir "$MNTDIR" | ||
;; | ||
|
@@ -957,6 +1013,10 @@ SPEC_EOF | |
installSDK 10.12 | ||
fi | ||
|
||
if [ "$osx1013" = 1 ]; then | ||
installSDK 10.13 | ||
fi | ||
|
||
if [ "$compilers" = 1 ]; then | ||
if [ -f /usr/bin/gcc-4.0 ]; then | ||
#echo "*** Not installing xcode_3.2.6_gcc4.0.pkg (found installed in /usr/bin/gcc-4.0, uninstall first to force install)" | ||
|
@@ -1085,6 +1145,9 @@ SPEC_EOF | |
if [ "$osx1012" = 1 ]; then | ||
rm Xcode1012SDK.tar.gz 2>/dev/null | ||
fi | ||
if [ "$osx1012" = 1 ]; then | ||
rm Xcode1013SDK.tar.gz 2>/dev/null | ||
fi | ||
|
||
;; | ||
|
||
|
@@ -1193,6 +1256,10 @@ SPEC_EOF | |
i=10.12 | ||
[ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" | ||
fi | ||
if [ "$osx1013" = 1 ]; then | ||
i=10.13 | ||
[ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" | ||
fi | ||
|
||
if [ "$compilers" = 1 ]; then | ||
if [ "$GCCINSTALLDIR/usr/bin/gcc" -ef "$GCCINSTALLDIR/usr/bin/clang" ]; then | ||
|