tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: graphics/ImageMagick: make dependencies optional



On Sat, Oct 20, 2018 at 05:01:53PM +0000, nia wrote:
> hi,
> 
> I wanted to disable tiff and ghostscript support in ImageMagick so I
> wouldn't need those libraries on my server, so I made them and the
> other ImageMagick dependencies optional.
> 
> The resulting binaries seem to work and don't depend on dynamic libraries
> from any disabled dependencies. It seems to work with ghostscript
> uninstalled, despite the comment hinting otherwise. Actually, building
> with _all_ of these dependencies disabled still seems to work, and
> `readelf -d` produces expected results.
> 
> It was my intention to bmake the default option set identical to the
> implied set of the original, so things wouldn't break.
> 
> nia
> 

Thanks leot for pointing out that this patch is blatantly Not Right.
This is what I meant to send:

Index: buildlink3.mk
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/ImageMagick/buildlink3.mk,v
retrieving revision 1.66
diff -u -r1.66 buildlink3.mk
--- buildlink3.mk	17 Apr 2018 22:29:32 -0000	1.66
+++ buildlink3.mk	20 Oct 2018 17:08:13 -0000
@@ -29,19 +29,42 @@
 .include "../../x11/libXext/buildlink3.mk"
 .include "../../x11/libXt/buildlink3.mk"
 .endif
-
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mbzip2)
 .include "../../archivers/bzip2/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mlzma)
 .include "../../archivers/xz/buildlink3.mk"
-.include "../../devel/libltdl/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mfontconfig)
 .include "../../fonts/fontconfig/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mfreetype)
 .include "../../graphics/freetype2/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mlcms)
 .include "../../graphics/lcms2/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mwebp)
 .include "../../graphics/libwebp/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mpng)
 .include "../../graphics/png/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mtiff)
 .include "../../graphics/tiff/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mfftw)
 .include "../../math/fftw/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mghostscript)
 .include "../../print/ghostscript/buildlink3.mk"
+.endif
+.if !empty(PKG_BUILD_OPTIONS.ImageMagick:Mxml)
 .include "../../textproc/libxml2/buildlink3.mk"
+.endif
+
+.include "../../devel/libltdl/buildlink3.mk"
+
 .endif # IMAGEMAGICK_BUILDLINK3_MK
 
 BUILDLINK_TREE+=	-ImageMagick
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/ImageMagick/Makefile,v
retrieving revision 1.248
diff -u -r1.248 Makefile
--- Makefile	3 Sep 2018 10:37:10 -0000	1.248
+++ Makefile	20 Oct 2018 17:08:13 -0000
@@ -12,15 +12,10 @@
 USE_LANGUAGES=		c c++ c99
 USE_TOOLS+=		gmake pkg-config:run
 CONFIGURE_ARGS+=	--disable-assert
-CONFIGURE_ARGS+=	--with-fontconfig
 CONFIGURE_ARGS+=	--with-ltdl-include=${BUILDLINK_PREFIX.libltdl}/include
 CONFIGURE_ARGS+=	--with-ltdl-lib=${BUILDLINK_PREFIX.libltdl}/lib
-CONFIGURE_ARGS+=	--with-xml=yes
 CONFIGURE_ARGS+=	--without-perl
 CONFIGURE_ARGS+=	--sysconfdir=${PKG_SYSCONFBASEDIR}
-# This one used to be optional, but it depends on ghostscript even if it's
-# disabled so having a way to disable it seems pointless.
-CONFIGURE_ARGS+=	--with-gslib
 # http://www.imagemagick.org/discourse-server/viewtopic.php?f=2&t=25475
 CONFIGURE_ARGS.NetBSD+=	--disable-openmp
 PKGCONFIG_OVERRIDE+=	MagickWand/MagickWand.pc.in
@@ -84,16 +79,5 @@
 SUBST_FILES.fix-pc+=	MagickWand/MagickWand-config.in
 SUBST_SED.fix-pc=	-e 's,@PKG_CONFIG@,pkg-config,g'
 
-.include "../../archivers/bzip2/buildlink3.mk"
-.include "../../archivers/xz/buildlink3.mk"
 .include "../../devel/libltdl/buildlink3.mk"
-.include "../../fonts/fontconfig/buildlink3.mk"
-.include "../../graphics/freetype2/buildlink3.mk"
-.include "../../graphics/lcms2/buildlink3.mk"
-.include "../../graphics/libwebp/buildlink3.mk"
-.include "../../graphics/png/buildlink3.mk"
-.include "../../graphics/tiff/buildlink3.mk"
-.include "../../math/fftw/buildlink3.mk"
-.include "../../print/ghostscript/buildlink3.mk"
-.include "../../textproc/libxml2/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"
Index: options.mk
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/ImageMagick/options.mk,v
retrieving revision 1.18
diff -u -r1.18 options.mk
--- options.mk	30 Oct 2017 14:44:05 -0000	1.18
+++ options.mk	20 Oct 2018 17:08:13 -0000
@@ -1,8 +1,14 @@
 # $NetBSD: options.mk,v 1.18 2017/10/30 14:44:05 fhajny Exp $
 
 PKG_OPTIONS_VAR=	PKG_OPTIONS.ImageMagick
