Skip to content

Commit 1467573

Browse files
author
Maxime Viargues
committed
Added an option to install in a custom Xcode path
This allow us to use an app with a different name than the default Xcode.app in case we have multiple Xcode installed on the same machine.
1 parent b705c20 commit 1467573

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

XcodeLegacy.sh

100755100644
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
# 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.
2727
# 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
2828
# 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
29+
# 2.3 (27/03/2019): Added an option to install in a custom Xcode path
2930

3031
#set -e # Exit immediately if a command exits with a non-zero status
3132
#set -u # Treat unset variables as an error when substituting.
@@ -103,6 +104,10 @@ while [[ $error = 0 ]] && [[ $# -gt 1 ]]; do
103104
gotoption=1
104105
shift
105106
;;
107+
-path=*)
108+
CUSTOM_APP="${1#*=}"
109+
shift
110+
;;
106111
*)
107112
# unknown option or spurious arg
108113
error=1
@@ -127,7 +132,7 @@ fi
127132

128133
if [ $# != 1 ]; then
129134
# ################################################################################ 80 cols
130-
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012|-osx1013] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta"
135+
echo "Usage: $0 [-compilers|-osx104|-osx105|-osx106|-osx107|-osx108|-osx109|-osx1010|-osx1011|-osx1012|-osx1013] [-path=/path/to/XcodeXXX.app] buildpackages|install|installbeta|cleanpackages|uninstall|uninstallbeta"
131136
echo ""
132137
echo "Description: Extracts / installs / cleans / uninstalls the following components"
133138
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"
@@ -151,6 +156,8 @@ if [ $# != 1 ]; then
151156
echo " -osx1011 : only install OSX 10.11 SDK"
152157
echo " -osx1012 : only install OSX 10.12 SDK"
153158
echo " -osx1013 : only install OSX 10.13 SDK"
159+
echo " -path=path : A alternative Xcode folder to use. Default is /Application/Xcode.app"
160+
echo " e.g. -path=/Application/Xcode_8.3.1.app"
154161
echo "Note that these can be combined. For example, to build and install the 10.9"
155162
echo "and 10.10 SDKs, one could execute:"
156163
echo " $ $0 -osx109 -osx1010 buildpackages"
@@ -166,7 +173,9 @@ if [ $# != 1 ]; then
166173
exit
167174
fi
168175

169-
if [ "$1" = "installbeta" ] || [ "$1" = "uninstallbeta" ]; then
176+
if [ ! -z $CUSTOM_APP ]; then
177+
XCODEAPP="$CUSTOM_APP"
178+
elif [ "$1" = "installbeta" ] || [ "$1" = "uninstallbeta" ]; then
170179
XCODEAPP="/Applications/Xcode-beta.app"
171180
else
172181
XCODEAPP="/Applications/Xcode.app"

0 commit comments

Comments
 (0)