summary refs log tree commit diff
diff options
context:
space:
mode:
authorMaximilian Bosch <maximilian@mbosch.me>2018-09-10 11:59:51 +0200
committerxeji <36407913+xeji@users.noreply.github.com>2018-09-10 11:59:51 +0200
commit6d6cbd316d5f5c12c002c86b919d1f923b0d87fe (patch)
tree4cd7982571b60696696caf9c3ca2a4dd7388b657
parent2b6144d1ad5374446e3e36d34c3b9d1905d9fc0a (diff)
downloadnixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar.gz
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar.bz2
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar.lz
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar.xz
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.tar.zst
nixlib-6d6cbd316d5f5c12c002c86b919d1f923b0d87fe.zip
pythonmagick: fix build (#46469)
The original build broke with the following linker issue:

```
  CXXLD    _PythonMagick.la
/nix/store/h0lbngpv6ln56hjj59i6l77vxq25flbz-binutils-2.30/bin/ld: cannot find -l-L/nix/store/4gh6ynzsd5ndx37hmkl62xa8z30k43y1-imagemagick-6.9.9-34/lib
collect2: error: ld returned 1 exit status
```

This happens since `BOOST_PYTHON_LIB` wasn't set properly, however
`_PythonMagick.la` was linked with `-l$(BOOST_PYTHON_LIB)
$(MAGICK_LIBS)`. With an empty `BOOST_PYTHON_LIB` the linker got
confused.

To work around this, the `boost` library directory needs to be specified
explicitly. To ensure that the changes take effect, the original
`configure` script shipped with `$src` needs to be removed and recreated
using the `autoreconfHook`.

Additionally the `imagemagick` license (https://spdx.org/licenses/ImageMagick.html)
needs to be added to `lib/licenses.nix` to document the proper license
of `pythonmagick` in the meta section.
-rw-r--r--lib/licenses.nix5
-rw-r--r--pkgs/applications/graphics/PythonMagick/default.nix16
2 files changed, 17 insertions, 4 deletions
diff --git a/lib/licenses.nix b/lib/licenses.nix
index 6f0e4217c196..c4db280645a4 100644
--- a/lib/licenses.nix
+++ b/lib/licenses.nix
@@ -355,6 +355,11 @@ lib.mapAttrs (n: v: v // { shortName = n; }) rec {
     fullName = "Independent JPEG Group License";
   };
 
+  imagemagick = spdx {
+    fullName = "ImageMagick License";
+    spdxId = "imagemagick";
+  };
+
   inria-compcert = {
     fullName  = "INRIA Non-Commercial License Agreement for the CompCert verified compiler";
     url       = "http://compcert.inria.fr/doc/LICENSE";
diff --git a/pkgs/applications/graphics/PythonMagick/default.nix b/pkgs/applications/graphics/PythonMagick/default.nix
index f0b4a991f74a..938df76e2572 100644
--- a/pkgs/applications/graphics/PythonMagick/default.nix
+++ b/pkgs/applications/graphics/PythonMagick/default.nix
@@ -1,6 +1,6 @@
 # This expression provides Python bindings to ImageMagick. Python libraries are supposed to be called via `python-packages.nix`.
 
-{stdenv, fetchurl, python, boost, pkgconfig, imagemagick}:
+{ stdenv, fetchurl, python, pkgconfig, imagemagick, autoreconfHook }:
 
 stdenv.mkDerivation rec {
   name = "pythonmagick-${version}";
@@ -11,10 +11,18 @@ stdenv.mkDerivation rec {
     sha256 = "137278mfb5079lns2mmw73x8dhpzgwha53dyl00mmhj2z25varpn";
   };
 
-  nativeBuildInputs = [ pkgconfig ];
-  buildInputs = [python boost imagemagick];
+  postPatch = ''
+    rm configure
+  '';
 
-  meta = {
+  configureFlags = [ "--with-boost=${python.pkgs.boost}" ];
+
+  nativeBuildInputs = [ pkgconfig autoreconfHook ];
+  buildInputs = [ python python.pkgs.boost imagemagick ];
+
+  meta = with stdenv.lib; {
     homepage = http://www.imagemagick.org/script/api.php;
+    license = licenses.imagemagick;
+    description = "PythonMagick provides object oriented bindings for the ImageMagick Library.";
   };
 }