Bug 178450 - graphics/freeimage: packaging freeimageplus
Summary: graphics/freeimage: packaging freeimageplus
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: Pietro Cerutti
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-05-09 13:30 UTC by Thierry Thomas
Modified: 2013-05-10 04:51 UTC (History)
1 user (show)

See Also:


Attachments
file.shar (767 bytes, text/plain)
2013-05-09 13:30 UTC, Thierry Thomas
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Thierry Thomas freebsd_committer freebsd_triage 2013-05-09 13:30:00 UTC
	The new release of cad/opencascade could use FreeImage, but the
	C++ wrapper (freeimageplus) is required.

	This wrapper is included in the same tarball, so I think that a
	slave port is the best solution.

	The attached patch freeimage.diff transforms the original
	Makefile into a master port, and freeimageplus.shar produces the
	slave port.

Fix: Please apply the following patch and execute the shar file.



--- freeimageplus.shar ends here -----MlsVnWH0BpESmYrhUKrS3WVOIQbMpwoujpAzuoBbP16rmg5P
Content-Type: text/plain; name="freeimage.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="freeimage.diff"

diff -urN graphics/freeimage.orig/Makefile graphics/freeimage/Makefile
--- graphics/freeimage.orig/Makefile	2013-03-01 17:56:51.000000000 +0100
+++ graphics/freeimage/Makefile	2013-05-09 12:53:38.000000000 +0200
@@ -5,24 +5,40 @@
 PORTVERSION=	3.15.4
 CATEGORIES=	graphics
 MASTER_SITES=	SF/${PORTNAME}/Source%20Distribution/${PORTVERSION}
