Last active
September 26, 2019 12:19
-
-
Save segabor/0403878643436cca96bb88c7b9e775c4 to your computer and use it in GitHub Desktop.
Build Swift 5.x snapshot on Arch Linux
This file contains hidden or 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
#!/bin/bash | |
# SNAPSHOT=5.1-DEVELOPMENT-SNAPSHOT-2019-09-16-a | |
SNAPSHOT=5.1-RELEASE | |
if [ ! -d swift ] | |
then | |
echo Please clone Swift language source | |
echo run | |
echo git clone https://github.com/apple/swift.git | |
echo or | |
echo git clone [email protected]:apple/swift.git | |
echo if you already have a github account | |
exit 1 | |
fi | |
# Fall-back to default path set | |
# to avoid interferences | |
unset PATH | |
. /etc/profile | |
# Fetch dependencies | |
python2 ./swift/utils/update-checkout --tag=swift-${SNAPSHOT} --clone-with-ssh | |
# Fix python2 usage | |
# TODO Check if python --version >= 3.x.y first | |
#./fix_python_usage.sh | |
# Use python2 where appropriate - on Arch Linux Python 3.x is the default breaking the build process | |
srcdir="." | |
find "$srcdir" -type f -print0 | \ | |
xargs -0 sed -i 's|/usr/bin/env python$|&2|;s|/usr/bin/python$|&2|' | |
find "$srcdir/lldb" -name Makefile -print0 | \ | |
xargs -0 sed -i 's|python-config|python2-config|g' | |
sed -i '/^cmake_minimum_required/a set(Python_ADDITIONAL_VERSIONS 2.7)' \ | |
"$srcdir/swift/CMakeLists.txt" | |
sed -i '/^cmake_minimum_required/a set(Python_ADDITIONAL_VERSIONS 2.7)' \ | |
"$srcdir/lldb/CMakeLists.txt" | |
sed -i 's/\<python\>/&2/' \ | |
"$srcdir/swift/utils/build-script-impl" \ | |
"$srcdir/swift/test/sil-passpipeline-dump/basic.test-sh" | |
# Fix wrong glibc include paths in glibc module map | |
# ( cd swift && patch -p1 -i "../glibc-includes.patch" ) | |
# Build the whole stuff | |
./swift/utils/build-script \ | |
--preset=buildbot_linux,no_test \ | |
installable_package=~/swift-${SNAPSHOT}.tar.gz \ | |
install_destdir=~/.swiftenv/versions/${SNAPSHOT} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment