merge llvm installer script to mingw script (#355)

This commit is contained in:
Cyano Hao 2024-03-31 08:23:30 +08:00 committed by GitHub
parent 1e73b7beb2
commit 334ab8d87b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 97 additions and 546 deletions

View File

@ -1,5 +1,45 @@
#!/bin/bash
set -euxo pipefail
function fn_print_help() {
cat <<EOF
Usage:
packages/msys/build-llvm.sh [-m|--msystem <MSYSTEM>] [-c|--clean] [-nd|--no-deps] [-t|--target-dir <dir>]
Options:
-h, --help Display this information.
-m, --msystem <MSYSTEM> Switch to other MSYS2 environment.
(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.
-t, --target-dir <dir> Set target directory for the packages.
EOF
}
source version.inc
[[ -n "${APP_VERSION_SUFFIX}" ]] && APP_VERSION="${APP_VERSION}${APP_VERSION_SUFFIX}"
if [[ ! -v MSYSTEM ]]; then
echo "This script must be run in MSYS2 shell"
exit 1
fi
if [[ $# -gt 1 && ($1 == "-m" || $1 == "--msystem") ]]; then
msystem=$2
shift 2
case "${msystem}" in
MINGW32|MINGW64|UCRT64|CLANG32|CLANG64|CLANGARM64)
export MSYSTEM="${msystem}"
exec /bin/bash --login "$0" "$@"
;;
*)
echo "Invalid MSYSTEM: ${msystem}"
exit 1
;;
esac
fi
case $MSYSTEM in
MINGW32|CLANG32)
_NATIVE_ARCH=i686
@ -22,25 +62,13 @@ case $MSYSTEM in
;;
esac
set -euxo pipefail
GCC_VERSION="13.2.0"
MINGW_VERSION="rt_v11-rev1"
REDPANDA_LLVM_VERSION="17-r0"
WINDOWS_TERMINAL_VERSION="1.18.3181.0"
WINDOWS_TERMINAL_VERSION="1.19.10821.0"
_QMAKE="$MINGW_PREFIX/qt5-static/bin/qmake"
_NSIS="/mingw32/bin/makensis"
_MINGW32_DIR="mingw32"
_MINGW32_TRIPLET="i686-w64-mingw32"
_MINGW32_ARCHIVE="i686-$GCC_VERSION-release-posix-dwarf-ucrt-$MINGW_VERSION.7z"
_MINGW32_URL="https://github.com/niXman/mingw-builds-binaries/releases/download/$GCC_VERSION-$MINGW_VERSION/$_MINGW32_ARCHIVE"
_MINGW64_DIR="mingw64"
_MINGW64_TRIPLET="x86_64-w64-mingw32"
_MINGW64_ARCHIVE="x86_64-$GCC_VERSION-release-posix-seh-ucrt-$MINGW_VERSION.7z"
_MINGW64_URL="https://github.com/niXman/mingw-builds-binaries/releases/download/$GCC_VERSION-$MINGW_VERSION/$_MINGW64_ARCHIVE"
_FINAL_NAME="redpanda-cpp-$APP_VERSION-$_DISPLAY_ARCH-llvm.exe"
_LLVM_DIR="llvm-mingw"
_LLVM_ARCHES=("x86_64" "i686" "aarch64")
@ -53,32 +81,25 @@ _WINDOWS_TERMINAL_URL="https://github.com/microsoft/terminal/releases/download/v
_SRCDIR="$PWD"
_ASSETSDIR="$PWD/assets"
_BUILDDIR="$TEMP/$MINGW_PACKAGE_PREFIX-redpanda-build"
_PKGDIR="$TEMP/$MINGW_PACKAGE_PREFIX-redpanda-pkg"
_BUILDDIR="$TEMP/redpanda-llvm-$MSYSTEM-build"
_PKGDIR="$TEMP/redpanda-llvm-$MSYSTEM-pkg"
_DISTDIR="$PWD/dist"
_REDPANDA_VERSION=$(sed -nr -e '/APP_VERSION\s*=/ s/APP_VERSION\s*=\s*(([0-9]+\.)*[0-9]+)\s*/\1/p' "$_SRCDIR"/Red_Panda_CPP.pro)
_REDPANDA_TESTVERSION=$(sed -nr -e '/TEST_VERSION\s*=/ s/TEST_VERSION\s*=\s*([A-Za-z0-9]*)\s*/\1/p' "$_SRCDIR"/Red_Panda_CPP.pro)
if [[ -n $_REDPANDA_TESTVERSION ]]; then
_REDPANDA_VERSION="$_REDPANDA_VERSION.$_REDPANDA_TESTVERSION"
fi
_CLEAN=0
_SKIP_DEPS_CHECK=0
_7Z_REPACK=0
while [[ $# -gt 0 ]]; do
case $1 in
--clean)
-c|--clean)
_CLEAN=1
shift
;;
--skip-deps-check)
-nd|--no-deps)
_SKIP_DEPS_CHECK=1
shift
;;
--7z)
_7Z_REPACK=1
shift
-t|--target-dir)
_DISTDIR="$2"
shift 2
;;
*)
echo "Unknown argument: $1"
@ -101,8 +122,8 @@ function check-deps() {
local deps=(
$MINGW_PACKAGE_PREFIX-{$compiler,make,qt5-static}
mingw-w64-i686-nsis
git
)
[[ _7Z_REPACK -eq 1 ]] && deps+=("$MINGW_PACKAGE_PREFIX-7zip")
for dep in "${deps[@]}"; do
pacman -Q "$dep" >/dev/null 2>&1 || (
echo "Missing dependency: $dep"
@ -120,33 +141,10 @@ function prepare-dirs() {
}
function download-assets() {
if [[ $_NATIVE_ARCH == i686 ]]; then
[[ -f "$_ASSETSDIR/$_MINGW32_ARCHIVE" ]] || curl -L -o "$_ASSETSDIR/$_MINGW32_ARCHIVE" "$_MINGW32_URL"
fi
if [[ $_NATIVE_ARCH == x86_64 ]]; then
[[ -f "$_ASSETSDIR/$_MINGW64_ARCHIVE" ]] || curl -L -o "$_ASSETSDIR/$_MINGW64_ARCHIVE" "$_MINGW64_URL"
fi
[[ -f "$_ASSETSDIR/$_LLVM_ARCHIVE" ]] || curl -L -o "$_ASSETSDIR/$_LLVM_ARCHIVE" "$_LLVM_URL"
[[ -f "$_ASSETSDIR/$_WINDOWS_TERMINAL_ARCHIVE" ]] || curl -L -o "$_ASSETSDIR/$_WINDOWS_TERMINAL_ARCHIVE" "$_WINDOWS_TERMINAL_URL"
}
function prepare-mingw() {
local bit="$1"
eval local mingw_dir="\$_MINGW${bit}_DIR"
eval local mingw_archive="\$_MINGW${bit}_ARCHIVE"
eval local mingw_triplet="\$_MINGW${bit}_TRIPLET"
local mingw_dir="$_BUILDDIR/$mingw_dir"
local mingw_lib_dir="$mingw_dir/$mingw_triplet/lib"
local mingw_shared_dir="$mingw_dir/$mingw_triplet/bin"
local mingw_include_dir="$mingw_dir/$mingw_triplet/include"
if [[ ! -d "$mingw_dir" ]]; then
bsdtar -C "$_BUILDDIR" -xf "$_ASSETSDIR/$mingw_archive"
local old_path="$PATH"
export PATH="$mingw_dir/bin:$PATH"
export PATH="$old_path"
fi
}
function prepare-openconsole() {
local windows_terminal_dir="$_BUILDDIR/$_WINDOWS_TERMINAL_DIR"
if [[ ! -d "$windows_terminal_dir" ]]; then
@ -169,39 +167,35 @@ function build() {
time mingw32-make WINDOWS_PREFER_OPENCONSOLE=ON -j$(nproc)
mingw32-make install
cp "$_SRCDIR"/packages/msys/domain/{main.nsi,lang.nsh,compiler_hint.lua} "$_PKGDIR"
cp "$_SRCDIR"/packages/msys/compiler_hint.lua "$_PKGDIR"
cp "$_SRCDIR"/platform/windows/installer-scripts/* "$_PKGDIR"
cp "$_WINDOWS_TERMINAL_DIR/OpenConsole.exe" "$_PKGDIR"
if [[ $_NATIVE_ARCH == i686 ]]; then
[[ -d "$_PKGDIR/mingw32" ]] || cp -r "mingw32" "$_PKGDIR"
fi
if [[ $_NATIVE_ARCH == x86_64 ]]; then
[[ -d "$_PKGDIR/mingw64" ]] || cp -r "mingw64" "$_PKGDIR"
fi
[[ -d "$_PKGDIR/llvm-mingw" ]] || bsdtar -C "$_PKGDIR" -xf "$_ASSETSDIR/$_LLVM_ARCHIVE"
popd
}
function package() {
pushd "$_PKGDIR"
"$_NSIS" -DVERSION="$_REDPANDA_VERSION" -DARCH="$_DISPLAY_ARCH" main.nsi
if [[ _7Z_REPACK -eq 1 ]]; then
7z x "redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.exe" -o"RedPanda-CPP" -xr'!$PLUGINSDIR' -x"!uninstall.exe"
7z a -t7z -mx=9 -ms=on -mqs=on -mf=BCJ2 -m0="LZMA2:d=128m:fb=273:c=2g" "redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.7z" "RedPanda-CPP"
rm -rf "RedPanda-CPP"
fi
nsis_flags=(
-DAPP_VERSION="$APP_VERSION"
-DARCH="$_DISPLAY_ARCH"
-DFINALNAME="$_FINAL_NAME"
-DREQUIRED_WINDOWS_BUILD=18362
-DREQUIRED_WINDOWS_NAME="Windows 10 v1903"
-DHAVE_LLVM
-DHAVE_OPENCONSOLE
)
"$_NSIS" "${nsis_flags[@]}" redpanda.nsi
popd
}
function dist() {
cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.exe" "$_DISTDIR"
[[ _7Z_REPACK -eq 1 ]] && cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.7z" "$_DISTDIR"
cp "$_PKGDIR/$_FINAL_NAME" "$_DISTDIR"
}
check-deps
prepare-dirs
download-assets
[[ $_NATIVE_ARCH == i686 ]] && prepare-mingw 32
[[ $_NATIVE_ARCH == x86_64 ]] && prepare-mingw 64
prepare-openconsole
prepare-src
trap restore-src EXIT INT TERM

View File

@ -1,65 +0,0 @@
/* English 1033 */
LangString MessageAppName 1033 "Red Panda C++"
LangString Message64bitBuildWarning 1033 "Note: installing Red Panda C++ x86 on 64-bit OS. There are 64-bit builds."
LangString MessageArm64BuildWarning 1033 "Note: installing Red Panda C++ x64 on ARM64. There is native ARM64 build."
LangString MessageWin10v1809RecommendedWarning 1033 "Note: Windows 10 version 1809 or later recommeded."
LangString Message64bitRequiredError 1033 "Unsupported operating system! 64-bit OS required."
LangString MessageArm64RequiredError 1033 "Unsupported operating system! ARM64 OS required."
LangString MessageWin7RequiredError 1033 "Unsupported operating system! Windows 7 or later required."
LangString MessageWin11RequiredError 1033 "Unsupported operating system! Windows 11 or later required."
LangString MessageSectionMain 1033 "The Red Panda C++ IDE (Integrated Development Environment)."
LangString MessageSectionOpenConsole 1033 "UTF-8 compatible OpenConsole.exe terminal emulator from Windows Terminal."
LangString MessageSectionMingw32 1033 "The MinGW GCC x86 compiler and associated tools, headers and libraries."
LangString MessageSectionMingw64 1033 "The MinGW GCC x64 compiler and associated tools, headers and libraries."
LangString MessageSectionLlvm 1033 "The LLVM MinGW compiler and associated tools, headers and libraries."
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."
LangString MessageSectionConfig 1033 "Remove all leftover configuration files from previous installs."
LangString MessageUninstallText 1033 "This program will uninstall Red Panda C++, continue?"
LangString MessageUninstallingExisting 1033 "Removing previous installation."
LangString MessageRemoveConfig 1033 "Do you want to remove all the remaining configuration files?"
LangString SectionMainName 1033 "Program files (required)"
LangString SectionOpenConsoleName 1033 "OpenConsole.exe terminal emulator"
LangString SectionMingw32Name 1033 "MinGW GCC x86 compiler"
LangString SectionMingw64Name 1033 "MinGW GCC x64 compiler"
LangString SectionLlvmName 1033 "LLVM MinGW compiler"
LangString SectionAssocsName 1033 "Associate files to Red Panda C++"
LangString SectionAssocExtNameBegin 1033 "Associate"
LangString SectionAssocExtNameEnd 1033 "files to Red Panda C++"
LangString SectionShortcutsName 1033 "Shortcuts"
LangString SectionMenuLaunchName 1033 "Create Start Menu shortcuts"
LangString SectionDesktopLaunchName 1033 "Create Desktop shortcut"
LangString SectionConfigName 1033 "Remove old configuration files"
/* Simplified Chinese 2052 */
LangString MessageAppName 2052 "小熊猫 C++"
LangString Message64bitBuildWarning 2052 "提示:正在把 x86 小熊猫 C++ 安装到 64 位操作系统上。小熊猫 C++ 有 64 位版本。"
LangString MessageArm64BuildWarning 2052 "提示:正在把 x64 小熊猫 C++ 安装到 ARM64 系统上。小熊猫 C++ 有原生 ARM64 版本。"
LangString MessageWin10v1809RecommendedWarning 2052 "提示:建议使用 Windows 10 1809 或更高版本。"
LangString Message64bitRequiredError 2052 "不支持的操作系统!需要 64 位操作系统。"
LangString MessageArm64RequiredError 2052 "不支持的操作系统!需要 ARM64 操作系统。"
LangString MessageWin7RequiredError 2052 "不支持的操作系统!需要 Windows 7 或更高版本。"
LangString MessageWin11RequiredError 2052 "不支持的操作系统!需要 Windows 11 或更高版本。"
LangString MessageSectionMain 2052 "小熊猫 C++ IDE集成开发环境。"
LangString MessageSectionOpenConsole 2052 "兼容 UTF-8 的 OpenConsole.exe 终端模拟器,来自 Windows 终端。"
LangString MessageSectionMingw32 2052 "MinGW GCC x86 编译器和相关的工具、头文件和库。"
LangString MessageSectionMingw64 2052 "MinGW GCC x64 编译器和相关的工具、头文件和库。"
LangString MessageSectionLlvm 2052 "LLVM MinGW 编译器和相关的工具、头文件和库。"
LangString MessageSectionAssocs 2052 "使用小熊猫 C++ 打开这些文件。"
LangString MessageSectionShortcuts 2052 "开始菜单和快捷方式。"
LangString MessageSectionConfig 2052 "删除之前安装遗留的所有配置文件。"
LangString MessageUninstallText 2052 "将要删除小熊猫 C++,是否继续?"
LangString MessageUninstallingExisting 2052 "正在删除之前的安装。"
LangString MessageRemoveConfig 2052 "你想要删除所有的配置文件吗?"
LangString SectionMainName 2052 "程序文件(必需)"
LangString SectionOpenConsoleName 2052 "OpenConsole.exe 终端模拟器"
LangString SectionMingw32Name 2052 "MinGW GCC x86 编译器"
LangString SectionMingw64Name 2052 "MinGW GCC x64 编译器"
LangString SectionLlvmName 2052 "LLVM MinGW 编译器"
LangString SectionAssocsName 2052 "关联文件到小熊猫C++"
LangString SectionAssocExtNameBegin 2052 "将"
LangString SectionAssocExtNameEnd 2052 "文件关联到小熊猫 C++"
LangString SectionShortcutsName 2052 "快捷方式"
LangString SectionMenuLaunchName 2052 "创建开始菜单程序项"
LangString SectionDesktopLaunchName 2052 "创建桌面快捷方式"
LangString SectionConfigName 2052 "删除原有配置文件"

View File

@ -1,411 +0,0 @@
####################################################################
# Startup
CRCCheck on
SetCompressor /SOLID /FINAL lzma
SetCompressorDictSize 128
SetDatablockOptimize on
Unicode True
!define FINALNAME "redpanda-cpp-${VERSION}-${ARCH}.exe"
!define DISPLAY_NAME "Red Panda C++ ${VERSION} (${ARCH})"
!define UNINSTKEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_KEY "${UNINSTKEY}"
!define MULTIUSER_INSTALLMODE_DEFAULT_REGISTRY_VALUENAME "CurrentUser"
!define MULTIUSER_INSTALLMODE_INSTDIR "RedPanda-CPP"
!define MULTIUSER_EXECUTIONLEVEL Highest
!define MULTIUSER_MUI
!define MULTIUSER_INSTALLMODE_COMMANDLINE
!if "${ARCH}" != "x86"
!define MULTIUSER_USE_PROGRAMFILES64
!endif
!include "x64.nsh"
!include "WinVer.nsh"
!include "MultiUser.nsh"
!include "MUI2.nsh"
!include "lang.nsh"
!define MUI_CUSTOMFUNCTION_GUIINIT myGuiInit
####################################################################
# Installer Attributes
Name "${DISPLAY_NAME}"
OutFile "${FINALNAME}"
Caption "${DISPLAY_NAME}"
LicenseData "LICENSE"
####################################################################
# Interface Settings
ShowInstDetails show
AutoCloseWindow false
SilentInstall normal
SetOverwrite try
XPStyle on
ManifestDPIAware true
InstType "Full" ;1
InstType "Minimal" ;2
####################################################################
# Pages
!define MUI_ICON "devcpp.ico"
!define MUI_UNICON "devcpp.ico"
!define MUI_ABORTWARNING
!define MUI_LANGDLL_ALLLANGUAGES
!define MUI_FINISHPAGE_RUN "$INSTDIR\RedPandaIDE.exe"
!define MUI_FINISHPAGE_NOREBOOTSUPPORT
!define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES
!insertmacro MUI_PAGE_FINISH
!insertmacro MUI_UNPAGE_CONFIRM
!insertmacro MUI_UNPAGE_INSTFILES
####################################################################
# Languages
!insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "SimpChinese"
Section "" SecUninstallPrevious
SetRegView 32
Call UninstallExisting
SetRegView 64
Call UninstallExisting
!if "${ARCH}" == "x86"
SetRegView 32
!endif
SectionEnd
####################################################################
# Files, by option section
Section "$(SectionMainName)" SectionMain
SectionIn 1 2 RO
SetOutPath $INSTDIR
; Allways create an uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe"
WriteRegStr ShCtx "${UNINSTKEY}" "DisplayName" "Red Panda C++"
WriteRegStr ShCtx "${UNINSTKEY}" "InstallLocation" "$INSTDIR"
WriteRegStr ShCtx "${UNINSTKEY}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr ShCtx "${UNINSTKEY}" "DisplayVersion" "${VERSION}"
WriteRegStr ShCtx "${UNINSTKEY}" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe"
WriteRegStr ShCtx "${UNINSTKEY}" "Publisher" "Roy Qu (royqh1979@gmail.com)"
WriteRegStr ShCtx "${UNINSTKEY}" $MultiUser.InstallMode 1
; Write required files
File "RedPandaIDE.exe"
File "consolepauser.exe"
File "redpanda-win-git-askpass.exe"
File "astyle.exe"
File "qt.conf"
File "LICENSE"
File "NEWS.md"
File "README.md"
File "compiler_hint.lua"
; Write required paths
SetOutPath $INSTDIR\templates
File /nonfatal /r "templates\*"
SectionEnd
Section "$(SectionOpenConsoleName)" SectionOpenConsole
SectionIn 1
SetOutPath $INSTDIR
File "OpenConsole.exe"
SectionEnd
!if "${ARCH}" == "x86"
Section "$(SectionMingw32Name)" SectionMingw32
SectionIn 1
SetOutPath $INSTDIR\mingw32
File /nonfatal /r "mingw32\*"
SectionEnd
!endif
!if "${ARCH}" == "x64"
Section "$(SectionMingw64Name)" SectionMingw64
SectionIn 1
SetOutPath $INSTDIR\mingw64
File /nonfatal /r "mingw64\*"
SectionEnd
!endif
Section "$(SectionLlvmName)" SectionLlvm
SectionIn 1
SetOutPath $INSTDIR\llvm-mingw
File /nonfatal /r "llvm-mingw\*"
SectionEnd
####################################################################
# File association
SectionGroup "$(SectionAssocsName)" SectionAssocs
Section "$(SectionAssocExtNameBegin) .dev $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.dev" "" "DevCpp.dev"
WriteRegStr ShCtx "Software\Classes\DevCpp.dev" "" "Dev-C++ Project File"
WriteRegStr ShCtx "Software\Classes\DevCpp.dev\DefaultIcon" "" '$0,3'
WriteRegStr ShCtx "Software\Classes\DevCpp.dev\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .c $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.c" "" "DevCpp.c"
WriteRegStr ShCtx "Software\Classes\DevCpp.c" "" "C Source File"
WriteRegStr ShCtx "Software\Classes\DevCpp.c\DefaultIcon" "" '$0,4'
WriteRegStr ShCtx "Software\Classes\DevCpp.c\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .cpp $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.cpp" "" "DevCpp.cpp"
WriteRegStr ShCtx "Software\Classes\DevCpp.cpp" "" "C++ Source File"
WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\DefaultIcon" "" '$0,5'
WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .cxx $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.cxx" "" "DevCpp.cxx"
WriteRegStr ShCtx "Software\Classes\DevCpp.cxx" "" "C++ Source File"
WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\DefaultIcon" "" '$0,5'
WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .cc $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.cc" "" "DevCpp.cc"
WriteRegStr ShCtx "Software\Classes\DevCpp.cc" "" "C++ Source File"
WriteRegStr ShCtx "Software\Classes\DevCpp.cc\DefaultIcon" "" '$0,5'
WriteRegStr ShCtx "Software\Classes\DevCpp.cc\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .hxx $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.hxx" "" "DevCpp.hxx"
WriteRegStr ShCtx "Software\Classes\DevCpp.hxx" "" "C++ Header File"
WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\DefaultIcon" "" '$0,7'
WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .h $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.h" "" "DevCpp.h"
WriteRegStr ShCtx "Software\Classes\DevCpp.h" "" "C Header File"
WriteRegStr ShCtx "Software\Classes\DevCpp.h\DefaultIcon" "" '$0,6'
WriteRegStr ShCtx "Software\Classes\DevCpp.h\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
Section "$(SectionAssocExtNameBegin) .hpp $(SectionAssocExtNameEnd)"
SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr ShCtx "Software\Classes\.hpp" "" "DevCpp.hpp"
WriteRegStr ShCtx "Software\Classes\DevCpp.hpp" "" "C++ Header File"
WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\DefaultIcon" "" '$0,7'
WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"'
SectionEnd
SectionGroupEnd
####################################################################
# Shortcuts
SectionGroup "$(SectionShortcutsName)" SectionShortcuts
Section "$(SectionMenuLaunchName)" SectionMenuLaunch
SectionIn 1 2
StrCpy $0 $SMPROGRAMS ; start menu Programs folder
CreateDirectory "$0\$(MessageAppName)"
CreateShortCut "$0\$(MessageAppName)\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe"
CreateShortCut "$0\$(MessageAppName)\License.lnk" "$INSTDIR\LICENSE"
CreateShortCut "$0\$(MessageAppName)\Uninstall $(MessageAppName).lnk" "$INSTDIR\uninstall.exe"
SectionEnd
Section "$(SectionDesktopLaunchName)" SectionDesktopLaunch
SectionIn 1 2
CreateShortCut "$DESKTOP\$(MessageAppName).lnk" "$INSTDIR\RedPandaIDE.exe"
SectionEnd
SectionGroupEnd
Section "$(SectionConfigName)" SectionConfig
RMDir /r "$APPDATA\RedPandaIDE"
SectionEnd
####################################################################
!insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMain} "$(MessageSectionMain)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionOpenConsole} "$(MessageSectionOpenConsole)"
!if "${ARCH}" == "x86"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMingw32} "$(MessageSectionMingw32)"
!endif
!if "${ARCH}" == "x64"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMingw64} "$(MessageSectionMingw64)"
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SectionLlvm} "$(MessageSectionLlvm)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionShortcuts} "$(MessageSectionShortcuts)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionAssocs} "$(MessageSectionAssocs)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionConfig} "$(MessageSectionConfig)"
!insertmacro MUI_FUNCTION_DESCRIPTION_END
####################################################################
# Functions, utilities
Function .onInit
!insertmacro MULTIUSER_INIT
!insertmacro MUI_LANGDLL_DISPLAY
!if "${ARCH}" != "x86"
SetRegView 64
!endif
${IfNot} ${AtLeastBuild} 17763 ; OpenConsole.exe requires Windows 10 v1809 ConPTY
!if "${ARCH}" == "x86"
${OrIfNot} ${IsNativeIA32} ; OpenConsole.exe x86 only works on x86, while x64 works on arm64
!endif
SectionSetFlags ${SectionOpenConsole} ${SF_RO}
${EndIf}
FunctionEnd
Function myGuiInit
${IfNot} ${AtLeastWin7}
MessageBox MB_OK|MB_ICONSTOP "$(MessageWin7RequiredError)"
Abort
${EndIf}
${IfNot} ${AtLeastBuild} 17763
MessageBox MB_OK|MB_ICONSTOP "$(MessageWin10v1809RecommendedWarning)"
${EndIf}
!if "${ARCH}" == "x86"
${If} ${IsNativeAMD64}
${OrIf} ${IsNativeARM64}
# note user if installing x86 on 64-bit OS
MessageBox MB_OK|MB_ICONINFORMATION "$(Message64bitBuildWarning)"
${EndIf}
!else if "${ARCH}" == "x64"
${If} ${IsNativeIA32}
MessageBox MB_OK|MB_ICONSTOP "$(Message64bitRequiredError)"
Abort
${ElseIf} ${IsNativeARM64}
# x64 can be installed on arm64 ...
MessageBox MB_OK|MB_ICONINFORMATION "$(MessageArm64BuildWarning)"
# ... but only works since Windows 11
${IfNot} ${AtLeastBuild} 22000
MessageBox MB_OK|MB_ICONSTOP "$(MessageWin11RequiredError)"
Abort
${EndIf}
${EndIf}
!else if "${ARCH}" == "arm64"
${IfNot} ${IsNativeARM64}
MessageBox MB_OK|MB_ICONSTOP "$(MessageArm64RequiredError)"
Abort
${EndIf}
!endif
FunctionEnd
Function .onSelChange
${IfNot} ${AtLeastBuild} 17763
!if "${ARCH}" == "x86"
${OrIfNot} ${IsNativeIA32}
!endif
SectionSetFlags ${SectionOpenConsole} ${SF_RO}
${EndIf}
FunctionEnd
Function un.onInit
!insertmacro MULTIUSER_UNINIT
!insertmacro MUI_UNGETLANGUAGE
!if "${ARCH}" != "x86"
SetRegView 64
!endif
FunctionEnd
Function UninstallExisting
ReadRegStr $R0 ShCtx "${UNINSTKEY}" "UninstallString"
${If} $R0 != ""
GetFullPathName $R1 "$R0\.." ; remove \uninstall.exe
DetailPrint "$(MessageUninstallingExisting)"
ExecWait '"$R0" /S _?=$R1'
Delete $R0
RMDir $R1
${EndIf}
FunctionEnd
####################################################################
# uninstall
UninstallText "$(MessageUninstallText)"
ShowUninstDetails show
Section "Uninstall"
; Remove uninstaller
Delete "$INSTDIR\uninstall.exe"
; Remove start menu stuff
Delete "$SMPROGRAMS\$(MessageAppName)\$(MessageAppName).lnk"
Delete "$SMPROGRAMS\$(MessageAppName)\License.lnk"
Delete "$SMPROGRAMS\$(MessageAppName)\Uninstall $(MessageAppName).lnk"
RMDir "$SMPROGRAMS\$(MessageAppName)"
; Remove desktop stuff
Delete "$QUICKLAUNCH\$(MessageAppName).lnk"
Delete "$DESKTOP\$(MessageAppName).lnk"
DeleteRegKey ShCtx "Software\Classes\DevCpp.dev"
DeleteRegKey ShCtx "Software\Classes\DevCpp.c"
DeleteRegKey ShCtx "Software\Classes\DevCpp.cpp"
DeleteRegKey ShCtx "Software\Classes\DevCpp.cxx"
DeleteRegKey ShCtx "Software\Classes\DevCpp.cc"
DeleteRegKey ShCtx "Software\Classes\DevCpp.h"
DeleteRegKey ShCtx "Software\Classes\DevCpp.hpp"
DeleteRegKey ShCtx "Software\Classes\DevCpp.hxx"
Delete "$INSTDIR\NEWS.md"
Delete "$INSTDIR\RedPandaIDE.exe"
Delete "$INSTDIR\consolepauser.exe"
Delete "$INSTDIR\OpenConsole.exe"
Delete "$INSTDIR\redpanda-win-git-askpass.exe"
Delete "$INSTDIR\astyle.exe"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\compiler_hint.lua"
RMDir /r "$INSTDIR\templates"
RMDir /r "$INSTDIR\mingw32"
RMDir /r "$INSTDIR\mingw64"
RMDir /r "$INSTDIR\llvm-mingw"
RMDir "$INSTDIR"
; Remove registry keys
DeleteRegKey ShCtx "${UNINSTKEY}"
MessageBox MB_YESNO "$(MessageRemoveConfig)" /SD IDNO IDNO SkipRemoveConfig
RMDir /r "$APPDATA\RedPandaIDE"
SkipRemoveConfig:
SectionEnd

