Skip to content

Commit

Permalink
Added support for OS X 10.13 SDK use by Xcode 10
Browse files Browse the repository at this point in the history
- Used same method as zettemaan used for 10.12 SDK using Xcode 9.4.1 as source
- Incorporated jwhitlock's fix to use plutil to fix Xcode 10's use of binary MaxOSX.platform/Info.plist
  • Loading branch information
Nick Beadman committed Jan 10, 2019
1 parent 817eb01 commit da04a71
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 9 deletions.
13 changes: 8 additions & 5 deletions README.md
@@ -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
50 changes: 46 additions & 4 deletions XcodeLegacy.sh
Expand Up @@ -8,6 +8,7 @@
# - Eric Knibbe <EricFromCanada@github>
# - Chris Roueche <croueche@github>
# - Kris Coppieters <zwettemaan@github>
# - Nick Beadman <nbeadman@gmail.com> / <nbeadman@github>
#
# License: Creative Commons BY-NC-SA 3.0 http://creativecommons.org/licenses/by-nc-sa/3.0/
#
Expand All @@ -24,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.1KC (26/10/2017): Added support to extract OS X 10.12 from Xcode 8.2.1 for use on Xcode 9/OS X 10.13
# 2.2NB (10/01/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 @@ -39,6 +41,7 @@ osx109=0
osx1010=0
osx1011=0
osx1012=0
osx1013=0
gotoption=0
error=0

Expand Down Expand Up @@ -95,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 @@ -114,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, Xcode 7.3.1 and Xcode 8.2.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, 10.12"
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 @@ -141,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 @@ -201,6 +211,7 @@ 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 Down Expand Up @@ -288,6 +299,14 @@ case $1 in
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
Expand Down Expand Up @@ -566,7 +585,7 @@ EOF
fi
if [ "$xc8" = 1 ]; then
if [ "$osx1012" = 1 ]; then
echo "Extracting Mac OS X 10.12 from Xcode 8.3.3. Be patient - this will take some time"
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
Expand All @@ -576,6 +595,18 @@ EOF
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 @@ -982,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 @@ -1110,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 @@ -1218,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 da04a71

Please sign in to comment.