From 9f622ec06cf7942d662f0d67ccd4f72b73db2fd7 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Thu, 7 Mar 2024 16:28:45 +0800 Subject: [PATCH] remove utf8init lib --- addon/compiler_hint/archlinux.tl | 13 ++----------- addon/compiler_hint/debian.tl | 14 ++------------ addon/compiler_hint/windows_domain.tl | 4 ---- packages/archlinux/PKGBUILD.in | 16 ---------------- packages/archlinux/compiler_hint.lua | 16 ++-------------- packages/debian/compiler_hint.lua | 14 ++------------ packages/debian/rules | 24 +----------------------- packages/msys/domain/build.sh | 5 ----- packages/msys/domain/compiler_hint.lua | 6 ++---- platform/windows/utf8/utf8init.cpp | 25 ------------------------- platform/windows/utf8/utf8manifest.rc | 12 ------------ 11 files changed, 11 insertions(+), 138 deletions(-) delete mode 100644 platform/windows/utf8/utf8init.cpp delete mode 100644 platform/windows/utf8/utf8manifest.rc diff --git a/addon/compiler_hint/archlinux.tl b/addon/compiler_hint/archlinux.tl index 3241b02d..cb4b05df 100644 --- a/addon/compiler_hint/archlinux.tl +++ b/addon/compiler_hint/archlinux.tl @@ -230,8 +230,6 @@ global function main(): CompilerHint ) then if C_FileSystem.isExecutable("/usr/bin/x86_64-w64-mingw32-gcc") then local extraObjects = { - utf8init = libexecDir .. "/x86_64-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/x86_64-w64-mingw32/utf8manifest.o", } do @@ -241,7 +239,7 @@ global function main(): CompilerHint { arch = "x86_64", triplet = "x86_64-w64-mingw32", - customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, + customLinkParams = {}, } ) table.insert(compilerList, release) @@ -257,7 +255,6 @@ global function main(): CompilerHint customCompileParams = {"-target", "x86_64-w64-mingw32"}, customLinkParams = { "-target", "x86_64-w64-mingw32", - extraObjects.utf8init, extraObjects.utf8manifest, "-lstdc++", "-lwinpthread", }, } @@ -267,11 +264,6 @@ global function main(): CompilerHint end if C_FileSystem.isExecutable("/usr/bin/i686-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/i686-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/i686-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -279,7 +271,7 @@ global function main(): CompilerHint { arch = "i686", triplet = "i686-w64-mingw32", - customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, + customLinkParams = {}, } ) table.insert(compilerList, release) @@ -296,7 +288,6 @@ global function main(): CompilerHint customCompileParams = {"-target", "i686-w64-mingw32"}, customLinkParams = { "-target", "i686-w64-mingw32", - extraObjects.utf8init, extraObjects.utf8manifest, "-lstdc++", "-lwinpthread", }, } diff --git a/addon/compiler_hint/debian.tl b/addon/compiler_hint/debian.tl index f2187394..e2f4098a 100644 --- a/addon/compiler_hint/debian.tl +++ b/addon/compiler_hint/debian.tl @@ -272,11 +272,6 @@ global function main(): CompilerHint ) ) then if C_FileSystem.isExecutable("/usr/bin/x86_64-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/x86_64-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/x86_64-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -284,7 +279,7 @@ global function main(): CompilerHint { arch = "x86_64", triplet = "x86_64-w64-mingw32", - customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, + customLinkParams = {}, } ) table.insert(compilerList, release) @@ -292,11 +287,6 @@ global function main(): CompilerHint end if C_FileSystem.isExecutable("/usr/bin/i686-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/i686-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/i686-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -304,7 +294,7 @@ global function main(): CompilerHint { arch = "i686", triplet = "i686-w64-mingw32", - customLinkParams = {extraObjects.utf8init, extraObjects.utf8manifest}, + customLinkParams = {}, } ) table.insert(compilerList, release) diff --git a/addon/compiler_hint/windows_domain.tl b/addon/compiler_hint/windows_domain.tl index 2830d468..fb6e00f8 100644 --- a/addon/compiler_hint/windows_domain.tl +++ b/addon/compiler_hint/windows_domain.tl @@ -264,7 +264,6 @@ global function main(): CompilerHint programs, { arch = appArch, - customLinkParams = {"-Wl,utf8init.o", "-Wl,utf8manifest.o"}, isClang = true, } ) @@ -303,7 +302,6 @@ global function main(): CompilerHint programs, { arch = foreignArch, - customLinkParams = {"-Wl,utf8init.o", "-Wl,utf8manifest.o"}, isClang = true, } ) @@ -347,7 +345,6 @@ global function main(): CompilerHint }, customLinkParams = { "-target", msvcTriplet, - "-Wl,utf8init.o", "-Wl,utf8manifest.o", }, isClang = true, } @@ -387,7 +384,6 @@ global function main(): CompilerHint }, customLinkParams = { "-target", msvcTriplet, - "-Wl,utf8init.o", "-Wl,utf8manifest.o", }, isClang = true, } diff --git a/packages/archlinux/PKGBUILD.in b/packages/archlinux/PKGBUILD.in index 3e7db731..cd394dc6 100644 --- a/packages/archlinux/PKGBUILD.in +++ b/packages/archlinux/PKGBUILD.in @@ -8,7 +8,6 @@ url="https://github.com/royqh1979/$_pkgname" license=('GPL3') depends=(qt5-base qt5-svg gcc gdb) makedepends=(qt5-tools) -makedepends_x86_64=(mingw-w64-gcc) optdepends=( 'clang: C/C++ compiler (alternative)' ) @@ -35,14 +34,6 @@ prepare() { } build() { - local _utf8dir="$srcdir/$_pkgname/platform/windows/utf8" - if [[ "$CARCH" == 'x86_64' ]]; then - x86_64-w64-mingw32-gcc -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o utf8init.x86_64.o "$_utf8dir/utf8init.cpp" - x86_64-w64-mingw32-windres -O coff -o utf8manifest.x86_64.o "$_utf8dir/utf8manifest.rc" - i686-w64-mingw32-gcc -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o utf8init.i686.o "$_utf8dir/utf8init.cpp" - i686-w64-mingw32-windres -O coff -o utf8manifest.i686.o "$_utf8dir/utf8manifest.rc" - fi - mkdir redpanda-build cd redpanda-build qmake \ @@ -56,13 +47,6 @@ package() { local _libexecdir="$pkgdir/usr/lib/RedPandaCPP" install -Dm644 "compiler_hint.lua" "$_libexecdir/compiler_hint.lua" - if [[ "$CARCH" == 'x86_64' ]]; then - install -Dm644 "utf8init.x86_64.o" "$_libexecdir/x86_64-w64-mingw32/utf8init.o" - install -Dm644 "utf8manifest.x86_64.o" "$_libexecdir/x86_64-w64-mingw32/utf8manifest.o" - install -Dm644 "utf8init.i686.o" "$_libexecdir/i686-w64-mingw32/utf8init.o" - install -Dm644 "utf8manifest.i686.o" "$_libexecdir/i686-w64-mingw32/utf8manifest.o" - fi - cd redpanda-build make INSTALL_ROOT="$pkgdir" install } diff --git a/packages/archlinux/compiler_hint.lua b/packages/archlinux/compiler_hint.lua index 9ebb7b81..1cedbb42 100644 --- a/packages/archlinux/compiler_hint.lua +++ b/packages/archlinux/compiler_hint.lua @@ -229,11 +229,6 @@ function main() if C_FileSystem.isExecutable("/usr/bin/x86_64-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/x86_64-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/x86_64-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -241,7 +236,7 @@ function main() { arch = "x86_64", triplet = "x86_64-w64-mingw32", - customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, + customLinkParams = {}, }) table.insert(compilerList, release) @@ -257,7 +252,6 @@ function main() customCompileParams = { "-target", "x86_64-w64-mingw32" }, customLinkParams = { "-target", "x86_64-w64-mingw32", - extraObjects.utf8init, extraObjects.utf8manifest, "-lstdc++", "-lwinpthread", }, }) @@ -267,11 +261,6 @@ function main() end if C_FileSystem.isExecutable("/usr/bin/i686-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/i686-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/i686-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -279,7 +268,7 @@ function main() { arch = "i686", triplet = "i686-w64-mingw32", - customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, + customLinkParams = {}, }) table.insert(compilerList, release) @@ -296,7 +285,6 @@ function main() customCompileParams = { "-target", "i686-w64-mingw32" }, customLinkParams = { "-target", "i686-w64-mingw32", - extraObjects.utf8init, extraObjects.utf8manifest, "-lstdc++", "-lwinpthread", }, }) diff --git a/packages/debian/compiler_hint.lua b/packages/debian/compiler_hint.lua index 454435e5..40cb666d 100644 --- a/packages/debian/compiler_hint.lua +++ b/packages/debian/compiler_hint.lua @@ -272,11 +272,6 @@ function main() if C_FileSystem.isExecutable("/usr/bin/x86_64-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/x86_64-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/x86_64-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -284,7 +279,7 @@ function main() { arch = "x86_64", triplet = "x86_64-w64-mingw32", - customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, + customLinkParams = {}, }) table.insert(compilerList, release) @@ -292,11 +287,6 @@ function main() end if C_FileSystem.isExecutable("/usr/bin/i686-w64-mingw32-gcc") then - local extraObjects = { - utf8init = libexecDir .. "/i686-w64-mingw32/utf8init.o", - utf8manifest = libexecDir .. "/i686-w64-mingw32/utf8manifest.o", - } - do local release, _, _ = generateConfig( lang, "GCC", "mingw", @@ -304,7 +294,7 @@ function main() { arch = "i686", triplet = "i686-w64-mingw32", - customLinkParams = { extraObjects.utf8init, extraObjects.utf8manifest }, + customLinkParams = {}, }) table.insert(compilerList, release) diff --git a/packages/debian/rules b/packages/debian/rules index 11d20c39..70a50f5f 100755 --- a/packages/debian/rules +++ b/packages/debian/rules @@ -7,33 +7,11 @@ export DEB_BUILD_MAINT_OPTIONS = hardening=+all %: dh ${@} --buildsystem qmake -ifeq ($(DEB_HOST_ARCH), amd64) - -MINGW_UTF8_OBJS = x86_64-w64-mingw32/utf8init.o i686-w64-mingw32/utf8init.o x86_64-w64-mingw32/utf8manifest.o i686-w64-mingw32/utf8manifest.o - -override_dh_auto_build: $(MINGW_UTF8_OBJS) +override_dh_auto_build: dh_auto_build -O--buildsystem qmake -x86_64-w64-mingw32/utf8init.o: platform/windows/utf8/utf8init.cpp - mkdir -p $(dir $@) - x86_64-w64-mingw32-g++ -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o $@ $< - -x86_64-w64-mingw32/utf8manifest.o: platform/windows/utf8/utf8manifest.rc - mkdir -p $(dir $@) - x86_64-w64-mingw32-windres -O coff -o $@ $< - -i686-w64-mingw32/utf8init.o: platform/windows/utf8/utf8init.cpp - mkdir -p $(dir $@) - i686-w64-mingw32-g++ -Os -fno-exceptions -nodefaultlibs -nostdlib -c -o $@ $< - -i686-w64-mingw32/utf8manifest.o: platform/windows/utf8/utf8manifest.rc - mkdir -p $(dir $@) - i686-w64-mingw32-windres -O coff -o $@ $< - override_dh_auto_install: dh_auto_install -O--buildsystem=qmake dh_install debian/compiler_hint.lua usr/libexec/RedPandaCPP - dh_install x86_64-w64-mingw32/* usr/libexec/RedPandaCPP/x86_64-w64-mingw32 - dh_install i686-w64-mingw32/* usr/libexec/RedPandaCPP/i686-w64-mingw32 endif diff --git a/packages/msys/domain/build.sh b/packages/msys/domain/build.sh index cf649515..80fbb987 100644 --- a/packages/msys/domain/build.sh +++ b/packages/msys/domain/build.sh @@ -143,11 +143,6 @@ function prepare-mingw() { bsdtar -C "$_BUILDDIR" -xf "$_ASSETSDIR/$mingw_archive" local old_path="$PATH" export PATH="$mingw_dir/bin:$PATH" - { - 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" - ar rcs "$mingw_lib_dir/libutf8.a" "$mingw_lib_dir/utf8init.o" "$mingw_lib_dir/utf8manifest.o" - } export PATH="$old_path" fi } diff --git a/packages/msys/domain/compiler_hint.lua b/packages/msys/domain/compiler_hint.lua index 9fc35193..473d05fd 100644 --- a/packages/msys/domain/compiler_hint.lua +++ b/packages/msys/domain/compiler_hint.lua @@ -264,7 +264,7 @@ function main() programs, { arch = appArch, - customLinkParams = { "-Wl,utf8init.o", "-Wl,utf8manifest.o" }, + customLinkParams = {}, isClang = true, }) @@ -303,7 +303,7 @@ function main() programs, { arch = foreignArch, - customLinkParams = { "-Wl,utf8init.o", "-Wl,utf8manifest.o" }, + customLinkParams = {}, isClang = true, }) @@ -347,7 +347,6 @@ function main() }, customLinkParams = { "-target", msvcTriplet, - "-Wl,utf8init.o", "-Wl,utf8manifest.o", }, isClang = true, }) @@ -387,7 +386,6 @@ function main() }, customLinkParams = { "-target", msvcTriplet, - "-Wl,utf8init.o", "-Wl,utf8manifest.o", }, isClang = true, }) diff --git a/platform/windows/utf8/utf8init.cpp b/platform/windows/utf8/utf8init.cpp deleted file mode 100644 index e5c63b8e..00000000 --- a/platform/windows/utf8/utf8init.cpp +++ /dev/null @@ -1,25 +0,0 @@ -extern "C" { - unsigned __stdcall GetConsoleCP() noexcept; - unsigned __stdcall GetConsoleOutputCP() noexcept; - int __stdcall SetConsoleCP(unsigned) noexcept; - int __stdcall SetConsoleOutputCP(unsigned) noexcept; -} - -constexpr int CP_UTF8 = 65001; - -struct __utf8init_t { - unsigned saved_input_cp; - unsigned saved_output_cp; - - __utf8init_t() noexcept { - saved_input_cp = GetConsoleCP(); - saved_output_cp = GetConsoleOutputCP(); - SetConsoleCP(CP_UTF8); - SetConsoleOutputCP(CP_UTF8); - } - - ~__utf8init_t() noexcept { - SetConsoleCP(saved_input_cp); - SetConsoleOutputCP(saved_output_cp); - } -} __utf8init; diff --git a/platform/windows/utf8/utf8manifest.rc b/platform/windows/utf8/utf8manifest.rc deleted file mode 100644 index 37d002bc..00000000 --- a/platform/windows/utf8/utf8manifest.rc +++ /dev/null @@ -1,12 +0,0 @@ -1 24 MOVEABLE PURE DISCARDABLE -BEGIN - "" - "" - "" - "" - "" - "UTF-8" - "" - "" - "" -END