-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
86 additions
and
73 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,117 +6,130 @@ on: | |
pull_request: {} | ||
workflow_dispatch: | ||
|
||
env: | ||
TVOS_SDK: '16.1' | ||
TVSIM_SDK: '16.1' | ||
IPHONEOS_SDK: '16.1' | ||
IPHONESIM_SDK: '16.1' | ||
MACOS_SDK: '13.0' | ||
|
||
jobs: | ||
build: | ||
extract_sdk: | ||
name: Extract SDK | ||
runs-on: macos-12 | ||
steps: | ||
- name: Copy SDK files | ||
run: | | ||
mkdir -p cctools/sdk | ||
# https://github.com/actions/runner-images/blob/main/images/macos/macos-12-Readme.md | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk cctools/sdk | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk cctools/sdk | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk cctools/sdk | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk cctools/sdk | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk cctools/sdk | ||
cp -R /Applications/Xcode_14.1.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/*/lib/darwin cctools | ||
cd cctools/sdk | ||
mv AppleTVOS.sdk AppleTVOS$TVOS_SDK.sdk | ||
ln -s AppleTVOS$TVOS_SDK.sdk AppleTVOS.sdk | ||
mv AppleTVSimulator.sdk AppleTVSimulator$TVSIM_SDK.sdk | ||
ln -s AppleTVSimulator$TVSIM_SDK.sdk AppleTVSimulator.sdk | ||
mv iPhoneOS.sdk iPhoneOS$IPHONEOS_SDK.sdk | ||
ln -s iPhoneOS$IPHONEOS_SDK.sdk iPhoneOS.sdk | ||
mv iPhoneSimulator.sdk iPhoneSimulator$IPHONESIM_SDK.sdk | ||
ln -s iPhoneSimulator$IPHONESIM_SDK.sdk iPhoneSimulator.sdk | ||
mv MacOSX.sdk MacOSX$MACOS_SDK.sdk | ||
ln -s MacOSX$MACOS_SDK.sdk MacOSX.sdk | ||
cd ../.. | ||
tar cf cctools.tar cctools | ||
- name: Upload SDK | ||
uses: actions/[email protected] | ||
with: | ||
name: sdk | ||
path: cctools.tar | ||
|
||
strategy: | ||
fail-fast: true | ||
runs-on: self-hosted | ||
build: | ||
name: Build cctools | ||
needs: extract_sdk | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- name: Build xar | ||
- name: Download SDK | ||
uses: actions/[email protected] | ||
- name: Extract SDK | ||
run: | | ||
sudo apt install -y libbz2-dev libxml2-dev libacl1-dev liblzma-dev zlib1g-dev libssl-dev libxml2-dev ninja-build | ||
wget https://github.com/tpoechtrager/xar/archive/refs/heads/master.zip -O xar.zip | ||
unzip xar.zip | ||
cd xar-master/xar | ||
./configure --prefix=/opt/cctools | ||
make -j5 | ||
make install | ||
sudo tar xf sdk/cctools.tar -C /opt | ||
- name: Build apple llvm | ||
run: | | ||
wget https://github.com/apple/llvm-project/archive/refs/heads/apple/stable/20210107.zip -O 20210107.zip | ||
unzip 20210107.zip | ||
cd llvm-project-apple-stable-20210107 | ||
sed -i 's/\&\& getTriple().isX86()/\&\& OSTarget->getAsString(Args, Opts).find("simulator") != std::string::npos/g' clang/lib/Driver/ToolChains/Darwin.cpp | ||
sudo apt install -y libbz2-dev libxml2-dev libacl1-dev liblzma-dev zlib1g-dev libssl-dev libxml2-dev ninja-build | ||
wget https://github.com/apple/llvm-project/archive/refs/heads/apple/stable/20221013.zip -O 20221013.zip | ||
unzip 20221013.zip | ||
cd llvm-project-apple-stable-20221013 | ||
sed -i -z 's/\&\&\n getTriple().isX86()/\&\& OSTarget->getAsString(Args, Opts).find("simulator") != std::string::npos/g' clang/lib/Driver/ToolChains/Darwin.cpp | ||
mkdir build | ||
cd build | ||
cmake ../llvm -G Ninja -DLLVM_ENABLE_PROJECTS=clang -DCMAKE_INSTALL_PREFIX=/opt/cctools \ | ||
-DCMAKE_BUILD_TYPE=MinSizeRel -DCMAKE_C_FLAGS="-I/opt/cctools/include -L/opt/cctools/lib" \ | ||
-DCMAKE_CXX_FLAGS="-I/opt/cctools/include -L/opt/cctools/lib" | ||
ninja | ||
ninja install | ||
sudo ninja install | ||
- name: Build libtapi | ||
run: | | ||
wget https://github.com/tpoechtrager/apple-libtapi/archive/refs/heads/master.zip -O libtapi.zip | ||
unzip libtapi.zip | ||
cd apple-libtapi-master | ||
INSTALLPREFIX=/opt/cctools ./build.sh | ||
./install.sh | ||
sudo ./install.sh | ||
- name: Build cctools | ||
run: | | ||
wget https://github.com/tpoechtrager/cctools-port/archive/refs/heads/master.zip -O cctools.zip | ||
unzip cctools.zip | ||
cd cctools-port-master/cctools | ||
./configure --prefix=/opt/cctools --with-libtapi=/opt/cctools \ | ||
--with-libxar=/opt/cctools --with-llvm-config=/opt/cctools/bin/llvm-config \ | ||
CC=/opt/cctools/bin/clang CXX=/opt/cctools/bin/clang++ ./configure \ | ||
--prefix=/opt/cctools --with-libtapi=/opt/cctools \ | ||
--with-llvm-config=/opt/cctools/bin/llvm-config \ | ||
--target=x86_64-apple-darwin11 | ||
make -j5 | ||
make install | ||
sudo make install | ||
cd ../.. | ||
rm -rf cctools-port-master | ||
unzip cctools.zip | ||
cd cctools-port-master/cctools | ||
./configure --prefix=/opt/cctools --with-libtapi=/opt/cctools \ | ||
--with-libxar=/opt/cctools --with-llvm-config=/opt/cctools/bin/llvm-config \ | ||
CC=/opt/cctools/bin/clang CXX=/opt/cctools/bin/clang++ ./configure \ | ||
--prefix=/opt/cctools --with-libtapi=/opt/cctools \ | ||
--with-llvm-config=/opt/cctools/bin/llvm-config \ | ||
--target=arm-apple-darwin11 | ||
make -j5 | ||
make install | ||
# SDK was prepared with this: | ||
#mkdir /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk /opt/cctools/sdk | ||
#cp -ra Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.5/lib/darwin /opt/cctools | ||
#cd sdk | ||
#mv AppleTVOS.sdk AppleTVOS14.5.sdk | ||
#ln -s AppleTVOS14.5.sdk AppleTVOS.sdk | ||
#mv AppleTVSimulator.sdk AppleTVSimulator14.5.sdk | ||
#ln -s AppleTVSimulator14.5.sdk AppleTVSimulator.sdk | ||
#mv iPhoneOS.sdk iPhoneOS14.5.sdk | ||
#ln -s iPhoneOS14.5.sdk iPhoneOS.sdk | ||
#mv iPhoneSimulator.sdk iPhoneSimulator14.5.sdk | ||
#ln -s iPhoneSimulator14.5.sdk iPhoneSimulator.sdk | ||
#mv MacOSX.sdk MacOSX11.3.sdk | ||
#ln -s MacOSX11.3.sdk MacOSX.sdk | ||
cd /opt/cctools | ||
#sudo pip3 install gdown | ||
#gdown https://drive.google.com/uc?id=1RE0zTs_zIyX2UjvrLKInNde0tvrBpvh8 | ||
#tar xf sdk.tar.xz | ||
#rm sdk.tar.xz | ||
#self-runner already put sdk*.tar.xz inside the chroot | ||
tar xf /sdk-12.0.5.tar.xz | ||
cd bin | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneOS14.5.sdk -arch arm64 -miphoneos-version-min=8.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-iphoneos-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneOS14.5.sdk -arch arm64 -miphoneos-version-min=8.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-iphoneos-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVOS14.5.sdk -arch arm64 -mtvos-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-appletvos-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVOS14.5.sdk -arch arm64 -mtvos-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-appletvos-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator14.5.sdk -arch arm64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-iphonesimulator-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator14.5.sdk -arch arm64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-iphonesimulator-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator14.5.sdk -arch arm64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-appletvsimulator-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator14.5.sdk -arch arm64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-appletvsimulator-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator14.5.sdk -arch x86_64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-appletvsimulator-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator14.5.sdk -arch x86_64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-appletvsimulator-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator14.5.sdk -arch x86_64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-iphonesimulator-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator14.5.sdk -arch x86_64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-iphonesimulator-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX11.3.sdk -arch x86_64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-macosx-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX11.3.sdk -arch x86_64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument $@' > x86_64-macosx-clang++ | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX11.3.sdk -arch arm64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-macosx-clang | ||
printf '#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX11.3.sdk -arch arm64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument $@' > arm64-macosx-clang++ | ||
chmod 755 arm*-clang* | ||
chmod 755 x86_64*-clang* | ||
sudo make install | ||
cd /opt/cctools/bin | ||
set +H | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneOS$IPHONEOS_SDK.sdk -arch arm64 -miphoneos-version-min=8.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-iphoneos-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneOS$IPHONEOS_SDK.sdk -arch arm64 -miphoneos-version-min=8.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-iphoneos-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVOS$TVOS_SDK.sdk -arch arm64 -mtvos-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-appletvos-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVOS$TVOS_SDK.sdk -arch arm64 -mtvos-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-appletvos-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator$TVSIM_SDK.sdk -arch arm64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-appletvsimulator-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator$TVSIM_SDK.sdk -arch arm64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-appletvsimulator-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator$TVSIM_SDK.sdk -arch x86_64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-appletvsimulator-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/AppleTVSimulator$TVSIM_SDK.sdk -arch x86_64 -mtvos-simulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-appletvsimulator-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator$IPHONESIM_SDK.sdk -arch arm64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-iphonesimulator-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator$IPHONESIM_SDK.sdk -arch arm64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-iphonesimulator-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator$IPHONESIM_SDK.sdk -arch x86_64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-iphonesimulator-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/iPhoneSimulator$IPHONESIM_SDK.sdk -arch x86_64 -miphonesimulator-version-min=9.0 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-iphonesimulator-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX$MACOS_SDK.sdk -arch x86_64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-macosx-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target x86_64-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX$MACOS_SDK.sdk -arch x86_64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > x86_64-macosx-clang++ | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX$MACOS_SDK.sdk -arch arm64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-macosx-clang | ||
sudo printf "#!/bin/bash\nCOMPILER_PATH=/opt/cctools/bin /opt/cctools/bin/clang++ -target arm-apple-darwin11 -isysroot /opt/cctools/sdk/MacOSX$MACOS_SDK.sdk -arch arm64 -mmacosx-version-min=10.9 -mlinker-version=609 -Wno-unused-command-line-argument \$@" > arm64-macosx-clang++ | ||
sudo chmod 755 arm*-clang* | ||
sudo chmod 755 x86_64*-clang* | ||
- name: Archive | ||
run: | | ||
var=$(pwd) | ||
cd /opt | ||
tar -cJvf $var/cctools.tar.xz cctools | ||
tar -cJvf $var/cctools-14.1.tar.xz cctools | ||
- name: Upload cctools deps | ||
uses: ncipollo/release-action@v1 | ||
uses: ncipollo/release-action@v1.11.2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
artifacts: "cctools.tar.xz" | ||
tag: "preview" | ||
artifacts: "cctools-14.1.tar.xz" | ||
tag: "cctools" | ||
omitBodyDuringUpdate: true | ||
omitNameDuringUpdate: true | ||
allowUpdates: true | ||
|