Gather XCode SDKs for OSXCROSS #26
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
name: Gather XCode SDKs for OSXCROSS | |
on: | |
workflow_dispatch: | |
inputs: | |
do_deploy: | |
description: Does this get deployed to Digital Ocean? | |
required: true | |
type: boolean | |
default: false | |
tar_files: | |
description: Do you want to Tar Files? | |
required: true | |
type: boolean | |
default: false | |
xcode_version: | |
description: Version of Xcode to copy the SDKs from | |
required: true | |
type: string | |
default: "15.4" | |
build_type: | |
description: nightly, prerelease, release | |
required: true | |
type: string | |
default: "nightly" | |
env: | |
BASE_FOLDER: deps | |
XCODE_VERSION: ${{ inputs.xcode_version }} | |
jobs: | |
build-osxcross-sdk: | |
name: Build osxcross SDK for Linux | |
runs-on: macos-latest | |
steps: | |
- name: Install Required Dependencies | |
run: | | |
brew install cmake wget coreutils llvm | |
echo "✅ Dependencies installed successfully." >> $GITHUB_STEP_SUMMARY | |
- name: Clone and Setup osxcross | |
run: | | |
git clone https://github.com/tpoechtrager/osxcross.git ~/osxcross | |
cd ~/osxcross | |
echo "✅ osxcross repository cloned." >> $GITHUB_STEP_SUMMARY | |
- name: Generate SDK Package | |
run: | | |
XCODE_VERSION=15.4 | |
./osxcross/tools/gen_sdk_package.sh "/Applications/Xcode_$XCODE_VERSION.app" | |
ls -la | |
echo "✅ SDK package generated using gen_sdk_package.sh." >> $GITHUB_STEP_SUMMARY | |
- name: Build osxcross | |
run: | | |
cd ~/osxcross | |
export OSXCROSS_ENABLE_WERROR_IMPLICIT_FUNCTION_DECLARATION=1 | |
export OSXCROSS_GCC_NO_STATIC_RUNTIME=1 | |
UNATTENDED=1 TARGET_DIR=/usr/local/osxcross ./build.sh | |
echo "✅ osxcross built successfully." >> $GITHUB_STEP_SUMMARY | |
- name: Validate osxcross Installation | |
run: | | |
/usr/local/osxcross/bin/x86_64-apple-darwin20.2-clang --version | |
/usr/local/osxcross/bin/x86_64-apple-darwin20.2-gcc --version | |
echo "✅ osxcross installation validated." >> $GITHUB_STEP_SUMMARY | |
- name: Build Clang | |
run: | | |
cd ~/osxcross | |
OCDEBUG=1 ./build_clang.sh | |
echo "✅ Clang built successfully." >> $GITHUB_STEP_SUMMARY | |
- name: Build GCC | |
run: | | |
cd ~/osxcross | |
GCC_VERSION=12.2.0 ENABLE_FORTRAN=1 ./build_gcc.sh | |
echo "✅ GCC built successfully (version 12.2.0 with Fortran enabled)." >> $GITHUB_STEP_SUMMARY | |
- name: Upload osxcross SDK as Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: osxcross-sdk-linux | |
path: /usr/local/osxcross/ | |
- name: Summary of Process | |
run: | | |
echo "### osxcross SDK Build Process Summary" >> $GITHUB_STEP_SUMMARY | |
echo "1. **Dependencies**: Installed cmake, wget, coreutils, and llvm." >> $GITHUB_STEP_SUMMARY | |
echo "2. **SDK Package Generation**: Used gen_sdk_package.sh with Xcode 15.4." >> $GITHUB_STEP_SUMMARY | |
echo "3. **Clang Setup**: Built Clang for osxcross." >> $GITHUB_STEP_SUMMARY | |
echo "4. **GCC Setup**: Built GCC version 12.2.0 with Fortran support." >> $GITHUB_STEP_SUMMARY | |
echo "5. **osxcross Setup**: Built osxcross using the generated SDK package and installed to /usr/local/osxcross." >> $GITHUB_STEP_SUMMARY | |
echo "6. **Environment**: Enabled -Werror=implicit-function-declaration and disabled static linking for libgcc/libstdc++." >> $GITHUB_STEP_SUMMARY | |
echo "7. **Validation**: Verified both Clang and GCC cross-compilers." >> $GITHUB_STEP_SUMMARY | |
echo "8. **Artifact**: osxcross SDK uploaded for Linux." >> $GITHUB_STEP_SUMMARY | |
- name: Cleanup | |
if: always() | |
run: | | |
rm -rf ~/osxcross | |
echo "✅ Cleanup completed." >> $GITHUB_STEP_SUMMARY | |
gather: | |
name: Process XCode SDKs | |
if: false | |
runs-on: "macos-latest" | |
steps: | |
- name: Set up Base Folder | |
id: base_folder | |
run: | | |
mkdir -p "$(pwd)/$BASE_FOLDER" | |
echo "base_folder=$(pwd)/$BASE_FOLDER" >> $GITHUB_OUTPUT | |
- name: XCode | |
run: | | |
xcode-select --print-path >> $GITHUB_STEP_SUMMARY | |
sudo xcodebuild -license accept | |
- name: List SDKs and Developer Platforms | |
run: | | |
echo '### Base Directory' >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/ >> $GITHUB_STEP_SUMMARY | |
echo '### Toolchains Directory' >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Toolchains/ >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ >> $GITHUB_STEP_SUMMARY | |
cat /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ToolchainInfo.plist >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include >> $GITHUB_STEP_SUMMARY | |
echo '### Platforms Directory' >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/ >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs >> $GITHUB_STEP_SUMMARY | |
ls -la /Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs >> $GITHUB_STEP_SUMMARY | |
- name: Create tar.xz archives for iPhoneOS directories | |
if: ${{ inputs.tar_files }} | |
run: | | |
SDK_PATH="/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs" | |
for sdk in $(ls "$SDK_PATH" | grep iPhoneOS | grep -v iPhoneOS.sdk); do | |
sudo tar -cJvhf "$(pwd)/$BASE_FOLDER/${sdk}.tar.xz" "$SDK_PATH/$sdk" | |
done | |
- name: Create tar.xz archives for iPhoneSimulator directories | |
if: ${{ inputs.tar_files }} | |
run: | | |
SDK_PATH="/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs" | |
for sdk in $(ls "$SDK_PATH" | grep iPhoneSimulator | grep -v iPhoneSimulator.sdk); do | |
sudo tar -cJvhf "$(pwd)/$BASE_FOLDER/${sdk}.tar.xz" "$SDK_PATH/$sdk" | |
done | |
- name: Create tar.xz archives for MacOSX directories | |
if: ${{ inputs.tar_files }} | |
run: | | |
SDK_PATH="/Applications/Xcode_$XCODE_VERSION.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" | |
for sdk in $(ls "$SDK_PATH" | grep MacOSX | grep -v MacOSX.sdk); do | |
sudo tar -cJvhf "$(pwd)/$BASE_FOLDER/${sdk}.tar.xz" "$SDK_PATH/$sdk" | |
done | |
- name: List Base Folder Contents and Add to Summary | |
if: ${{ inputs.tar_files }} | |
run: | | |
ls -la "$(pwd)/$BASE_FOLDER" >> $GITHUB_STEP_SUMMARY | |
- uses: BetaHuhn/do-spaces-action@v2 | |
name: Deploy to DigitalOcean | |
if: ${{ inputs.do_deploy }} | |
id: spaces | |
with: | |
access_key: ${{ secrets.DO_ACCESS_KEY }} | |
secret_key: ${{ secrets.DO_SECRET_KEY }} | |
space_name: ${{ secrets.DO_SPACE_NAME }} | |
space_region: ${{ secrets.DO_SPACE_REGION }} | |
source: ${{ env.BASE_FOLDER }} | |
out_dir: pipeline | |