python312Packages.llama-index: 0.12.9 -> 0.12.9.post1 (#371957)
[NixPkgs.git] / pkgs / by-name / li / libloot / package.nix
bloba7ab3ed42e53d6c8f9c59369577d7646184dc38c
2   lib,
3   stdenv,
4   fetchFromGitHub,
6   rustPlatform,
7   rust-cbindgen,
9   cmake,
10   pkg-config,
12   withDocs ? true,
13   doxygen,
14   python3Packages,
16   boost,
17   fmt_11,
18   gtest,
19   icu,
20   spdlog,
21   tbb_2021_11,
22   yaml-cpp,
25 stdenv.mkDerivation (finalAttrs: {
26   pname = "libloot";
27   version = "0.24.5";
28   # Note: don't forget to also update the package versions in the passthru section
30   outputs = [
31     "out"
32     "dev"
33   ] ++ lib.optionals withDocs [ "doc" ];
35   src = fetchFromGitHub {
36     owner = "loot";
37     repo = "libloot";
38     rev = "refs/tags/${finalAttrs.version}";
39     hash = "sha256-SAnbp34DlGsq4nfaRHfCTGRSGQtv/rRgngvwma2tc7Q=";
40   };
42   patches = [
43     # don't try to build the rust FFI dependencies with cargo, since we build them separately
44     ./deps.patch
45   ];
47   postPatch = ''
48     # there seem to have been some changes in header files generated by rust-cbindgen, so we use the new names
49     substituteInPlace src/api/plugin.{h,cpp} \
50         --replace-fail 'Vec_PluginMetadata' 'Vec<::PluginMetadata>'
51   '';
53   strictDeps = true;
55   nativeBuildInputs =
56     [
57       cmake
58       pkg-config
59     ]
60     ++ lib.optionals withDocs [
61       doxygen
62       python3Packages.sphinx
63       python3Packages.sphinx-rtd-theme
64       python3Packages.breathe
65     ];
67   buildInputs = [
68     boost
69     fmt_11
70     gtest
71     icu
72     (spdlog.override { fmt = fmt_11; })
73     tbb_2021_11
75     finalAttrs.passthru.yaml-cpp # has merge-key support
76     finalAttrs.passthru.libloadorder
77     finalAttrs.passthru.esplugin
78     finalAttrs.passthru.loot-condition-interpreter
79   ];
81   cmakeFlags = [
82     (lib.cmakeFeature "ESPLUGIN_LIBRARIES" "esplugin_ffi")
83     (lib.cmakeFeature "LIBLOADORDER_LIBRARIES" "loadorder_ffi")
84     (lib.cmakeFeature "LCI_LIBRARIES" "loot_condition_interpreter_ffi")
85     (lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TESTING-PLUGINS" "../testing-plugins")
86     (lib.cmakeBool "LIBLOOT_BUILD_TESTS" finalAttrs.doCheck)
87     (lib.cmakeBool "LIBLOOT_INSTALL_DOCS" withDocs)
88   ];
90   postConfigure = lib.optionalString finalAttrs.doCheck ''
91     cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} ../testing-plugins
92   '';
94   postBuild = lib.optionalString withDocs ''
95     sphinx-build -b html ../docs docs/html
96   '';
98   env.GTEST_FILTER =
99     let
100       disabledTests = [
101         # Some locale releated tests fail because they need the LOCALE_ARCHIVE env var to be set to "${glibcLocales}/lib/locale/locale-archive"
102         # Due to storage size concerns of `glibcLocales`, we skip this
103         "CompareFilenames.shouldBeCaseInsensitiveAndLocaleInvariant"
104         "NormalizeFilename.shouldCaseFoldStringsAndBeLocaleInvariant"
106         # Some filesystem related test fail because they assume `std::filesystem::equivalent` works with non-existent paths
107         "Filesystem.equivalentShouldNotRequireThatBothPathsExist"
108         "Filesystem.equivalentShouldBeCaseSensitive"
109       ];
110     in
111     "-${builtins.concatStringsSep ":" disabledTests}";
113   doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
115   passthru = {
116     testing-plugins = fetchFromGitHub {
117       owner = "Ortham";
118       repo = "testing-plugins";
119       rev = "refs/tags/1.6.2";
120       hash = "sha256-3Aa98EwqpuGA3YlsRF8luWzXVEFO/rs6JXisXdLyIK4=";
121     };
123     buildRustFFIPackage =
124       args:
125       rustPlatform.buildRustPackage (
126         args
127         // {
128           postConfigure = ''
129             cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} testing-plugins
130           '';
132           nativeBuildInputs = [ rust-cbindgen ];
134           buildAndTestSubdir = "ffi";
136           postBuild = ''
137             cbindgen ffi/ -l "$lang" -o "$out/include/$header"
138           '';
139         }
140       );
142     libloadorder = finalAttrs.passthru.buildRustFFIPackage rec {
143       pname = "libloadorder";
144       version = "18.1.3";
146       src = fetchFromGitHub {
147         owner = "Ortham";
148         repo = "libloadorder";
149         rev = "refs/tags/${version}";
150         hash = "sha256-qJ7gC4BkrXJiVcyA1BqlJSRzgc/7VmNBHtDq0ouJoTU=";
151       };
153       cargoHash = "sha256-x4LFO6dD3bBKv6gTrNUAo7Rdw5cP67gn44QP6Iwbv0I=";
155       lang = "c++";
156       header = "libloadorder.hpp";
157     };
159     esplugin = finalAttrs.passthru.buildRustFFIPackage rec {
160       pname = "esplugin";
161       version = "6.1.1";
163       src = fetchFromGitHub {
164         owner = "Ortham";
165         repo = "esplugin";
166         rev = "refs/tags/${version}";
167         hash = "sha256-ygjSyixg+9HFFNV/G+w+TxGFTrjlWxlDt8phpCE8xyQ=";
168       };
170       cargoHash = "sha256-39iod83yVU5PyIjwv7pLLuMeNw9fHiM0tXDauyGrbx8=";
172       lang = "c++";
173       header = "esplugin.hpp";
174     };
176     loot-condition-interpreter = finalAttrs.passthru.buildRustFFIPackage rec {
177       pname = "loot-condition-interpreter";
178       version = "4.0.2";
180       src = fetchFromGitHub {
181         owner = "loot";
182         repo = "loot-condition-interpreter";
183         rev = "refs/tags/${version}";
184         hash = "sha256-yXbe7ByYHvFpokRpV2pz2SX0986dpk5IpehwDUhoZKg=";
185       };
187       cargoHash = "sha256-p+raWZkW16MrvfZhJigSPth8pZZ68twU1+0GL/Mo1Xw=";
189       lang = "c";
190       header = "loot_condition_interpreter.h";
191     };
193     yaml-cpp = yaml-cpp.overrideAttrs rec {
194       version = "0.8.0+merge-key-support.2";
195       src = fetchFromGitHub {
196         owner = "loot";
197         repo = "yaml-cpp";
198         rev = "refs/tags/${version}";
199         hash = "sha256-whYorebrLiDeO75LC2SMUX/8OD528BR0+DEgnJxxpoQ=";
200       };
201     };
202   };
204   meta = {
205     description = "C++ library for accessing LOOT's metadata and sorting functionality";
206     homepage = "https://github.com/loot/libloot";
207     license = lib.licenses.gpl3Only;
208     maintainers = with lib.maintainers; [ tomasajt ];
209     platforms = lib.platforms.linux;
210   };