Skip to content

Commit de07fdc

Browse files
committed
Merge #8617: Include instructions to extract Mac OS X SDK on Linux using 7zip and SleuthKit
b729fcd Include instructions to extract Mac OS X SDK on Linux using 7zip and SleuthKit (Luke Dashjr)
2 parents 0168019 + b729fcd commit de07fdc

File tree

2 files changed

+45
-1
lines changed

2 files changed

+45
-1
lines changed

contrib/macdeploy/extract-osx-sdk.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
set -e
3+
4+
INPUTFILE="Xcode_7.3.1.dmg"
5+
HFSFILENAME="5.hfs"
6+
SDKDIR="Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"
7+
8+
7z x "${INPUTFILE}" "${HFSFILENAME}"
9+
SDKNAME="$(basename "${SDKDIR}")"
10+
SDKDIRINODE=$(ifind -n "${SDKDIR}" "${HFSFILENAME}")
11+
fls "${HFSFILENAME}" -rpF ${SDKDIRINODE} |
12+
while read type inode filename; do
13+
inode="${inode::-1}"
14+
if [ "${filename:0:14}" = "usr/share/man/" ]; then
15+
continue
16+
fi
17+
filename="${SDKNAME}/$filename"
18+
echo "Extracting $filename ..."
19+
mkdir -p "$(dirname "$filename")"
20+
if [ "$type" = "l/l" ]; then
21+
ln -s "$(icat "${HFSFILENAME}" $inode)" "$filename"
22+
else
23+
icat "${HFSFILENAME}" $inode >"$filename"
24+
fi
25+
done
26+
echo "Building ${SDKNAME}.tar.gz ..."
27+
MTIME="$(istat "${HFSFILENAME}" "${SDKDIRINODE}" | perl -nle 'm/Content Modified:\s+(.*?)\s\(/ && print $1')"
28+
find "${SDKNAME}" | sort | tar --no-recursion --mtime="${MTIME}" --mode='u+rw,go+r-w,a+X' --owner=0 --group=0 -c -T - | gzip -9n > "${SDKNAME}.tar.gz"
29+
echo 'All done!'

doc/README_osx.md

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,26 @@ Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.1
3636
```
3737

3838
Unfortunately, the usual linux tools (7zip, hpmount, loopback mount) are incapable of opening this file.
39-
To create a tarball suitable for Gitian input, mount the dmg in OS X, then create it with:
39+
To create a tarball suitable for Gitian input, there are two options:
40+
41+
Using Mac OS X, you can mount the dmg, and then create it with:
4042
```
43+
$ hdiutil attach Xcode_7.3.1.dmg
4144
$ tar -C /Volumes/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ -czf MacOSX10.11.sdk.tar.gz MacOSX10.11.sdk
4245
```
4346

47+
Alternatively, you can use 7zip and SleuthKit to extract the files one by one.
48+
The script contrib/macdeploy/extract-osx-sdk.sh automates this. First ensure
49+
the dmg file is in the current directory, and then run the script. You may wish
50+
to delete the intermediate 5.hfs file and MacOSX10.11.sdk (the directory) when
51+
you've confirmed the extraction succeeded.
52+
53+
```bash
54+
apt-get install p7zip-full sleuthkit
55+
contrib/macdeploy/extract-osx-sdk.sh
56+
rm -rf 5.hfs MacOSX10.11.sdk
57+
```
58+
4459
The Gitian descriptors build 2 sets of files: Linux tools, then Apple binaries
4560
which are created using these tools. The build process has been designed to
4661
avoid including the SDK's files in Gitian's outputs. All interim tarballs are

0 commit comments

Comments
 (0)