@@ -996,14 +996,65 @@ jobs:
996996 - name : Set up build environment (Linux)
997997 if : ${{ runner.os == 'Linux' }}
998998 run : |
999+ # Create workspace directory
1000+ WORKSPACE="${RUNNER_TEMP}/workspace"
1001+ mkdir -p ${WORKSPACE}
1002+
1003+ # Install dependencies for cross compilation
1004+ if [ "${{ matrix.host.name }}" == "windows-x86_64" ]; then
1005+ # Make MinGW-w64 win32 cross toolchain available in PATH
1006+ echo "/opt/mingw-w64-win32/bin" >> $GITHUB_PATH
1007+
1008+ # Configure pkgconfig discovery path
1009+ echo "PKG_CONFIG_PATH=/opt/mingw-w64-win32/x86_64-w64-mingw32/lib/pkgconfig" >> $GITHUB_ENV
1010+ fi
1011+
9991012 # Set environment variables
10001013 echo "TAR=tar" >> $GITHUB_ENV
1014+ echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10011015
10021016 - name : Set up build environment (macOS)
10031017 if : ${{ runner.os == 'macOS' }}
10041018 run : |
1019+ # Create case-sensitive workspace volume for macOS
1020+ WORKSPACE="/Volumes/Workspace"
1021+ hdiutil create ${RUNNER_TEMP}/Workspace.sparseimage \
1022+ -volname Workspace -type SPARSE -size 150g -fs HFSX
1023+ hdiutil mount ${RUNNER_TEMP}/Workspace.sparseimage -mountpoint ${WORKSPACE}
1024+
1025+ # Set up emulated x86-64 macOS build environment
1026+ if [ "${{ matrix.host.name }}" == "macos-x86_64" ]; then
1027+ # Install x86-64 Homebrew
1028+ arch -x86_64 \
1029+ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
1030+ BREW="/usr/local/bin/brew"
1031+
1032+ # Install x86-64 build tools
1033+ ${BREW} install \
1034+ ccache \
1035+ cmake \
1036+ meson \
1037+ ninja \
1038+ pkg-config
1039+ else
1040+ BREW="/opt/homebrew/bin/brew"
1041+ fi
1042+
1043+ # Install required libraries
1044+ ${BREW} install \
1045+ glib \
1046+ gmp \
1047+ jpeg-turbo \
1048+ libffi \
1049+ libgcrypt \
1050+ libpng \
1051+ pcre2 \
1052+ pixman \
1053+ zstd
1054+
10051055 # Set environment variables
10061056 echo "TAR=gtar" >> $GITHUB_ENV
1057+ echo "WORKSPACE=${WORKSPACE}" >> $GITHUB_ENV
10071058
10081059 - name : Check out source code
10091060 if : ${{ github.event_name != 'pull_request_target' }}
@@ -1052,7 +1103,7 @@ jobs:
10521103 echo "SRC_CACHE_URI=${SRC_CACHE_URI}" >> $GITHUB_ENV
10531104 echo "POKY_DOWNLOADS=${POKY_DOWNLOADS}" >> $GITHUB_ENV
10541105
1055- - name : Build Linux host tools
1106+ - name : Build host tools (Linux)
10561107 if : startsWith(matrix.host.name, 'linux-')
10571108 run : |
10581109 POKY_BASE=${GITHUB_WORKSPACE}/meta-zephyr-sdk
@@ -1085,6 +1136,51 @@ jobs:
10851136 md5sum ${ARCHIVE_FILE} > md5.sum
10861137 sha256sum ${ARCHIVE_FILE} > sha256.sum
10871138
1139+ - name : Build host tools (non-Linux)
1140+ if : " !startsWith(matrix.host.name, 'linux-')"
1141+ run : |
1142+ if [ "${{ matrix.host.name }}" == "macos-x86_64" ]; then
1143+ BUILD_PRECMD="arch -x86_64"
1144+ fi
1145+
1146+ # Create output directory
1147+ mkdir -p ${WORKSPACE}/hosttools
1148+ BUILD_OUTPUT="${WORKSPACE}/hosttools"
1149+
1150+ # Build QEMU
1151+ QEMU_BUILD="${WORKSPACE}/build/qemu"
1152+ QEMU_SOURCE="${GITHUB_WORKSPACE}/qemu"
1153+
1154+ mkdir -p ${QEMU_BUILD}
1155+ pushd ${QEMU_BUILD}
1156+ ${BUILD_PRECMD} ${GITHUB_WORKSPACE}/scripts/build_qemu.sh \
1157+ ${{ matrix.host.name }} \
1158+ ${GITHUB_WORKSPACE}/qemu \
1159+ ${BUILD_OUTPUT}
1160+ popd
1161+
1162+ # TODO: Build ARC QEMU
1163+ # TODO: Build Xilinx QEMU
1164+ # TODO: Build OpenOCD
1165+
1166+ # Create archive
1167+ ARCHIVE_NAME=hosttools_${{ matrix.host.name }}
1168+ ARCHIVE_FILE=hosttools_${{ matrix.host.name }}.${{ matrix.host.archive }}
1169+
1170+ if [ "${{ matrix.host.archive }}" == "tar.xz" ]; then
1171+ XZ_OPT="-T0" \
1172+ ${TAR} -Jcvf ${ARCHIVE_FILE} \
1173+ --owner=0 --group=0 -C ${WORKSPACE}/hosttools .
1174+ elif [ "${{ matrix.host.archive }}" == "7z" ]; then
1175+ pushd ${WORKSPACE}/hosttools
1176+ 7z a -t7z -l ${GITHUB_WORKSPACE}/${ARCHIVE_FILE} .
1177+ popd
1178+ fi
1179+
1180+ # Compute checksum
1181+ md5sum ${ARCHIVE_FILE} > md5.sum
1182+ sha256sum ${ARCHIVE_FILE} > sha256.sum
1183+
10881184 - name : Setup debug session
10891185 if : always() && needs.setup.outputs.debug == 'hosttools'
10901186 uses : mxschmitt/action-tmate@v3
@@ -1102,7 +1198,6 @@ jobs:
11021198 popd
11031199
11041200 - name : Upload toolchain build artifact
1105- if : startsWith(matrix.host.name, 'linux-') # FIXME: Do for all
11061201 uses : actions/upload-artifact@v4
11071202 with :
11081203 name : hosttools_${{ matrix.host.name }}
@@ -1111,9 +1206,6 @@ jobs:
11111206 md5.sum
11121207 sha256.sum
11131208
1114- # TODO: Add host tool build process for macOS hosts.
1115- # TODO: Add host tool build process for Windows hosts.
1116-
11171209 # Build CMake package
11181210 build-cmake-pkg :
11191211 name : CMake Package (${{ matrix.host.name }})
0 commit comments