Update Windows on Arm build script (#185)

* update woa build script: move out llvm libs preparation

* update woa compiler hint: remove armv7; simplify UTF-8 objects

* update woa build script: merge system and user installer

* update woa: fix gcc utf8
This commit is contained in:
Cyano Hao 2024-02-19 17:18:34 +08:00 committed by GitHub
parent e2a23ed4ee
commit 613b2a5cff
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 194 additions and 289 deletions

View File

@ -9,7 +9,6 @@ end
local gnuArchMap: {string:string} = { local gnuArchMap: {string:string} = {
i386 = "i686", i386 = "i686",
x86_64 = "x86_64", x86_64 = "x86_64",
arm = "armv7",
arm64 = "aarch64", arm64 = "aarch64",
} }
@ -199,39 +198,42 @@ global function main(): CompilerHint
resourceCompiler = binDir .. "/windres.exe", resourceCompiler = binDir .. "/windres.exe",
binDirs = {binDir}, binDirs = {binDir},
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, debug_, debugWithAsan = generateConfig( if C_FileSystem.exists(libDir .. "/libutf8.a") then
function (arch_: string, profile: string): string local release, debug_, _ = generateConfig(
return nameGeneratorMingwGcc(lang, arch_, profile, true) function (arch_: string, profile: string): string
end, return nameGeneratorMingwGcc(lang, arch_, profile, true)
programs, end,
{ programs,
arch = arch, {
customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, arch = arch,
} customLinkParams = {"-Wl,--whole-archive", "-lutf8", "-Wl,--no-whole-archive"},
) }
table.insert(compilerList, release) )
table.insert(compilerList, debug_) table.insert(compilerList, release)
if preferCompiler == 0 then table.insert(compilerList, debug_)
preferCompiler = 2 if preferCompiler == 0 then
preferCompiler = 2
end
end end
release, debug_, debugWithAsan = generateConfig( do
function (arch_: string, profile: string): string local release, debug_, _ = generateConfig(
return nameGeneratorMingwGcc(lang, arch_, profile, false) function (arch_: string, profile: string): string
end, return nameGeneratorMingwGcc(lang, arch_, profile, false)
programs, end,
{ programs,
arch = arch, {
isAnsi = true, arch = arch,
} isAnsi = true,
) }
table.insert(compilerList, release) )
table.insert(compilerList, debug_) table.insert(compilerList, release)
table.insert(compilerList, debug_)
if preferCompiler == 0 then
preferCompiler = 2
end
end
table.insert(noSearch, excludeBinDir) table.insert(noSearch, excludeBinDir)
end end
@ -243,9 +245,9 @@ global function main(): CompilerHint
local binDir = libexecDir .. "/llvm-mingw/bin" local binDir = libexecDir .. "/llvm-mingw/bin"
local appTriplet = gnuArchMap[appArch] .. "-w64-mingw32" local appTriplet = gnuArchMap[appArch] .. "-w64-mingw32"
local appDllDir = libexecDir .. "/llvm-mingw/" .. appTriplet .. "/bin"
do do
-- appArch is always debuggable -- appArch is always debuggable
local libDir = libexecDir .. "/llvm-mingw/" .. appTriplet .. "/lib"
local programs: Programs = { local programs: Programs = {
cCompiler = binDir .. "/" .. appTriplet .. "-clang.exe", cCompiler = binDir .. "/" .. appTriplet .. "-clang.exe",
cxxCompiler = binDir .. "/" .. appTriplet .. "-clang++.exe", cxxCompiler = binDir .. "/" .. appTriplet .. "-clang++.exe",
@ -253,11 +255,7 @@ global function main(): CompilerHint
debugger = binDir .. "/lldb-mi.exe", debugger = binDir .. "/lldb-mi.exe",
debugServer = binDir .. "/lldb-server.exe", debugServer = binDir .. "/lldb-server.exe",
resourceCompiler = binDir .. "/" .. appTriplet .. "-windres.exe", resourceCompiler = binDir .. "/" .. appTriplet .. "-windres.exe",
binDirs = {binDir}, binDirs = {binDir, appDllDir},
}
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
} }
local release, debug_, debugWithAsan = generateConfig( local release, debug_, debugWithAsan = generateConfig(
function (arch_: string, profile: string): string function (arch_: string, profile: string): string
@ -266,7 +264,7 @@ global function main(): CompilerHint
programs, programs,
{ {
arch = appArch, arch = appArch,
customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, customLinkParams = {"-Wl,utf8init.o", "-Wl,utf8manifest.o"},
isClang = true, isClang = true,
} }
) )
@ -285,9 +283,10 @@ global function main(): CompilerHint
end end
for _, foreignArch in ipairs(supportedAppArches) do for _, foreignArch in ipairs(supportedAppArches) do
if foreignArch ~= appArch then local gnuArch = gnuArchMap[foreignArch]
local foreignTriplet = gnuArchMap[foreignArch] .. "-w64-mingw32" if foreignArch ~= appArch and gnuArch ~= nil then
local libDir = libexecDir .. "/llvm-mingw/" .. foreignTriplet .. "/lib" local foreignTriplet = gnuArch .. "-w64-mingw32"
local foreignDllDir = libexecDir .. "/llvm-mingw/" .. foreignTriplet .. "/bin"
local programs: Programs = { local programs: Programs = {
cCompiler = binDir .. "/" .. foreignTriplet .. "-clang.exe", cCompiler = binDir .. "/" .. foreignTriplet .. "-clang.exe",
cxxCompiler = binDir .. "/" .. foreignTriplet .. "-clang++.exe", cxxCompiler = binDir .. "/" .. foreignTriplet .. "-clang++.exe",
@ -295,11 +294,7 @@ global function main(): CompilerHint
debugger = binDir .. "/lldb-mi.exe", debugger = binDir .. "/lldb-mi.exe",
debugServer = binDir .. "/lldb-server.exe", debugServer = binDir .. "/lldb-server.exe",
resourceCompiler = binDir .. "/" .. foreignTriplet .. "-windres.exe", resourceCompiler = binDir .. "/" .. foreignTriplet .. "-windres.exe",
binDirs = {binDir}, binDirs = {binDir, foreignDllDir},
}
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
} }
local release, _, _ = generateConfig( local release, _, _ = generateConfig(
function (arch_: string, profile: string): string function (arch_: string, profile: string): string
@ -308,7 +303,7 @@ global function main(): CompilerHint
programs, programs,
{ {
arch = foreignArch, arch = foreignArch,
customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, customLinkParams = {"-Wl,utf8init.o", "-Wl,utf8manifest.o"},
isClang = true, isClang = true,
} }
) )
@ -337,10 +332,6 @@ global function main(): CompilerHint
binDirs = {llvmOrgBinDir}, binDirs = {llvmOrgBinDir},
libDirs = {libDir}, libDirs = {libDir},
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, debug_, _ = generateConfig( local release, debug_, _ = generateConfig(
function (arch: string, profile: string): string function (arch: string, profile: string): string
return nameGeneratorClang(lang, arch, profile, false) return nameGeneratorClang(lang, arch, profile, false)
@ -356,7 +347,7 @@ global function main(): CompilerHint
}, },
customLinkParams = { customLinkParams = {
"-target", msvcTriplet, "-target", msvcTriplet,
extraObjects.utf8init, extraObjects.utf8manifest, "-Wl,utf8init.o", "-Wl,utf8manifest.o",
}, },
isClang = true, isClang = true,
} }
@ -366,8 +357,9 @@ global function main(): CompilerHint
end end
for _, foreignArch in ipairs(supportedAppArches) do for _, foreignArch in ipairs(supportedAppArches) do
if foreignArch ~= appArch then local gnuArch = gnuArchMap[foreignArch]
local foreignTriplet = gnuArchMap[foreignArch] .. "-w64-mingw32" if foreignArch ~= appArch and gnuArch ~= nil then
local foreignTriplet = gnuArch .. "-w64-mingw32"
local msvcTriplet = gnuArchMap[foreignArch] .. "-pc-windows-msvc" local msvcTriplet = gnuArchMap[foreignArch] .. "-pc-windows-msvc"
local libDir = libexecDir .. "/llvm-mingw/" .. msvcTriplet .. "/lib" local libDir = libexecDir .. "/llvm-mingw/" .. msvcTriplet .. "/lib"
local programs: Programs = { local programs: Programs = {
@ -380,10 +372,6 @@ global function main(): CompilerHint
binDirs = {llvmOrgBinDir}, binDirs = {llvmOrgBinDir},
libDirs = {libDir}, libDirs = {libDir},
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, _, _ = generateConfig( local release, _, _ = generateConfig(
function (arch: string, profile: string): string function (arch: string, profile: string): string
return nameGeneratorClang(lang, arch, profile, false) return nameGeneratorClang(lang, arch, profile, false)
@ -399,7 +387,7 @@ global function main(): CompilerHint
}, },
customLinkParams = { customLinkParams = {
"-target", msvcTriplet, "-target", msvcTriplet,
extraObjects.utf8init, extraObjects.utf8manifest, "-Wl,utf8init.o", "-Wl,utf8manifest.o",
}, },
isClang = true, isClang = true,
} }
@ -412,9 +400,12 @@ global function main(): CompilerHint
if appArch == "x86_64" then if appArch == "x86_64" then
checkAndAddMingw("x86_64") checkAndAddMingw("x86_64")
checkAndAddMingw("i386")
checkAndAddClang() checkAndAddClang()
elseif appArch == "arm64" then elseif appArch == "arm64" then
checkAndAddClang() checkAndAddClang()
checkAndAddMingw("x86_64")
checkAndAddMingw("i386")
else else
checkAndAddMingw("i386") checkAndAddMingw("i386")
checkAndAddClang() checkAndAddClang()

