tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
libloot: init at 0.24.5
TomaSajt
1 year ago
0f9bf051
7b875041
+257
2 changed files
expand all
collapse all
unified
split
pkgs
by-name
li
libloot
deps.patch
package.nix
+46
pkgs/by-name/li/libloot/deps.patch
···
1
1
+
diff --git a/CMakeLists.txt b/CMakeLists.txt
2
2
+
index 24c7d85..3d070d5 100644
3
3
+
--- a/CMakeLists.txt
4
4
+
+++ b/CMakeLists.txt
5
5
+
@@ -79,6 +79,7 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
6
6
+
find_package(TBB REQUIRED)
7
7
+
endif()
8
8
+
9
9
+
+#[==[
10
10
+
if(NOT DEFINED ESPLUGIN_URL)
11
11
+
set(ESPLUGIN_URL "https://github.com/Ortham/esplugin/archive/refs/tags/6.1.0.tar.gz")
12
12
+
set(ESPLUGIN_HASH "SHA256=52dec796d98426e1c75c5cf3c41351c0b3431a6301137e00fcf6023f4e47b502")
13
13
+
@@ -153,6 +154,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
14
14
+
else()
15
15
+
set(LCI_LIBRARIES ${LCI_LIBRARIES} dl)
16
16
+
endif()
17
17
+
+#]==]
18
18
+
19
19
+
FetchContent_Declare(
20
20
+
fmt
21
21
+
@@ -307,10 +309,6 @@ set(LIBLOOT_ALL_SOURCES
22
22
+
23
23
+
# Build API.
24
24
+
add_library(loot ${LIBLOOT_ALL_SOURCES})
25
25
+
-add_dependencies(loot
26
26
+
- esplugin
27
27
+
- libloadorder
28
28
+
- loot-condition-interpreter)
29
29
+
target_link_libraries(loot PRIVATE
30
30
+
Boost::headers
31
31
+
${ESPLUGIN_LIBRARIES}
32
32
+
diff --git a/cmake/tests.cmake b/cmake/tests.cmake
33
33
+
index ebccd82..2cef53c 100644
34
34
+
--- a/cmake/tests.cmake
35
35
+
+++ b/cmake/tests.cmake
36
36
+
@@ -108,10 +108,6 @@ set(LIBLOOT_INTERFACE_TESTS_ALL_SOURCES
37
37
+
38
38
+
# Build tests.
39
39
+
add_executable(libloot_internals_tests ${LIBLOOT_INTERNALS_TESTS_ALL_SOURCES})
40
40
+
-add_dependencies(libloot_internals_tests
41
41
+
- esplugin
42
42
+
- libloadorder
43
43
+
- loot-condition-interpreter)
44
44
+
target_link_libraries(libloot_internals_tests PRIVATE
45
45
+
Boost::headers
46
46
+
${ESPLUGIN_LIBRARIES}
+211
pkgs/by-name/li/libloot/package.nix
···
1
1
+
{
2
2
+
lib,
3
3
+
stdenv,
4
4
+
fetchFromGitHub,
5
5
+
6
6
+
rustPlatform,
7
7
+
rust-cbindgen,
8
8
+
9
9
+
cmake,
10
10
+
pkg-config,
11
11
+
12
12
+
withDocs ? true,
13
13
+
doxygen,
14
14
+
python3Packages,
15
15
+
16
16
+
boost,
17
17
+
fmt_11,
18
18
+
gtest,
19
19
+
icu,
20
20
+
spdlog,
21
21
+
tbb_2021_11,
22
22
+
yaml-cpp,
23
23
+
}:
24
24
+
25
25
+
stdenv.mkDerivation (finalAttrs: {
26
26
+
pname = "libloot";
27
27
+
version = "0.24.5";
28
28
+
# Note: don't forget to also update the package versions in the passthru section
29
29
+
30
30
+
outputs = [
31
31
+
"out"
32
32
+
"dev"
33
33
+
] ++ lib.optionals withDocs [ "doc" ];
34
34
+
35
35
+
src = fetchFromGitHub {
36
36
+
owner = "loot";
37
37
+
repo = "libloot";
38
38
+
rev = "refs/tags/${finalAttrs.version}";
39
39
+
hash = "sha256-SAnbp34DlGsq4nfaRHfCTGRSGQtv/rRgngvwma2tc7Q=";
40
40
+
};
41
41
+
42
42
+
patches = [
43
43
+
# don't try to build the rust FFI dependencies with cargo, since we build them separately
44
44
+
./deps.patch
45
45
+
];
46
46
+
47
47
+
postPatch = ''
48
48
+
# there seem to have been some changes in header files generated by rust-cbindgen, so we use the new names
49
49
+
substituteInPlace src/api/plugin.{h,cpp} \
50
50
+
--replace-fail 'Vec_PluginMetadata' 'Vec<::PluginMetadata>'
51
51
+
'';
52
52
+
53
53
+
strictDeps = true;
54
54
+
55
55
+
nativeBuildInputs =
56
56
+
[
57
57
+
cmake
58
58
+
pkg-config
59
59
+
]
60
60
+
++ lib.optionals withDocs [
61
61
+
doxygen
62
62
+
python3Packages.sphinx
63
63
+
python3Packages.sphinx-rtd-theme
64
64
+
python3Packages.breathe
65
65
+
];
66
66
+
67
67
+
buildInputs = [
68
68
+
boost
69
69
+
fmt_11
70
70
+
gtest
71
71
+
icu
72
72
+
(spdlog.override { fmt = fmt_11; })
73
73
+
tbb_2021_11
74
74
+
75
75
+
finalAttrs.passthru.yaml-cpp # has merge-key support
76
76
+
finalAttrs.passthru.libloadorder
77
77
+
finalAttrs.passthru.esplugin
78
78
+
finalAttrs.passthru.loot-condition-interpreter
79
79
+
];
80
80
+
81
81
+
cmakeFlags = [
82
82
+
(lib.cmakeFeature "ESPLUGIN_LIBRARIES" "esplugin_ffi")
83
83
+
(lib.cmakeFeature "LIBLOADORDER_LIBRARIES" "loadorder_ffi")
84
84
+
(lib.cmakeFeature "LCI_LIBRARIES" "loot_condition_interpreter_ffi")
85
85
+
(lib.cmakeFeature "FETCHCONTENT_SOURCE_DIR_TESTING-PLUGINS" "../testing-plugins")
86
86
+
(lib.cmakeBool "LIBLOOT_BUILD_TESTS" finalAttrs.doCheck)
87
87
+
(lib.cmakeBool "LIBLOOT_INSTALL_DOCS" withDocs)
88
88
+
];
89
89
+
90
90
+
postConfigure = lib.optionalString finalAttrs.doCheck ''
91
91
+
cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} ../testing-plugins
92
92
+
'';
93
93
+
94
94
+
postBuild = lib.optionalString withDocs ''
95
95
+
sphinx-build -b html ../docs docs/html
96
96
+
'';
97
97
+
98
98
+
env.GTEST_FILTER =
99
99
+
let
100
100
+
disabledTests = [
101
101
+
# Some locale releated tests fail because they need the LOCALE_ARCHIVE env var to be set to "${glibcLocales}/lib/locale/locale-archive"
102
102
+
# Due to storage size concerns of `glibcLocales`, we skip this
103
103
+
"CompareFilenames.shouldBeCaseInsensitiveAndLocaleInvariant"
104
104
+
"NormalizeFilename.shouldCaseFoldStringsAndBeLocaleInvariant"
105
105
+
106
106
+
# Some filesystem related test fail because they assume `std::filesystem::equivalent` works with non-existent paths
107
107
+
"Filesystem.equivalentShouldNotRequireThatBothPathsExist"
108
108
+
"Filesystem.equivalentShouldBeCaseSensitive"
109
109
+
];
110
110
+
in
111
111
+
"-${builtins.concatStringsSep ":" disabledTests}";
112
112
+
113
113
+
doCheck = stdenv.buildPlatform.canExecute stdenv.hostPlatform;
114
114
+
115
115
+
passthru = {
116
116
+
testing-plugins = fetchFromGitHub {
117
117
+
owner = "Ortham";
118
118
+
repo = "testing-plugins";
119
119
+
rev = "refs/tags/1.6.2";
120
120
+
hash = "sha256-3Aa98EwqpuGA3YlsRF8luWzXVEFO/rs6JXisXdLyIK4=";
121
121
+
};
122
122
+
123
123
+
buildRustFFIPackage =
124
124
+
args:
125
125
+
rustPlatform.buildRustPackage (
126
126
+
args
127
127
+
// {
128
128
+
postConfigure = ''
129
129
+
cp -r --no-preserve=all ${finalAttrs.passthru.testing-plugins} testing-plugins
130
130
+
'';
131
131
+
132
132
+
nativeBuildInputs = [ rust-cbindgen ];
133
133
+
134
134
+
buildAndTestSubdir = "ffi";
135
135
+
136
136
+
postBuild = ''
137
137
+
cbindgen ffi/ -l "$lang" -o "$out/include/$header"
138
138
+
'';
139
139
+
}
140
140
+
);
141
141
+
142
142
+
libloadorder = finalAttrs.passthru.buildRustFFIPackage rec {
143
143
+
pname = "libloadorder";
144
144
+
version = "18.1.3";
145
145
+
146
146
+
src = fetchFromGitHub {
147
147
+
owner = "Ortham";
148
148
+
repo = "libloadorder";
149
149
+
rev = "refs/tags/${version}";
150
150
+
hash = "sha256-qJ7gC4BkrXJiVcyA1BqlJSRzgc/7VmNBHtDq0ouJoTU=";
151
151
+
};
152
152
+
153
153
+
cargoHash = "sha256-x4LFO6dD3bBKv6gTrNUAo7Rdw5cP67gn44QP6Iwbv0I=";
154
154
+
155
155
+
lang = "c++";
156
156
+
header = "libloadorder.hpp";
157
157
+
};
158
158
+
159
159
+
esplugin = finalAttrs.passthru.buildRustFFIPackage rec {
160
160
+
pname = "esplugin";
161
161
+
version = "6.1.1";
162
162
+
163
163
+
src = fetchFromGitHub {
164
164
+
owner = "Ortham";
165
165
+
repo = "esplugin";
166
166
+
rev = "refs/tags/${version}";
167
167
+
hash = "sha256-ygjSyixg+9HFFNV/G+w+TxGFTrjlWxlDt8phpCE8xyQ=";
168
168
+
};
169
169
+
170
170
+
cargoHash = "sha256-39iod83yVU5PyIjwv7pLLuMeNw9fHiM0tXDauyGrbx8=";
171
171
+
172
172
+
lang = "c++";
173
173
+
header = "esplugin.hpp";
174
174
+
};
175
175
+
176
176
+
loot-condition-interpreter = finalAttrs.passthru.buildRustFFIPackage rec {
177
177
+
pname = "loot-condition-interpreter";
178
178
+
version = "4.0.2";
179
179
+
180
180
+
src = fetchFromGitHub {
181
181
+
owner = "loot";
182
182
+
repo = "loot-condition-interpreter";
183
183
+
rev = "refs/tags/${version}";
184
184
+
hash = "sha256-yXbe7ByYHvFpokRpV2pz2SX0986dpk5IpehwDUhoZKg=";
185
185
+
};
186
186
+
187
187
+
cargoHash = "sha256-p+raWZkW16MrvfZhJigSPth8pZZ68twU1+0GL/Mo1Xw=";
188
188
+
189
189
+
lang = "c";
190
190
+
header = "loot_condition_interpreter.h";
191
191
+
};
192
192
+
193
193
+
yaml-cpp = yaml-cpp.overrideAttrs rec {
194
194
+
version = "0.8.0+merge-key-support.2";
195
195
+
src = fetchFromGitHub {
196
196
+
owner = "loot";
197
197
+
repo = "yaml-cpp";
198
198
+
rev = "refs/tags/${version}";
199
199
+
hash = "sha256-whYorebrLiDeO75LC2SMUX/8OD528BR0+DEgnJxxpoQ=";
200
200
+
};
201
201
+
};
202
202
+
};
203
203
+
204
204
+
meta = {
205
205
+
description = "C++ library for accessing LOOT's metadata and sorting functionality";
206
206
+
homepage = "https://github.com/loot/libloot";
207
207
+
license = lib.licenses.gpl3Only;
208
208
+
maintainers = with lib.maintainers; [ tomasajt ];
209
209
+
platforms = lib.platforms.linux;
210
210
+
};
211
211
+
})