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