diff --git a/packages/msys/build-mingw.sh b/packages/msys/build-mingw.sh index 7f85dc4b..0a2afbf3 100644 --- a/packages/msys/build-mingw.sh +++ b/packages/msys/build-mingw.sh @@ -6,7 +6,7 @@ set -euxo pipefail # packages/msys/build-mingw.sh [-m|--msystem ] [-c|--clean] [-nd|--no-deps] [-t|--target-dir ] # Options: # -m, --msystem switch to other MSYS2 environment -# (MINGW32, MINGW64, UCRT64, CLANG32, CLANG64) +# (MINGW32, MINGW64, UCRT64, CLANG32, CLANG64, CLANGARM64) # MUST be used before other options # -c, --clean clean build and package directories # -nd, --no-deps skip dependency check @@ -24,7 +24,7 @@ if [[ $# -gt 1 && ($1 == "-m" || $1 == "--msystem") ]]; then msystem=$2 shift 2 case "${msystem}" in - MINGW32|MINGW64|UCRT64|CLANG32|CLANG64) + MINGW32|MINGW64|UCRT64|CLANG32|CLANG64|CLANGARM64) export MSYSTEM="${msystem}" exec /bin/bash --login "$0" "$@" ;; @@ -38,28 +38,30 @@ fi case "${MSYSTEM}" in MINGW32|CLANG32) # there is no UCRT32 NSIS_ARCH=x86 - BITNESS=32 - COMPILER_NAME="MinGW-w64 i686 GCC 8.1" - ARCHIVE_MINGW_COMPILER_BASENAME="RedPanda.C++.${APP_VERSION}.win32.${COMPILER_NAME}" - ARCHIVE_NO_COMPILER_BASENAME="RedPanda.C++.${APP_VERSION}.win32.No.Compiler" + PACKAGE_BASENAME="RedPanda.C++.${APP_VERSION}.win32" ;; MINGW64|UCRT64|CLANG64) NSIS_ARCH=x64 - BITNESS=64 - COMPILER_NAME="MinGW-w64 X86_64 GCC 11.4" - ARCHIVE_MINGW_COMPILER_BASENAME="RedPanda.C++.${APP_VERSION}.win64.${COMPILER_NAME}" - ARCHIVE_NO_COMPILER_BASENAME="RedPanda.C++.${APP_VERSION}.win64.No.Compiler" + PACKAGE_BASENAME="RedPanda.C++.${APP_VERSION}.win64" + ;; + CLANGARM64) + NSIS_ARCH=arm64 + PACKAGE_BASENAME="RedPanda.C++.${APP_VERSION}.arm64" ;; *) echo "This script must be run in one of the following MSYS2 shells:" echo " - MINGW32 / CLANG32" echo " - MINGW64 / UCRT64 / CLANG64" + echo " - CLANGARM64" exit 1 ;; esac CLEAN=0 CHECK_DEPS=1 +compilers=() +COMPILER_MINGW32=0 +COMPILER_MINGW64=0 TARGET_DIR="$(pwd)/dist" while [[ $# -gt 0 ]]; do case $1 in @@ -67,6 +69,16 @@ while [[ $# -gt 0 ]]; do CLEAN=1 shift ;; + --mingw32) + compilers+=("mingw32") + COMPILER_MINGW32=1 + shift + ;; + --mingw64) + compilers+=("mingw64") + COMPILER_MINGW64=1 + shift + ;; -nd|--no-deps) CHECK_DEPS=0 shift @@ -87,7 +99,21 @@ PACKAGE_DIR="${TEMP}/redpanda-mingw-${MSYSTEM}-pkg" QMAKE="${MINGW_PREFIX}/qt5-static/bin/qmake" NSIS="/mingw32/bin/makensis" SOURCE_DIR="$(pwd)" -MINGW_ARCHIVE="mingw${BITNESS}.7z" + +MINGW32_ARCHIVE="mingw32.7z" +MINGW32_COMPILER_NAME="MinGW-w64 i686 GCC 8.1" +MINGW32_PACKAGE_SUFFIX="MinGW32_8.1" + +MINGW64_ARCHIVE="mingw64.7z" +MINGW64_COMPILER_NAME="MinGW-w64 X86_64 GCC 11.4" +MINGW64_PACKAGE_SUFFIX="MinGW64_11.4" + +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}" +fi function fn_print_progress() { echo -e "\e[1;32;44m$1\e[0m" @@ -100,7 +126,7 @@ if [[ ${CHECK_DEPS} -eq 1 ]]; then MINGW32|MINGW64|UCRT64) compiler=gcc ;; - CLANG32|CLANG64) + CLANG32|CLANG64|CLANGARM64) compiler=clang ;; esac @@ -117,8 +143,12 @@ if [[ ${CHECK_DEPS} -eq 1 ]]; then done fi -if [[ ! -f "${SOURCE_DIR}/assets/${MINGW_ARCHIVE}" ]]; then - echo "Missing MinGW archive: assets/${MINGW_ARCHIVE}" +if [[ ${COMPILER_MINGW32} -eq 1 && ! -f "${SOURCE_DIR}/assets/${MINGW32_ARCHIVE}" ]]; then + echo "Missing MinGW archive: assets/${MINGW32_ARCHIVE}" + exit 1 +fi +if [[ ${COMPILER_MINGW64} -eq 1 && ! -f "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}" ]]; then + echo "Missing MinGW archive: assets/${MINGW64_ARCHIVE}" exit 1 fi @@ -136,7 +166,7 @@ fn_print_progress "Building..." pushd . cd "${BUILD_DIR}" qmake_flags=() -[[ NSIS_ARCH == x64 ]] && qmake_flags+=("X86_64=ON") +[[ ${NSIS_ARCH} == x64 ]] && qmake_flags+=("X86_64=ON") "$QMAKE" PREFIX="${PACKAGE_DIR}" ${qmake_flags[@]} -o Makefile "${SOURCE_DIR}/Red_Panda_Cpp.pro" -r mingw32-make -j$(nproc) mingw32-make install @@ -153,45 +183,31 @@ cp "${SOURCE_DIR}/platform/windows/installer-scripts/lang.nsh" . cp "${SOURCE_DIR}/platform/windows/installer-scripts/redpanda.nsi" . popd -## make no-compiler package +## make package pushd . cd "${PACKAGE_DIR}" -SETUP_NAME="${ARCHIVE_NO_COMPILER_BASENAME}.Setup.exe" -PORTABLE_NAME="${ARCHIVE_NO_COMPILER_BASENAME}.Portable.7z" - -fn_print_progress "Making no-compiler installer ..." -"${NSIS}" \ - -DAPP_VERSION="${APP_VERSION}" \ - -DARCH="${NSIS_ARCH}" \ - -DFINALNAME="${SETUP_NAME}" \ - redpanda.nsi - -fn_print_progress "Making no-compiler Portable Package..." -7z x "${SETUP_NAME}" -o"RedPanda-CPP" -xr'!$PLUGINSDIR' -x"!uninstall.exe" -7z a -mmt -mx9 -ms=on -mqs=on -mf=BCJ2 "${PORTABLE_NAME}" "RedPanda-CPP" -rm -rf "RedPanda-CPP" - -mv "${SETUP_NAME}" "${TARGET_DIR}" -mv "${PORTABLE_NAME}" "${TARGET_DIR}" -popd - -## make mingw package - -pushd . -cd "${PACKAGE_DIR}" -SETUP_NAME="${ARCHIVE_MINGW_COMPILER_BASENAME}.Setup.exe" -PORTABLE_NAME="${ARCHIVE_MINGW_COMPILER_BASENAME}.Portable.7z" +SETUP_NAME="${PACKAGE_BASENAME}.Setup.exe" +PORTABLE_NAME="${PACKAGE_BASENAME}.Portable.7z" fn_print_progress "Making installer..." -[[ ! -d "mingw${BITNESS}" ]] && 7z x "${SOURCE_DIR}/assets/${MINGW_ARCHIVE}" -o"${PACKAGE_DIR}" -"${NSIS}" \ - -DAPP_VERSION="${APP_VERSION}" \ - -DARCH="${NSIS_ARCH}" \ - -DFINALNAME="${SETUP_NAME}" \ - -DHAVE_MINGW -DCOMPILERNAME="${COMPILER_NAME}" -DCOMPILERFOLDER="mingw${BITNESS}" \ - redpanda.nsi +nsis_flags=( + -DAPP_VERSION="${APP_VERSION}" + -DARCH="${NSIS_ARCH}" + -DFINALNAME="${SETUP_NAME}" + -DMINGW32_COMPILER_NAME="${MINGW32_COMPILER_NAME}" + -DMINGW64_COMPILER_NAME="${MINGW64_COMPILER_NAME}" +) +if [[ ${COMPILER_MINGW32} -eq 1 ]]; then + nsis_flags+=(-DHAVE_MINGW32) + [[ -d "mingw32" ]] || 7z x "${SOURCE_DIR}/assets/${MINGW32_ARCHIVE}" -o"${PACKAGE_DIR}" +fi +if [[ ${COMPILER_MINGW64} -eq 1 ]]; then + nsis_flags+=(-DHAVE_MINGW64) + [[ -d "mingw64" ]] || 7z x "${SOURCE_DIR}/assets/${MINGW64_ARCHIVE}" -o"${PACKAGE_DIR}" +fi +"${NSIS}" "${nsis_flags[@]}" redpanda.nsi fn_print_progress "Making Portable Package..." 7z x "${SETUP_NAME}" -o"RedPanda-CPP" -xr'!$PLUGINSDIR' -x"!uninstall.exe" diff --git a/platform/windows/installer-scripts/lang.nsh b/platform/windows/installer-scripts/lang.nsh index db24f245..b5701963 100644 --- a/platform/windows/installer-scripts/lang.nsh +++ b/platform/windows/installer-scripts/lang.nsh @@ -2,7 +2,8 @@ LangString MessageAppName 1033 "Red Panda C++" LangString MessageSectionMain 1033 "The Red Panda C++ IDE (Integrated Development Environment)" LangString MessageSectionIcons 1033 "Various icons that you can use in your programs" -LangString MessageSectionMinGW 1033 "The ${COMPILERNAME} compiler and associated tools, headers and libraries" +LangString MessageSectionMinGW32 1033 "The ${MINGW32_COMPILER_NAME} compiler and associated tools, headers and libraries" +LangString MessageSectionMinGW64 1033 "The ${MINGW64_COMPILER_NAME} compiler and associated tools, headers and libraries" LangString MessageSectionLangs 1033 "The Red Panda C++ interface translated to different languages (other than English which is built-in)" LangString MessageSectionAssocs 1033 "Use Red Panda C++ as the default application for opening these types of files" LangString MessageSectionShortcuts 1033 "Create shortcuts to Red Panda C++ in various folders" @@ -13,7 +14,8 @@ LangString MessageRemoveConfig 1033 "Do you want to remove all the remainin LangString SectionMainName 1033 "Program files (required)" LangString SectionIconsName 1033 "Icon files" LangString SectionLangsName 1033 "Language files" -LangString SectionMinGWName 1033 "${COMPILERNAME} compiler" +LangString SectionMinGW32Name 1033 "${MINGW32_COMPILER_NAME} compiler" +LangString SectionMinGW64Name 1033 "${MINGW64_COMPILER_NAME} compiler" LangString SectionAssocsName 1033 "Associate files to Red Panda C++" LangString SectionAssocExtNameBegin 1033 "Associate" LangString SectionAssocExtNameEnd 1033 "files to Red Panda C++" @@ -26,7 +28,8 @@ LangString SectionConfigName 1033 "Remove old configuration files" LangString MessageAppName 2052 "小熊猫C++" LangString MessageSectionMain 2052 "小熊猫C++ IDE (集成开发环境)" LangString MessageSectionIcons 2052 "项目模板使用的图标文件" -LangString MessageSectionMinGW 2052 "${COMPILERNAME} 编译器和相关的工具、头文件和库" +LangString MessageSectionMinGW32 2052 "${MINGW32_COMPILER_NAME} 编译器和相关的工具、头文件和库" +LangString MessageSectionMinGW64 2052 "${MINGW64_COMPILER_NAME} 编译器和相关的工具、头文件和库" LangString MessageSectionLangs 2052 "小熊猫C++翻译文件" LangString MessageSectionAssocs 2052 "使用小熊猫C++打开这些文件" LangString MessageSectionShortcuts 2052 "开始菜单和快捷方式" @@ -37,7 +40,8 @@ LangString MessageRemoveConfig 2052 "你想要删除所有的配置文件 LangString SectionMainName 2052 "程序文件 (必须)" LangString SectionIconsName 2052 "图标文件" LangString SectionLangsName 2052 "语言文件" -LangString SectionMinGWName 2052 "${COMPILERNAME}编译器" +LangString SectionMinGW32Name 2052 "${MINGW32_COMPILER_NAME} 编译器" +LangString SectionMinGW64Name 2052 "${MINGW64_COMPILER_NAME} 编译器" LangString SectionAssocsName 2052 "关联文件到小熊猫C++" LangString SectionAssocExtNameBegin 2052 "将" LangString SectionAssocExtNameEnd 2052 "文件关联到小熊猫C++" diff --git a/platform/windows/installer-scripts/redpanda.nsi b/platform/windows/installer-scripts/redpanda.nsi index ee44be61..5864f0fd 100644 --- a/platform/windows/installer-scripts/redpanda.nsi +++ b/platform/windows/installer-scripts/redpanda.nsi @@ -104,12 +104,21 @@ Section "$(SectionMainName)" SectionMain SectionEnd -!ifdef HAVE_MINGW - Section "$(SectionMinGWName)" SectionMinGW +!ifdef HAVE_MINGW32 + Section "$(SectionMinGW32Name)" SectionMinGW32 SectionIn 1 3 - SetOutPath $INSTDIR\${COMPILERFOLDER} + SetOutPath $INSTDIR - File /nonfatal /r "${COMPILERFOLDER}\*" + File /nonfatal /r "mingw32" + SectionEnd +!endif + +!ifdef HAVE_MINGW64 + Section "$(SectionMinGW64Name)" SectionMinGW64 + SectionIn 1 3 + SetOutPath $INSTDIR + + File /nonfatal /r "mingw64" SectionEnd !endif @@ -263,8 +272,11 @@ SectionEnd !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN !insertmacro MUI_DESCRIPTION_TEXT ${SectionMain} "$(MessageSectionMain)" -!ifdef HAVE_MINGW - !insertmacro MUI_DESCRIPTION_TEXT ${SectionMinGW} "$(MessageSectionMinGW)" +!ifdef HAVE_MINGW32 + !insertmacro MUI_DESCRIPTION_TEXT ${SectionMinGW32} "$(MessageSectionMinGW32)" +!endif +!ifdef HAVE_MINGW64 + !insertmacro MUI_DESCRIPTION_TEXT ${SectionMinGW64} "$(MessageSectionMinGW64)" !endif !insertmacro MUI_DESCRIPTION_TEXT ${SectionShortcuts} "$(MessageSectionShortcuts)" !insertmacro MUI_DESCRIPTION_TEXT ${SectionAssocs} "$(MessageSectionAssocs)" @@ -488,9 +500,8 @@ Section "Uninstall" RMDir /r "$INSTDIR\Lang" RMDir /r "$INSTDIR\Templates" - RMDir /r "$INSTDIR\MinGW32" - RMDir /r "$INSTDIR\MinGW64" - RMDir /r "$INSTDIR\Clang64" + RMDir /r "$INSTDIR\mingw32" + RMDir /r "$INSTDIR\mingw64" StrCpy $0 "$INSTDIR" Call un.DeleteDirIfEmpty