lol
1{
2 lib, stdenv,
3 cmake,
4 fetchFromGitHub,
5 boost,
6 xercesc,
7 icu,
8}:
9
10stdenv.mkDerivation rec {
11 pname = "libe57format";
12 version = "2.2.0";
13
14 src = fetchFromGitHub {
15 owner = "asmaloney";
16 repo = "libE57Format";
17 rev = "v${version}";
18 sha256 = "15l23spjvak5h3n7aj3ggy0c3cwcg8mvnc9jlbd9yc2ra43bx7bp";
19 };
20
21 nativeBuildInputs = [
22 cmake
23 ];
24
25 buildInputs = [
26 boost
27 icu
28 ];
29
30 propagatedBuildInputs = [
31 # Necessary for projects that try to find libE57Format via CMake
32 # due to the way that libe57format's CMake config is written.
33 xercesc
34 ];
35
36 # The build system by default builds ONLY static libraries, and with
37 # `-DE57_BUILD_SHARED=ON` builds ONLY shared libraries, see:
38 # https://github.com/asmaloney/libE57Format/issues/48
39 # https://github.com/asmaloney/libE57Format/blob/f657d470da5f0d185fe371c4c011683f6e30f0cb/CMakeLists.txt#L82-L89
40 # We support building both by building statically and then
41 # building an .so file here manually.
42 # The way this is written makes this Linux-only for now.
43 postInstall = ''
44 cd $out/lib
45 g++ -Wl,--no-undefined -shared -o libE57FormatShared.so -L. -Wl,-whole-archive -lE57Format -Wl,-no-whole-archive -lxerces-c
46 mv libE57FormatShared.so libE57Format.so
47
48 if [ "$dontDisableStatic" -ne "1" ]; then
49 rm libE57Format.a
50 fi
51 '';
52
53 meta = with lib; {
54 description = "Library for reading & writing the E57 file format";
55 homepage = "https://github.com/asmaloney/libE57Format";
56 license = licenses.boost;
57 maintainers = with maintainers; [ chpatrick nh2 ];
58 platforms = platforms.linux; # because of the .so buiding in `postInstall` above
59 };
60}