From 01dffbe72efe43207123a783a74f827f2061fb14 Mon Sep 17 00:00:00 2001 From: Cyano Hao Date: Fri, 17 May 2024 15:52:36 +0800 Subject: [PATCH] update nt5 toolchain (#428) --- .github/workflows/build.yml | 53 +++++++++++++++++-------------------- BUILD.md | 16 +++++++---- BUILD_cn.md | 16 +++++++---- packages/msys/build-xp.sh | 17 ++++-------- 4 files changed, 52 insertions(+), 50 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c25a6240..5d4a2f3b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -50,59 +50,56 @@ jobs: path: pkg/ windows_legacy: - name: Windows NT 5.1–6.0 MinGW + name: Windows NT 5.x strategy: fail-fast: false matrix: - arch: [32, 64] + profile: + - 64-ucrt + - 32-ucrt + - 64-msvcrt + - 32-msvcrt + - 32-win2000 include: - - arch: 32 - vcArch: x86 - - arch: 64 - vcArch: x64 + - isUcrt: 0 + - profile: 64-ucrt + isUcrt: 1 + - profile: 32-ucrt + isUcrt: 1 runs-on: windows-2019 defaults: run: - shell: bash + shell: msys2 {0} env: - _QT_VERSION: "5.15.13" - _QT_NAME: mingw132_${{ matrix.arch }}-redpanda - _REDPANDA_QT_BUILD: "20240428.0" - _MINGW_LITE_RELEASE: "13.2.0-r4" + _REDPANDA_QT_BUILD: "5.15.13+redpanda1" + _QT_NAME: mingw141_${{ matrix.profile }} steps: - uses: actions/checkout@v2 with: fetch-depth: 0 - - name: Setup toolchain - run: | - curl -LO https://github.com/redpanda-cpp/mingw-lite/releases/download/$_MINGW_LITE_RELEASE/mingw${{ matrix.arch }}-ucrt-$_MINGW_LITE_RELEASE.7z - 7z x mingw${{ matrix.arch }}-ucrt-$_MINGW_LITE_RELEASE.7z + - name: Setup + uses: msys2/setup-msys2@v2 + with: + msystem: UCRT64 + update: true + install: mingw-w64-x86_64-7zip mingw-w64-x86_64-cmake mingw-w64-i686-nsis curl git - name: Setup Qt run: | curl -LO https://github.com/redpanda-cpp/qtbase-xp/releases/download/$_REDPANDA_QT_BUILD/$_QT_NAME.7z - 7z x $_QT_NAME.7z -oC:/Qt + /mingw64/bin/7z x $_QT_NAME.7z -oC:/Qt - name: Build run: | - export PATH="/c/Qt/$_QT_VERSION/$_QT_NAME/bin:$PWD/mingw${{ matrix.arch }}/bin:$PATH" - - mkdir build && pushd build - { - qmake PREFIX=$GITHUB_WORKSPACE/pkg $GITHUB_WORKSPACE/Red_Panda_CPP.pro - mingw32-make -j$(nproc) - mingw32-make install - cp "/c/Program Files (x86)/Windows Kits/10/Redist/10.0.22621.0/ucrt/DLLs/${{ matrix.vcArch }}"/*.dll $GITHUB_WORKSPACE/pkg/ - } - popd + ./packages/msys/build-xp.sh -p ${{ matrix.profile }} $( [[ ${{ matrix.isUcrt }} -eq 1 ]] && echo --ucrt 22621 ) - name: Upload uses: actions/upload-artifact@v2 with: - name: Windows NT 5.1–6.0 MinGW - arch=${{ matrix.arch }} - path: pkg/ + name: Windows NT 5.x - profile=${{ matrix.profile }} + path: dist/* windows_msvc_x64: name: Windows MSVC x64 diff --git a/BUILD.md b/BUILD.md index 9726affe..0a636b01 100644 --- a/BUILD.md +++ b/BUILD.md @@ -79,7 +79,7 @@ Extra arguments for `build-mingw.sh`: ## Windows NT 5.x Qt Library with MinGW Lite Toolchain -The script `build-xp.sh` is alike `build-mingw.sh`, but it will download a standalone MinGW Lite toolchain to build Red Panda C++ for Windows NT 5.x. +The script `build-xp.sh` is alike `build-mingw.sh`, but the toolchain is provided by Qt library. Prerequisites: @@ -97,21 +97,27 @@ Prerequisites: ``` C: └─ Qt - └─ 5.15.13 - ├─ mingw141_32-msvcrt-redpanda + └─ 5.15.13+redpanda1 + ├─ mingw141_32-msvcrt │ ├─ bin + │ │ ├─ gcc.exe + │ │ ├─ mingw32-make.exe + │ │ └─ qmake.exe │ ├─ include │ ├─ lib │ └─ ... - └─ mingw141_64-msvcrt-redpanda + └─ mingw141_64-msvcrt ├─ bin + │ ├─ gcc.exe + │ ├─ mingw32-make.exe + │ └─ qmake.exe ├─ include ├─ lib └─ ... ``` - Or you can build from source and specify the path with `--qt` argument. -To build, launch selected MSYS2 environment, run: +To build, launch MSYS2 environment, run: ```bash ./packages/msys/build-xp.sh -p 32-msvcrt ``` diff --git a/BUILD_cn.md b/BUILD_cn.md index 37c896b8..8897bb01 100644 --- a/BUILD_cn.md +++ b/BUILD_cn.md @@ -79,7 +79,7 @@ ## 用于 Windows NT 5.x 的 Qt 库 + MinGW Lite 工具链 -`build-xp.sh` 脚本和 `build-mingw.sh` 类似,但是会下载独立的 MinGW Lite 工具链来构建用于 Windows NT 5.x 的小熊猫C++。 +`build-xp.sh` 脚本和 `build-mingw.sh` 类似,但是工具链由 Qt 库提供。 前置条件: @@ -97,21 +97,27 @@ ``` C: └─ Qt - └─ 5.15.13 - ├─ mingw141_32-msvcrt-redpanda + └─ 5.15.13+redpanda1 + ├─ mingw141_32-msvcrt │ ├─ bin + │ │ ├─ gcc.exe + │ │ ├─ mingw32-make.exe + │ │ └─ qmake.exe │ ├─ include │ ├─ lib │ └─ ... - └─ mingw141_64-msvcrt-redpanda + └─ mingw141_64-msvcrt ├─ bin + │ ├─ gcc.exe + │ ├─ mingw32-make.exe + │ └─ qmake.exe ├─ include ├─ lib └─ ... ``` - 也可以从源代码自行构建 Qt 并在构建时指定 `--qt` 参数。 -要构建此项目,启动所选的 MSYS2 环境,然后运行 +要构建此项目,启动 MSYS2 环境,然后运行 ```bash ./packages/msys/build-xp.sh -p 32-msvcrt ``` diff --git a/packages/msys/build-xp.sh b/packages/msys/build-xp.sh index 8e1b4b98..006314cb 100644 --- a/packages/msys/build-xp.sh +++ b/packages/msys/build-xp.sh @@ -39,8 +39,8 @@ fi PROFILE=$2 shift 2 -QT_VERSION="5.15.13" -QT_NAME="mingw141_${PROFILE}-redpanda" +QT_VERSION="5.15.13+redpanda1" +QT_NAME="mingw141_${PROFILE}" case "${PROFILE}" in 64-ucrt|64-msvcrt) NSIS_ARCH=x64 @@ -161,10 +161,6 @@ SOURCE_DIR="$(pwd)" ASSETS_DIR="${SOURCE_DIR}/assets" UCRT_DIR="/c/Program Files (x86)/Windows Kits/10/Redist/10.0.${UCRT}.0/ucrt/DLLs/${NSIS_ARCH}" -MINGW_LITE_RELEASE="14.1.0-r1" -HOST_MINGW_ARCHIVE="mingw${PROFILE}-${MINGW_LITE_RELEASE}.7z" -HOST_MINGW_BIT="${PROFILE%%-*}" - REDPANDA_MINGW_RELEASE="11.4.0-r0" MINGW32_ARCHIVE="mingw32-${REDPANDA_MINGW_RELEASE}.7z" MINGW32_COMPILER_NAME="MinGW-w64 i686 GCC" @@ -174,6 +170,7 @@ MINGW64_ARCHIVE="mingw64-${REDPANDA_MINGW_RELEASE}.7z" MINGW64_COMPILER_NAME="MinGW-w64 x86_64 GCC" MINGW64_PACKAGE_SUFFIX="mingw64" +MINGW_LITE_RELEASE="14.1.0-r2" MINGW32_WIN2000_ARCHIVE="mingw32-win2000-${MINGW_LITE_RELEASE}.7z" if [[ ${#compilers[@]} -eq 0 ]]; then @@ -213,6 +210,8 @@ if [[ -n "${UCRT}" && ! -f "${UCRT_DIR}/ucrtbase.dll" ]]; then exit 1 fi +export PATH="${QT_DIR}/bin:${PATH}" + ## prepare dirs if [[ ${CLEAN} -eq 1 ]]; then @@ -243,12 +242,6 @@ if [[ ${COMPILER_MINGW32_WIN2000} -eq 1 && ! -f "${ASSETS_DIR}/${MINGW32_WIN2000 curl -L "https://github.com/redpanda-cpp/mingw-lite/releases/download/${MINGW_LITE_RELEASE}/${MINGW32_WIN2000_ARCHIVE}" -o "${ASSETS_DIR}/${MINGW32_WIN2000_ARCHIVE}" fi -## prepare host compiler - -[[ -f "${ASSETS_DIR}/${HOST_MINGW_ARCHIVE}" ]] || curl -L "https://github.com/redpanda-cpp/mingw-lite/releases/download/${MINGW_LITE_RELEASE}/${HOST_MINGW_ARCHIVE}" -o "${ASSETS_DIR}/${HOST_MINGW_ARCHIVE}" -[[ -x "${BUILD_DIR}/mingw${HOST_MINGW_BIT}/bin/gcc.exe" ]] || "${_7Z}" x "${ASSETS_DIR}/${HOST_MINGW_ARCHIVE}" -o"${BUILD_DIR}" -export PATH="${BUILD_DIR}/mingw${HOST_MINGW_BIT}/bin:${PATH}" - ## build fn_print_progress "Building astyle..." pushd "${ASSETS_DIR}/astyle"