From 02c670cb587063d399a71c796bc96f06a5764b47 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sun, 20 Sep 2026 14:18:24 -0400 Subject: [PATCH 1/3] thtk: fix early variable expansions in pkg-config file --- thtk/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/thtk/CMakeLists.txt b/thtk/CMakeLists.txt index 27379c47..9a6c63a8 100644 --- a/thtk/CMakeLists.txt +++ b/thtk/CMakeLists.txt @@ -27,7 +27,7 @@ set_target_properties(thtk PROPERTIES find_package(PkgConfig) if (PKG_CONFIG_FOUND) - configure_file(thtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/thtk.pc) + configure_file(thtk.pc.in ${CMAKE_CURRENT_BINARY_DIR}/thtk.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/thtk.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) endif() From 69e657e894b089cbb29acf0d20337a6aff6bcd95 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sun, 20 Sep 2026 14:18:36 -0400 Subject: [PATCH 2/3] thtk: handle absolute install dirs in pkg-config file --- thtk/thtk.pc.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/thtk/thtk.pc.in b/thtk/thtk.pc.in index 15526e66..73f80015 100644 --- a/thtk/thtk.pc.in +++ b/thtk/thtk.pc.in @@ -1,7 +1,7 @@ prefix = @CMAKE_INSTALL_PREFIX@ exec_prefix = ${prefix} -includedir = ${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ -libdir = ${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ +includedir = @CMAKE_INSTALL_FULL_INCLUDEDIR@ +libdir = @CMAKE_INSTALL_FULL_LIBDIR@ Name: @PROJECT_NAME@ Description: Touhou Toolkit shared library From 988d70a52f81a76e3a0c49d7b7e70e95531c64e2 Mon Sep 17 00:00:00 2001 From: pagedmov Date: Sun, 20 Sep 2026 14:32:27 -0400 Subject: [PATCH 3/3] add flake.nix --- .gitignore | 1 + flake.lock | 24 +++++++++++++++++++++++ flake.nix | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 81 insertions(+) create mode 100644 flake.lock create mode 100644 flake.nix diff --git a/.gitignore b/.gitignore index f0e2480e..be8720d8 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ bin build *~ .vs +result diff --git a/flake.lock b/flake.lock new file mode 100644 index 00000000..0380ccd3 --- /dev/null +++ b/flake.lock @@ -0,0 +1,24 @@ +{ + "nodes": { + "nixpkgs": { + "locked": { + "lastModified": 1789724158, + "narHash": "sha256-a+eLlfZMyiiI5LIQ946grNITLv+FMldenpy02jbE3NI=", + "rev": "0a3468a402c449992505b6a9fc5b06580141b750", + "type": "tarball", + "url": "https://releases.nixos.org/nixpkgs/nixpkgs-26.11pre1075779.0a3468a402c4/nixexprs.tar.zst" + }, + "original": { + "type": "tarball", + "url": "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst" + } + }, + "root": { + "inputs": { + "nixpkgs": "nixpkgs" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 00000000..e7d00ccb --- /dev/null +++ b/flake.nix @@ -0,0 +1,56 @@ +{ + description = "Touhou Toolkit"; + + inputs = { + nixpkgs.url = "https://channels.nixos.org/nixpkgs-unstable/nixexprs.tar.zst"; + }; + + outputs = inputs: { + packages = builtins.mapAttrs (system: pkgs: let + inherit (pkgs) lib stdenv fetchFromGitHub; + thtypes = fetchFromGitHub { + owner = "thpatch"; + repo = "thtypes"; + rev = "29ed7d6e1db555ad15fd29edcc0763754ad5b764"; + hash = "sha256-j3lrToLuS7SbzzdL3/8uB0nL1z04GtmfmKIC/v37jwI="; + }; + in { + thtk = stdenv.mkDerivation { + pname = "thtk"; + version = "12"; + + src = inputs.self; + + env.NIX_CFLAGS_COMPILE = "-I${thtypes}"; + + nativeBuildInputs = with pkgs; [ + cmake + pkg-config + validatePkgConfig + flex + bison + ]; + + buildInputs = with pkgs; [ + zlib + libpng + ]; + + cmakeFlags = [ + (lib.cmakeBool "WITH_LIBPNG_SOURCE" false) + ]; + + meta = { + description = "Touhou Toolkit"; + homepage = "https://github.com/thpatch/thtk"; + changelog = "https://github.com/thpatch/thtk/releases"; + license = lib.licenses.bsd2; + pkgConfigModules = [ "thtk" ]; + platforms = with lib.platforms; linux ++ windows; + }; + }; + + default = inputs.self.packages.${system}.thtk; + }) inputs.nixpkgs.legacyPackages; + }; +}