10 stdenv.mkDerivation (finalAttrs: {
11 pname = "libe57format";
14 src = fetchFromGitHub {
16 repo = "libE57Format";
17 rev = "v${finalAttrs.version}";
18 hash = "sha256-bOuWh9Nkxva2v0M6+vnAya8EW/G3WQePxHakQt8T9NE=";
19 fetchSubmodules = true; # for submodule-vendored libraries such as `gtest`
22 # Repository of E57 files used for testing.
23 libE57Format-test-data_src = fetchFromGitHub {
25 repo = "libE57Format-test-data";
26 rev = "4960564a732c6444c50dfae5b2273e68837399cd";
27 hash = "sha256-k26yVbYSQJ3EMgcpjm35N1OAxarFmfMvzfTN2Hdyu8c=";
31 # GCC 13: error: 'int16_t' has not been declared in 'std'
36 # TODO: Remove with the next release: https://github.com/asmaloney/libE57Format/pull/299
38 name = "libE57Format-Dont-force-warnings-as-errors-when-building-self.patch"; # https://github.com/apache/thrift/pull/2726
39 url = "https://github.com/asmaloney/libE57Format/commit/66bb5af15937b4c10a7f412ca4d1673f42bbad28.patch";
40 hash = "sha256-2cNURjMLP0TijYY5gbuWLE7H/PlMW936wAeOqJ/w9C0=";
54 # See https://github.com/asmaloney/libE57Format/blob/9372bdea8db2cc0c032a08f6d655a53833d484b8/test/README.md
56 if finalAttrs.finalPackage.doCheck then
57 "-DE57_TEST_DATA_PATH=${finalAttrs.libE57Format-test-data_src}"
59 "-DE57_BUILD_TEST=OFF"
69 # The build system by default builds ONLY static libraries, and with
70 # `-DE57_BUILD_SHARED=ON` builds ONLY shared libraries, see:
71 # https://github.com/asmaloney/libE57Format/issues/48
72 # https://github.com/asmaloney/libE57Format/blob/f657d470da5f0d185fe371c4c011683f6e30f0cb/CMakeLists.txt#L82-L89
73 # We support building both by building statically and then
74 # building an .so file here manually.
75 # The way this is written makes this Linux-only for now.
78 g++ -Wl,--no-undefined -shared -o libE57FormatShared.so -L. -Wl,-whole-archive -lE57Format -Wl,-no-whole-archive -lxerces-c
79 mv libE57FormatShared.so libE57Format.so
81 if [ "$dontDisableStatic" -ne "1" ]; then
87 description = "Library for reading & writing the E57 file format";
88 homepage = "https://github.com/asmaloney/libE57Format";
89 license = licenses.boost;
90 maintainers = with maintainers; [
94 platforms = platforms.linux; # because of the .so buiding in `postInstall` above