Skip to content

Commit 1a5fad2

Browse files
committed
fix #23
1 parent 914ecaf commit 1a5fad2

File tree

3 files changed

+42
-8
lines changed

3 files changed

+42
-8
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,6 @@
22
*.dmg.part
33
*.pkg
44
*.tar.gz
5+
6+
build
7+
dgph

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,5 @@ History
8181
- 1.3 (07/10/2014): Xcode 6 removed 10.8 SDK, grab it from Xcode 5.1.1
8282
- 1.4 (21/08/2015): Xcode 7 removed 10.9 and 10.10 SDKs, grab them from Xcode 6.4
8383
- 1.5 (15/10/2015): Fixes for OS X 10.11 El Capitan (nothing can be installed in /usr/bin because of the sandbox)
84+
- 1.6 (11/11/2015): Fix buildpackages, fix /usr/bin/gcc on recent OS X, fix download messages
85+
- 1.7 (05/04/2016): Xcode 7.3 disables support for older SDKs, fix that

XcodeLegacy.sh

Lines changed: 37 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
# 1.4 (21/08/2015): Xcode 7 removed 10.9 and 10.10 SDKs, grab them from Xcode 6.4
1414
# 1.5 (15/10/2015): Fixes for OS X 10.11 El Capitan (nothing can be installed in /usr/bin because of the sandbox)
1515
# 1.6 (11/11/2015): Fix buildpackages, fix /usr/bin/gcc on recent OS X, fix download messages
16+
# 1.7 (05/04/2016): Xcode 7.3 disables support for older SDKs, fix that
1617

1718

