diff -Nru ruby-rmagick-2.15.4+dfsg/debian/changelog ruby-rmagick-2.15.4+dfsg/debian/changelog
--- ruby-rmagick-2.15.4+dfsg/debian/changelog 2016-11-29 17:00:20.000000000 -0800
+++ ruby-rmagick-2.15.4+dfsg/debian/changelog 2016-12-01 15:36:05.000000000 -0800
@@ -1,3 +1,11 @@
+ruby-rmagick (2.15.4+dfsg-2ubuntu1) zesty; urgency=medium
+
+ * d/{control,rules}: use a new substitution variable to specify the
+ hard-dependency on the version of ImageMagick built against
+ (Closes: #591419).
+
+ -- Nishanth Aravamudan <nish.aravamudan@canonical.com> Thu, 01 Dec 2016 15:36:05 -0800
+
ruby-rmagick (2.15.4+dfsg-2build1) zesty; urgency=medium
* No change rebuild against src:imagemagick 1:6.9.6.6+dfsg-1.
diff -Nru ruby-rmagick-2.15.4+dfsg/debian/control ruby-rmagick-2.15.4+dfsg/debian/control
--- ruby-rmagick-2.15.4+dfsg/debian/control 2016-08-16 07:29:37.000000000 -0700
+++ ruby-rmagick-2.15.4+dfsg/debian/control 2016-12-01 15:36:05.000000000 -0800
@@ -28,7 +28,8 @@
XB-Ruby-Versions: ${ruby:Versions}
Depends: ruby | ruby-interpreter,
${misc:Depends},
- ${shlibs:Depends}
+ ${shlibs:Depends},
+ ${imagemagick:Depends}
Description: ImageMagick API for Ruby
RMagick is an interface between the Ruby programming language and the
ImageMagick image processing library.
diff -Nru ruby-rmagick-2.15.4+dfsg/debian/rules ruby-rmagick-2.15.4+dfsg/debian/rules
--- ruby-rmagick-2.15.4+dfsg/debian/rules 2016-08-16 07:29:37.000000000 -0700
+++ ruby-rmagick-2.15.4+dfsg/debian/rules 2016-12-01 15:36:05.000000000 -0800
@@ -12,3 +12,11 @@
find debian/*/usr/share/doc/ruby-rmagick-doc/ \
-type f -executable -exec \
chmod -x '{}' ';'
+
+override_dh_gencontrol:
+ $(eval IMAGEMAGICK_DEP := \
+ $(shell find debian/ruby-rmagick/ -name RMagick2.so -exec ldd '{}' ';' | \
+ awk '/\/libMagickCore/ {print $$3}' | xargs dpkg -S | \
+ awk '{print $$1}' | sed 's/:$$//' | xargs dpkg-query -W \
+ -f='$${Package} (>= $${Version})'))
+ dh_gencontrol -- -Vimagemagick:Depends='$(IMAGEMAGICK_DEP)'