View File

@ -3,6 +3,7 @@ LangString MessageSectionMain 1033 "The Red Panda C++ IDE (Integrated Developmen
LangString MessageSectionIcons 1033 "Various icons that you can use in your programs"
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 MessageSectionLlvm 1033 "The LLVM-MinGW 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"
@ -18,6 +19,7 @@ LangString SectionIconsName 1033 "Icon files"
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 SectionAssocsName 1033 "Associate files to Red Panda C++"
LangString SectionAssocExtNameBegin 1033 "Associate"
LangString SectionAssocExtNameEnd 1033 "files to Red Panda C++"
@ -46,6 +48,7 @@ LangString MessageSectionMain 2052 "小熊猫 C++ IDE集成开发环境"
LangString MessageSectionIcons 2052 "项目模板使用的图标文件"
LangString MessageSectionMinGW32 2052 "${MINGW32_COMPILER_NAME} 编译器和相关的工具、头文件和库"
LangString MessageSectionMinGW64 2052 "${MINGW64_COMPILER_NAME} 编译器和相关的工具、头文件和库"
LangString MessageSectionLlvm 2052 "LLVM-MinGW 编译器和相关的工具、头文件和库"
LangString MessageSectionLangs 2052 "小熊猫 C++ 翻译文件"
LangString MessageSectionAssocs 2052 "使用小熊猫 C++ 打开这些文件"
LangString MessageSectionShortcuts 2052 "开始菜单和快捷方式"
@ -61,6 +64,7 @@ LangString SectionIconsName 2052 "图标文件"
LangString SectionLangsName 2052 "语言文件"
LangString SectionMinGW32Name 2052 "${MINGW32_COMPILER_NAME} 编译器"
LangString SectionMinGW64Name 2052 "${MINGW64_COMPILER_NAME} 编译器"
LangString SectionLlvmName 2052 "LLVM-MinGW 编译器"
LangString SectionAssocsName 2052 "关联文件到小熊猫 C++"
LangString SectionAssocExtNameBegin 2052 "将"
LangString SectionAssocExtNameEnd 2052 "文件关联到小熊猫 C++"

