VirtualBox

source: vbox/trunk/tools/darwin.amd64/bin/xcode-6.2-extractor.sh@ 77807

Last change on this file since 77807 was 69210, checked in by vboxsync, 7 years ago

tools: scm cleanups

  • Property svn:eol-style set to LF
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 4.6 KB
Line 
1#!/bin/bash
2# $Id: xcode-6.2-extractor.sh 69210 2017-10-24 13:38:47Z vboxsync $
3## @file
4# Extracts the necessary bits from the Xcode 6.2 (Xcode_6.2.dmg,
5# md5sum fe4c6c99182668cf14bfa5703bedeed6) and the Command Line
6# Tools for Xcode 6.2 (10.9: commandlinetoolsosx10.9forxcode6.2.dmg,
7# 10.10: commandlinetoolsosx10.10forxcode6.2.dmg).
8#
9# This script allows extracting the tools on systems where the command line
10# tools refuse to install due to version checks.
11#
12
13#
14# Copyright (C) 2014-2016 Oracle Corporation
15#
16# This file is part of VirtualBox Open Source Edition (OSE), as
17# available from http://www.virtualbox.org. This file is free software;
18# you can redistribute it and/or modify it under the terms of the GNU
19# General Public License (GPL) as published by the Free Software
20# Foundation, in version 2 as it comes in the "COPYING" file of the
21# VirtualBox OSE distribution. VirtualBox OSE is distributed in the
22# hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
23#
24
25#
26# Make sure we're talking the same language.
27#
28LC_ALL=C
29export LC_ALL
30
31#
32# Figure the tools/darwin.x86 location.
33#
34MY_DARWIN_DIR=`dirname "$0"`
35MY_DARWIN_DIR=`(cd "${MY_DARWIN_DIR}" ; pwd)`
36MY_DARWIN_DIR=`dirname "${MY_DARWIN_DIR}"`
37
38#
39# Parse arguments.
40#
41MY_DST_DIR="${MY_DARWIN_DIR}/xcode/v6.2"
42MY_XCODE_APP="/Volumes/Xcode/Xcode.app"
43
44my_usage()
45{
46 echo "usage: $0 <--destination|-d> <dstdir> <--xcode-app|-x> </Volumes/Xcode/Xcode.app>";
47 exit $1;
48}
49
50while test $# -ge 1;
51do
52 ARG=$1;
53 shift;
54 case "$ARG" in
55
56 --destination|-d)
57 if test $# -eq 0; then
58 echo "error: missing --tmpdir argument." 1>&2;
59 exit 1;
60 fi
61 MY_DST_DIR="$1";
62 shift;
63 ;;
64
65 --xcode-app|-x)
66 if test $# -eq 0; then
67 echo "error: missing --xcode-app argument." 1>&2;
68 exit 1;
69 fi
70 MY_XCODE_APP="$1";
71 shift;
72 ;;
73
74 --h*|-h*|-?|--?)
75 my_usage 0;
76 esac
77done
78
79# Check the xcode application.
80if [ -z "${MY_XCODE_APP}" ]; then
81 echo "error: missing --xcode-app <dir/Xcode.app>." 1>&2l
82 my_usage 1;
83fi
84if ! test -d "${MY_XCODE_APP}/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk" ; then
85 echo "error: missing '/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk' under '${MY_XCODE_APP}'." 1>&2;
86 exit 1;
87fi
88
89# Check the destination directory.
90if [ -z "${MY_DST_DIR}" ]; then
91 echo "error: missing --destination <dstdir>." 1>&2;
92 my_usage 1;
93fi
94if ! mkdir -p "${MY_DST_DIR}"; then
95 echo "error: error creating '${MY_DST_DIR}'." 1>&2;
96 exit 1;
97fi
98
99#
100# Copy bits from the Xcode package. Must retain a valid .pkg bundle structure or xcrun
101# doesn't work, which breaks 'cpp' (needed for dtrace and maybe more).
102#
103for item in \
104 Contents/Info.plist \
105 Contents/version.plist \
106 Contents/PkgInfo\
107 Contents/Frameworks/IDEFoundation.framework \
108 Contents/PlugIns/IDEModelFoundation.ideplugin \
109 Contents/PlugIns/IDEStandardExecutionActionsCore.ideplugin \
110 Contents/PlugIns/Xcode3Core.ideplugin \
111 Contents/SharedFrameworks/DTXConnectionServices.framework \
112 Contents/SharedFrameworks/DVTFoundation.framework \
113 Contents/SharedFrameworks/DVTSourceControl.framework \
114 Contents/SharedFrameworks/LLDB.framework \
115 Contents/Developer/Toolchains/XcodeDefault.xctoolchain \
116 Contents/Developer/usr \
117 Contents/Developer/Platforms/MacOSX.platform/Info.plist \
118 Contents/Developer/Platforms/MacOSX.platform/version.plist \
119 Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs \
120 ;
121do
122 echo "Copying ${item}..."
123 if [ -d "${MY_XCODE_APP}/${item}" ]; then
124 if ! mkdir -p "${MY_DST_DIR}/x.app/${item}"; then
125 echo "error: error creating directory '${MY_DST_DIR}/x.app/${item}'." 1>&2;
126 exit 1;
127 fi
128 if ! cp -af "${MY_XCODE_APP}/${item}/" "${MY_DST_DIR}/x.app/${item}/"; then
129 echo "error: problem occured copying directory \"${MY_XCODE_APP}/${item}/\" to \"${MY_DST_DIR}/x.app/${item}/\"." 1>&2;
130 exit 1;
131 fi
132 else
133 dir=`dirname "${item}"`
134 if ! mkdir -p "${MY_DST_DIR}/x.app/${dir}"; then
135 echo "error: error creating directory '${MY_DST_DIR}/x.app/${dir}'." 1>&2;
136 exit 1;
137 fi
138 if ! cp -P "${MY_XCODE_APP}/${item}" "${MY_DST_DIR}/x.app/${item}"; then
139 echo "error: problem occured copying \"${MY_XCODE_APP}/${item}\" to \"${MY_DST_DIR}/x.app/${item}\"." 1>&2;
140 exit 1;
141 fi
142 fi
143done
144
145#
146# Done.
147#
148echo "info: Successfully extracted."
149
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle
ContactPrivacy/Do Not Sell My InfoTerms of Use