+.if defined(FIP)
+PKGNAMESUFFIX=plus
+.endif
 DISTNAME=	FreeImage${PORTVERSION:S/.//g}
 
 MAINTAINER=	gahr@FreeBSD.org
-COMMENT=	An open source graphics library
+COMMENT?=	An open source graphics library
 
 USE_ZIP=	yes
-USE_DOS2UNIX=	Source/LibOpenJPEG/opj_malloc.h
+USE_DOS2UNIX=	Source/LibOpenJPEG/opj_malloc.h Makefile.fip
 USE_GMAKE=	yes
 USE_LDCONFIG=	yes
 WRKSRC=		${WRKDIR}/FreeImage
 
-CFLAGS+= -fexceptions -fvisibility=hidden
+CFLAGS+=	-fexceptions -fvisibility=hidden
+
+SLAVEDIRS=	graphics/freeimageplus
 
+.if defined(FIP)
+LIB_DEPENDS+=	freeimage:${PORTSDIR}/graphics/freeimage
+MAKEFILE=	Makefile.fip
+MAKE_ENV=	DESTDIR=${DESTDIR} INCDIR=${PREFIX}/include INSTALLDIR=${PREFIX}/lib
+PLIST_FILES=	include/FreeImagePlus.h	\
+		lib/libfreeimageplus.a \
+		lib/libfreeimageplus-${PORTVERSION}.so \
+		lib/libfreeimageplus.so.3 \
+		lib/libfreeimageplus.so
+.else
 PLIST_FILES=	include/FreeImage.h \
 		lib/libfreeimage.a \
 		lib/libfreeimage-${PORTVERSION}.so \
 		lib/libfreeimage.so.3 \
 		lib/libfreeimage.so
+.endif
 
 .include <bsd.port.pre.mk>
 
@@ -32,6 +48,6 @@
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr|${PREFIX}| ; s|-g root|-g wheel|' \
-		${WRKSRC}/Makefile.gnu
+		${WRKSRC}/Makefile.gnu ${WRKSRC}/Makefile.fip
 
 .include <bsd.port.post.mk>
diff -urN graphics/freeimage.orig/files/patch-Makefile.fip graphics/freeimage/files/patch-Makefile.fip
--- graphics/freeimage.orig/files/patch-Makefile.fip	1970-01-01 01:00:00.000000000 +0100
+++ graphics/freeimage/files/patch-Makefile.fip	2013-05-09 12:55:08.000000000 +0200
@@ -0,0 +1,30 @@
+--- Makefile.fip.orig	2010-12-09 15:12:12.000000000 +0100
++++ Makefile.fip	2013-05-09 11:44:43.000000000 +0200
+@@ -5,8 +5,8 @@
+ 
+ # General configuration variables:
+ DESTDIR ?= /
+-INCDIR ?= $(DESTDIR)/usr/include
+-INSTALLDIR ?= $(DESTDIR)/usr/lib
++INCDIR ?= $(DESTDIR)/usr/local/include
++INSTALLDIR ?= $(DESTDIR)/usr/local/lib
+ 
+ # Converts cr/lf to just lf
+ DOS2UNIX = dos2unix
+@@ -63,10 +63,12 @@
+ 
+ install:
+ 	install -d $(INCDIR) $(INSTALLDIR)
+-	install -m 644 -o root -g root $(HEADER) $(INCDIR)
+-	install -m 644 -o root -g root $(HEADERFIP) $(INCDIR)
+-	install -m 644 -o root -g root $(STATICLIB) $(INSTALLDIR)
+-	install -m 755 -o root -g root $(SHAREDLIB) $(INSTALLDIR)
++	#install -m 644 -o root -g wheel $(HEADER) $(INCDIR)
++	install -m 644 -o root -g wheel $(HEADERFIP) $(INCDIR)
++	install -m 644 -o root -g wheel $(STATICLIB) $(INSTALLDIR)
++	install -m 755 -o root -g wheel $(SHAREDLIB) $(INSTALLDIR)
++	ln -sf $(SHAREDLIB) $(INSTALLDIR)/$(VERLIBNAME)
++	ln -sf $(VERLIBNAME) $(INSTALLDIR)/$(LIBNAME)
+ 
+ clean:
+ 	rm -f core Dist/*.* u2dtmp* $(MODULES) $(STATICLIB) $(SHAREDLIB) $(LIBNAME)
How-To-Repeat: 	N/A.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-05-09 13:30:15 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gahr

Over to maintainer (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=178450 
Date: Thu, 9 May 2013 16:26:00 +0200
Comment 2 Thierry Thomas freebsd_committer freebsd_triage 2013-05-09 15:48:04 UTC
On thu 9 may 13 at 16:26:00 +0200, Pietro Cerutti <gahr@FreeBSD.org>
 wrote:

> Thanks for this Thierry. I'm fine with it as a solution, but did you
> also consider just adding the c++ wrapper to the original port, so that
> both the C and the C++ interfaces are installed? It's just matter of an
> extra header file and an extra library (plus symlinks), no big deal for
> users.


Yes, could be so. But since upstream considers it as an optional
wrapper, I just did so myself.

Best regards,
-- 
Th. Thomas.
Comment 3 Thierry Thomas freebsd_committer freebsd_triage 2013-05-09 16:31:37 UTC
on thu 9 may 13 at 17:14:39 +0200, Pietro Cerutti <gahr@FreeBSD.org>
 wrote:

> I see your point, but I still consider it an overkill to handle it as
> master/slave ports. The small patch attached is in my opinion a simpler
> solution. If you have no strong arguments against it, I'm going to
> commit it later today or tomorrow.


OK, this is also fine for me. Please go!
-- 
Th. Thomas.
Comment 4 dfilter service freebsd_committer freebsd_triage 2013-05-09 17:46:41 UTC
Author: gahr
Date: Thu May  9 16:46:32 2013
New Revision: 317740
URL: http://svnweb.freebsd.org/changeset/ports/317740

Log:
  - Install the C++ wrapper FreeImagePlus as well
  - Fix COMMENT and pkg-descr
  - Bump PORTREVISION
  
  PR:		178450
  Submitted by:	thierry

Modified:
  head/graphics/freeimage/Makefile
  head/graphics/freeimage/pkg-descr   (contents, props changed)

Modified: head/graphics/freeimage/Makefile
==============================================================================
--- head/graphics/freeimage/Makefile	Thu May  9 16:45:46 2013	(r317739)
+++ head/graphics/freeimage/Makefile	Thu May  9 16:46:32 2013	(r317740)
@@ -3,12 +3,13 @@
 
 PORTNAME=	freeimage
 PORTVERSION=	3.15.4
+PORTREVISION=	1
 CATEGORIES=	graphics
 MASTER_SITES=	SF/${PORTNAME}/Source%20Distribution/${PORTVERSION}
 DISTNAME=	FreeImage${PORTVERSION:S/.//g}
 
 MAINTAINER=	gahr@FreeBSD.org
-COMMENT=	An open source graphics library
+COMMENT=	Simple C/C++ bitmap graphics library
 
 USE_ZIP=	yes
 USE_DOS2UNIX=	Source/LibOpenJPEG/opj_malloc.h
@@ -16,13 +17,18 @@ USE_GMAKE=	yes
 USE_LDCONFIG=	yes
 WRKSRC=		${WRKDIR}/FreeImage
 
-CFLAGS+= -fexceptions -fvisibility=hidden
+CFLAGS+=	-fexceptions -fvisibility=hidden
 
 PLIST_FILES=	include/FreeImage.h \
+		include/FreeImagePlus.h \
 		lib/libfreeimage.a \
 		lib/libfreeimage-${PORTVERSION}.so \
 		lib/libfreeimage.so.3 \
-		lib/libfreeimage.so
+		lib/libfreeimage.so \
+		lib/libfreeimageplus.a \
+		lib/libfreeimageplus-${PORTVERSION}.so \
+		lib/libfreeimageplus.so.3 \
+		lib/libfreeimageplus.so
 
 .include <bsd.port.pre.mk>
 
@@ -32,6 +38,14 @@ CFLAGS+=	-fPIC
 
 post-patch:
 	@${REINPLACE_CMD} -e 's|/usr|${PREFIX}| ; s|-g root|-g wheel|' \
-		${WRKSRC}/Makefile.gnu
+		${WRKSRC}/Makefile.gnu ${WRKSRC}/Makefile.fip
+
+post-build:
+	cd ${WRKSRC} && ${GMAKE} -f Makefile.fip
+
+post-install:
+	cd ${WRKSRC} && ${GMAKE} -f Makefile.fip ${INSTALL_TARGET}
+	${LN} -s libfreeimageplus-${PORTVERSION} ${PREFIX}/lib/libfreeimageplus.so.3
+	${LN} -s libfreeimageplus-${PORTVERSION} ${PREFIX}/lib/libfreeimageplus.so
 
 .include <bsd.port.post.mk>

Modified: head/graphics/freeimage/pkg-descr
==============================================================================
--- head/graphics/freeimage/pkg-descr	Thu May  9 16:45:46 2013	(r317739)
+++ head/graphics/freeimage/pkg-descr	Thu May  9 16:46:32 2013	(r317740)
@@ -1,6 +1,7 @@
 FreeImage is an open source library project for developers who would like to
 support popular graphics image formats like PNG, BMP, JPEG, TIFF, and others
 as needed by today's multimedia applications.  FreeImage is easy to use,
-fast, multithreading safe, and cross-platform.
+fast, multithreading safe, and cross-platform. This port includes both the
+original C interface and the C++ wrapper FreeImagePlus.
 
 WWW: http://freeimage.sourceforge.net/
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 5 Pietro Cerutti freebsd_committer freebsd_triage 2013-05-09 17:47:14 UTC
State Changed
From-To: open->closed

Committed, with modification as discussed.