Skip to content

Commit

Permalink
Merge pull request #48 from nbeadman/master
Browse files Browse the repository at this point in the history
Xcode 10 support for OS X 10.13 SDK
  • Loading branch information
devernay authored Feb 12, 2019
2 parents 7605efe + 2b615b8 commit b705c20
Show file tree
Hide file tree
Showing 3 changed files with 89 additions and 17 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
*.dmg
*.dmg.part
*.pkg
*.xip
*.app
*.tar.gz
*.tar.xz

Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
XcodeLegacy
===========

Legacy components for Xcode 4-8 (deprecated compilers and Mac OS X SDKs).
Legacy components for Xcode 4-10 (deprecated compilers and Mac OS X SDKs).

Home page: https://github.com/devernay/xcodelegacy

Expand All @@ -10,12 +10,12 @@ Description

Many components were removed in recent versions of Xcode, the most notable being the Mac OS X 10.6 SDK, which is required to build software using the Carbon API (such as wxWidgets 2.8).

I made the script XcodeLegacy.sh to extract these components (the links work if you [sign in to Apple Developer](https://developer.apple.com/downloads/) first) from [Xcode 3.2.6](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) (10.4, 10.5 and 10.6 SDKs, PPC assembler, GCC 4.0 and 4.2, LLVM-GCC 4.2), [Xcode 4.6.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) (10.7 SDK), [Xcode 5.1.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) (10.8 SDK), [Xcode 6.4](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg) (10.9 and 10.10 SDKs), [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) (10.11 SDK) and install them in Xcode 4-8:
I made the script XcodeLegacy.sh to extract these components (the links work if you [sign in to Apple Developer](https://developer.apple.com/downloads/) first) from [Xcode 3.2.6](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) (10.4, 10.5 and 10.6 SDKs, PPC assembler, GCC 4.0 and 4.2, LLVM-GCC 4.2), [Xcode 4.6.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) (10.7 SDK), [Xcode 5.1.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) (10.8 SDK), [Xcode 6.4](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg) (10.9 and 10.10 SDKs), [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) (10.11 SDK), [Xcode 8.3.3](https://download.developer.apple.com/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip) (10.12 SDK), [Xcode 9.4.1](https://download.developer.apple.com/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip) (10.13 SDK) and install them in Xcode 4-10:

- GCC 4.0, GCC 4.2 and LLVM GCC 4.2 compilers
- GCC 4.0, GCC 4.2 and LLVM GCC 4.2 Xcode plugins
- PPC assembler
- Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11
- Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 10.12, 10.13

The script also fixes a few known bugs in the 10.4, 10.5 and 10.6 SDK.

Expand All @@ -35,7 +35,7 @@ Open a Terminal application, change to the directory where `XcodeLegacy.sh`, and
cd path/to/xcodelegacy
chmod +x XcodeLegacy.sh
```
Execute the script by typing `./XcodeLegacy.sh <arg>`. The script takes one argument, which can be "buildpackages" (to extract components from the legacy Xcode downloads to the current directory), "install" (to install the components in Xcode 4-8), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4-8).
Execute the script by typing `./XcodeLegacy.sh <arg>`. The script takes one argument, which can be "buildpackages" (to extract components from the legacy Xcode downloads to the current directory), "install" (to install the components in Xcode 4-10), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4-10).

With the "install" or "uninstall" arguments, the script uses sudo to become root, and will thus ask for your password. Please check the script contents before executing it.

Expand All @@ -51,6 +51,7 @@ Optionally, one of the following options can be passed as the *first* argument t
* `-osx1010` : only install OSX 10.10 SDK
* `-osx1011` : only install OSX 10.11 SDK
* `-osx1012` : only install OSX 10.12 SDK
* `-osx1013` : only install OSX 10.13 SDK


Using the older SDKs
Expand Down Expand Up @@ -111,6 +112,7 @@ Here are the latest versions of Xcode that are known to /run/ on each OS X versi
- [Xcode 7.2.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.2.1/Xcode_7.2.1.dmg) on OS X 10.10 (Yosemite)
- [Xcode 7.3.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_7.3.1/Xcode_7.3.1.dmg) on OS X 10.11 (El Capitan), please see note on linking below. [Xcode 8.2.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_8.2.1/Xcode_8.2.1.xip) also runs on OS X 10.11, but can only compile for macOS 10.12.
- [Xcode 8.3.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_8.3.3/Xcode8.3.3.xip) on macOS 10.12 (Sierra), please see note on linking below.
- [Xcode 9.4.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_9.4.1/Xcode_9.4.1.xip) on macOS 10.13 (High Sierra), please see note on linking below.

(*) These Xcode versions were released before 26.03.2012 and may cause an "An unknown installation error" during installation, which is due to an expired certificate. Installing these may require disabling network time sync and setting the date to 01.01.2012 before installing. Network time sync may be re-enabled after install. See [this stackexchange question](https://apple.stackexchange.com/questions/45841/xcode-4-2-snow-leopard-doesnt-install) for more details.

Expand Down Expand Up @@ -207,4 +209,5 @@ History
- 1.7 (05/04/2016): Xcode 7.3 disables support for older SDKs, fix that
- 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.1 (17/01/2017): Xcode 9 dropped 10.12 SDK, get it from Xcode 8.3.3; fix compiling with GNU Ada, and many other fixes
- 2.2 (10/01/2019): Xcode 10 dropped 10.13 SDK, get it from Xcode 9.4.1
91 changes: 79 additions & 12 deletions XcodeLegacy.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -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/
#
Expand All @@ -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.
Expand All @@ -38,6 +41,7 @@ osx109=0
osx1010=0
osx1011=0
osx1012=0
osx1013=0
gotoption=0
error=0

Expand Down Expand Up @@ -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
Expand All @@ -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):"
Expand All @@ -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"
Expand Down Expand Up @@ -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() {
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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"
;;
Expand Down Expand Up @@ -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)"
Expand Down Expand Up @@ -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

;;

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b705c20

Please sign in to comment.