View File

@ -26,7 +26,7 @@ set -euxo pipefail
GCC_VERSION="13.2.0" GCC_VERSION="13.2.0"
MINGW_VERSION="rt_v11-rev1" MINGW_VERSION="rt_v11-rev1"
LLVM_MINGW_TAG="20231128" REDPANDA_LLVM_VERSION="17-r0"
WINDOWS_TERMINAL_VERSION="1.18.3181.0" WINDOWS_TERMINAL_VERSION="1.18.3181.0"
_QMAKE="$MINGW_PREFIX/qt5-static/bin/qmake" _QMAKE="$MINGW_PREFIX/qt5-static/bin/qmake"
@ -43,10 +43,9 @@ _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" _MINGW64_URL="https://github.com/niXman/mingw-builds-binaries/releases/download/$GCC_VERSION-$MINGW_VERSION/$_MINGW64_ARCHIVE"
_LLVM_DIR="llvm-mingw" _LLVM_DIR="llvm-mingw"
_LLVM_ARCHES=("x86_64" "i686" "aarch64" "armv7") _LLVM_ARCHES=("x86_64" "i686" "aarch64")
_LLVM_ORIGINAL_DIR="llvm-mingw-$LLVM_MINGW_TAG-ucrt-$_NATIVE_ARCH" _LLVM_ARCHIVE="$_LLVM_DIR-$REDPANDA_LLVM_VERSION-$_NATIVE_ARCH.7z"
_LLVM_ARCHIVE="$_LLVM_ORIGINAL_DIR.zip" _LLVM_URL="https://github.com/redpanda-cpp/toolchain-win32-llvm/releases/download/$REDPANDA_LLVM_VERSION/$_LLVM_ARCHIVE"
_LLVM_URL="https://github.com/mstorsjo/llvm-mingw/releases/download/$LLVM_MINGW_TAG/$_LLVM_ARCHIVE"
_WINDOWS_TERMINAL_DIR="terminal-${WINDOWS_TERMINAL_VERSION}" _WINDOWS_TERMINAL_DIR="terminal-${WINDOWS_TERMINAL_VERSION}"
_WINDOWS_TERMINAL_ARCHIVE="Microsoft.WindowsTerminal_${WINDOWS_TERMINAL_VERSION}_$_DISPLAY_ARCH.zip" _WINDOWS_TERMINAL_ARCHIVE="Microsoft.WindowsTerminal_${WINDOWS_TERMINAL_VERSION}_$_DISPLAY_ARCH.zip"
@ -103,7 +102,7 @@ function check-deps() {
$MINGW_PACKAGE_PREFIX-{$compiler,make,qt5-static} $MINGW_PACKAGE_PREFIX-{$compiler,make,qt5-static}
mingw-w64-i686-nsis mingw-w64-i686-nsis
) )
[[ _7Z_REPACK -eq 1 ]] || deps+=("$MINGW_PACKAGE_PREFIX-7zip") [[ _7Z_REPACK -eq 1 ]] && deps+=("$MINGW_PACKAGE_PREFIX-7zip")
for dep in "${deps[@]}"; do for dep in "${deps[@]}"; do
pacman -Q "$dep" >/dev/null 2>&1 || ( pacman -Q "$dep" >/dev/null 2>&1 || (
echo "Missing dependency: $dep" echo "Missing dependency: $dep"
@ -113,7 +112,10 @@ function check-deps() {
} }
function prepare-dirs() { function prepare-dirs() {
[[ $_CLEAN -eq 1 ]] && rm -rf "$_BUILDDIR" "$_PKGDIR" || true if [[ $_CLEAN -eq 1 ]]; then
[[ -d "$_BUILDDIR" ]] && rm -rf "$_BUILDDIR"
[[ -d "$_PKGDIR" ]] && rm -rf "$_PKGDIR"
fi
mkdir -p "$_ASSETSDIR" "$_BUILDDIR" "$_PKGDIR" "$_DISTDIR" mkdir -p "$_ASSETSDIR" "$_BUILDDIR" "$_PKGDIR" "$_DISTDIR"
} }
@ -144,37 +146,7 @@ function prepare-mingw() {
{ {
gcc -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o "$mingw_lib_dir/utf8init.o" "$_SRCDIR/platform/windows/utf8/utf8init.cpp" gcc -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o "$mingw_lib_dir/utf8init.o" "$_SRCDIR/platform/windows/utf8/utf8init.cpp"
windres -O coff -o "$mingw_lib_dir/utf8manifest.o" "$_SRCDIR/platform/windows/utf8/utf8manifest.rc" windres -O coff -o "$mingw_lib_dir/utf8manifest.o" "$_SRCDIR/platform/windows/utf8/utf8manifest.rc"
} ar rcs "$mingw_lib_dir/libutf8.a" "$mingw_lib_dir/utf8init.o" "$mingw_lib_dir/utf8manifest.o"
export PATH="$old_path"
fi
}
function prepare-llvm-mingw() {
local llvm_dir="$_BUILDDIR/$_LLVM_DIR"
if [[ ! -d "$llvm_dir" ]]; then
bsdtar -C "$_BUILDDIR" -xf "$_ASSETSDIR/$_LLVM_ARCHIVE"
mv "$_BUILDDIR/$_LLVM_ORIGINAL_DIR" "$llvm_dir"
local old_path="$PATH"
export PATH="$llvm_dir/bin:$PATH"
for arch in "${_LLVM_ARCHES[@]}"; do
local triplet="$arch-w64-mingw32"
local lib_dir="$llvm_dir/$triplet/lib"
$triplet-clang -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o "$lib_dir/utf8init.o" "$_SRCDIR/platform/windows/utf8/utf8init.cpp"
$triplet-windres -O coff -o "$lib_dir/utf8manifest.o" "$_SRCDIR/platform/windows/utf8/utf8manifest.rc"
local msvc_triplet="$arch-pc-windows-msvc"
local lib_dir="$llvm_dir/$msvc_triplet/lib"
mkdir -p "$lib_dir"
$triplet-clang -target $msvc_triplet -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o "$lib_dir/utf8init.o" "$_SRCDIR/platform/windows/utf8/utf8init.cpp"
$triplet-windres -O coff -o "$lib_dir/utf8manifest.o" "$_SRCDIR/platform/windows/utf8/utf8manifest.rc"
done
{
local triplet="x86_64-w64-mingw32"
local msvc_triplet="arm64ec-pc-windows-msvc"
local lib_dir="$llvm_dir/$msvc_triplet/lib"
mkdir -p "$lib_dir"
$triplet-clang -target $msvc_triplet -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o "$lib_dir/utf8init.o" "$_SRCDIR/platform/windows/utf8/utf8init.cpp"
$triplet-windres -O coff -o "$lib_dir/utf8manifest.o" "$_SRCDIR/platform/windows/utf8/utf8manifest.rc"
} }
export PATH="$old_path" export PATH="$old_path"
fi fi
@ -210,17 +182,15 @@ function build() {
if [[ $_NATIVE_ARCH == x86_64 ]]; then if [[ $_NATIVE_ARCH == x86_64 ]]; then
[[ -d "$_PKGDIR/mingw64" ]] || cp -r "mingw64" "$_PKGDIR" [[ -d "$_PKGDIR/mingw64" ]] || cp -r "mingw64" "$_PKGDIR"
fi fi
[[ -d "$_PKGDIR/llvm-mingw" ]] || cp -r "llvm-mingw" "$_PKGDIR" [[ -d "$_PKGDIR/llvm-mingw" ]] || bsdtar -C "$_PKGDIR" -xf "$_ASSETSDIR/$_LLVM_ARCHIVE"
popd popd
} }
function package() { function package() {
pushd "$_PKGDIR" pushd "$_PKGDIR"
"$_NSIS" -DVERSION="$_REDPANDA_VERSION" -DARCH="$_DISPLAY_ARCH" main.nsi & "$_NSIS" -DVERSION="$_REDPANDA_VERSION" -DARCH="$_DISPLAY_ARCH" main.nsi
"$_NSIS" -DVERSION="$_REDPANDA_VERSION" -DARCH="$_DISPLAY_ARCH" -DUSER_MODE main.nsi &
wait
if [[ _7Z_REPACK -eq 1 ]]; then if [[ _7Z_REPACK -eq 1 ]]; then
7z x "redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH-user.exe" -o"RedPanda-CPP" -xr'!$PLUGINSDIR' -x"!uninstall.exe" 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" 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" rm -rf "RedPanda-CPP"
fi fi
@ -228,8 +198,7 @@ function package() {
} }
function dist() { function dist() {
cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH-system.exe" "$_DISTDIR" cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.exe" "$_DISTDIR"
cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH-user.exe" "$_DISTDIR"
[[ _7Z_REPACK -eq 1 ]] && cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.7z" "$_DISTDIR" [[ _7Z_REPACK -eq 1 ]] && cp "$_PKGDIR/redpanda-cpp-$_REDPANDA_VERSION-$_DISPLAY_ARCH.7z" "$_DISTDIR"
} }
@ -238,7 +207,6 @@ prepare-dirs
download-assets download-assets
[[ $_NATIVE_ARCH == i686 ]] && prepare-mingw 32 [[ $_NATIVE_ARCH == i686 ]] && prepare-mingw 32
[[ $_NATIVE_ARCH == x86_64 ]] && prepare-mingw 64 [[ $_NATIVE_ARCH == x86_64 ]] && prepare-mingw 64
prepare-llvm-mingw
prepare-openconsole prepare-openconsole
prepare-src prepare-src
trap restore-src EXIT INT TERM trap restore-src EXIT INT TERM

View File

@ -9,7 +9,6 @@ end
local gnuArchMap = { local gnuArchMap = {
i386 = "i686", i386 = "i686",
x86_64 = "x86_64", x86_64 = "x86_64",
arm = "armv7",
arm64 = "aarch64", arm64 = "aarch64",
} }
@ -199,39 +198,42 @@ function main()
resourceCompiler = binDir .. "/windres.exe", resourceCompiler = binDir .. "/windres.exe",
binDirs = { binDir }, binDirs = { binDir },
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, debug_, debugWithAsan = generateConfig( if C_FileSystem.exists(libDir .. "/libutf8.a") then
function(arch_, profile) local release, debug_, _ = generateConfig(
return nameGeneratorMingwGcc(lang, arch_, profile, true) function(arch_, profile)
end, return nameGeneratorMingwGcc(lang, arch_, profile, true)
programs, end,
{ programs,
arch = arch, {
customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, arch = arch,
}) customLinkParams = { "-Wl,--whole-archive", "-lutf8", "-Wl,--no-whole-archive" },
})
table.insert(compilerList, release) table.insert(compilerList, release)
table.insert(compilerList, debug_) table.insert(compilerList, debug_)
if preferCompiler == 0 then if preferCompiler == 0 then
preferCompiler = 2 preferCompiler = 2
end
end end
release, debug_, debugWithAsan = generateConfig( do
function(arch_, profile) local release, debug_, _ = generateConfig(
return nameGeneratorMingwGcc(lang, arch_, profile, false) function(arch_, profile)
end, return nameGeneratorMingwGcc(lang, arch_, profile, false)
programs, end,
{ programs,
arch = arch, {
isAnsi = true, arch = arch,
}) isAnsi = true,
})
table.insert(compilerList, release) table.insert(compilerList, release)
table.insert(compilerList, debug_) table.insert(compilerList, debug_)
if preferCompiler == 0 then
preferCompiler = 2
end
end
table.insert(noSearch, excludeBinDir) table.insert(noSearch, excludeBinDir)
end end
@ -243,9 +245,9 @@ function main()
local binDir = libexecDir .. "/llvm-mingw/bin" local binDir = libexecDir .. "/llvm-mingw/bin"
local appTriplet = gnuArchMap[appArch] .. "-w64-mingw32" local appTriplet = gnuArchMap[appArch] .. "-w64-mingw32"
local appDllDir = libexecDir .. "/llvm-mingw/" .. appTriplet .. "/bin"
do do
local libDir = libexecDir .. "/llvm-mingw/" .. appTriplet .. "/lib"
local programs = { local programs = {
cCompiler = binDir .. "/" .. appTriplet .. "-clang.exe", cCompiler = binDir .. "/" .. appTriplet .. "-clang.exe",
cxxCompiler = binDir .. "/" .. appTriplet .. "-clang++.exe", cxxCompiler = binDir .. "/" .. appTriplet .. "-clang++.exe",
@ -253,11 +255,7 @@ function main()
debugger = binDir .. "/lldb-mi.exe", debugger = binDir .. "/lldb-mi.exe",
debugServer = binDir .. "/lldb-server.exe", debugServer = binDir .. "/lldb-server.exe",
resourceCompiler = binDir .. "/" .. appTriplet .. "-windres.exe", resourceCompiler = binDir .. "/" .. appTriplet .. "-windres.exe",
binDirs = { binDir }, binDirs = { binDir, appDllDir },
}
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
} }
local release, debug_, debugWithAsan = generateConfig( local release, debug_, debugWithAsan = generateConfig(
function(arch_, profile) function(arch_, profile)
@ -266,7 +264,7 @@ function main()
programs, programs,
{ {
arch = appArch, arch = appArch,
customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, customLinkParams = { "-Wl,utf8init.o", "-Wl,utf8manifest.o" },
isClang = true, isClang = true,
}) })
@ -285,9 +283,10 @@ function main()
end end
for _, foreignArch in ipairs(supportedAppArches) do for _, foreignArch in ipairs(supportedAppArches) do
if foreignArch ~= appArch then local gnuArch = gnuArchMap[foreignArch]
local foreignTriplet = gnuArchMap[foreignArch] .. "-w64-mingw32" if foreignArch ~= appArch and gnuArch ~= nil then
local libDir = libexecDir .. "/llvm-mingw/" .. foreignTriplet .. "/lib" local foreignTriplet = gnuArch .. "-w64-mingw32"
local foreignDllDir = libexecDir .. "/llvm-mingw/" .. foreignTriplet .. "/bin"
local programs = { local programs = {
cCompiler = binDir .. "/" .. foreignTriplet .. "-clang.exe", cCompiler = binDir .. "/" .. foreignTriplet .. "-clang.exe",
cxxCompiler = binDir .. "/" .. foreignTriplet .. "-clang++.exe", cxxCompiler = binDir .. "/" .. foreignTriplet .. "-clang++.exe",
@ -295,11 +294,7 @@ function main()
debugger = binDir .. "/lldb-mi.exe", debugger = binDir .. "/lldb-mi.exe",
debugServer = binDir .. "/lldb-server.exe", debugServer = binDir .. "/lldb-server.exe",
resourceCompiler = binDir .. "/" .. foreignTriplet .. "-windres.exe", resourceCompiler = binDir .. "/" .. foreignTriplet .. "-windres.exe",
binDirs = { binDir }, binDirs = { binDir, foreignDllDir },
}
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
} }
local release, _, _ = generateConfig( local release, _, _ = generateConfig(
function(arch_, profile) function(arch_, profile)
@ -308,7 +303,7 @@ function main()
programs, programs,
{ {
arch = foreignArch, arch = foreignArch,
customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, customLinkParams = { "-Wl,utf8init.o", "-Wl,utf8manifest.o" },
isClang = true, isClang = true,
}) })
@ -337,10 +332,6 @@ function main()
binDirs = { llvmOrgBinDir }, binDirs = { llvmOrgBinDir },
libDirs = { libDir }, libDirs = { libDir },
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, debug_, _ = generateConfig( local release, debug_, _ = generateConfig(
function(arch, profile) function(arch, profile)
return nameGeneratorClang(lang, arch, profile, false) return nameGeneratorClang(lang, arch, profile, false)
@ -356,7 +347,7 @@ function main()
}, },
customLinkParams = { customLinkParams = {
"-target", msvcTriplet, "-target", msvcTriplet,
extraObjects.utf8init, extraObjects.utf8manifest, "-Wl,utf8init.o", "-Wl,utf8manifest.o",
}, },
isClang = true, isClang = true,
}) })
@ -366,8 +357,9 @@ function main()
end end
for _, foreignArch in ipairs(supportedAppArches) do for _, foreignArch in ipairs(supportedAppArches) do
if foreignArch ~= appArch then local gnuArch = gnuArchMap[foreignArch]
local foreignTriplet = gnuArchMap[foreignArch] .. "-w64-mingw32" if foreignArch ~= appArch and gnuArch ~= nil then
local foreignTriplet = gnuArch .. "-w64-mingw32"
local msvcTriplet = gnuArchMap[foreignArch] .. "-pc-windows-msvc" local msvcTriplet = gnuArchMap[foreignArch] .. "-pc-windows-msvc"
local libDir = libexecDir .. "/llvm-mingw/" .. msvcTriplet .. "/lib" local libDir = libexecDir .. "/llvm-mingw/" .. msvcTriplet .. "/lib"
local programs = { local programs = {
@ -380,10 +372,6 @@ function main()
binDirs = { llvmOrgBinDir }, binDirs = { llvmOrgBinDir },
libDirs = { libDir }, libDirs = { libDir },
} }
local extraObjects = {
utf8init = libDir .. "/utf8init.o",
utf8manifest = libDir .. "/utf8manifest.o",
}
local release, _, _ = generateConfig( local release, _, _ = generateConfig(
function(arch, profile) function(arch, profile)
return nameGeneratorClang(lang, arch, profile, false) return nameGeneratorClang(lang, arch, profile, false)
@ -399,7 +387,7 @@ function main()
}, },
customLinkParams = { customLinkParams = {
"-target", msvcTriplet, "-target", msvcTriplet,
extraObjects.utf8init, extraObjects.utf8manifest, "-Wl,utf8init.o", "-Wl,utf8manifest.o",
}, },
isClang = true, isClang = true,
}) })
@ -412,9 +400,12 @@ function main()
if appArch == "x86_64" then if appArch == "x86_64" then
checkAndAddMingw("x86_64") checkAndAddMingw("x86_64")
checkAndAddMingw("i386")
checkAndAddClang() checkAndAddClang()
elseif appArch == "arm64" then elseif appArch == "arm64" then
checkAndAddClang() checkAndAddClang()
checkAndAddMingw("x86_64")
checkAndAddMingw("i386")
else else
checkAndAddMingw("i386") checkAndAddMingw("i386")
checkAndAddClang() checkAndAddClang()

