aboutsummaryrefslogtreecommitdiff
path: root/contrib/macdeploy/extract-osx-sdk.sh
diff options
context:
space:
mode:
authorPieter Wuille <pieter.wuille@gmail.com>2016-08-29 16:17:06 +0200
committerPieter Wuille <pieter.wuille@gmail.com>2016-08-29 16:17:36 +0200
commitde07fdcf77e97b8613091285e4d0a734f5de7492 (patch)
tree433b961e2c26dac9ef793597ef35f82d2024fd79 /contrib/macdeploy/extract-osx-sdk.sh
parent01680195f8aa586c55c44767397380def3a23b54 (diff)
parentb729fcdb84f819e72d6d2bc264c76328d171abd8 (diff)
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)
Diffstat (limited to 'contrib/macdeploy/extract-osx-sdk.sh')
-rwxr-xr-xcontrib/macdeploy/extract-osx-sdk.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/contrib/macdeploy/extract-osx-sdk.sh b/contrib/macdeploy/extract-osx-sdk.sh
new file mode 100755
index 0000000000..46d2d825d4
--- /dev/null
+++ b/contrib/macdeploy/extract-osx-sdk.sh
@@ -0,0 +1,29 @@
+#!/bin/bash
+set -e
+
+INPUTFILE="Xcode_7.3.1.dmg"
+HFSFILENAME="5.hfs"
+SDKDIR="Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.11.sdk"
+
+7z x "${INPUTFILE}" "${HFSFILENAME}"
+SDKNAME="$(basename "${SDKDIR}")"
+SDKDIRINODE=$(ifind -n "${SDKDIR}" "${HFSFILENAME}")
+fls "${HFSFILENAME}" -rpF ${SDKDIRINODE} |
+ while read type inode filename; do
+ inode="${inode::-1}"
+ if [ "${filename:0:14}" = "usr/share/man/" ]; then
+ continue
+ fi
+ filename="${SDKNAME}/$filename"
+ echo "Extracting $filename ..."
+ mkdir -p "$(dirname "$filename")"
+ if [ "$type" = "l/l" ]; then
+ ln -s "$(icat "${HFSFILENAME}" $inode)" "$filename"
+ else
+ icat "${HFSFILENAME}" $inode >"$filename"
+ fi
+done
+echo "Building ${SDKNAME}.tar.gz ..."
+MTIME="$(istat "${HFSFILENAME}" "${SDKDIRINODE}" | perl -nle 'm/Content Modified:\s+(.*?)\s\(/ && print $1')"
+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"
+echo 'All done!'