diff --git a/README.md b/README.md index 5b03066..fb87b17 100644 --- a/README.md +++ b/README.md @@ -10,29 +10,47 @@ 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](http://adcdownload.apple.com/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](http://adcdownload.apple.com/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) (10.7 SDK), [Xcode 5.1.1](http://adcdownload.apple.com/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) (10.8 SDK), [Xcode 6.4](http://adcdownload.apple.com/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg) (10.9 and 10.10 SDKs) and install them in Xcode 4/5/6/7: +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) and install them in Xcode 4/5/6/7: - 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 -In order to re-enable the GCC 4.2 plugin in Xcode 4, you may also want to edit "/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec" and change ShowInCompilerSelectionPopup to "YES" and IsNoLongerSupported to "NO". +In order to re-enable the GCC 4.2 plugin in Xcode 4-7, you may also want to edit "/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins/GCC 4.2.xcplugin/Contents/Resources/GCC 4.2.xcspec" and change ShowInCompilerSelectionPopup to "YES" and IsNoLongerSupported to "NO". Note: There may be similar tips to compile for older iOS (not Mac OS X) versions, but I don't develop for iOS. However, if you want to enhace the XcodeLegacy script to also include those components, I'll gladly integrate your modifications. Download -------- -[XcodeLegacy.sh](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy.sh) (previous versions: [1.0](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.0.sh), [1.1](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.1.sh), [1.2](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.2.sh)) +[XcodeLegacy.sh](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy.sh) (previous versions: [1.0](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.0.sh), [1.1](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.1.sh), [1.2](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.2.sh), [1.3](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.3.sh), [1.4](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.4.sh), [1.5](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.5.sh), [1.6](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.6.sh), [1.7](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.7.sh), [1.8](http://devernay.free.fr/hacks/xcodelegacy/XcodeLegacy-1.8.sh)) [GitHub repository](https://github.com/devernay/xcodelegacy) Usage ----- -Execute the script in a terminal. 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/5/6), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4/5/6). + +Open a Terminal application, change to the directory where `XcodeLegacy.sh`, and make it executable, as in: +``` +cd path/to/xcodelegacy +chmod +x XcodeLegacy.sh +``` +Execute the script by typing `./XcodeLegacy.sh `. 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/5/6), "cleanpackages" (to delete the extracted components from the current directory), "uninstall" (to uninstall the components from Xcode 4/5/6). 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. +Optionally, one of the following options can be passed as the *first* argument to `XcodeLegacy.sh`, to limit its operation: + +* `-compilers` : only install the gcc and llvm-gcc compilers, as well as the corresponding Xcode plugins +* `-osx104` : only install Mac OSX 10.4 SDK +* `-osx105` : only install Mac OSX 10.5 SDK +* `-osx106` : only install Mac OSX 10.6 SDK +* `-osx107` : only install Mac OSX 10.7 SDK +* `-osx108` : only install OSX 10.8 SDK +* `-osx109` : only install OSX 10.9 SDK +* `-osx1010` : only install OSX 10.10 SDK + + Using the older SDKs -------------------- @@ -60,12 +78,12 @@ Note on Xcode versions Here are the latest versions of Xcode that are known to /run/ on each OS X version (the links work if you [sign in to Apple Developer](https://developer.apple.com/downloads/) first): -- [Xcode 3.1.4](http://adcdownload.apple.com/Developer_Tools/xcode_3.1.4_developer_tools/xcode314_2809_developerdvd.dmg) on Mac OS X 10.5 (Leopard) -- [Xcode 3.2.6](http://adcdownload.apple.com/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg) on Mac OS X 10.6 (Snow Leopard) - [Xcode 4.0.2](http://adcdownload.apple.com/Developer_Tools/xcode_4.0.2_and_ios_sdk_4.3/xcode_4.0.2_and_ios_sdk_4.3.dmg), [Xcode 4.1](http://adcdownload.apple.com/Developer_Tools/xcode_4.1_for_snow_leopard_21110/xcode_4.1_for_snow_leopard.dmg) and [Xcode 4.2](http://adcdownload.apple.com/Developer_Tools/xcode_4.2_with_ios_5_sdk/xcode_4.2_and_ios_5_sdk_for_snow_leopard.dmg) also run on Snow Leopard, but are only available to pay members -- [Xcode 4.6.3](http://adcdownload.apple.com/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) on OS X 10.7 (Lion) -- [Xcode 5.1.1](http://adcdownload.apple.com/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) on OS X 10.8 (Mountain Lion) -- [Xcode 6.2](http://adcdownload.apple.com/Developer_Tools/Xcode_6.2/Xcode_6.2.dmg) on OS X 10.9 (Mavericks) -- [Xcode 7.2.1](http://adcdownload.apple.com/Developer_Tools/Xcode_7.2.1/Xcode_7.2.1.dmg) on OS X 10.10 (Yosemite) and OS X 10.11 (El Capitan) +- [Xcode 3.1.4](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_3.1.4_developer_tools/xcode314_2809_developerdvd.dmg) on Mac OS X 10.5 (Leopard) +- [Xcode 3.2.6](http://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) on Mac OS X 10.6 (Snow Leopard) - [Xcode 4.0.2](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.0.2_and_ios_sdk_4.3/xcode_4.0.2_and_ios_sdk_4.3.dmg), [Xcode 4.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.1_for_snow_leopard_21110/xcode_4.1_for_snow_leopard.dmg) and [Xcode 4.2](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.2_with_ios_5_sdk/xcode_4.2_and_ios_5_sdk_for_snow_leopard.dmg) also run on Snow Leopard, but are only available to pay members +- [Xcode 4.6.3](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_4.6.3/xcode4630916281a.dmg) on OS X 10.7 (Lion) +- [Xcode 5.1.1](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg) on OS X 10.8 (Mountain Lion) +- [Xcode 6.2](https://developer.apple.com/devcenter/download.action?path=/Developer_Tools/Xcode_6.2/Xcode_6.2.dmg) on OS X 10.9 (Mavericks) +- [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) and OS X 10.11 (El Capitan) More information about the compilers included in each version of Xcode can be found on the [MacPorts Wiki](https://trac.macports.org/wiki/XcodeVersionInfo). diff --git a/XcodeLegacy.sh b/XcodeLegacy.sh index 2891a49..e12a80d 100755 --- a/XcodeLegacy.sh +++ b/XcodeLegacy.sh @@ -14,10 +14,63 @@ # 1.5 (15/10/2015): Fixes for OS X 10.11 El Capitan (nothing can be installed in /usr/bin because of the sandbox) # 1.6 (11/11/2015): Fix buildpackages, fix /usr/bin/gcc on recent OS X, fix download messages # 1.7 (05/04/2016): Xcode 7.3 disables support for older SDKs, fix that - +# 1.8 (07/04/2016): add options to install only some SDKs or compilers only + +compilers=0 +osx104=0 +osx105=0 +osx106=0 +osx107=0 +osx108=0 +osx109=0 +osx1010=0 +case $1 in + -compilers) + compilers=1 + shift + ;; + -osx104) + osx104=1 + shift + ;; + -osx105) + osx105=1 + shift + ;; + -osx106) + osx106=1 + shift + ;; + -osx107) + osx107=1 + shift + ;; + -osx108) + osx108=1 + shift + ;; + -osx109) + osx109=1 + shift + ;; + -osx1010) + osx1010=1 + shift + ;; + *) + compilers=1 + osx104=1 + osx105=1 + osx106=1 + osx107=1 + osx108=1 + osx109=1 + osx1010=1 + ;; +esac if [ $# != 1 ]; then - echo "Usage: $0 buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta" + echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta" echo "Description: Extracts / installs / cleans / uninstalls the following components from Xcode 3.2.6, Xcode 4.6.3, Xcode 5.1.1 and Xcode 6.4," echo "which are not available in Xcode >= 4.2:" echo "- GCC 4.0 Xcode plugin" @@ -25,6 +78,22 @@ if [ $# != 1 ]; then echo "- GCC 4.0 and 4.2" echo "- Mac OS X SDK 10.4u, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10" echo "" + echo "An optional first argument may be provided to limit the operation (by default everything is done):" + echo " -compilers : only install the gcc and llvm-gcc compilers, as well as the corresponding Xcode plugins" + echo " -osx104 : only install Mac OSX 10.4 SDK" + echo " -osx105 : only install Mac OSX 10.5 SDK" + echo " -osx106 : only install Mac OSX 10.6 SDK" + echo " -osx107 : only install Mac OSX 10.7 SDK" + echo " -osx108 : only install OSX 10.8 SDK" + echo " -osx109 : only install OSX 10.9 SDK" + echo " -osx1010 : only install OSX 10.10 SDK" + echo "Note that these cannot be combined. For example, to build and install the 10.9" + echo "and 10.10 SDKs, one should execute:" + echo "$ $0 -osx109 buildpackages" + echo "$ $0 -osx1010 buildpackages" + echo "$ sudo $0 -osx109 install" + echo "$ sudo $0 -osx1010 install" + echo "" echo "Typically, you will want to run this script with the buildpackages argument first, then the install argument, " echo "and lastly the cleanpackages argument, in order to properly install the legacy Xcode files." echo "The install and uninstall phases have to be run with administrative rights, as in:" @@ -70,13 +139,20 @@ fi GCCFILES="usr/share/man/man7/fsf-funding.7 usr/share/man/man7/gfdl.7 usr/share/man/man7/gpl.7 usr/share/man/man1/*-4.0.1 usr/share/man/man1/*-4.0.1.1 usr/libexec/gcc/*-apple-darwin10/4.0.1 usr/lib/gcc/*-apple-darwin10/4.0.1 usr/include/gcc/darwin/4.0 usr/bin/*-4.0 usr/bin/*-4.0.1 usr/share/man/man1/*-4.2.1 usr/libexec/gcc/*-apple-darwin10/4.2.1 usr/lib/gcc/*-apple-darwin10/4.2.1 usr/include/gcc/darwin/4.2 usr/bin/*-4.2 usr/bin/*-4.2.1 usr/llvm-gcc-4.2 usr/share/man/man1/llvm-g*.1.gz usr/libexec/gcc/*-apple-darwin10/4.2.1 usr/lib/gcc/*-apple-darwin10/4.2.1 usr/include/gcc/darwin/4.2 usr/bin/*-4.2 usr/bin/*-4.2.1" + +xc3=`expr $compilers + $osx104 + $osx105 + $osx106 != 0` +xc4=`expr $compilers + $osx107 != 0` +xc5=`expr $osx108 != 0` +xc6=`expr $osx109 + $osx1010 != 0` + case $1 in buildpackages) ####################### # PHASE 1: PACKAGING # + 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 [ ! -f xcode_3.2.6_and_ios_sdk_4.3.dmg ]; then + if [ $xc3 = 1 -a ! -f xcode_3.2.6_and_ios_sdk_4.3.dmg ]; then echo "*** you should download Xcode 3.2.6. Login to:" echo " https://developer.apple.com/downloads/" echo "then download from:" @@ -84,9 +160,9 @@ case $1 in echo "or" echo " http://adcdownload.apple.com/Developer_Tools/xcode_3.2.6_and_ios_sdk_4.3__final/xcode_3.2.6_and_ios_sdk_4.3.dmg" echo "and then run this script from within the same directory as the downloaded file" - exit + missingdmg=1 fi - if [ ! -f xcode4630916281a.dmg ]; then + if [ $xc4 = 1 -a ! -f xcode4630916281a.dmg ]; then echo "*** you should download Xcode 4.6.3. Login to:" echo " https://developer.apple.com/downloads/" echo "then download from:" @@ -96,7 +172,7 @@ case $1 in echo "and then run this script from within the same directory as the downloaded file" exit fi - if [ ! -f xcode_5.1.1.dmg ]; then + if [ $xc5 = 1 -a ! -f xcode_5.1.1.dmg ]; then echo "*** you should download Xcode 5.1.1. Login to:" echo " https://developer.apple.com/downloads/" echo "then download from:" @@ -104,9 +180,9 @@ case $1 in echo "or" echo " http://adcdownload.apple.com/Developer_Tools/xcode_5.1.1/xcode_5.1.1.dmg" echo "and then run this script from within the same directory as the downloaded file" - exit + missingdmg=1 fi - if [ ! -f Xcode_6.4.dmg ]; then + if [ $xc6 = 1 -a ! -f Xcode_6.4.dmg ]; then echo "*** you should download Xcode 6.4. Login to:" echo " https://developer.apple.com/downloads/" echo "then download from:" @@ -114,59 +190,66 @@ case $1 in echo "or" echo " http://adcdownload.apple.com/Developer_Tools/Xcode_6.4/Xcode_6.4.dmg" 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 - MNTDIR=`mktemp -d mount.XXX` ATTACH_OPTS="-nobrowse -mountroot $MNTDIR" - # you should download Xcode 3.2.6 from: - # http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792 - hdiutil attach xcode_3.2.6_and_ios_sdk_4.3.dmg $ATTACH_OPTS - if [ ! -d $MNTDIR/Xcode\ and\ iOS\ SDK ]; then - echo "*** Error while trying to attach disk image xcode_3.2.6_and_ios_sdk_4.3.dmg" - echo "Aborting" - exit - fi - rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/DeveloperTools.pkg /tmp/XC3 - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet Library/Xcode/Plug-ins) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 - ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "GCC 4.0.xcplugin") |gzip -c > XcodePluginGCC40.tar.gz) && echo "*** Created XcodePluginGCC40.tar.gz in directory "`pwd` - ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "GCC 4.2.xcplugin") |gzip -c > XcodePluginGCC42.tar.gz) && echo "*** Created XcodePluginGCC42.tar.gz in directory "`pwd` - ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "LLVM GCC 4.2.xcplugin") |gzip -c > XcodePluginLLVMGCC42.tar.gz) && echo "*** Created XcodePluginLLVMGCC42.tar.gz in directory "`pwd` - # should be untarred in /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins - # gzip -dc XcodePluginGCC40.tar.gz | (cd /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; sudo tar xvf -) - - rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/DeveloperToolsCLI.pkg /tmp/XC3 - - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr/bin usr/libexec) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 - ((cd /tmp/XC3; tar cf - usr/libexec/gcc/darwin/ppc usr/libexec/gcc/darwin/ppc64) |gzip -c > XcodePPCas.tar.gz) && echo "*** Created XcodePPCas.tar.gz in directory "`pwd` - ((cd /tmp/XC3; tar cf - usr/bin/ld) |gzip -c > Xcode3ld.tar.gz) && echo "*** Created Xcode3ld.tar.gz in directory "`pwd` - - #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.0.pkg xcode_3.2.6_gcc4.0.pkg) && echo "*** Created xcode_3.2.6_gcc4.0.pkg in directory "`pwd` - rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.0.pkg /tmp/XC3 - - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 - ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3gcc40.tar.gz) && echo "*** Created Xcode3gcc40.tar.gz in directory "`pwd` - - #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.2.pkg xcode_3.2.6_gcc4.2.pkg) && echo "*** Created xcode_3.2.6_gcc4.2.pkg in directory "`pwd` - rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.2.pkg /tmp/XC3 - - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 - ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3gcc42.tar.gz) && echo "*** Created Xcode3gcc42.tar.gz in directory "`pwd` - - #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/llvm-gcc4.2.pkg xcode_3.2.6_llvm-gcc4.2.pkg) && echo "*** Created xcode_3.2.6_llvm-gcc4.2.pkg in directory "`pwd` - rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/llvm-gcc4.2.pkg /tmp/XC3 - - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 - ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3llvmgcc42.tar.gz) && echo "*** Created Xcode3llvmgcc42.tar.gz in directory "`pwd` - - rm -rf /tmp/XC3 + if [ $xc3 = 1 ]; then + # you should download Xcode 3.2.6 from: + # http://connect.apple.com/cgi-bin/WebObjects/MemberSite.woa/wa/getSoftware?bundleID=20792 + hdiutil attach xcode_3.2.6_and_ios_sdk_4.3.dmg $ATTACH_OPTS + if [ ! -d $MNTDIR/Xcode\ and\ iOS\ SDK ]; then + echo "*** Error while trying to attach disk image xcode_3.2.6_and_ios_sdk_4.3.dmg" + echo "Aborting" + exit + fi + if [ $compilers = 1 ]; then + rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/DeveloperTools.pkg /tmp/XC3 + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet Library/Xcode/Plug-ins) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 + ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "GCC 4.0.xcplugin") |gzip -c > XcodePluginGCC40.tar.gz) && echo "*** Created XcodePluginGCC40.tar.gz in directory "`pwd` + ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "GCC 4.2.xcplugin") |gzip -c > XcodePluginGCC42.tar.gz) && echo "*** Created XcodePluginGCC42.tar.gz in directory "`pwd` + ((cd /tmp/XC3/Library/Xcode/Plug-ins; tar cf - "LLVM GCC 4.2.xcplugin") |gzip -c > XcodePluginLLVMGCC42.tar.gz) && echo "*** Created XcodePluginLLVMGCC42.tar.gz in directory "`pwd` + # should be untarred in /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins + # gzip -dc XcodePluginGCC40.tar.gz | (cd /Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; sudo tar xvf -) + + rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/DeveloperToolsCLI.pkg /tmp/XC3 + + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr/bin usr/libexec) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 + ((cd /tmp/XC3; tar cf - usr/libexec/gcc/darwin/ppc usr/libexec/gcc/darwin/ppc64) |gzip -c > XcodePPCas.tar.gz) && echo "*** Created XcodePPCas.tar.gz in directory "`pwd` + ((cd /tmp/XC3; tar cf - usr/bin/ld) |gzip -c > Xcode3ld.tar.gz) && echo "*** Created Xcode3ld.tar.gz in directory "`pwd` + + #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.0.pkg xcode_3.2.6_gcc4.0.pkg) && echo "*** Created xcode_3.2.6_gcc4.0.pkg in directory "`pwd` + rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.0.pkg /tmp/XC3 + + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 + ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3gcc40.tar.gz) && echo "*** Created Xcode3gcc40.tar.gz in directory "`pwd` + + #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.2.pkg xcode_3.2.6_gcc4.2.pkg) && echo "*** Created xcode_3.2.6_gcc4.2.pkg in directory "`pwd` + rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/gcc4.2.pkg /tmp/XC3 + + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 + ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3gcc42.tar.gz) && echo "*** Created Xcode3gcc42.tar.gz in directory "`pwd` + + #(cp $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/llvm-gcc4.2.pkg xcode_3.2.6_llvm-gcc4.2.pkg) && echo "*** Created xcode_3.2.6_llvm-gcc4.2.pkg in directory "`pwd` + rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/llvm-gcc4.2.pkg /tmp/XC3 + + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet usr) #we only need these, see https://github.com/devernay/xcodelegacy/issues/8 + ((cd /tmp/XC3; tar cf - usr) |gzip -c > Xcode3llvmgcc42.tar.gz) && echo "*** Created Xcode3llvmgcc42.tar.gz in directory "`pwd` + fi + + rm -rf /tmp/XC3 - cat > /tmp/hashtable.patch < /tmp/hashtable.patch <m_next) if (this->compare (k, code, p)) EOF - test -d /tmp/XC3-10.4 && rm -rf /tmp/XC3-10.4 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.4.Universal.pkg /tmp/XC3-10.4 - (cd /tmp/XC3-10.4;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.4u.sdk) - # should we install more than these? (fixed includes?) - # Add links to libstdc++ so that "g++-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" works - ln -s ../../../i686-apple-darwin10/4.0.1/libstdc++.dylib /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/libstdc++.dylib - # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" works - ln -s libstdc++.6.dylib /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/lib/libstdc++.dylib - # Fix tr1/hashtable - # see http://www.openfst.org/twiki/bin/view/FST/CompilingOnMacOSX https://gcc.gnu.org/ml/libstdc++/2005-08/msg00017.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23053 - # in SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/tr1/hashtable - (cd /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/tr1; patch -p0 -d. < /tmp/hashtable.patch) - ((cd /tmp/XC3-10.4; tar cf - SDKs/MacOSX10.4u.sdk) |gzip -c > Xcode104SDK.tar.gz) && echo "*** Created Xcode104SDK.tar.gz in directory "`pwd` - rm -rf /tmp/XC3-10.4 - - test -d /tmp/XC3-10.5 && rm -rf /tmp/XC3-10.5 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.5.pkg /tmp/XC3-10.5 - (cd /tmp/XC3-10.5;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.5.sdk) - # should we install more than these? (fixed includes?) - # Add links to libstdc++ so that "g++-4.0 -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" works - ln -s ../../../i686-apple-darwin10/4.0.1/libstdc++.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/libstdc++.dylib - ln -s ../../../i686-apple-darwin10/4.2.1/libstdc++.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/libstdc++.dylib - # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" works - ln -s libstdc++.6.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libstdc++.dylib - # fix AvailabilityInternal.h (see https://trac.macports.org/wiki/LeopardSDKFixes) - sed -i.orig -e 's/define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6/define __MAC_OS_X_VERSION_MAX_ALLOWED 1058/' /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/include/AvailabilityInternal.h - # Fix tr1/hashtable - # see http://www.openfst.org/twiki/bin/view/FST/CompilingOnMacOSX https://gcc.gnu.org/ml/libstdc++/2005-08/msg00017.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23053 - # in SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/tr1/hashtable - # this also affects g++-4.2, since usr/include/c++/4.2.1 links to usr/include/c++/4.0.0 - (cd /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/tr1; patch -p0 -d. < /tmp/hashtable.patch) - rm /tmp/hashtable.patch - - test -d /tmp/XC3 && rm -rf /tmp/XC3 - pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.6.pkg /tmp/XC3 - (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.6.sdk) - # should we install more than these? (fixed includes?) - # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.6.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" works - ln -s libstdc++.6.dylib /tmp/XC3/SDKs/MacOSX10.6.sdk/usr/lib/libstdc++.dylib - - # we also need to copy /usr/lib/libgcc_s.10.5.dylib from 10.6 SDK to 10.5SDK, see https://trac.macports.org/wiki/LeopardSDKFixes - # This should fix compiling the following: - # int main() { __uint128_t a = 100; __uint128_t b = 200; __uint128_t c = a / b; return 0; } - # with clang -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 conftest1.c - cp /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib.bak - cp /tmp/XC3/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.10.5.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib - - ((cd /tmp/XC3-10.5; tar cf - SDKs/MacOSX10.5.sdk) |gzip -c > Xcode105SDK.tar.gz) && echo "*** Created Xcode105SDK.tar.gz in directory "`pwd` - ((cd /tmp/XC3; tar cf - SDKs/MacOSX10.6.sdk) |gzip -c > Xcode106SDK.tar.gz) && echo "*** Created Xcode106SDK.tar.gz in directory "`pwd` - - rm -rf /tmp/XC3-10.5 /tmp/XC3 - hdiutil detach $MNTDIR/Xcode\ and\ iOS\ SDK - - hdiutil attach xcode4630916281a.dmg $ATTACH_OPTS - if [ ! -d $MNTDIR/Xcode ]; then - echo "*** Error while trying to attach disk image xcode4630916281a.dmg" - echo "Aborting" - rmdir $MNTDIR - exit + fi + + if [ $osx104 = 1 ]; then + test -d /tmp/XC3-10.4 && rm -rf /tmp/XC3-10.4 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.4.Universal.pkg /tmp/XC3-10.4 + (cd /tmp/XC3-10.4;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.4u.sdk) + # should we install more than these? (fixed includes?) + # Add links to libstdc++ so that "g++-4.0 -isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" works + ln -s ../../../i686-apple-darwin10/4.0.1/libstdc++.dylib /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/libstdc++.dylib + # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4" works + ln -s libstdc++.6.dylib /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/lib/libstdc++.dylib + # Fix tr1/hashtable + # see http://www.openfst.org/twiki/bin/view/FST/CompilingOnMacOSX https://gcc.gnu.org/ml/libstdc++/2005-08/msg00017.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23053 + # in SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/tr1/hashtable + (cd /tmp/XC3-10.4/SDKs/MacOSX10.4u.sdk/usr/include/c++/4.0.0/tr1; patch -p0 -d. < /tmp/hashtable.patch) + ((cd /tmp/XC3-10.4; tar cf - SDKs/MacOSX10.4u.sdk) |gzip -c > Xcode104SDK.tar.gz) && echo "*** Created Xcode104SDK.tar.gz in directory "`pwd` + rm -rf /tmp/XC3-10.4 + fi + + if [ $osx105 = 1 ]; then + test -d /tmp/XC3-10.5 && rm -rf /tmp/XC3-10.5 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.5.pkg /tmp/XC3-10.5 + (cd /tmp/XC3-10.5;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.5.sdk) + # should we install more than these? (fixed includes?) + # Add links to libstdc++ so that "g++-4.0 -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" works + ln -s ../../../i686-apple-darwin10/4.0.1/libstdc++.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.0.1/libstdc++.dylib + ln -s ../../../i686-apple-darwin10/4.2.1/libstdc++.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/gcc/i686-apple-darwin10/4.2.1/libstdc++.dylib + # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" works + ln -s libstdc++.6.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libstdc++.dylib + # fix AvailabilityInternal.h (see https://trac.macports.org/wiki/LeopardSDKFixes) + sed -i.orig -e 's/define __MAC_OS_X_VERSION_MAX_ALLOWED __MAC_10_6/define __MAC_OS_X_VERSION_MAX_ALLOWED 1058/' /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/include/AvailabilityInternal.h + # Fix tr1/hashtable + # see http://www.openfst.org/twiki/bin/view/FST/CompilingOnMacOSX https://gcc.gnu.org/ml/libstdc++/2005-08/msg00017.html https://gcc.gnu.org/bugzilla/show_bug.cgi?id=23053 + # in SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/tr1/hashtable + # this also affects g++-4.2, since usr/include/c++/4.2.1 links to usr/include/c++/4.0.0 + (cd /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/include/c++/4.0.0/tr1; patch -p0 -d. < /tmp/hashtable.patch) + fi + + if [ $osx104 = 1 -o $osx105 = 1 ]; then + rm /tmp/hashtable.patch + fi + + if [ $osx105 = 1 -o $osx106 = 1 ]; then + test -d /tmp/XC3 && rm -rf /tmp/XC3 + pkgutil --expand $MNTDIR/Xcode\ and\ iOS\ SDK/Packages/MacOSX10.6.pkg /tmp/XC3 + (cd /tmp/XC3;gzip -dc Payload |cpio -id --quiet SDKs/MacOSX10.6.sdk) + # should we install more than these? (fixed includes?) + # Add links to libstdc++ so that "clang++ -stdlib=libstdc++ -isysroot /Developer/SDKs/MacOSX10.6.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" works + ln -s libstdc++.6.dylib /tmp/XC3/SDKs/MacOSX10.6.sdk/usr/lib/libstdc++.dylib + + if [ $osx105 = 1 ]; then + # we also need to copy /usr/lib/libgcc_s.10.5.dylib from 10.6 SDK to 10.5SDK, see https://trac.macports.org/wiki/LeopardSDKFixes + # This should fix compiling the following: + # int main() { __uint128_t a = 100; __uint128_t b = 200; __uint128_t c = a / b; return 0; } + # with clang -isysroot /Developer/SDKs/MacOSX10.5.sdk -Wl,-syslibroot,/Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5 conftest1.c + cp /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib.bak + cp /tmp/XC3/SDKs/MacOSX10.6.sdk/usr/lib/libgcc_s.10.5.dylib /tmp/XC3-10.5/SDKs/MacOSX10.5.sdk/usr/lib/libgcc_s.10.5.dylib + + ((cd /tmp/XC3-10.5; tar cf - SDKs/MacOSX10.5.sdk) |gzip -c > Xcode105SDK.tar.gz) && echo "*** Created Xcode105SDK.tar.gz in directory "`pwd` + fi + if [ $osx106 = 1 ]; then + ((cd /tmp/XC3; tar cf - SDKs/MacOSX10.6.sdk) |gzip -c > Xcode106SDK.tar.gz) && echo "*** Created Xcode106SDK.tar.gz in directory "`pwd` + fi + rm -rf /tmp/XC3-10.5 /tmp/XC3 + fi + hdiutil detach $MNTDIR/Xcode\ and\ iOS\ SDK fi - ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.7.sdk) |gzip -c > Xcode107SDK.tar.gz) && echo "*** Created Xcode107SDK.tar.gz in directory "`pwd` - ((cd $MNTDIR/Xcode/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; tar cf - "GCC 4.2.xcplugin") |gzip -c > XcodePluginGCC42-Xcode4.tar.gz) && echo "*** Created XcodePluginGCC42-Xcode4.tar.gz in directory "`pwd` - ((cd $MNTDIR/Xcode/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; tar cf - "LLVM GCC 4.2.xcplugin") |gzip -c > XcodePluginLLVMGCC42.tar.gz) && echo "*** Created XcodePluginLLVMGCC42.tar.gz in directory "`pwd` - hdiutil detach $MNTDIR/Xcode - hdiutil attach xcode_5.1.1.dmg $ATTACH_OPTS - if [ ! -d $MNTDIR/Xcode ]; then - echo "*** Error while trying to attach disk image xcode_5.1.1.dmg" - echo "Aborting" - rmdir $MNTDIR - exit + if [ $xc4 = 1 ]; then + hdiutil attach xcode4630916281a.dmg $ATTACH_OPTS + if [ ! -d $MNTDIR/Xcode ]; then + echo "*** Error while trying to attach disk image xcode4630916281a.dmg" + echo "Aborting" + rmdir $MNTDIR + exit + fi + if [ $osx107 = 1 ]; then + ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.7.sdk) |gzip -c > Xcode107SDK.tar.gz) && echo "*** Created Xcode107SDK.tar.gz in directory "`pwd` + fi + if [ $compilers = 1 ]; then + ((cd $MNTDIR/Xcode/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; tar cf - "GCC 4.2.xcplugin") |gzip -c > XcodePluginGCC42-Xcode4.tar.gz) && echo "*** Created XcodePluginGCC42-Xcode4.tar.gz in directory "`pwd` + ((cd $MNTDIR/Xcode/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer/Library/Xcode/Plug-ins; tar cf - "LLVM GCC 4.2.xcplugin") |gzip -c > XcodePluginLLVMGCC42.tar.gz) && echo "*** Created XcodePluginLLVMGCC42.tar.gz in directory "`pwd` + fi + hdiutil detach $MNTDIR/Xcode fi - ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.8.sdk) |gzip -c > Xcode108SDK.tar.gz) && echo "*** Created Xcode108SDK.tar.gz in directory "`pwd` - hdiutil detach $MNTDIR/Xcode - hdiutil attach Xcode_6.4.dmg $ATTACH_OPTS - if [ ! -d $MNTDIR/Xcode ]; then - echo "*** Error while trying to attach disk image Xcode_6.4.dmg" - echo "Aborting" - rmdir $MNTDIR - exit + if [ $xc5 = 1 ]; then + hdiutil attach xcode_5.1.1.dmg $ATTACH_OPTS + if [ ! -d $MNTDIR/Xcode ]; then + echo "*** Error while trying to attach disk image xcode_5.1.1.dmg" + echo "Aborting" + rmdir $MNTDIR + exit + fi + if [ $osx108 = 1 ]; then + ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.8.sdk) |gzip -c > Xcode108SDK.tar.gz) && echo "*** Created Xcode108SDK.tar.gz in directory "`pwd` + fi + hdiutil detach $MNTDIR/Xcode + fi + + if [ $xc6 = 1 ]; then + hdiutil attach Xcode_6.4.dmg $ATTACH_OPTS + if [ ! -d $MNTDIR/Xcode ]; then + echo "*** Error while trying to attach disk image Xcode_6.4.dmg" + echo "Aborting" + rmdir $MNTDIR + exit + fi + if [ $osx109 = 1 ]; then + ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.9.sdk) |gzip -c > Xcode109SDK.tar.gz) && echo "*** Created Xcode109SDK.tar.gz in directory "`pwd` + fi + if [ $osx1010 = 1 ]; then + ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.10.sdk) |gzip -c > Xcode1010SDK.tar.gz) && echo "*** Created Xcode1010SDK.tar.gz in directory "`pwd` + fi + hdiutil detach $MNTDIR/Xcode fi - ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.9.sdk) |gzip -c > Xcode109SDK.tar.gz) && echo "*** Created Xcode109SDK.tar.gz in directory "`pwd` - ((cd $MNTDIR/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer; tar cf - SDKs/MacOSX10.10.sdk) |gzip -c > Xcode1010SDK.tar.gz) && echo "*** Created Xcode1010SDK.tar.gz in directory "`pwd` - hdiutil detach $MNTDIR/Xcode rmdir $MNTDIR ;; @@ -300,54 +414,55 @@ EOF echo "*** Error: could not find Xcode 4.2 in /Developer nor Xcode 4.3 in /Applications/Xcode.app, cannot install" exit 1 fi - if [ -d "$PLUGINDIR/GCC 4.0.xcplugin" ]; then - echo "*** Not installing XcodePluginGCC40.tar.gz (found installed in $PLUGINDIR/GCC 4.0.xcplugin, uninstall first to force install)" - else - (gzip -dc XcodePluginGCC40.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.0.xcplugin/legacy" && echo "*** installed XcodePluginGCC40.tar.gz" - fi - if [ -d "$PLUGINDIR/GCC 4.2.xcplugin" ]; then - echo "*** Not installing XcodePluginGCC42.tar.gz (found installed in $PLUGINDIR/GCC 4.2.xcplugin, uninstall first to force install)" - else - (gzip -dc XcodePluginGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginGCC42.tar.gz" - fi - if [ -d "$PLUGINDIR/LLVM GCC 4.2.xcplugin" ]; then - echo "*** Not installing XcodePluginLLVMGCC42.tar.gz (found installed in $PLUGINDIR/LLVM GCC 4.2.xcplugin, uninstall first to force install)" - else - (gzip -dc XcodePluginLLVMGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginLLVMGCC42.tar.gz" - fi + if [ $compilers = 1 ]; then + if [ -d "$PLUGINDIR/GCC 4.0.xcplugin" ]; then + echo "*** Not installing XcodePluginGCC40.tar.gz (found installed in $PLUGINDIR/GCC 4.0.xcplugin, uninstall first to force install)" + else + (gzip -dc XcodePluginGCC40.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.0.xcplugin/legacy" && echo "*** installed XcodePluginGCC40.tar.gz" + fi + if [ -d "$PLUGINDIR/GCC 4.2.xcplugin" ]; then + echo "*** Not installing XcodePluginGCC42.tar.gz (found installed in $PLUGINDIR/GCC 4.2.xcplugin, uninstall first to force install)" + else + (gzip -dc XcodePluginGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginGCC42.tar.gz" + fi + if [ -d "$PLUGINDIR/LLVM GCC 4.2.xcplugin" ]; then + echo "*** Not installing XcodePluginLLVMGCC42.tar.gz (found installed in $PLUGINDIR/LLVM GCC 4.2.xcplugin, uninstall first to force install)" + else + (gzip -dc XcodePluginLLVMGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginLLVMGCC42.tar.gz" + fi - if [ -f "$GCCDIR/usr/libexec/gcc/darwin/ppc/as" ]; then - echo "*** Not installing XcodePPCas.tar.gz (found installed in $GCCDIR/usr/libexec/gcc/darwin/ppc/as, uninstall first to force install)" - else - (gzip -dc XcodePPCas.tar.gz | (cd "$GCCDIR"; tar xf -)) - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc" - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/as" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc/as" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc64/as" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64/as" - echo "*** installed XcodePPCas.tar.gz" - fi + if [ -f "$GCCDIR/usr/libexec/gcc/darwin/ppc/as" ]; then + echo "*** Not installing XcodePPCas.tar.gz (found installed in $GCCDIR/usr/libexec/gcc/darwin/ppc/as, uninstall first to force install)" + else + (gzip -dc XcodePPCas.tar.gz | (cd "$GCCDIR"; tar xf -)) + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc" + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/as" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc/as" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc64/as" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64/as" + echo "*** installed XcodePPCas.tar.gz" + fi - if [ -f "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" ]; then - echo "*** Not installing Xcode3ld.tar.gz (found installed in $GCCDIR/usr/libexec/gcc/darwin/ppc/ld, uninstall first to force install)" - else - mkdir -p "$GCCDIR/tmp" - (gzip -dc Xcode3ld.tar.gz | (cd "$GCCDIR/tmp"; tar xf -)) - cp "$GCCDIR/tmp/usr/bin/ld" "$GCCDIR/usr/libexec/gcc/darwin/ppc/" - cp "$GCCDIR/tmp/usr/bin/ld" "$GCCDIR/usr/libexec/gcc/darwin/ppc64/" - rm -rf "$GCCDIR/tmp" - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc" - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400" - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970" - mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc/ld" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400/ld" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970/ld" - ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc64/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64/ld" - # prevent overwriting the original ld if the script is run twice - if [ ! -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" ]; then - mv "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" - fi - cat <> "$GCCDIR"/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld + if [ -f "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" ]; then + echo "*** Not installing Xcode3ld.tar.gz (found installed in $GCCDIR/usr/libexec/gcc/darwin/ppc/ld, uninstall first to force install)" + else + mkdir -p "$GCCDIR/tmp" + (gzip -dc Xcode3ld.tar.gz | (cd "$GCCDIR/tmp"; tar xf -)) + cp "$GCCDIR/tmp/usr/bin/ld" "$GCCDIR/usr/libexec/gcc/darwin/ppc/" + cp "$GCCDIR/tmp/usr/bin/ld" "$GCCDIR/usr/libexec/gcc/darwin/ppc64/" + rm -rf "$GCCDIR/tmp" + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc" + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400" + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970" + mkdir -p "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc/ld" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400/ld" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970/ld" + ln -sf "$GCCDIR/usr/libexec/gcc/darwin/ppc64/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64/ld" + # prevent overwriting the original ld if the script is run twice + if [ ! -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" ]; then + mv "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" + fi + cat <> "$GCCDIR"/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld #!/bin/bash ARCH='' @@ -412,13 +527,13 @@ fi exit \$LD_RESULT LD_EOF - chmod +x "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" - echo "*** installed Xcode3ld.tar.gz" - fi + chmod +x "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" + echo "*** installed Xcode3ld.tar.gz" + fi - if [ -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" ]; then - echo "*** Not modifying MacOSX Architectures.xcspec (found original at $SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original, uninstall first to force install)" - else + if [ -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" ]; then + echo "*** Not modifying MacOSX Architectures.xcspec (found original at $SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original, uninstall first to force install)" + else mv "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" { awk 'NR>1{print l}{l=$0}' "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original"; cat - < "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" { @@ -461,127 +576,150 @@ LD_EOF }, ) SPEC_EOF - echo "*** modified MacOSX Architectures.xcspec" + echo "*** modified MacOSX Architectures.xcspec" + fi fi - - # Xcode >= 7.3 disables support for older SDKs in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist - # see https://github.com/devernay/xcodelegacy/issues/23 - if [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" ]; then - echo "*** Not modifying MacOSX Info.plist (found original at $GCCDIR/Platforms/MacOSX.platform/Info.plist-original, uninstall first to force install)" - elif [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist" ]; then - mv "$GCCDIR/Platforms/MacOSX.platform/Info.plist" "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" - sed -e '/MinimumSDKVersion/{N;d;}' < "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" > "$GCCDIR/Platforms/MacOSX.platform/Info.plist" - echo "*** modified MacOSX Info.plist" + + if [ $osx104 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.4u.sdk" ]; then + echo "*** Not installing Xcode104SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.4u.sdk, uninstall first to force install)" + else + (gzip -dc Xcode104SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode104SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.4u.sdk/legacy" + fi fi - if [ -d "$SDKDIR/SDKs/MacOSX10.4u.sdk" ]; then - echo "*** Not installing Xcode104SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.4u.sdk, uninstall first to force install)" - else - (gzip -dc Xcode104SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode104SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.4u.sdk/legacy" - fi - if [ -d "$SDKDIR/SDKs/MacOSX10.5.sdk" ]; then - echo "*** Not installing Xcode105SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.5.sdk, uninstall first to force install)" - else - (gzip -dc Xcode105SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode105SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.5.sdk/legacy" - fi - if [ -d "$SDKDIR/SDKs/MacOSX10.6.sdk" ]; then - echo "*** Not installing Xcode106SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.6.sdk, uninstall first to force install)" - else - (gzip -dc Xcode106SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode106SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.6.sdk/legacy" + if [ $osx105 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.5.sdk" ]; then + echo "*** Not installing Xcode105SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.5.sdk, uninstall first to force install)" + else + (gzip -dc Xcode105SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode105SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.5.sdk/legacy" + fi fi - if [ -d "$SDKDIR/SDKs/MacOSX10.7.sdk" ]; then - echo "*** Not installing Xcode107SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.7.sdk, uninstall first to force install)" - else - (gzip -dc Xcode107SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode107SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.7.sdk/legacy" + + if [ $osx106 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.6.sdk" ]; then + echo "*** Not installing Xcode106SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.6.sdk, uninstall first to force install)" + else + (gzip -dc Xcode106SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode106SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.6.sdk/legacy" + fi fi - if [ -d "$SDKDIR/SDKs/MacOSX10.8.sdk" ]; then - echo "*** Not installing Xcode108SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.8.sdk, uninstall first to force install)" - else - (gzip -dc Xcode108SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode108SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.8.sdk/legacy" + + if [ $osx107 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.7.sdk" ]; then + echo "*** Not installing Xcode107SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.7.sdk, uninstall first to force install)" + else + (gzip -dc Xcode107SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode107SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.7.sdk/legacy" + fi fi - if [ -d "$SDKDIR/SDKs/MacOSX10.9.sdk" ]; then - echo "*** Not installing Xcode109SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.9.sdk, uninstall first to force install)" - else - (gzip -dc Xcode109SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode109SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.9.sdk/legacy" + + if [ $osx108 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.8.sdk" ]; then + echo "*** Not installing Xcode108SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.8.sdk, uninstall first to force install)" + else + (gzip -dc Xcode108SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode108SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.8.sdk/legacy" + fi fi - if [ -d "$SDKDIR/SDKs/MacOSX10.10.sdk" ]; then - echo "*** Not installing Xcode1010SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.10.sdk, uninstall first to force install)" - else - (gzip -dc Xcode1010SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode1010SDK.tar.gz" - touch "$SDKDIR/SDKs/MacOSX10.10.sdk/legacy" + + if [ $osx109 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.9.sdk" ]; then + echo "*** Not installing Xcode109SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.9.sdk, uninstall first to force install)" + else + (gzip -dc Xcode109SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode109SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.9.sdk/legacy" + fi fi - 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)" - echo "*** Not installing Xcode3gcc40.tar.gz (found installed in /usr/bin/gcc-4.0, uninstall first to force install)" - elif [ -f "$GCCINSTALLDIR/usr/bin/gcc-4.0" ]; then - echo "*** Not installing Xcode3gcc40.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/gcc-4.0, uninstall first to force install)" - else - echo "*** Installing GCC 4.0" - #installer -pkg xcode_3.2.6_gcc4.0.pkg -target / - (gzip -dc Xcode3gcc40.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3gcc40.tar.gz" - fi - if [ -f /usr/bin/gcc-4.2 ]; then - #echo "*** Not installing xcode_3.2.6_gcc4.2.pkg (found installed in /usr/bin/gcc-4.2, uninstall first to force install)" - echo "*** Not installing Xcode3gcc42.tar.gz (found installed in /usr/bin/gcc-4.2, uninstall first to force install)" - elif [ -f "$GCCINSTALLDIR/usr/bin/gcc-4.2" ]; then - echo "*** Not installing Xcode3gcc42.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/gcc-4.2, uninstall first to force install)" - else - echo "*** Installing GCC 4.2" - #installer -pkg xcode_3.2.6_gcc4.2.pkg -target / - (gzip -dc Xcode3gcc42.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3gcc42.tar.gz" - fi - if [ -f /usr/bin/llvm-gcc-4.2 ]; then - #echo "*** Not installing xcode_3.2.6_llvm-gcc4.2.pkg (found installed in /usr/bin/llvm-gcc-4.2, uninstall first to force install)" - echo "*** Not installing Xcode3llvmgcc42.tar.gz (found installed in /usr/bin/llvm-gcc-4.2, uninstall first to force install)" - elif [ -f "$GCCINSTALLDIR/usr/bin/llvm-gcc-4.2" ]; then - echo "*** Not installing Xcode3llvmgcc42.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/llvm-gcc-4.2, uninstall first to force install)" - else - echo "*** Installing LLVM GCC 4.2" - #installer -pkg xcode_3.2.6_llvm-gcc4.2.pkg -target / - (gzip -dc Xcode3llvmgcc42.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3llvmgcc42.tar.gz" + if [ $osx1010 = 1 ]; then + if [ -d "$SDKDIR/SDKs/MacOSX10.10.sdk" ]; then + echo "*** Not installing Xcode1010SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.10.sdk, uninstall first to force install)" + else + (gzip -dc Xcode1010SDK.tar.gz | (cd "$SDKDIR"; tar xf -)) && echo "*** installed Xcode1010SDK.tar.gz" + touch "$SDKDIR/SDKs/MacOSX10.10.sdk/legacy" + fi fi - - echo "*** Create symbolic links to compliers in $GCCDIR and $GCCLINKDIR:" - if [ ! -d "$GCCDIR"/usr/bin ]; then - mkdir -p "$GCCDIR"/usr/bin - fi - if [ ! -d "$GCCLINKDIR"/bin ]; then - mkdir -p "$GCCLINKDIR"/bin - fi - for v in 4.0 4.2 4.0.1 4.2.1; do - for i in c++ cpp g++ gcc gcov llvm-cpp llvm-g++ llvm-gcc; do - for p in i686-apple-darwin10- powerpc-apple-darwin10- ""; do - if [ -f "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} ]; then - echo "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} exists - if [ ! -f "$GCCLINKDIR"/bin/${p}${i}-${v} ]; then - echo "* creating link $GCCLINKDIR/bin/${p}${i}-${v}" - ln -sf "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} "$GCCLINKDIR"/bin/${p}${i}-${v} - fi - if [ ! -f "$GCCDIR"/usr/bin/${p}${i}-${v} ]; then - echo "* creating link $GCCDIR/usr/bin/${i}-${v}" - ln -sf "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} "$GCCDIR"/usr/bin/${p}${i}-${v} + + 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)" + echo "*** Not installing Xcode3gcc40.tar.gz (found installed in /usr/bin/gcc-4.0, uninstall first to force install)" + elif [ -f "$GCCINSTALLDIR/usr/bin/gcc-4.0" ]; then + echo "*** Not installing Xcode3gcc40.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/gcc-4.0, uninstall first to force install)" + else + echo "*** Installing GCC 4.0" + #installer -pkg xcode_3.2.6_gcc4.0.pkg -target / + (gzip -dc Xcode3gcc40.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3gcc40.tar.gz" + fi + if [ -f /usr/bin/gcc-4.2 ]; then + #echo "*** Not installing xcode_3.2.6_gcc4.2.pkg (found installed in /usr/bin/gcc-4.2, uninstall first to force install)" + echo "*** Not installing Xcode3gcc42.tar.gz (found installed in /usr/bin/gcc-4.2, uninstall first to force install)" + elif [ -f "$GCCINSTALLDIR/usr/bin/gcc-4.2" ]; then + echo "*** Not installing Xcode3gcc42.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/gcc-4.2, uninstall first to force install)" + else + echo "*** Installing GCC 4.2" + #installer -pkg xcode_3.2.6_gcc4.2.pkg -target / + (gzip -dc Xcode3gcc42.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3gcc42.tar.gz" + fi + if [ -f /usr/bin/llvm-gcc-4.2 ]; then + #echo "*** Not installing xcode_3.2.6_llvm-gcc4.2.pkg (found installed in /usr/bin/llvm-gcc-4.2, uninstall first to force install)" + echo "*** Not installing Xcode3llvmgcc42.tar.gz (found installed in /usr/bin/llvm-gcc-4.2, uninstall first to force install)" + elif [ -f "$GCCINSTALLDIR/usr/bin/llvm-gcc-4.2" ]; then + echo "*** Not installing Xcode3llvmgcc42.tar.gz (found installed in $GCCINSTALLDIR/usr/bin/llvm-gcc-4.2, uninstall first to force install)" + else + echo "*** Installing LLVM GCC 4.2" + #installer -pkg xcode_3.2.6_llvm-gcc4.2.pkg -target / + (gzip -dc Xcode3llvmgcc42.tar.gz | (cd "$GCCINSTALLDIR"; tar xf -)) && echo "*** installed Xcode3llvmgcc42.tar.gz" + fi + + echo "*** Create symbolic links to compliers in $GCCDIR and $GCCLINKDIR:" + if [ ! -d "$GCCDIR"/usr/bin ]; then + mkdir -p "$GCCDIR"/usr/bin + fi + if [ ! -d "$GCCLINKDIR"/bin ]; then + mkdir -p "$GCCLINKDIR"/bin + fi + for v in 4.0 4.2 4.0.1 4.2.1; do + for i in c++ cpp g++ gcc gcov llvm-cpp llvm-g++ llvm-gcc; do + for p in i686-apple-darwin10- powerpc-apple-darwin10- ""; do + if [ -f "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} ]; then + echo "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} exists + if [ ! -f "$GCCLINKDIR"/bin/${p}${i}-${v} ]; then + echo "* creating link $GCCLINKDIR/bin/${p}${i}-${v}" + ln -sf "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} "$GCCLINKDIR"/bin/${p}${i}-${v} + fi + if [ ! -f "$GCCDIR"/usr/bin/${p}${i}-${v} ]; then + echo "* creating link $GCCDIR/usr/bin/${i}-${v}" + ln -sf "$GCCINSTALLDIR"/usr/bin/${p}${i}-${v} "$GCCDIR"/usr/bin/${p}${i}-${v} + fi fi - fi + done done done - done - # fix /usr/bin/gcc, see https://github.com/devernay/xcodelegacy/issues/19 - if [ -x /usr/bin/gcc -a ! -x "$GCCINSTALLDIR/usr/bin/gcc" -a -x "$GCCINSTALLDIR/usr/bin/clang" ]; then - # "xcode-select -r" sets /usr/bin/gcc to be the first gcc found in $GCCINSTALLDIR, which happens to be - # the directory $GCCINSTALLDIR/usr/libexec/gcc, and results in the following error: - # $ gcc - # gcc: error: can't exec '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/gcc' (errno=Permission denied) - # by putting a link to clang (which is the default Xcode behavior), we fix this - ln -s clang "$GCCINSTALLDIR/usr/bin/gcc" - # run gcc once so that xcode-select finds the right file for gcc - gcc 1>/dev/null 2>/dev/null + # fix /usr/bin/gcc, see https://github.com/devernay/xcodelegacy/issues/19 + if [ -x /usr/bin/gcc -a ! -x "$GCCINSTALLDIR/usr/bin/gcc" -a -x "$GCCINSTALLDIR/usr/bin/clang" ]; then + # "xcode-select -r" sets /usr/bin/gcc to be the first gcc found in $GCCINSTALLDIR, which happens to be + # the directory $GCCINSTALLDIR/usr/libexec/gcc, and results in the following error: + # $ gcc + # gcc: error: can't exec '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/libexec/gcc' (errno=Permission denied) + # by putting a link to clang (which is the default Xcode behavior), we fix this + ln -s clang "$GCCINSTALLDIR/usr/bin/gcc" + # run gcc once so that xcode-select finds the right file for gcc + gcc 1>/dev/null 2>/dev/null + fi + fi + + # Xcode >= 7.3 disables support for older SDKs in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist + # see https://github.com/devernay/xcodelegacy/issues/23 + if [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" ]; then + echo "*** Not modifying MacOSX Info.plist (found original at $GCCDIR/Platforms/MacOSX.platform/Info.plist-original, uninstall first to force install)" + elif [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist" ]; then + mv "$GCCDIR/Platforms/MacOSX.platform/Info.plist" "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" + sed -e '/MinimumSDKVersion/{N;d;}' < "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" > "$GCCDIR/Platforms/MacOSX.platform/Info.plist" + echo "*** modified MacOSX Info.plist" fi ;; @@ -590,7 +728,31 @@ SPEC_EOF # PHASE 3: CLEANING # - rm XcodePluginGCC40.tar.gz XcodePPCas.tar.gz Xcode3ld.tar.gz xcode_3.2.6_gcc4.0.pkg xcode_3.2.6_gcc4.2.pkg xcode_3.2.6_llvm-gcc4.2.pkg Xcode104SDK.tar.gz Xcode105SDK.tar.gz Xcode106SDK.tar.gz Xcode107SDK.tar.gz Xcode108SDK.tar.gz Xcode109SDK.tar.gz Xcode1010SDK.tar.gz XcodePluginGCC42-Xcode4.tar.gz XcodePluginGCC42.tar.gz XcodePluginLLVMGCC42.tar.gz Xcode3gcc40.tar.gz Xcode3gcc42.tar.gz Xcode3llvmgcc42.tar.gz 2>/dev/null + if [ $compilers = 1 ]; then + rm XcodePluginGCC40.tar.gz XcodePPCas.tar.gz Xcode3ld.tar.gz xcode_3.2.6_gcc4.0.pkg xcode_3.2.6_gcc4.2.pkg xcode_3.2.6_llvm-gcc4.2.pkg XcodePluginGCC42-Xcode4.tar.gz XcodePluginGCC42.tar.gz XcodePluginLLVMGCC42.tar.gz Xcode3gcc40.tar.gz Xcode3gcc42.tar.gz Xcode3llvmgcc42.tar.gz 2>/dev/null + fi + #for i in 10.4u 10.5 10.6 10.7 10.8 10.9 10.10; do + if [ $osx104 = 1 ]; then + rm Xcode104SDK.tar.gz 2>/dev/null + fi + if [ $osx105 = 1 ]; then + rm Xcode105SDK.tar.gz 2>/dev/null + fi + if [ $osx106 = 1 ]; then + rm Xcode106SDK.tar.gz 2>/dev/null + fi + if [ $osx107 = 1 ]; then + rm Xcode107SDK.tar.gz 2>/dev/null + fi + if [ $osx108 = 1 ]; then + rm Xcode108SDK.tar.gz 2>/dev/null + fi + if [ $osx109 = 1 ]; then + rm Xcode109SDK.tar.gz 2>/dev/null + fi + if [ $osx1010 = 1 ]; then + rm Xcode1010SDK.tar.gz 2>/dev/null + fi ;; @@ -603,55 +765,86 @@ SPEC_EOF exit 1 fi - if [ -f "$PLUGINDIR/GCC 4.0.xcplugin/legacy" ]; then - rm -rf "$PLUGINDIR/GCC 4.0.xcplugin" + if [ $compilers = 1 ]; then + if [ -f "$PLUGINDIR/GCC 4.0.xcplugin/legacy" ]; then + rm -rf "$PLUGINDIR/GCC 4.0.xcplugin" + fi + if [ -f "$PLUGINDIR/GCC 4.2.xcplugin/legacy" ]; then + rm -rf "$PLUGINDIR/GCC 4.2.xcplugin" + fi + if [ -f "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" ]; then + rm -rf "$PLUGINDIR/LLVM GCC 4.2.xcplugin" + fi + rm -rf "$GCCDIR/usr/libexec/gcc/darwin/ppc" "$GCCDIR/usr/libexec/gcc/darwin/ppc64" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970" + rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64" + if [ -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" ]; then + rm "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" + mv -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" + fi + (cd "$GCCDIR"; rm -rf $GCCFILES) + (cd "$GCCINSTALLDIR"; rm -rf $GCCFILES) + rmdir "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld" "$GCCDIR/usr/libexec/gcc/darwin" "$GCCDIR/usr/libexec/gcc" || : + if [ -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" ]; then + rm "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" + mv -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" + fi + fi + #for i in 10.4u 10.5 10.6 10.7 10.8 10.9 10.10; do + if [ $osx104 = 1 ]; then + i=10.4u + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" + fi + if [ $osx105 = 1 ]; then + i=10.5 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" fi - if [ -f "$PLUGINDIR/GCC 4.2.xcplugin/legacy" ]; then - rm -rf "$PLUGINDIR/GCC 4.2.xcplugin" + if [ $osx106 = 1 ]; then + i=10.6 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" fi - if [ -f "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" ]; then - rm -rf "$PLUGINDIR/LLVM GCC 4.2.xcplugin" + if [ $osx107 = 1 ]; then + i=10.7 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" fi - rm -rf "$GCCDIR/usr/libexec/gcc/darwin/ppc" "$GCCDIR/usr/libexec/gcc/darwin/ppc64" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970" - rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64" - if [ -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" ]; then - rm "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" - mv -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" + if [ $osx108 = 1 ]; then + i=10.8 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" fi - (cd "$GCCDIR"; rm -rf $GCCFILES) - (cd "$GCCINSTALLDIR"; rm -rf $GCCFILES) - rmdir "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld" "$GCCDIR/usr/libexec/gcc/darwin" "$GCCDIR/usr/libexec/gcc" || : - if [ -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" ]; then - rm "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" - mv -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec" + if [ $osx109 = 1 ]; then + i=10.9 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" + fi + if [ $osx1010 = 1 ]; then + i=10.10 + [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" + fi + + if [ $compilers = 1 ]; then + for b in gcc-4.0 g++-4.0 gcc-4.2 g++-4.2 llvm-cpp-4.2 llvm-g++-4.2 llvm-gcc-4.2; do + if [ -L $GCCLINKDIR/bin/$b ]; then + rm $GCCLINKDIR/bin/$b + fi + done + for b in cpp-4.2.1 gcc-4.0.1 g++-4.0.1 gcc-4.2.1 g++-4.2.1 llvm-g++-4.2 llvm-gcc-4.2; do + if [ -L $GCCLINKDIR/bin/i686-apple-darwin10-$b ]; then + rm $GCCLINKDIR/bin/i686-apple-darwin10-$b + fi + done + for b in cpp-4.2.1 gcc-4.0.1 g++-4.0.1 gcc-4.2.1 g++-4.2.1 llvm-g++-4.2 llvm-gcc-4.2; do + if [ -L $GCCLINKDIR/usr/bin/powerpc-apple-darwin10-$b ]; then + rm $GCCLINKDIR/usr/bin/powerpc-apple-darwin10-$b + fi + done fi if [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" ]; then rm "$GCCDIR/Platforms/MacOSX.platform/Info.plist" mv -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" "$GCCDIR/Platforms/MacOSX.platform/Info.plist" fi - for i in 10.4u 10.5 10.6 10.7 10.8 10.9 10.10; do - [ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk" - done - for b in gcc-4.0 g++-4.0 gcc-4.2 g++-4.2 llvm-cpp-4.2 llvm-g++-4.2 llvm-gcc-4.2; do - if [ -L $GCCLINKDIR/bin/$b ]; then - rm $GCCLINKDIR/bin/$b - fi - done - for b in cpp-4.2.1 gcc-4.0.1 g++-4.0.1 gcc-4.2.1 g++-4.2.1 llvm-g++-4.2 llvm-gcc-4.2; do - if [ -L $GCCLINKDIR/bin/i686-apple-darwin10-$b ]; then - rm $GCCLINKDIR/bin/i686-apple-darwin10-$b - fi - done - for b in cpp-4.2.1 gcc-4.0.1 g++-4.0.1 gcc-4.2.1 g++-4.2.1 llvm-g++-4.2 llvm-gcc-4.2; do - if [ -L $GCCLINKDIR/usr/bin/powerpc-apple-darwin10-$b ]; then - rm $GCCLINKDIR/usr/bin/powerpc-apple-darwin10-$b - fi - done ;;