View File

@ -16,7 +16,7 @@ LangString MessageSectionAssocs 1033 "Use Red Panda C++ as the default applicati
LangString MessageSectionShortcuts 1033 "Create shortcuts to Red Panda C++ in various folders." LangString MessageSectionShortcuts 1033 "Create shortcuts to Red Panda C++ in various folders."
LangString MessageSectionConfig 1033 "Remove all leftover configuration files from previous installs." LangString MessageSectionConfig 1033 "Remove all leftover configuration files from previous installs."
LangString MessageUninstallText 1033 "This program will uninstall Red Panda C++, continue?" LangString MessageUninstallText 1033 "This program will uninstall Red Panda C++, continue?"
LangString MessageUninstallExisting 1033 "Red Panda C++ is already installed.$\n$\nClick OK to remove the previous version or Cancel to cancel the installation." LangString MessageUninstallingExisting 1033 "Removing previous installation."
LangString MessageRemoveConfig 1033 "Do you want to remove all the remaining configuration files?" LangString MessageRemoveConfig 1033 "Do you want to remove all the remaining configuration files?"
LangString SectionMainName 1033 "Program files (required)" LangString SectionMainName 1033 "Program files (required)"
LangString SectionOpenConsoleName 1033 "OpenConsole.exe terminal emulator" LangString SectionOpenConsoleName 1033 "OpenConsole.exe terminal emulator"
@ -49,7 +49,7 @@ LangString MessageSectionAssocs 2052 "使用小熊猫 C++ 打开这些文件。"
LangString MessageSectionShortcuts 2052 "开始菜单和快捷方式。" LangString MessageSectionShortcuts 2052 "开始菜单和快捷方式。"
LangString MessageSectionConfig 2052 "删除之前安装遗留的所有配置文件。" LangString MessageSectionConfig 2052 "删除之前安装遗留的所有配置文件。"
LangString MessageUninstallText 2052 "将要删除小熊猫 C++,是否继续?" LangString MessageUninstallText 2052 "将要删除小熊猫 C++,是否继续?"
LangString MessageUninstallExisting 2052 "本机上已经安装了旧版本小熊猫 C++。 $\n$\n点击“确定”以将其删除并继续或者“取消”中止安装。" LangString MessageUninstallingExisting 2052 "正在删除之前的安装。"
LangString MessageRemoveConfig 2052 "你想要删除所有的配置文件吗?" LangString MessageRemoveConfig 2052 "你想要删除所有的配置文件吗?"
LangString SectionMainName 2052 "程序文件(必需)" LangString SectionMainName 2052 "程序文件(必需)"
LangString SectionOpenConsoleName 2052 "OpenConsole.exe 终端模拟器" LangString SectionOpenConsoleName 2052 "OpenConsole.exe 终端模拟器"

