Last active
May 27, 2021 01:25
-
-
Save asdfugil/71cdfca5aa1bc0d59de06518cd1c530c to your computer and use it in GitHub Desktop.
procursus_utils for FreeBSD
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
export BUILD_DIR=${HOME}/procursus_utils | |
export BUILD_ROOT=${BUILD_DIR}/build | |
export SDKS=${BUILD_DIR}/SDKs | |
export TARGET_SYSROOT=${SDKS}/iPhoneOS13.2.sdk | |
export MACOSX_SYSROOT=${SDKS}/MacOSX.sdk | |
export GNUBINDIR=${BUILD_DIR}/gnubin | |
mkdir -p ${BUILD_DIR} ${BUILD_DIR}/{SDKs,gnubin} | |
## GNU BIN | |
## don't add to PATH, that might break other things | |
COREUTILS='basename cat chgrp chmod chown chroot cksum comm cp csplit cut date dd df dir dircolors dirname du echo env expand expr factor false fmt fold groups head hostid hostname id install join kill link ln logname ls md5sum mkdir mkfifo mknod mv nice nl nohup od paste pathchk pinky pr printenv printf ptx pwd readlink rm rmdir seq sha1sum shred sleep sort split stat stty su sum sync tac tail tee test touch tr true tsort tty uname unexpand uniq unlink uptime users vdir wc who whoami yes' | |
OTHER_GNU_BINS='make tar sed patch find' | |
if [ ! -f "${GNUBINDIR}/.link_complete" ]; then | |
for util in $COREUTILS $OTHER_GNU_BINS; do | |
ln -sfn /usr/local/bin/g$util "${GNUBINDIR}/${util}" | |
done | |
ln -sfn /usr/local/bin/grep "${GNUBINDIR}/grep" | |
touch "${GNUBINDIR}/.link_complete" | |
fi | |
###SDKs | |
##macos | |
if [ ! -d "${MACOSX_SYSROOT}" ]; then | |
wget -O/tmp/MacOSSDK.tar.xz \ | |
https://github.com/phracker/MacOSX-SDKs/releases/download/10.15/MacOSX10.15.sdk.tar.xz | |
gtar -xf /tmp/MacOSSDK.tar.xz -C /tmp | |
mv /tmp/MacOSX10.15.sdk ${MACOSX_SYSROOT} | |
rm /tmp/MacOSSDK.tar.xz | |
fi | |
##ios | |
if [ ! -d "${TARGET_SYSROOT}" ]; then | |
wget -O/tmp/iPhoneSDK.tar.gz \ | |
https://github.com/okanon/iPhoneOS.sdk/releases/download/v0.0.1/iPhoneOS13.2.sdk.tar.gz | |
gtar -xf /tmp/iPhoneSDK.tar.gz -C /tmp | |
wget -O/tmp/iPhoneC.zip \ | |
https://cdn.discordapp.com/attachments/688121419980341282/725234834024431686/c.zip | |
unzip /tmp/iPhoneC.zip -d /tmp/iPhoneOS13.2.sdk/usr/include | |
mv /tmp/iPhoneOS13.2.sdk ${TARGET_SYSROOT} | |
rm /tmp/iPhoneSDK.tar.gz | |
fi | |
### cctools | |
##clang | |
if [ ! -f "${BUILD_DIR}/cctools-src/.build_complete" ]; then | |
export PATH=${GNUBINDIR}:$PATH | |
gtar -czf ${SDKS}/iPhoneOS13.2.sdk.tar.gz -C ${SDKS} iPhoneOS13.2.sdk | |
git clone https://github.com/tpoechtrager/cctools-port ${BUILD_DIR}/cctools-src | |
cd ${BUILD_DIR}/cctools-src/usage_examples/ios_toolchain | |
gsed -i "s/arm-apple-darwin11/aarch64-apple-darwin/" build.sh | |
./build.sh ${SDKS}/iPhoneOS13.2.sdk.tar.gz arm64 | |
rm -rf \ | |
${BUILD_DIR}/cctools-src/usage_examples/ios_toolchain/{tmp,wrapper.c,README,build.sh} \ | |
${BUILD_DIR}/cctools-src/{cctools,tools,package.sh,README.md} \ | |
${SDKS}/iPhoneOS13.2.sdk.tar.gz | |
touch ${BUILD_DIR}/cctools-src/.build_complete | |
fi | |
export PATH=${BUILD_DIR}/cctools-src/usage_examples/ios_toolchain/target/bin:${PATH} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment