Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add packaging support for WSL toolchain #569

Merged
merged 1 commit into from
Jan 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ Extra arguments for `build-mingw.sh`:
- `--mingw32`: add `assets/mingw32.7z` to the package.
- `--mingw64`: add `assets/mingw64.7z` to the package.
- `--mingw`: alias for `--mingw64` (x64 app).
- `--gcc-linux-x86-64`: add `assets/gcc-linux-x86-64.7z` and `assets/alpine-minirootfs-x86_64.tar` to the package.
- `--gcc-linux-aarch64`: add `assets/gcc-linux-aarch64.7z` and `assets/alpine-minirootfs-aarch64.tar` to the package.
- `--ucrt <build>`: add UCRT runtime from Windows SDK to the package. e.g. `--ucrt 22621` for Windows 11 SDK 22H2.

## Windows NT 5.x Qt Library with MinGW Lite Toolchain
Expand Down
2 changes: 2 additions & 0 deletions BUILD_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
- `--mingw32`:把 `assets/mingw32.7z` 添加到包中。
- `--mingw64`:把 `assets/mingw64.7z` 添加到包中。
- `--mingw`:`--mingw64`(x64 程序)的别名。
- `--gcc-linux-x86-64`:把 `assets/gcc-linux-x86-64.7z` 和 `assets/alpine-minirootfs-x86_64.tar` 添加到包中。
- `--gcc-linux-aarch64`:把 `assets/gcc-linux-aarch64.7z` 和 `assets/alpine-minirootfs-aarch64.tar` 添加到包中。
- `--ucrt <build>`:把 Windows SDK 附带的 UCRT 运行时添加到包中。例如 `--ucrt 22621` 表示 Windows 11 SDK 22H2。

## 用于 Windows NT 5.x 的 Qt 库 + MinGW Lite 工具链
Expand Down
2 changes: 2 additions & 0 deletions BUILD_ru.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,8 @@ Red Panda C++ должна работать с любым 64-битным наб
- `--mingw32`: и `assets/mingw32.7z` для сборки пакета.
- `--mingw64`: и `assets/mingw64.7z` для сборки пакета.
- `--mingw`: псевдоним для `--mingw64` (x64-приложение).
- `--gcc-linux-x86-64`: add `assets/gcc-linux-x86-64.7z` and `assets/alpine-minirootfs-x86_64.tar` to the package.
- `--gcc-linux-aarch64`: add `assets/gcc-linux-aarch64.7z` and `assets/alpine-minirootfs-aarch64.tar` to the package.
- `--ucrt <build>`: добавить UCRT runtime из Windows SDK в пакет. Например, `--ucrt 22621` для Windows 11 SDK 22H2.

## Windows NT 5.x с библиотекой Qt с набором инструментов MinGW Lite
Expand Down
5 changes: 5 additions & 0 deletions RedPandaIDE/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3350,6 +3350,11 @@ void Settings::CompilerSets::findSets()
mSettings->dirs().appDir() + "/clang64/bin",
mSettings->dirs().appDir() + "/mingw64/bin",
mSettings->dirs().appDir() + "/mingw32/bin",