-PKG_SUPPORTED_OPTIONS=	x11 jp2 djvu openexr wmf
-PKG_SUGGESTED_OPTIONS=	x11 jp2
+
+PKG_SUPPORTED_OPTIONS+=	bzip2 fftw fontconfig freetype ghostscript jpeg png
+PKG_SUPPORTED_OPTIONS+=	tiff lcms lzma webp xml x11 jp2
+PKG_SUPPORTED_OPTIONS+=	djvu openexr wmf
+
+PKG_SUGGESTED_OPTIONS+=	bzip2 fftw fontconfig freetype ghostscript jpeg png
+PKG_SUGGESTED_OPTIONS+=	tiff lcms lzma webp xml x11 jp2
+
 PKG_OPTIONS_LEGACY_OPTS+=	jasper:jp2
 
 .include "../../mk/bsd.options.mk"
@@ -22,6 +28,13 @@
 CONFIGURE_ARGS+=	--without-openjp2
 .endif
 
+.if !empty(PKG_OPTIONS:Mbzip2)
+.include "../../archivers/bzip2/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-bzlib
+.else
+CONFIGURE_ARGS+=	--without-bzlib
+.endif
+
 .if !empty(PKG_OPTIONS:Mdjvu)
 .include "../../graphics/djvulibre-lib/buildlink3.mk"
 CONFIGURE_ARGS+=	--with-djvu
@@ -29,6 +42,55 @@
 CONFIGURE_ARGS+=	--without-djvu
 .endif
 
+.if !empty(PKG_OPTIONS:Mfftw)
+.include "../../math/fftw/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-fftw
+.else
+CONFIGURE_ARGS+=	--without-fftw
+.endif
+
+.if !empty(PKG_OPTIONS:Mfontconfig)
+.include "../../fonts/fontconfig/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-fontconfig
+.else
+CONFIGURE_ARGS+=	--without-fontconfig
+.endif
+
+.if !empty(PKG_OPTIONS:Mfreetype)
+.include "../../graphics/freetype2/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-freetype
+.else
+CONFIGURE_ARGS+=	--without-freetype
+.endif
+
+.if !empty(PKG_OPTIONS:Mghostscript)
+.include "../../print/ghostscript/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-gslib
+.else
+CONFIGURE_ARGS+=	--without-gslib
+.endif
+
+.if !empty(PKG_OPTIONS:Mjpeg)
+.include "../../mk/jpeg.buildlink3.mk"
+CONFIGURE_ARGS+=	--with-jpeg
+.else
+CONFIGURE_ARGS+=	--without-jpeg
+.endif
+
+.if !empty(PKG_OPTIONS:Mlcms)
+.include "../../graphics/lcms2/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-lcms2
+.else
+CONFIGURE_ARGS+=	--without-lcms2
+.endif
+
+.if !empty(PKG_OPTIONS:Mlzma)
+.include "../../archivers/xz/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-lzma
+.else
+CONFIGURE_ARGS+=	--without-lzma
+.endif
+
 .if !empty(PKG_OPTIONS:Mopenexr)
 .include "../../graphics/openexr/buildlink3.mk"
 CONFIGURE_ARGS+=	--with-openexr
@@ -36,9 +98,37 @@
 CONFIGURE_ARGS+=	--without-openexr
 .endif
 
+.if !empty(PKG_OPTIONS:Mpng)
+.include "../../graphics/png/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-png
+.else
+CONFIGURE_ARGS+=	--without-png
+.endif
+
+.if !empty(PKG_OPTIONS:Mtiff)
+.include "../../graphics/tiff/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-tiff
+.else
+CONFIGURE_ARGS+=	--without-tiff
+.endif
+
+.if !empty(PKG_OPTIONS:Mwebp)
+.include "../../graphics/libwebp/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-webp
+.else
+CONFIGURE_ARGS+=	--without-webp
+.endif
+
 .if !empty(PKG_OPTIONS:Mwmf)
 .include "../../graphics/libwmf/buildlink3.mk"
 CONFIGURE_ARGS+=	--with-wmf
 .else
 CONFIGURE_ARGS+=	--without-wmf
 .endif
+
+.if !empty(PKG_OPTIONS:Mxml)
+.include "../../textproc/libxml2/buildlink3.mk"
+CONFIGURE_ARGS+=	--with-libxml2
+.else
+CONFIGURE_ARGS+=	--without-libxml2
+.endif



Home | Main Index | Thread Index | Old Index