2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2016-09-20 09:56:14 +02:00
|
|
|
# Copyright (c) 2016 The Bitcoin Core developers
|
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
2018-06-18 13:12:07 +02:00
|
|
|
export LC_ALL=C
|
2016-08-29 16:17:06 +02:00
|
|
|
set -e
|
|
|
|
|
|
|
|
INPUTFILE="Xcode_7.3.1.dmg"
|
|
|
|
HFSFILENAME="5.hfs"
|
2021-08-25 17:10:23 +02:00
|
|
|
SDKDIR="Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk"
|
2016-08-29 16:17:06 +02:00
|
|
|
|
|
|
|
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!'
|