// cross toolchain targeting Linux
// directory names follow dynamic linker (ld-linux-x86-64.so -> gcc-linux-x86-64)
mSettings->dirs().appDir() + "/gcc-linux-x86-64/bin",
mSettings->dirs().appDir() + "/gcc-linux-aarch64/bin",
} + pathList;
#endif
QString folder, canonicalFolder;
Expand Down
1 change: 1 addition & 0 deletions packages/msys/build-llvm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ function package() {
-DUSE_MODERN_FONT
-DHAVE_LLVM
-DHAVE_OPENCONSOLE
-DSTRICT_ARCH_CHECK # required by OpenConsole
-DHAVE_COMPILER_HINT
)
"$_NSIS" "${nsis_flags[@]}" redpanda.nsi
Expand Down
81 changes: 79 additions & 2 deletions packages/msys/build-mingw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ function fn_print_help() {
--mingw Alias for --mingw32 (x86 app) or --mingw64 (x64 app).
--mingw32 Build mingw32 integrated compiler.
--mingw64 Build mingw64 integrated compiler.
--gcc-linux-x86-64 Build x86_64-linux-gnu integrated compiler.
--gcc-linux-aarch64 Build aarch64-linux-gnu integrated compiler.
--ucrt <build> Include UCRT in the package. Windows SDK required.
e.g. '--ucrt 22621' for Windows 11 SDK 22H2.
-nd, --no-deps Skip dependency check.
Expand Down Expand Up @@ -74,6 +76,10 @@ CHECK_DEPS=1
compilers=()
COMPILER_MINGW32=0
COMPILER_MINGW64=0
COMPILER_GCC_LINUX_X8664=0
COMPILER_GCC_LINUX_AARCH64=0
REQUIRED_WINDOWS_BUILD=7600
REQUIRED_WINDOWS_NAME="Windows 7"
TARGET_DIR="$(pwd)/dist"
UCRT=""
while [[ $# -gt 0 ]]; do
Expand Down Expand Up @@ -114,6 +120,36 @@ while [[ $# -gt 0 ]]; do
COMPILER_MINGW64=1
shift
;;
--gcc-linux-x86-64)
case "${NSIS_ARCH}" in
x64)
compilers+=("gcc-linux-x86-64")
COMPILER_GCC_LINUX_X8664=1
REQUIRED_WINDOWS_BUILD=17763
REQUIRED_WINDOWS_NAME="Windows 10 v1809"
shift
;;
*)
echo "architecture mismatch, --gcc-linux-x86-64 is only supported on x64"
exit 1
;;
esac
;;
--gcc-linux-aarch64)
case "${NSIS_ARCH}" in
arm64)
compilers+=("gcc-linux-aarch64")
COMPILER_GCC_LINUX_AARCH64=1
REQUIRED_WINDOWS_BUILD=22000
REQUIRED_WINDOWS_NAME="Windows 11"
shift
;;
*)
echo "architecture mismatch, --gcc-linux-aarch64 is only supported on arm64"
exit 1
;;
esac
;;
--ucrt)
case "${MSYSTEM}" in
UCRT64|CLANG64)
Expand Down Expand Up @@ -177,11 +213,18 @@ MINGW64_ARCHIVE="mingw64.7z"
MINGW64_COMPILER_NAME="MinGW-w64 X86_64 GCC 11.4"
MINGW64_PACKAGE_SUFFIX="MinGW64_11.4"

GCC_LINUX_X8664_ARCHIVE="gcc-linux-x86-64.7z"
ALPINE_X8664_ARCHIVE="alpine-minirootfs-x86_64.tar"

GCC_LINUX_AARCH64_ARCHIVE="gcc-linux-aarch64.7z"
ALPINE_AARCH64_ARCHIVE="alpine-minirootfs-aarch64.tar"

