new package: rcedit (#23965)
This commit is contained in:
parent
ddb9cf060e
commit
b12eb9640c
16
mingw-w64-rcedit/001-mingw-cmake.patch
Normal file
16
mingw-w64-rcedit/001-mingw-cmake.patch
Normal file
@ -0,0 +1,16 @@
|
||||
diff -bur rcedit-2.0.0-o/CMakeLists.txt rcedit-2.0.0/CMakeLists.txt
|
||||
--- rcedit-2.0.0-o/CMakeLists.txt 2025-04-13 09:51:58.081962300 -0600
|
||||
+++ rcedit-2.0.0/CMakeLists.txt 2025-04-13 09:52:03.525370400 -0600
|
||||
@@ -1,11 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
-set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
-
|
||||
-# /Ox, full optimization
|
||||
-# /Os, favour small code
|
||||
-add_compile_options(/Ox /Os)
|
||||
-
|
||||
project(rcedit)
|
||||
|
||||
add_executable(rcedit src/main.cc src/rescle.cc src/rcedit.rc)
|
||||
+target_link_options(rcedit PUBLIC -mconsole -municode)
|
||||
71
mingw-w64-rcedit/002-no-atl.patch
Normal file
71
mingw-w64-rcedit/002-no-atl.patch
Normal file
@ -0,0 +1,71 @@
|
||||
diff -bur rcedit-2.0.0-o/src/rescle.cc rcedit-2.0.0/src/rescle.cc
|
||||
--- rcedit-2.0.0-o/src/rescle.cc 2025-04-13 10:50:49.524397300 -0600
|
||||
+++ rcedit-2.0.0/src/rescle.cc 2025-04-13 10:52:57.542408100 -0600
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "rescle.h"
|
||||
|
||||
#include <assert.h>
|
||||
-#include <atlstr.h>
|
||||
#include <sstream> // wstringstream
|
||||
#include <iomanip> // setw, setfill
|
||||
#include <fstream>
|
||||
@@ -85,7 +84,7 @@
|
||||
|
||||
std::wstring ReadFileToString(const wchar_t* filename) {
|
||||
std::wifstream wif(filename);
|
||||
- wif.imbue(std::locale(std::locale::empty(), new std::codecvt_utf8<wchar_t>));
|
||||
+ wif.imbue(std::locale(std::locale(), new std::codecvt_utf8<wchar_t>));
|
||||
std::wstringstream wss;
|
||||
wss << wif.rdbuf();
|
||||
return wss.str();
|
||||
@@ -881,7 +880,7 @@
|
||||
ResourceUpdater* instance = reinterpret_cast<ResourceUpdater*>(lParam);
|
||||
if (IS_INTRESOURCE(lpszName) && IS_INTRESOURCE(lpszType)) {
|
||||
switch (reinterpret_cast<ptrdiff_t>(lpszType)) {
|
||||
- case reinterpret_cast<ptrdiff_t>(RT_VERSION): {
|
||||
+ case (ptrdiff_t)(16): {
|
||||
try {
|
||||
instance->versionStampMap_[wIDLanguage] = VersionInfo(instance->module_, wIDLanguage);
|
||||
} catch (const std::system_error& e) {
|
||||
@@ -889,30 +888,33 @@
|
||||
}
|
||||
break;
|
||||
}
|
||||
- case reinterpret_cast<ptrdiff_t>(RT_STRING): {
|
||||
+ case (ptrdiff_t)(6): {
|
||||
UINT id = reinterpret_cast<ptrdiff_t>(lpszName) - 1;
|
||||
auto& vector = instance->stringTableMap_[wIDLanguage][id];
|
||||
for (size_t k = 0; k < 16; k++) {
|
||||
- CStringW buf;
|
||||
-
|
||||
- buf.LoadStringW(instance->module_, id * 16 + k, wIDLanguage);
|
||||
- vector.push_back(buf.GetBuffer());
|
||||
+ WCHAR buffer[1024] = {0};
|
||||
+ int len = LoadStringW(instance->module_, id * 16 + k, buffer, 1024);
|
||||
+ if (len > 0) {
|
||||
+ vector.push_back(std::wstring(buffer, len));
|
||||
+ } else {
|
||||
+ vector.push_back(std::wstring());
|
||||
+ }
|
||||
}
|
||||
break;
|
||||
}
|
||||
- case reinterpret_cast<ptrdiff_t>(RT_ICON): {
|
||||
+ case (ptrdiff_t)(3): {
|
||||
UINT iconId = reinterpret_cast<ptrdiff_t>(lpszName);
|
||||
UINT maxIconId = instance->iconBundleMap_[wIDLanguage].maxIconId;
|
||||
if (iconId > maxIconId)
|
||||
maxIconId = iconId;
|
||||
break;
|
||||
}
|
||||
- case reinterpret_cast<ptrdiff_t>(RT_GROUP_ICON): {
|
||||
+ case (ptrdiff_t)(14): {
|
||||
UINT iconId = reinterpret_cast<ptrdiff_t>(lpszName);
|
||||
instance->iconBundleMap_[wIDLanguage].iconBundles[iconId] = nullptr;
|
||||
break;
|
||||
}
|
||||
- case reinterpret_cast<ptrdiff_t>(RT_RCDATA): {
|
||||
+ case (ptrdiff_t)(10): {
|
||||
const auto moduleHandle = HMODULE(hModule);
|
||||
HRSRC hResInfo = FindResource(moduleHandle, lpszName, lpszType);
|
||||
DWORD cbResource = SizeofResource(moduleHandle, hResInfo);
|
||||
72
mingw-w64-rcedit/PKGBUILD
Normal file
72
mingw-w64-rcedit/PKGBUILD
Normal file
@ -0,0 +1,72 @@
|
||||
|
||||
_realname=rcedit
|
||||
pkgbase=mingw-w64-${_realname}
|
||||
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
|
||||
pkgver=2.0.0
|
||||
pkgrel=1
|
||||
pkgdesc="Command line tool to edit resources of executable files (mingw-w64)"
|
||||
arch=('any')
|
||||
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
|
||||
url="https://github.com/electron/rcedit"
|
||||
msys2_repository_url="https://github.com/electron/rcedit"
|
||||
msys2_references=(
|
||||
"aur : rcedit-bin"
|
||||
)
|
||||
license=("spdx:MIT")
|
||||
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
|
||||
"${MINGW_PACKAGE_PREFIX}-cmake"
|
||||
"${MINGW_PACKAGE_PREFIX}-ninja")
|
||||
|
||||
source=("https://github.com/electron/rcedit/archive/refs/tags/v${pkgver}.tar.gz"
|
||||
"001-mingw-cmake.patch"
|
||||
"002-no-atl.patch")
|
||||
sha256sums=('2a55a176fc11cc563cd827ef3f55a7afe2aa0dca1ecc8d8d53b1b5afd5cffa20'
|
||||
'5accc4e5de7b7f724ce9d0ea3090897db9cf17ccab4c894539293e5b29094006'
|
||||
'39672c98dd057c5f7f3d820a7be3f8ee59c2defce305bd5b21ae27e6fcaf4c0f')
|
||||
|
||||
apply_patch_with_msg() {
|
||||
for _patch in "$@"
|
||||
do
|
||||
msg2 "Applying $_patch"
|
||||
patch -Nbp1 -i "${srcdir}/$_patch"
|
||||
done
|
||||
}
|
||||
|
||||
prepare() {
|
||||
cd "${srcdir}"/${_realname}-${pkgver}
|
||||
|
||||
apply_patch_with_msg \
|
||||
001-mingw-cmake.patch \
|
||||
002-no-atl.patch
|
||||
}
|
||||
|
||||
build() {
|
||||
mkdir -p build-${MSYSTEM} && cd build-${MSYSTEM}
|
||||
|
||||
local -a extra_config
|
||||
if check_option "debug" "y"; then
|
||||
extra_config+=(-DCMAKE_BUILD_TYPE=Debug)
|
||||
else
|
||||
extra_config+=(-DCMAKE_BUILD_TYPE=Release)
|
||||
fi
|
||||
|
||||
CXXFLAGS+=" -Wno-format -Wno-conversion-null" \
|
||||
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
|
||||
${MINGW_PREFIX}/bin/cmake.exe -Wno-dev \
|
||||
-G"Ninja" \
|
||||
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
|
||||
"${extra_config[@]}" \
|
||||
../${_realname}-${pkgver}
|
||||
|
||||
${MINGW_PREFIX}/bin/cmake --build .
|
||||
}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}"/build-${MSYSTEM}
|
||||
|
||||
install -Dm644 rcedit.exe "${pkgdir}${MINGW_PREFIX}/bin/rcedit.exe"
|
||||
install -Dm644 "${srcdir}"/${_realname}-${pkgver}/LICENSE "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
|
||||
|
||||
# Update rcedit.exe's product version using rcedit itself
|
||||
./rcedit.exe "${pkgdir}${MINGW_PREFIX}/bin/rcedit.exe" --set-product-version ${pkgver}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user