View File

@ -123,6 +123,9 @@ Section "$(SectionMainName)" SectionMain
File "NEWS.md"
File "README.md"
File "qt.conf"
!ifdef HAVE_OPENCONSOLE
File "OpenConsole.exe"
!endif
; Write required paths
SetOutPath $INSTDIR\Templates
@ -148,6 +151,15 @@ SectionEnd
SectionEnd
!endif
!ifdef HAVE_LLVM
Section "$(SectionLlvmName)" SectionLlvm
SectionIn 1 3
SetOutPath $INSTDIR
File /nonfatal /r "llvm-mingw"
SectionEnd
!endif
####################################################################
# File association
SectionGroup "$(SectionAssocsName)" SectionAssocs
@ -285,6 +297,9 @@ SectionEnd
!ifdef HAVE_MINGW64
!insertmacro MUI_DESCRIPTION_TEXT ${SectionMinGW64} "$(MessageSectionMinGW64)"
!endif
!ifdef HAVE_LLVM
!insertmacro MUI_DESCRIPTION_TEXT ${SectionLlvm} "$(MessageSectionLlvm)"
!endif
!insertmacro MUI_DESCRIPTION_TEXT ${SectionShortcuts} "$(MessageSectionShortcuts)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionAssocs} "$(MessageSectionAssocs)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionCompress} "$(MessageSectionCompress)"
@ -419,11 +434,13 @@ Section "Uninstall"
Delete "$INSTDIR\LICENSE"
Delete "$INSTDIR\README.md"
Delete "$INSTDIR\qt.conf"
Delete "$INSTDIR\OpenConsole.exe"
RMDir /r "$INSTDIR\Lang"
RMDir /r "$INSTDIR\Templates"
RMDir /r "$INSTDIR\mingw32"
RMDir /r "$INSTDIR\mingw64"
RMDir /r "$INSTDIR\llvm-mingw"
RMDir "$INSTDIR"

View File

@ -15,6 +15,18 @@ 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, following general rule
!ifdef HAVE_OPENCONSOLE
!if "${ARCH}" == "x86"
${If} $osArch != "x86"
MessageBox MB_OK|MB_ICONSTOP "$(ErrorArchMismatch)"
Abort
${EndIf}
!endif
!endif
; x64 cannot be installed on arm64 prior to Windows 11
!if "${ARCH}" == "x64"
${If} $osArch == "arm64"