View File

@ -7,16 +7,24 @@ SetCompressorDictSize 128
SetDatablockOptimize on SetDatablockOptimize on
Unicode True Unicode True
!ifdef USER_MODE !define FINALNAME "redpanda-cpp-${VERSION}-${ARCH}.exe"
!define MODE "user" !define DISPLAY_NAME "Red Panda C++ ${VERSION} (${ARCH})"
!else
!define MODE "system" !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 !endif
!define FINALNAME "redpanda-cpp-${VERSION}-${ARCH}-${MODE}.exe"
!define DISPLAY_NAME "Red Panda C++ ${VERSION} (${ARCH} ${MODE})"
!include "x64.nsh" !include "x64.nsh"
!include "WinVer.nsh" !include "WinVer.nsh"
!include "MultiUser.nsh"
!include "MUI2.nsh" !include "MUI2.nsh"
!include "lang.nsh" !include "lang.nsh"
@ -31,18 +39,6 @@ Caption "${DISPLAY_NAME}"
LicenseData "LICENSE" LicenseData "LICENSE"
!ifdef USER_MODE
RequestExecutionLevel user
InstallDir "$LOCALAPPDATA\RedPanda-CPP"
!else
RequestExecutionLevel admin
!if "${ARCH}" == "x86"
InstallDir "$PROGRAMFILES\RedPanda-CPP"
!else
InstallDir "$PROGRAMFILES64\RedPanda-CPP"
!endif
!endif
#################################################################### ####################################################################
# Interface Settings # Interface Settings
@ -56,15 +52,6 @@ ManifestDPIAware true
InstType "Full" ;1 InstType "Full" ;1
InstType "Minimal" ;2 InstType "Minimal" ;2
## Remember the installer language
!ifdef USER_MODE
!define MUI_LANGDLL_REGISTRY_ROOT "HKCU"
!else
!define MUI_LANGDLL_REGISTRY_ROOT "HKLM"
!endif
!define MUI_LANGDLL_REGISTRY_KEY "Software\RedPanda-C++"
!define MUI_LANGDLL_REGISTRY_VALUENAME "Installer Language"
#################################################################### ####################################################################
# Pages # Pages
@ -77,6 +64,7 @@ InstType "Minimal" ;2
!define MUI_COMPONENTSPAGE_SMALLDESC !define MUI_COMPONENTSPAGE_SMALLDESC
!insertmacro MUI_PAGE_LICENSE "LICENSE" !insertmacro MUI_PAGE_LICENSE "LICENSE"
!insertmacro MULTIUSER_PAGE_INSTALLMODE
!insertmacro MUI_PAGE_COMPONENTS !insertmacro MUI_PAGE_COMPONENTS
!insertmacro MUI_PAGE_DIRECTORY !insertmacro MUI_PAGE_DIRECTORY
!insertmacro MUI_PAGE_INSTFILES !insertmacro MUI_PAGE_INSTFILES
@ -90,6 +78,16 @@ InstType "Minimal" ;2
!insertmacro MUI_LANGUAGE "English" !insertmacro MUI_LANGUAGE "English"
!insertmacro MUI_LANGUAGE "SimpChinese" !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 # Files, by option section
@ -100,21 +98,13 @@ Section "$(SectionMainName)" SectionMain
; Allways create an uninstaller ; Allways create an uninstaller
WriteUninstaller "$INSTDIR\uninstall.exe" WriteUninstaller "$INSTDIR\uninstall.exe"
!ifdef USER_MODE WriteRegStr ShCtx "${UNINSTKEY}" "DisplayName" "Red Panda C++"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Red Panda C++" WriteRegStr ShCtx "${UNINSTKEY}" "InstallLocation" "$INSTDIR"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "InstallLocation" "$INSTDIR" WriteRegStr ShCtx "${UNINSTKEY}" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe" WriteRegStr ShCtx "${UNINSTKEY}" "DisplayVersion" "${VERSION}"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${VERSION}" WriteRegStr ShCtx "${UNINSTKEY}" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe" WriteRegStr ShCtx "${UNINSTKEY}" "Publisher" "Roy Qu (royqh1979@gmail.com)"
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu (royqh1979@gmail.com)" WriteRegStr ShCtx "${UNINSTKEY}" $MultiUser.InstallMode 1
!else
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayName" "Red Panda C++"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "InstallLocation" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString" "$INSTDIR\uninstall.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayVersion" "${VERSION}"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "DisplayIcon" "$INSTDIR\RedPandaIDE.exe"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "Publisher" "Roy Qu (royqh1979@gmail.com)"
!endif
; Write required files ; Write required files
File "RedPandaIDE.exe" File "RedPandaIDE.exe"
@ -167,80 +157,80 @@ SectionGroup "$(SectionAssocsName)" SectionAssocs
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".dev" "" "DevCpp.dev" WriteRegStr ShCtx "Software\Classes\.dev" "" "DevCpp.dev"
WriteRegStr HKCR "DevCpp.dev" "" "Dev-C++ Project File" WriteRegStr ShCtx "Software\Classes\DevCpp.dev" "" "Dev-C++ Project File"
WriteRegStr HKCR "DevCpp.dev\DefaultIcon" "" '$0,3' WriteRegStr ShCtx "Software\Classes\DevCpp.dev\DefaultIcon" "" '$0,3'
WriteRegStr HKCR "DevCpp.dev\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.dev\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .c $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .c $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".c" "" "DevCpp.c" WriteRegStr ShCtx "Software\Classes\.c" "" "DevCpp.c"
WriteRegStr HKCR "DevCpp.c" "" "C Source File" WriteRegStr ShCtx "Software\Classes\DevCpp.c" "" "C Source File"
WriteRegStr HKCR "DevCpp.c\DefaultIcon" "" '$0,4' WriteRegStr ShCtx "Software\Classes\DevCpp.c\DefaultIcon" "" '$0,4'
WriteRegStr HKCR "DevCpp.c\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.c\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .cpp $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .cpp $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cpp" "" "DevCpp.cpp" WriteRegStr ShCtx "Software\Classes\.cpp" "" "DevCpp.cpp"
WriteRegStr HKCR "DevCpp.cpp" "" "C++ Source File" WriteRegStr ShCtx "Software\Classes\DevCpp.cpp" "" "C++ Source File"
WriteRegStr HKCR "DevCpp.cpp\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cpp\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .cxx $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .cxx $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cxx" "" "DevCpp.cxx" WriteRegStr ShCtx "Software\Classes\.cxx" "" "DevCpp.cxx"
WriteRegStr HKCR "DevCpp.cxx" "" "C++ Source File" WriteRegStr ShCtx "Software\Classes\DevCpp.cxx" "" "C++ Source File"
WriteRegStr HKCR "DevCpp.cxx\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cxx\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cxx\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .cc $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .cc $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".cc" "" "DevCpp.cc" WriteRegStr ShCtx "Software\Classes\.cc" "" "DevCpp.cc"
WriteRegStr HKCR "DevCpp.cc" "" "C++ Source File" WriteRegStr ShCtx "Software\Classes\DevCpp.cc" "" "C++ Source File"
WriteRegStr HKCR "DevCpp.cc\DefaultIcon" "" '$0,5' WriteRegStr ShCtx "Software\Classes\DevCpp.cc\DefaultIcon" "" '$0,5'
WriteRegStr HKCR "DevCpp.cc\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.cc\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .hxx $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .hxx $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".hxx" "" "DevCpp.hxx" WriteRegStr ShCtx "Software\Classes\.hxx" "" "DevCpp.hxx"
WriteRegStr HKCR "DevCpp.hxx" "" "C++ Header File" WriteRegStr ShCtx "Software\Classes\DevCpp.hxx" "" "C++ Header File"
WriteRegStr HKCR "DevCpp.hxx\DefaultIcon" "" '$0,7' WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\DefaultIcon" "" '$0,7'
WriteRegStr HKCR "DevCpp.hxx\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.hxx\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .h $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .h $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".h" "" "DevCpp.h" WriteRegStr ShCtx "Software\Classes\.h" "" "DevCpp.h"
WriteRegStr HKCR "DevCpp.h" "" "C Header File" WriteRegStr ShCtx "Software\Classes\DevCpp.h" "" "C Header File"
WriteRegStr HKCR "DevCpp.h\DefaultIcon" "" '$0,6' WriteRegStr ShCtx "Software\Classes\DevCpp.h\DefaultIcon" "" '$0,6'
WriteRegStr HKCR "DevCpp.h\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.h\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
Section "$(SectionAssocExtNameBegin) .hpp $(SectionAssocExtNameEnd)" Section "$(SectionAssocExtNameBegin) .hpp $(SectionAssocExtNameEnd)"
SectionIn 1 SectionIn 1
StrCpy $0 $INSTDIR\RedPandaIDE.exe StrCpy $0 $INSTDIR\RedPandaIDE.exe
WriteRegStr HKCR ".hpp" "" "DevCpp.hpp" WriteRegStr ShCtx "Software\Classes\.hpp" "" "DevCpp.hpp"
WriteRegStr HKCR "DevCpp.hpp" "" "C++ Header File" WriteRegStr ShCtx "Software\Classes\DevCpp.hpp" "" "C++ Header File"
WriteRegStr HKCR "DevCpp.hpp\DefaultIcon" "" '$0,7' WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\DefaultIcon" "" '$0,7'
WriteRegStr HKCR "DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"' WriteRegStr ShCtx "Software\Classes\DevCpp.hpp\Shell\Open\Command" "" '$0 "%1"'
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
@ -264,11 +254,9 @@ SectionGroup "$(SectionShortcutsName)" SectionShortcuts
SectionEnd SectionEnd
SectionGroupEnd SectionGroupEnd
!ifdef USER_MODE
Section "$(SectionConfigName)" SectionConfig Section "$(SectionConfigName)" SectionConfig
RMDir /r "$APPDATA\RedPandaIDE" RMDir /r "$APPDATA\RedPandaIDE"
SectionEnd SectionEnd
!endif
#################################################################### ####################################################################
@ -284,23 +272,17 @@ SectionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${SectionLlvm} "$(MessageSectionLlvm)" !insertmacro MUI_DESCRIPTION_TEXT ${SectionLlvm} "$(MessageSectionLlvm)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionShortcuts} "$(MessageSectionShortcuts)" !insertmacro MUI_DESCRIPTION_TEXT ${SectionShortcuts} "$(MessageSectionShortcuts)"
!insertmacro MUI_DESCRIPTION_TEXT ${SectionAssocs} "$(MessageSectionAssocs)" !insertmacro MUI_DESCRIPTION_TEXT ${SectionAssocs} "$(MessageSectionAssocs)"
!ifdef USER_MODE
!insertmacro MUI_DESCRIPTION_TEXT ${SectionConfig} "$(MessageSectionConfig)" !insertmacro MUI_DESCRIPTION_TEXT ${SectionConfig} "$(MessageSectionConfig)"
!endif
!insertmacro MUI_FUNCTION_DESCRIPTION_END !insertmacro MUI_FUNCTION_DESCRIPTION_END
#################################################################### ####################################################################
# Functions, utilities # Functions, utilities
Function .onInit Function .onInit
!insertmacro MULTIUSER_INIT
!insertmacro MUI_LANGDLL_DISPLAY !insertmacro MUI_LANGDLL_DISPLAY
!if "${ARCH}" != "x86" !if "${ARCH}" != "x86"
SetRegView 64 SetRegView 64
!endif
!ifdef USER_MODE
SetShellVarContext current
!else
SetShellVarContext all
!endif !endif
${IfNot} ${AtLeastBuild} 17763 ; OpenConsole.exe requires Windows 10 v1809 ConPTY ${IfNot} ${AtLeastBuild} 17763 ; OpenConsole.exe requires Windows 10 v1809 ConPTY
!if "${ARCH}" == "x86" !if "${ARCH}" == "x86"
@ -343,14 +325,6 @@ Function myGuiInit
Abort Abort
${EndIf} ${EndIf}
!endif !endif
SetRegView 32
Call UninstallExisting
SetRegView 64
Call UninstallExisting
!if "${ARCH}" == "x86"
SetRegView 32
!endif
FunctionEnd FunctionEnd
Function .onSelChange Function .onSelChange
@ -363,32 +337,21 @@ Function .onSelChange
FunctionEnd FunctionEnd
Function un.onInit Function un.onInit
!insertmacro MULTIUSER_UNINIT
!insertmacro MUI_UNGETLANGUAGE !insertmacro MUI_UNGETLANGUAGE
!if "${ARCH}" != "x86" !if "${ARCH}" != "x86"
SetRegView 64 SetRegView 64
!endif !endif
!ifdef USER_MODE
SetShellVarContext current
!else
SetShellVarContext all
!endif
FunctionEnd FunctionEnd
Function UninstallExisting Function UninstallExisting
!ifdef USER_MODE ReadRegStr $R0 ShCtx "${UNINSTKEY}" "UninstallString"
ReadRegStr $R0 HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString"
!else
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++" "UninstallString"
!endif
${If} $R0 != "" ${If} $R0 != ""
GetFullPathName $R1 "$R0\.." ; remove \uninstall.exe GetFullPathName $R1 "$R0\.." ; remove \uninstall.exe
MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION \ DetailPrint "$(MessageUninstallingExisting)"
"$(MessageUninstallExisting)" \ ExecWait '"$R0" /S _?=$R1'
IDOK uninst Delete $R0
Abort RMDir $R1
uninst:
ClearErrors
ExecWait '"$R0" /S _?=$R1'
${EndIf} ${EndIf}
FunctionEnd FunctionEnd
@ -412,14 +375,14 @@ Section "Uninstall"
Delete "$QUICKLAUNCH\$(MessageAppName).lnk" Delete "$QUICKLAUNCH\$(MessageAppName).lnk"
Delete "$DESKTOP\$(MessageAppName).lnk" Delete "$DESKTOP\$(MessageAppName).lnk"
DeleteRegKey HKCR "DevCpp.dev" DeleteRegKey ShCtx "Software\Classes\DevCpp.dev"
DeleteRegKey HKCR "DevCpp.c" DeleteRegKey ShCtx "Software\Classes\DevCpp.c"
DeleteRegKey HKCR "DevCpp.cpp" DeleteRegKey ShCtx "Software\Classes\DevCpp.cpp"
DeleteRegKey HKCR "DevCpp.cxx" DeleteRegKey ShCtx "Software\Classes\DevCpp.cxx"
DeleteRegKey HKCR "DevCpp.cc" DeleteRegKey ShCtx "Software\Classes\DevCpp.cc"
DeleteRegKey HKCR "DevCpp.h" DeleteRegKey ShCtx "Software\Classes\DevCpp.h"
DeleteRegKey HKCR "DevCpp.hpp" DeleteRegKey ShCtx "Software\Classes\DevCpp.hpp"
DeleteRegKey HKCR "DevCpp.hxx" DeleteRegKey ShCtx "Software\Classes\DevCpp.hxx"
Delete "$INSTDIR\NEWS.md" Delete "$INSTDIR\NEWS.md"
Delete "$INSTDIR\RedPandaIDE.exe" Delete "$INSTDIR\RedPandaIDE.exe"
@ -440,17 +403,9 @@ Section "Uninstall"
RMDir "$INSTDIR" RMDir "$INSTDIR"
; Remove registry keys ; Remove registry keys
!ifdef USER_MODE DeleteRegKey ShCtx "${UNINSTKEY}"
DeleteRegKey HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++"
DeleteRegKey HKCU "Software\RedPanda-C++"
!else
DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\RedPanda-C++"
DeleteRegKey HKLM "Software\RedPanda-C++"
!endif
!ifdef USER_MODE
MessageBox MB_YESNO "$(MessageRemoveConfig)" /SD IDNO IDNO SkipRemoveConfig MessageBox MB_YESNO "$(MessageRemoveConfig)" /SD IDNO IDNO SkipRemoveConfig
RMDir /r "$APPDATA\RedPandaIDE" RMDir /r "$APPDATA\RedPandaIDE"
SkipRemoveConfig: SkipRemoveConfig:
!endif
SectionEnd SectionEnd