if [[ ${#compilers[@]} -eq 0 ]]; then
PACKAGE_BASENAME="${PACKAGE_BASENAME}.NoCompiler"
else
[[ ${COMPILER_MINGW32} -eq 1 ]] && PACKAGE_BASENAME="${PACKAGE_BASENAME}.${MINGW32_PACKAGE_SUFFIX}"
[[ ${COMPILER_MINGW64} -eq 1 ]] && PACKAGE_BASENAME="${PACKAGE_BASENAME}.${MINGW64_PACKAGE_SUFFIX}"
[[ ${COMPILER_GCC_LINUX_X8664} -eq 1 || ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]] && PACKAGE_BASENAME="${PACKAGE_BASENAME}.Linux_GCC"
fi

function fn_print_progress() {
Expand Down Expand Up @@ -215,6 +258,22 @@ if [[ ${COMPILER_MINGW64} -eq 1 && ! -f "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}
echo "Missing MinGW archive: assets/${MINGW64_ARCHIVE} or MinGW folder: assets/${MINGW64_FOLDER}"
exit 1
fi
if [[ ${COMPILER_GCC_LINUX_X8664} -eq 1 ]]; then
if [[ ! -f "${SOURCE_DIR}/assets/${GCC_LINUX_X8664_ARCHIVE}" ]]; then
echo "Missing GCC archive: assets/${GCC_LINUX_X8664_ARCHIVE}"
fi
if [[ ! -f "${SOURCE_DIR}/assets/${ALPINE_X8664_ARCHIVE}" ]]; then
echo "Missing Alpine rootfs: assets/${ALPINE_X8664_ARCHIVE}"
fi
fi
if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
if [[ ! -f "${SOURCE_DIR}/assets/${GCC_LINUX_AARCH64_ARCHIVE}" ]]; then
echo "Missing GCC archive: assets/${GCC_LINUX_AARCH64_ARCHIVE}"
fi
if [[ ! -f "${SOURCE_DIR}/assets/${ALPINE_AARCH64_ARCHIVE}" ]]; then
echo "Missing Alpine rootfs: assets/${ALPINE_AARCH64_ARCHIVE}"
fi
fi
if [[ -n "${UCRT}" && ! -f "${UCRT_DIR}/ucrtbase.dll" ]]; then
echo "Missing Windows SDK, UCRT cannot be included."
exit 1
Expand Down Expand Up @@ -290,8 +349,8 @@ nsis_flags=(
-DFINALNAME="${SETUP_NAME}"
-DMINGW32_COMPILER_NAME="${MINGW32_COMPILER_NAME}"
-DMINGW64_COMPILER_NAME="${MINGW64_COMPILER_NAME}"
-DREQUIRED_WINDOWS_BUILD=7600
-DREQUIRED_WINDOWS_NAME="Windows 7"
-DREQUIRED_WINDOWS_BUILD="${REQUIRED_WINDOWS_BUILD}"
-DREQUIRED_WINDOWS_NAME="${REQUIRED_WINDOWS_NAME}"
-DUSE_MODERN_FONT
)
if [[ ${COMPILER_MINGW32} -eq 1 ]]; then
Expand All @@ -308,6 +367,24 @@ if [[ ${COMPILER_MINGW64} -eq 1 ]]; then
[[ -d "${SOURCE_DIR}/assets/${MINGW64_FOLDER}" ]] && cp -a --dereference "${SOURCE_DIR}/assets/${MINGW64_FOLDER}" "${PACKAGE_DIR}"
fi
fi
if [[ ${COMPILER_GCC_LINUX_X8664} -eq 1 ]]; then
nsis_flags+=(-DHAVE_GCC_LINUX_X8664 -DSTRICT_ARCH_CHECK)
if [[ ! -d "gcc-linux-x86_64" ]]; then
"${_7Z}" x "${SOURCE_DIR}/assets/${GCC_LINUX_X8664_ARCHIVE}" -o"${PACKAGE_DIR}"
fi
if [[ ! -d "alpine-minirootfs.tar" ]]; then
cp "${SOURCE_DIR}/assets/${ALPINE_X8664_ARCHIVE}" alpine-minirootfs.tar
fi
fi
if [[ ${COMPILER_GCC_LINUX_AARCH64} -eq 1 ]]; then
nsis_flags+=(-DHAVE_GCC_LINUX_AARCH64 -DSTRICT_ARCH_CHECK)
if [[ ! -d "gcc-linux-aarch64" ]]; then
"${_7Z}" x "${SOURCE_DIR}/assets/${GCC_LINUX_AARCH64_ARCHIVE}" -o"${PACKAGE_DIR}"
fi
if [[ ! -d "alpine-minirootfs.tar" ]]; then
cp "${SOURCE_DIR}/assets/${ALPINE_AARCH64_ARCHIVE}" alpine-minirootfs.tar
fi
fi
if [[ -n "${UCRT}" ]]; then
nsis_flags+=(-DHAVE_UCRT)
if [[ ! -f ucrt/ucrtbase.dll ]]; then
Expand Down
6 changes: 6 additions & 0 deletions platform/windows/installer-scripts/lang.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ LangString SectionLangsName 1033 "Language files"
LangString SectionMinGW32Name 1033 "${MINGW32_COMPILER_NAME} compiler"
LangString SectionMinGW64Name 1033 "${MINGW64_COMPILER_NAME} compiler"
LangString SectionLlvmName 1033 "LLVM-MinGW compiler"
LangString SectionGccLinuxX8664Name 1033 "Linux x86-64 GCC compiler"
LangString SectionGccLinuxAarch64Name 1033 "Linux aarch64 GCC compiler"
LangString SectionAssocsName 1033 "Associate files to Red Panda C++"
LangString SectionAssocExtNameBegin 1033 "Associate"
LangString SectionAssocExtNameEnd 1033 "files to Red Panda C++"
Expand All @@ -30,6 +32,7 @@ LangString SectionCompressName 1033 "Compress installation directory"
LangString SectionConfigName 1033 "Remove old configuration files"

LangString ErrorArchMismatch 1033 "Architecture mismatch. This package is for ${ARCH}, but the operating system is $osArch."
LangString ErrorStrictArchMismatch 1033 "Architecture mismatch. This package is STRICTLY for ${ARCH}, but the operating system is $osArch."
LangString ErrorWindowsBuildRequired 1033 "Unsupported operating system. ${REQUIRED_WINDOWS_NAME} (${REQUIRED_WINDOWS_BUILD}) or later is required."

LangString WarningArchMismatch 1033 "Note: installing Red Panda C++ for ${ARCH} on $osArch OS. You may want to install native build instead."
Expand Down Expand Up @@ -65,6 +68,8 @@ LangString SectionLangsName 2052 "语言文件"
LangString SectionMinGW32Name 2052 "${MINGW32_COMPILER_NAME} 编译器"
LangString SectionMinGW64Name 2052 "${MINGW64_COMPILER_NAME} 编译器"
LangString SectionLlvmName 2052 "LLVM-MinGW 编译器"
LangString SectionGccLinuxX8664Name 2052 "Linux x86_64 GCC 编译器"
LangString SectionGccLinuxAarch64Name 2052 "Linux aarch64 GCC 编译器"
LangString SectionAssocsName 2052 "关联文件到小熊猫C++"
LangString SectionAssocExtNameBegin 2052 "将"
LangString SectionAssocExtNameEnd 2052 "文件关联到小熊猫C++"
Expand All @@ -75,6 +80,7 @@ LangString SectionCompressName 2052 "压缩安装目录"
LangString SectionConfigName 2052 "删除原有配置文件"

LangString ErrorArchMismatch 2052 "架构不匹配。此软件包适用于 ${ARCH},但操作系统是 $osArch。"
LangString ErrorStrictArchMismatch 2052 "架构不匹配。此软件包**只能用于** ${ARCH},但操作系统是 $osArch。"
LangString ErrorWindowsBuildRequired 2052 "不支持的操作系统。需要 ${REQUIRED_WINDOWS_NAME} (${REQUIRED_WINDOWS_BUILD}) 或更高版本。"

LangString WarningArchMismatch 2052 "注意:在 $osArch 操作系统上安装小熊猫C++ ${ARCH} 版本。你可能想要安装本机版本。"
Expand Down
20 changes: 20 additions & 0 deletions platform/windows/installer-scripts/redpanda.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,26 @@ SectionEnd
SectionEnd
!endif

!ifdef HAVE_GCC_LINUX_X8664
Section "$(SectionGccLinuxX8664Name)" SectionGccLinuxX8664
SectionIn 1 3
SetOutPath $INSTDIR

File "alpine-minirootfs.tar"
File /nonfatal /r "gcc-linux-x86-64"
SectionEnd
!endif

!ifdef HAVE_GCC_LINUX_AARCH64
Section "$(SectionGccLinuxAarch64Name)" SectionGccLinuxAarch64
SectionIn 1 3
SetOutPath $INSTDIR

File "alpine-minirootfs.tar"
File /nonfatal /r "gcc-linux-aarch64"
SectionEnd
!endif

####################################################################
# File association
SectionGroup "$(SectionAssocsName)" SectionAssocs
Expand Down
39 changes: 17 additions & 22 deletions platform/windows/installer-scripts/utils.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,31 @@ Var /GLOBAL sectionDepTemp
!macroend

!macro CheckOsArch
; special check for OpenConsole.exe:
; - 32-bit cannot be installed on 64-bit OS
; - x64 can be install on arm64 OS
!ifdef HAVE_OPENCONSOLE
!if "${ARCH}" == "x86"
${If} $osArch != "x86"
!ifdef STRICT_ARCH_CHECK
${If} $osArch != "${ARCH}"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorStrictArchMismatch)"
Abort
${EndIf}
!else
!if "${ARCH}" == "x64"
${If} $osArch == "x86"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorArchMismatch)"
Abort
${EndIf}
!endif
!endif

!if "${ARCH}" == "x64"
${If} $osArch == "x86"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorArchMismatch)"
Abort
${EndIf}
!endif
!if "${ARCH}" == "arm64"
${If} $osArch != "arm64"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorArchMismatch)"
Abort
${EndIf}
!endif

!if "${ARCH}" == "arm64"
${If} $osArch != "arm64"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorArchMismatch)"
Abort
; warning if not matching
${If} $osArch != "${ARCH}"
MessageBox MB_OK|MB_ICONEXCLAMATION "$(WarningArchMismatch)"
${EndIf}
!endif

; warning if not matching
${If} $osArch != "${ARCH}"
MessageBox MB_OK|MB_ICONEXCLAMATION "$(WarningArchMismatch)"
${EndIf}
!macroend

!macro CheckOsBuild
Expand Down
Loading