Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ bin
build
*~
.vs
result
24 changes: 24 additions & 0 deletions flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 56 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
@@ -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;
};
}
2 changes: 1 addition & 1 deletion thtk/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions thtk/thtk.pc.in
Original file line number Diff line number Diff line change
@@ -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
Expand Down