From f924c8b9cea92ac5e7eca7035b3d614afbdd9d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niklas=20Hamb=C3=BCchen?= Date: Thu, 25 Jun 2020 21:54:21 +0200 Subject: [PATCH] libe57format: init at 2.1 Originally contributed by @chpatrick. --- .../libraries/libe57format/default.nix | 55 +++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 + 2 files changed, 57 insertions(+) create mode 100644 pkgs/development/libraries/libe57format/default.nix diff --git a/pkgs/development/libraries/libe57format/default.nix b/pkgs/development/libraries/libe57format/default.nix new file mode 100644 index 00000000000..6bb48c9530c --- /dev/null +++ b/pkgs/development/libraries/libe57format/default.nix @@ -0,0 +1,55 @@ +{ + stdenv, + cmake, + fetchFromGitHub, + boost, + xercesc, + icu, +}: + +stdenv.mkDerivation rec { + pname = "libe57format"; + version = "2.1"; + + src = fetchFromGitHub { + owner = "asmaloney"; + repo = "libE57Format"; + rev = "v${version}"; + sha256 = "05z955q68wjbd9gc5fw32nqg69xc82n2x75j5vchxzkgnn3adcpi"; + }; + + nativeBuildInputs = [ + cmake + ]; + + buildInputs = [ + boost + icu + xercesc + ]; + + # The build system by default builds ONLY static libraries, and with + # `-DE57_BUILD_SHARED=ON` builds ONLY shared libraries, see: + # https://github.com/asmaloney/libE57Format/issues/48 + # https://github.com/asmaloney/libE57Format/blob/f657d470da5f0d185fe371c4c011683f6e30f0cb/CMakeLists.txt#L82-L89 + # We support building both by building statically and then + # building an .so file here manually. + # The way this is written makes this Linux-only for now. + postInstall = '' + cd $out/lib + g++ -Wl,--no-undefined -shared -o libE57FormatShared.so -L. -Wl,-whole-archive -lE57Format -Wl,-no-whole-archive -lxerces-c + mv libE57FormatShared.so libE57Format.so + + if [ "$dontDisableStatic" -ne "1" ]; then + rm libE57Format.a + fi + ''; + + meta = with stdenv.lib; { + description = "Library for reading & writing the E57 file format (fork of E57RefImpl)"; + homepage = "https://github.com/asmaloney/libE57Format"; + license = licenses.boost; + maintainers = with maintainers; [ chpatrick nh2 ]; + platforms = platforms.linux; # because of the .so buiding in `postInstall` above + }; +} diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d2f70dbf8af..a804a93e10a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -12898,6 +12898,8 @@ in inherit (callPackage ../development/libraries/libdwarf { }) libdwarf dwarfdump; + libe57format = callPackage ../development/libraries/libe57format { }; + libeatmydata = callPackage ../development/libraries/libeatmydata { }; libeb = callPackage ../development/libraries/libeb { };