From 028d98f4fca38ac0eb18cd822d871060033d3800 Mon Sep 17 00:00:00 2001 From: yuuko Date: Tue, 2 Sep 2025 10:44:05 -0700 Subject: vpkedit: init @ 5.0.0-beta.1 --- .../vpkedit/0001-nix-translation-base-fixup.patch | 25 ++++ srcds-pkgs/vpkedit/default.nix | 148 +++++++++++++++++++++ srcds-pkgs/vpkedit/fix-miniz-cmake-dirs.patch | 28 ++++ 3 files changed, 201 insertions(+) create mode 100644 srcds-pkgs/vpkedit/0001-nix-translation-base-fixup.patch create mode 100644 srcds-pkgs/vpkedit/default.nix create mode 100644 srcds-pkgs/vpkedit/fix-miniz-cmake-dirs.patch (limited to 'srcds-pkgs/vpkedit') diff --git a/srcds-pkgs/vpkedit/0001-nix-translation-base-fixup.patch b/srcds-pkgs/vpkedit/0001-nix-translation-base-fixup.patch new file mode 100644 index 0000000..9789a5b --- /dev/null +++ b/srcds-pkgs/vpkedit/0001-nix-translation-base-fixup.patch @@ -0,0 +1,25 @@ +From ec8b880ad940d3413c7a0a3d8ef7ec440cb23eb5 Mon Sep 17 00:00:00 2001 +From: yuuko +Date: Tue, 2 Sep 2025 09:39:49 -0700 +Subject: [PATCH] nix translation base fixup + +--- + src/gui/Main.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/gui/Main.cpp b/src/gui/Main.cpp +index 1831525..2e89c6c 100644 +--- a/src/gui/Main.cpp ++++ b/src/gui/Main.cpp +@@ -43,7 +43,7 @@ int main(int argc, char** argv) { + QCoreApplication::installTranslator(&translatorQt); + } + QTranslator translator; +- if (translator.load(locale, PROJECT_NAME.data(), "_", ":/i18n")) { ++ if (translator.load(locale, PROJECT_NAME.data(), "_", QApplication::applicationDirPath() + "/../lib/vpkedit/i18n")) { + QCoreApplication::installTranslator(&translator); + } + +-- +2.50.1 + diff --git a/srcds-pkgs/vpkedit/default.nix b/srcds-pkgs/vpkedit/default.nix new file mode 100644 index 0000000..0b04ced --- /dev/null +++ b/srcds-pkgs/vpkedit/default.nix @@ -0,0 +1,148 @@ +{ + lib, + stdenv, + fetchgit, + fetchFromGitHub, + cmake, + openssl, + qt6, + zlib-ng, + bzip2, + xz, + zstd, + cryptopp, + pkg-config, + makeWrapper, + versionCheckHook, +}: + +stdenv.mkDerivation (finalAttrs: { + pname = "vpkedit"; + version = "5.0.0-beta.1"; + + # FIXME: when updating, see if versions match again & we can get rid of this. + # pls dont let it last longer than it needs to kthx + passthru.tmpVerMismatch = + assert finalAttrs.version == "5.0.0-beta.1"; + "5.0.0.1"; + + src = fetchFromGitHub { + owner = "craftablescience"; + repo = finalAttrs.pname; + tag = "v${finalAttrs.passthru.tmpVerMismatch}"; + fetchSubmodules = true; + hash = "sha256-CPL+pPVrkbTIktskRsgHHgarg4edf0s3U2pnJ5/6h8E="; + }; + + /* + The following sources should be updated to what was available at the time of + VPKEdit's release, according to the vendored submodules and their nested + submodules. These need to exist to avoid CMake's FetchContent trying to + pull stuff over the network. + + v5.0.0.1 + - src/thirdparty/sourcepp @ 6ba306ad + - ext/cryptopp (which is actually cryptopp-cmake) @ gedb9a71 + - sources cryptopp (the actual one) from latest release tag of + https://github.com/weidai11/cryptopp + - ext/minizip-ng @ heads/develop + which at time of v5.0.0.1 commit was 2c0dc5d8 + - sources zlib from stable branch of https://github.com/zlib-ng/zlib-ng + (pinned to latest release tag) + - sources bzip2 from master branch of https://gitlab.com/bzip2/bzip2 + (seemingly assuming + - sources xz from master branch of https://github.com/tukaani-project/xz + - sources zstd from release branch of https://github.com/facebook/zstd + (pinned to latest release tag) + */ + + cryptopp-src = fetchgit { + url = "https://github.com/weidai11/cryptopp"; + tag = "CRYPTOPP_8_9_0"; + hash = "sha256-HV+afSFkiXdy840JbHBTR8lLL0GMwsN3QdwaoQmicpQ="; + }; + + zlib-src = fetchgit { + url = "https://github.com/zlib-ng/zlib-ng"; + tag = "2.2.5"; + hash = "sha256-VB4aegnZCZut9H/Hu2PBwwldpbM7E67D5QFYCKgq3mg="; + }; + + bzip2-src = fetchgit { + url = "https://gitlab.com/bzip2/bzip2"; + rev = "66c46b8c9436613fd81bc5d03f63a61933a4dcc3"; + hash = "sha256-JuwmLBwtUPW9Wt31wIX5NMCu0VTxt16XaBQ2c5rFTY4="; + }; + + xz-src = fetchgit { + url = "https://github.com/tukaani-project/xz"; + tag = "v5.8.1"; + hash = "sha256-29w1K3zC58oFkBvSdwpKu694S+42FxzqOtWBpS7iJ+A="; + }; + + zstd-src = fetchgit { + url = "https://github.com/facebook/zstd"; + tag = "v1.5.7"; + hash = "sha256-tNFWIT9ydfozB8dWcmTMuZLCQmQudTFJIkSr0aG7S44="; + }; + + nativeBuildInputs = [ + cmake + makeWrapper + qt6.wrapQtAppsHook + ]; + + buildInputs = [ + bzip2 + cryptopp + openssl + pkg-config + qt6.qtbase + qt6.qttools + xz + zlib-ng + zstd + ]; + + cmakeFlags = with finalAttrs; [ + (lib.cmakeFeature "CRYPTOPP_SOURCES" "${cryptopp-src}") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZLIB" "${zlib-src}") + # it wants write access now. wowee. + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_BZIP2" "/build/bzip2tmp") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_LIBLZMA" "${xz-src}") + (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_ZSTD" "${zstd-src}") + (lib.cmakeFeature "CPACK_GENERATOR" "DEB") + (lib.cmakeBool "MZ_OPENSSL" true) + ]; + + patches = [ + ./0001-nix-translation-base-fixup.patch + ./fix-miniz-cmake-dirs.patch + ]; + + postInstall = '' + mkdir -p $out/lib/vpkedit/i18n + mv *.qm $out/lib/vpkedit/i18n + ''; + + postUnpack = '' + cp -r ${finalAttrs.bzip2-src} /build/bzip2tmp + chmod -R +w /build/bzip2tmp + ''; + + # doesnt seem to make any real difference but it complained and i listened + LANG = "C.UTF-8"; + + nativeInstallCheckInputs = [ versionCheckHook ]; + versionCheckProgram = "${placeholder "out"}/bin/vpkeditcli"; + doInstallCheck = true; + + meta = { + description = "CLI/GUI tool to create, read, and write several pack file formats"; + homepage = "https://github.com/craftablescience/VPKEdit"; + mainProgram = "vpkeditcli"; + license = lib.licenses.mit; + platforms = [ "x86_64-linux" ]; + changelog = "https://github.com/craftablescience/VPKEdit/releases/tag/v${finalAttrs.passthru.tmpVerMismatch}"; + }; +}) \ No newline at end of file diff --git a/srcds-pkgs/vpkedit/fix-miniz-cmake-dirs.patch b/srcds-pkgs/vpkedit/fix-miniz-cmake-dirs.patch new file mode 100644 index 0000000..55e8c46 --- /dev/null +++ b/srcds-pkgs/vpkedit/fix-miniz-cmake-dirs.patch @@ -0,0 +1,28 @@ +--- a/ext/shared/sourcepp/ext/miniz/miniz.pc.in ++++ b/ext/shared/sourcepp/ext/miniz/miniz.pc.in +@@ -1,13 +1,12 @@ +-prefix=@CMAKE_INSTALL_PREFIX@ +-exec_prefix=${prefix} +-libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +-includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@/@PROJECT_NAME@ +- +-Name: @PROJECT_NAME@ +-Description: @PROJECT_DESCRIPTION@ +-Version: @MINIZ_VERSION@ +-URL: @PROJECT_HOMEPAGE_URL@ +- +-Requires: +-Libs: -L${libdir} -lminiz +-Cflags: -I${includedir} ++prefix=@CMAKE_INSTALL_PREFIX@ ++libdir=@CMAKE_INSTALL_FULL_LIBDIR@ ++includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@/@PROJECT_NAME@ ++ ++Name: @PROJECT_NAME@ ++Description: @PROJECT_DESCRIPTION@ ++Version: @MINIZ_VERSION@ ++URL: @PROJECT_HOMEPAGE_URL@ ++ ++Requires: ++Libs: -L${libdir} -lminiz ++Cflags: -I${includedir} -- cgit v1.2.3