Subject: Re: tiff shouldn't require C++
To: None <tech-pkg@NetBSD.org>
From: Johnny C. Lam <jlam@NetBSD.org>
List: tech-pkg
Date: 01/09/2005 23:12:23
--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
On Sat, Jan 08, 2005 at 08:56:39PM +0000, Johnny C. Lam wrote:
> We have far too many packages that link against libtiff but are not
> C++ applications, and it's quite a lot of work to sweep through pkgsrc
> to make sure that those applications that link against libtiff, or
> that load libtiff via a loadable shared module, are linked using the
> C++ compiler. Therefore, I want to disable the C++ support in the
> libtiff.la library and split out the C++ functions into a libtiffcxx.la
> and bump the PKGREVISION of the tiff package.
>
> Comments?
I've attached a patch to create a separate libtiffcxx.so library for
use by C++ applications. It's meant to be used directly in place of
libtiff.so, i.e. instead of linking against -ltiff, you link against
-ltiffcxx. It also leaves libtiff.so as a plain C-linkage library
again.
Please review/comment as I'd like to commit this on Tuesday.
Cheers,
-- Johnny Lam <jlam@NetBSD.org>
--SUOF0GtieIMvvwua
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="tiff.diff"
? patch
Index: Makefile
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/tiff/Makefile,v
retrieving revision 1.63
diff -u -r1.63 Makefile
--- Makefile 9 Jan 2005 23:03:58 -0000 1.63
+++ Makefile 9 Jan 2005 23:04:45 -0000
@@ -1,6 +1,7 @@
# $NetBSD: Makefile,v 1.63 2005/01/09 23:03:58 jlam Exp $
DISTNAME= tiff-3.7.1
+PKGREVISION= 1
CATEGORIES= graphics
MASTER_SITES= ftp://ftp.remotesensing.org/pub/libtiff/ \
http://libtiff.maptools.org/dl/
@@ -41,4 +42,18 @@
.include "../../devel/zlib/buildlink3.mk"
.include "../../graphics/jpeg/buildlink3.mk"
+
+# We explicitly build libtiff without C++ support by patching the
+# configure script (patch-af). We also add a new target into
+# libtiff/Makefile to create a libtiffcxx.la containing the C++
+# functions (patch-ag).
+#
+post-build:
+ cd ${WRKSRC}/libtiff && ${MAKE} libtiffcxx.la
+
+post-install:
+ cd ${WRKSRC}/libtiff && ${INSTALL_DATA} tiffio.hxx ${PREFIX}/include
+ cd ${WRKSRC}/libtiff && ${LIBTOOL} --mode=install \
+ ${INSTALL_LIB} libtiffcxx.la ${PREFIX}/lib
+
.include "../../mk/bsd.pkg.mk"
Index: PLIST
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/tiff/PLIST,v
retrieving revision 1.5
diff -u -r1.5 PLIST
--- PLIST 28 Dec 2004 23:10:10 -0000 1.5
+++ PLIST 9 Jan 2005 23:04:46 -0000
@@ -27,6 +27,7 @@
include/tiffio.hxx
include/tiffvers.h
lib/libtiff.la
+lib/libtiffcxx.la
man/man1/bmp2tiff.1
man/man1/fax2ps.1
man/man1/fax2tiff.1
Index: distinfo
===================================================================
RCS file: /cvsroot/pkgsrc/graphics/tiff/distinfo,v
retrieving revision 1.20
diff -u -r1.20 distinfo
--- distinfo 28 Dec 2004 23:10:10 -0000 1.20
+++ distinfo 9 Jan 2005 23:04:46 -0000
@@ -7,3 +7,5 @@
SHA1 (patch-ac) = 40e817380c5183cf2e1e5461c05600073dec7348
SHA1 (patch-ad) = 301e0ce2c121e9082e0ff9c5681c2ea1e0e6dcff
SHA1 (patch-ae) = bb2e2d3a5be49204356c3c504d3a4bd5ba1fd9b2
+SHA1 (patch-af) = 29adfbcaa317df36a41af791e93159ad795c5e0b
+SHA1 (patch-ag) = dc6490a688b8e26a068465965de0856d1affe2eb
Index: patches/patch-af
===================================================================
RCS file: patches/patch-af
diff -N patches/patch-af
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-af 9 Jan 2005 23:04:46 -0000
@@ -0,0 +1,12 @@
+$NetBSD$
+
+--- configure.orig 2004-12-20 14:41:54.000000000 -0500
++++ configure
+@@ -23722,6 +23722,7 @@ if test "${enable_c+++set}" = set; then
+ else
+ HAVE_CXX=yes
+ fi;
++HAVE_CXX=no
+
+ if test "$HAVE_CXX" = "yes" ; then
+
Index: patches/patch-ag
===================================================================
RCS file: patches/patch-ag
diff -N patches/patch-ag
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-ag 9 Jan 2005 23:04:46 -0000
@@ -0,0 +1,15 @@
+$NetBSD$
+
+--- libtiff/Makefile.in.orig 2004-12-20 14:41:54.000000000 -0500
++++ libtiff/Makefile.in
+@@ -409,6 +409,10 @@ clean-libLTLIBRARIES:
+ libtiff.la: $(libtiff_la_OBJECTS) $(libtiff_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libtiff_la_LDFLAGS) $(libtiff_la_OBJECTS) $(libtiff_la_LIBADD) $(LIBS)
+
++libtiffcxx_la_OBJECTS: tif_stream.lo
++libtiffcxx.la: $(libtiffcxx_la_OBJECTS) $(libtiff_la_DEPENDENCIES)
++ $(CXXLINK) -rpath $(libdir) $(libtiff_la_LDFLAGS) $(libtiffcxx_la_OBJECTS) libtiff.la $(libtiff_la_LIBADD) $(LIBS)
++
+ clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
--SUOF0GtieIMvvwua--