1819
if [ $# != 1 ]; then
@@ -45,7 +46,7 @@ else
4546
fi
4647
echo "*** Info: found Xcode >= 4.3"
4748
GCCDIR="/Applications/Xcode.app/Contents/Developer"
48-
SDKDIR="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer"
49+
SDKDIR="$GCCDIR/Platforms/MacOSX.platform/Developer"
4950
fi
5051

5152
if [ "$1" = "installbeta" -o "$1" = "uninstallbeta" ]; then
@@ -55,7 +56,7 @@ if [ "$1" = "installbeta" -o "$1" = "uninstallbeta" ]; then
5556
fi
5657
echo "*** Info: found Xcode beta"
5758
GCCDIR="/Applications/Xcode-beta.app/Contents/Developer"
58-
SDKDIR="/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer"
59+
SDKDIR="$GCCDIR/Platforms/MacOSX.platform/Developer"
5960
fi
6061
SANDBOX=0
6162
GCCINSTALLDIR="$GCCDIR/Toolchains/XcodeDefault.xctoolchain"
@@ -293,17 +294,17 @@ EOF
293294
if [ -d "$PLUGINDIR/GCC 4.0.xcplugin" ]; then
294295
echo "*** Not installing XcodePluginGCC40.tar.gz (found installed in $PLUGINDIR/GCC 4.0.xcplugin, uninstall first to force install)"
295296
else
296-
(gzip -dc XcodePluginGCC40.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && echo "*** installed XcodePluginGCC40.tar.gz"
297+
(gzip -dc XcodePluginGCC40.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.0.xcplugin/legacy" && echo "*** installed XcodePluginGCC40.tar.gz"
297298
fi
298299
if [ -d "$PLUGINDIR/GCC 4.2.xcplugin" ]; then
299300
echo "*** Not installing XcodePluginGCC42.tar.gz (found installed in $PLUGINDIR/GCC 4.2.xcplugin, uninstall first to force install)"
300301
else
301-
(gzip -dc XcodePluginGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && echo "*** installed XcodePluginGCC42.tar.gz"
302+
(gzip -dc XcodePluginGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginGCC42.tar.gz"
302303
fi
303304
if [ -d "$PLUGINDIR/LLVM GCC 4.2.xcplugin" ]; then
304305
echo "*** Not installing XcodePluginLLVMGCC42.tar.gz (found installed in $PLUGINDIR/LLVM GCC 4.2.xcplugin, uninstall first to force install)"
305306
else
306-
(gzip -dc XcodePluginLLVMGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && echo "*** installed XcodePluginLLVMGCC42.tar.gz"
307+
(gzip -dc XcodePluginLLVMGCC42.tar.gz | (cd "$PLUGINDIR"; tar xf -)) && touch "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" && echo "*** installed XcodePluginLLVMGCC42.tar.gz"
307308
fi
308309

309310
if [ -f "$GCCDIR/usr/libexec/gcc/darwin/ppc/as" ]; then
@@ -454,6 +455,16 @@ SPEC_EOF
454455
echo "*** modified MacOSX Architectures.xcspec"
455456
fi
456457

458+
# Xcode >= 7.3 disables support for older SDKs in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Info.plist
459+
# see https://github.com/devernay/xcodelegacy/issues/23
460+
if [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" ]; then
461+
echo "*** Not modifying MacOSX Info.plist (found original at $GCCDIR/Platforms/MacOSX.platform/Info.plist-original, uninstall first to force install)"
462+
elif [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist" ]; then
463+
mv "$GCCDIR/Platforms/MacOSX.platform/Info.plist" "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original"
464+
sed -e '/MinimumSDKVersion/{N;d;}' < "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" > "$GCCDIR/Platforms/MacOSX.platform/Info.plist"
465+
echo "*** modified MacOSX Info.plist"
466+
fi
467+
457468
if [ -d "$SDKDIR/SDKs/MacOSX10.4u.sdk" ]; then
458469
echo "*** Not installing Xcode104SDK.tar.gz (found installed in $SDKDIR/SDKs/MacOSX10.4u.sdk, uninstall first to force install)"
459470
else
@@ -583,19 +594,37 @@ SPEC_EOF
583594
exit 1
584595
fi
585596

586-
rm -rf "$PLUGINDIR/GCC 4.0.xcplugin"
597+
if [ -f "$PLUGINDIR/GCC 4.0.xcplugin/legacy" ]; then
598+
rm -rf "$PLUGINDIR/GCC 4.0.xcplugin"
599+
fi
600+
if [ -f "$PLUGINDIR/GCC 4.2.xcplugin/legacy" ]; then
601+
rm -rf "$PLUGINDIR/GCC 4.2.xcplugin"
602+
fi
603+
if [ -f "$PLUGINDIR/LLVM GCC 4.2.xcplugin/legacy" ]; then
604+
rm -rf "$PLUGINDIR/LLVM GCC 4.2.xcplugin"
605+
fi
587606
rm -rf "$GCCDIR/usr/libexec/gcc/darwin/ppc" "$GCCDIR/usr/libexec/gcc/darwin/ppc64"
588607
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc"
589608
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/as/ppc64"
590609
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc"
591610
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc7400"
592611
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc970"
593612
rm -rf "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld/ppc64"
594-
mv -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
613+
if [ -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" ]; then
614+
rm "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
615+
mv -f "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld-original" "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld"
616+
fi
595617
(cd "$GCCDIR"; rm -rf $GCCFILES)
596618
(cd "$GCCINSTALLDIR"; rm -rf $GCCFILES)
597619
rmdir "$GCCDIR/Toolchains/XcodeDefault.xctoolchain/usr/libexec/ld" "$GCCDIR/usr/libexec/gcc/darwin" "$GCCDIR/usr/libexec/gcc" || :
598-
mv -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec"
620+
if [ -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" ]; then
621+
rm "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec"
622+
mv -f "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec-original" "$SDKDIR/Library/Xcode/Specifications/MacOSX Architectures.xcspec"
623+
fi
624+
if [ -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" ]; then
625+
rm "$GCCDIR/Platforms/MacOSX.platform/Info.plist"
626+
mv -f "$GCCDIR/Platforms/MacOSX.platform/Info.plist-original" "$GCCDIR/Platforms/MacOSX.platform/Info.plist"
627+
fi
599628
for i in 10.4u 10.5 10.6 10.7 10.8 10.9 10.10; do
600629
[ -f "$SDKDIR/SDKs/MacOSX${i}.sdk/legacy" ] && rm -rf "$SDKDIR/SDKs/MacOSX${i}.sdk"
601630
done

0 commit comments

Comments
 (0)