Bug 182205 - [PATCH] graphics/osg: Fixes build of dependant ports with Clang
Summary: [PATCH] graphics/osg: Fixes build of dependant ports with Clang
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: Dmitry Marakasov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-18 15:10 UTC by Rusmir Dusko
Modified: 2013-09-26 18:20 UTC (History)
1 user (show)

See Also:


Attachments
osg-3.0.1_6.patch (8.68 KB, patch)
2013-09-18 15:10 UTC, Rusmir Dusko
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rusmir Dusko freebsd_committer freebsd_triage 2013-09-18 15:10:00 UTC
- Bump portrevision
- Use the new format for LIB_DEPENDS
- Remove useless USE_GCC=any
- Add FFMPEG to default Options
- Remove unneeded Comment and Option, change pkg-plist
- Add OPTIONS_SUB
- Add patches, fix build with Clang

Port maintainer (amdmi3@FreeBSD.org) is cc'd.

Generated and tested manually, tested with port test and with RedPorts, sent with FreeBSD Port Tools 0.99_8 (mode: change, diff: ports)

How-To-Repeat: 
Build log

https://redports.org/buildarchive/20130918115300-57150/

All Ports which use graphics/osg can't be builded with Clang

pkg info | grep osg
osg-3.0.1_5                    C++ OpenGL scene graph library for real-time rendering

/usr/local/include/OpenThreads/Atomic:244:48: error: cannot initialize a parameter of type 'void *' with an lvalue of type 'const void *const'
    return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);
                                               ^~~~~~
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-09-18 15:10:08 UTC
Responsible Changed
From-To: freebsd-ports-bugs->amdmi3

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Dmitry Marakasov freebsd_committer freebsd_triage 2013-09-26 18:19:36 UTC
State Changed
From-To: open->closed

Committed, with minor changes. Thanks!
Comment 3 dfilter service freebsd_committer freebsd_triage 2013-09-26 18:19:42 UTC
Author: amdmi3
Date: Thu Sep 26 17:19:33 2013
New Revision: 328395
URL: http://svnweb.freebsd.org/changeset/ports/328395

Log:
  - Fix build with clang
  - Support staging
  - Convert to new LIB_DEPENDS syntax and OPTIONS features
  
  PR:		182205
  Submitted by:	nemysis <nemysis@FreeBSD.org>

Added:
  head/graphics/osg/files/patch-include-OpenThreads-Atomic   (contents, props changed)
  head/graphics/osg/files/patch-include-osg-Math   (contents, props changed)
  head/graphics/osg/files/patch-src-OpenThreads-common-Atomic.cpp   (contents, props changed)
Modified:
  head/graphics/osg/Makefile
  head/graphics/osg/pkg-plist

Modified: head/graphics/osg/Makefile
==============================================================================
--- head/graphics/osg/Makefile	Thu Sep 26 17:17:30 2013	(r328394)
+++ head/graphics/osg/Makefile	Thu Sep 26 17:19:33 2013	(r328395)
@@ -3,7 +3,7 @@
 
 PORTNAME=	osg
 PORTVERSION=	3.0.1
-PORTREVISION=	5
+PORTREVISION=	6
 CATEGORIES=	graphics
 MASTER_SITES=	http://www.openscenegraph.org/downloads/stable_releases/OpenSceneGraph-${PORTVERSION}/source/ \
 		http://mirror.amdmi3.ru/distfiles/
@@ -12,19 +12,17 @@ DISTNAME=	OpenSceneGraph-${PORTVERSION}
 MAINTAINER=	amdmi3@FreeBSD.org
 COMMENT=	C++ OpenGL scene graph library for real-time rendering
 
-LIB_DEPENDS=	jpeg:${PORTSDIR}/graphics/jpeg \
-		png15:${PORTSDIR}/graphics/png \
-		tiff:${PORTSDIR}/graphics/tiff
+LIB_DEPENDS=	libjpeg.so:${PORTSDIR}/graphics/jpeg \
+		libpng.so:${PORTSDIR}/graphics/png \
+		libtiff.so:${PORTSDIR}/graphics/tiff
 
 CONFLICTS=	osg-devel-[0-9]*
 
-USE_GCC=	any
 USE_ZIP=	yes
 USES=		cmake pkgconfig
 USE_GL=		gl glu
 USE_XORG=	x11
 USE_LDCONFIG=	yes
-USE_GCC=	4.2+
 
 PLIST_SUB=	OSG_VERSION=${PORTVERSION} \
 		OSG_SHLIBVER=80 \
@@ -35,18 +33,33 @@ PORTSCOUT=	limitw:1,even
 
 OPTIONS_DEFINE=	CURL FREETYPE GDAL GIF INVENTOR JASPER XINE ITK \
 		VNC OPENEXR FFMPEG SVG PDF XRANDR SDL
+OPTIONS_DEFAULT=FREETYPE GIF FFMPEG XRANDR
+
 GDAL_DESC=	GDAL support
 INVENTOR_DESC=	SGI OpenInventor support
 ITK_DESC=	InsightToolkit support
 VNC_DESC=	LibVNCServer support
 SDL_DESC=	Use SDL (joystick support in present3d)
 
-OPTIONS_DEFAULT=	FREETYPE GIF XRANDR
+OPTIONS_SUB=	yes
 
-# broken (openvrml from ports is too old)
-#		OPENVRML "Support for OpenVRML"             off
+CURL_LIB_DEPENDS=	libcurl.so:${PORTSDIR}/ftp/curl
+FREETYPE_LIB_DEPENDS=	libfreetype.so:${PORTSDIR}/print/freetype2
+GDAL_LIB_DEPENDS=	libgdal.so:${PORTSDIR}/graphics/gdal
+GIF_LIB_DEPENDS=	libgif.so:${PORTSDIR}/graphics/giflib
+INVENTOR_LIB_DEPENDS=	libInventor.so:${PORTSDIR}/graphics/inventor
+JASPER_LIB_DEPENDS=	libjasper.so:${PORTSDIR}/graphics/jasper
+XINE_LIB_DEPENDS=	libxine.so:${PORTSDIR}/multimedia/libxine
+ITK_BUILD_DEPENDS=	${LOCALBASE}/lib/InsightToolkit/UseITK.cmake:${PORTSDIR}/science/InsightToolkit
+ITK_RUN_DEPENDS=	${LOCALBASE}/lib/InsightToolkit/UseITK.cmake:${PORTSDIR}/science/InsightToolkit
+VNC_LIB_DEPENDS=	libvncserver.so:${PORTSDIR}/net/libvncserver
+OPENEXR_LIB_DEPENDS=	libIlmImf.so:${PORTSDIR}/graphics/OpenEXR
+FFMPEG_LIB_DEPENDS=	libavcodec.so:${PORTSDIR}/multimedia/ffmpeg
+SVG_LIB_DEPENDS=	librsvg-2.so:${PORTSDIR}/graphics/librsvg2
+PDF_LIB_DEPENDS=	libpoppler-glib.so:${PORTSDIR}/graphics/poppler-glib
+XRANDR_CMAKE_ON=	-DOSGVIEWER_USE_XRANDR:BOOL=ON
+XRANDR_CMAKE_OFF=	-DOSGVIEWER_USE_XRANDR:BOOL=OFF
 
-NO_STAGE=	yes
 .include <bsd.port.options.mk>
 
 # GUI toolkits are only needed for building examples, which are not even installed
@@ -57,113 +70,72 @@ FORCE_REQUIRE=	Threads OpenGL X11 JPEG P
 # options that affect FIND_PACKAGE
 .if ${PORT_OPTIONS:MCURL}
 FORCE_REQUIRE+=	CURL
-LIB_DEPENDS+=	curl:${PORTSDIR}/ftp/curl
-PLIST_SUB+=	CURL=""
 .else
 FORCE_IGNORE+=	CURL
-PLIST_SUB+=	CURL="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MFREETYPE}
 FORCE_REQUIRE+=	FreeType
-LIB_DEPENDS+=	freetype:${PORTSDIR}/print/freetype2
-PLIST_SUB+=	FREETYPE=""
 .else
 FORCE_IGNORE+=	FreeType
-PLIST_SUB+=	FREETYPE="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MGDAL}
 FORCE_REQUIRE+=	GDAL
-LIB_DEPENDS+=	gdal:${PORTSDIR}/graphics/gdal
-PLIST_SUB+=	GDAL=""
 .else
 FORCE_IGNORE+=	GDAL
-PLIST_SUB+=	GDAL="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MGIF}
 FORCE_REQUIRE+=	GIFLIB
-LIB_DEPENDS+=	gif:${PORTSDIR}/graphics/giflib
-PLIST_SUB+=	GIF=""
 .else
 FORCE_IGNORE+=	GIFLIB
-PLIST_SUB+=	GIF="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MINVENTOR}
 FORCE_REQUIRE+=	Inventor
-BUILD_DEPENDS+=	${LOCALBASE}/lib/libInventor.so:${PORTSDIR}/graphics/inventor
-RUN_DEPENDS+=	${LOCALBASE}/lib/libInventor.so:${PORTSDIR}/graphics/inventor
-PLIST_SUB+=	INVENTOR=""
 .else
 FORCE_IGNORE+=	Inventor
-PLIST_SUB+=	INVENTOR="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MJASPER}
 FORCE_REQUIRE+=	Jasper
-LIB_DEPENDS+=	jasper:${PORTSDIR}/graphics/jasper
-PLIST_SUB+=	JASPER=""
 .else
 FORCE_IGNORE+=	Jasper
-PLIST_SUB+=	JASPER="@comment "
 .endif
 
-#.if ${PORT_OPTIONS:MOPENVRML}
-#FORCE_REQUIRE+=	OpenVRML
-#LIB_DEPENDS+=	openvrml:${PORTSDIR}/www/openvrml
-#PLIST_SUB+=	OPENVRML=""
-#.else
+# broken (openvrml from ports is too old)
 FORCE_IGNORE+=	OpenVRML
-PLIST_SUB+=	OPENVRML="@comment "
-#.endif
 
 .if ${PORT_OPTIONS:MXINE}
 FORCE_REQUIRE+=	Xine
-LIB_DEPENDS+=	xine:${PORTSDIR}/multimedia/libxine
-PLIST_SUB+=	XINE=""
 .else
 FORCE_IGNORE+=	Xine
-PLIST_SUB+=	XINE="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MITK}
 FORCE_REQUIRE+=	ITK
-BUILD_DEPENDS+=	${LOCALBASE}/lib/InsightToolkit/UseITK.cmake:${PORTSDIR}/science/InsightToolkit
-RUN_DEPENDS+=	${LOCALBASE}/lib/InsightToolkit/UseITK.cmake:${PORTSDIR}/science/InsightToolkit
-PLIST_SUB+=	ITK=""
 CXXFLAGS+=	-DVCL_CAN_STATIC_CONST_INIT_FLOAT=0
 .else
 FORCE_IGNORE+=	ITK
-PLIST_SUB+=	ITK="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MVNC}
 FORCE_REQUIRE+=	LibVNCServer
-LIB_DEPENDS+=	vncserver:${PORTSDIR}/net/libvncserver
-PLIST_SUB+=	VNC=""
 .else
 FORCE_IGNORE+=	LibVNCServer
-PLIST_SUB+=	VNC="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MOPENEXR}
 FORCE_REQUIRE+=	OpenEXR
-LIB_DEPENDS+=	IlmImf:${PORTSDIR}/graphics/OpenEXR
-PLIST_SUB+=	OPENEXR=""
 .else
 FORCE_IGNORE+=	OpenEXR
-PLIST_SUB+=	OPENEXR="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MFFMPEG}
 FORCE_REQUIRE+=	FFmpeg
-LIB_DEPENDS+=	avcodec:${PORTSDIR}/multimedia/ffmpeg
-PLIST_SUB+=	FFMPEG=""
 .else
 FORCE_IGNORE+=	FFmpeg
-PLIST_SUB+=	FFMPEG="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MSDL}
@@ -176,39 +148,23 @@ FORCE_IGNORE+=	SDL
 # options that affect PKG_CHECK_MODULES
 .if ${PORT_OPTIONS:MSVG}
 FORCE_REQUIRE+=	RSVG
-LIB_DEPENDS+=	rsvg-2:${PORTSDIR}/graphics/librsvg2
-PLIST_SUB+=	SVG=""
 .else
 FORCE_IGNORE+=	RSVG
-PLIST_SUB+=	SVG="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MPDF}
 FORCE_REQUIRE+=	Poppler-glib
-LIB_DEPENDS+=	poppler-glib:${PORTSDIR}/graphics/poppler-glib
-PLIST_SUB+=	PDF=""
 .else
 FORCE_IGNORE+=	Poppler-glib
-PLIST_SUB+=	PDF="@comment "
 .endif
 
 .if ${PORT_OPTIONS:MSVG} || ${PORT_OPTIONS:MPDF}
-LIB_DEPENDS+=	cairo:${PORTSDIR}/graphics/cairo
+USE_GNOME=	cairo
 .endif
 
 # other options
 .if ${PORT_OPTIONS:MXRANDR}
-CMAKE_ARGS+=	-DOSGVIEWER_USE_XRANDR:BOOL=ON
 USE_XORG+=	xrandr
-.else
-CMAKE_ARGS+=	-DOSGVIEWER_USE_XRANDR:BOOL=OFF
-.endif
-
-.if ${PORT_OPTIONS:MXRANDR}
-CMAKE_ARGS+=	-DOSGVIEWER_USE_XRANDR:BOOL=ON
-USE_XORG+=	xrandr
-.else
-CMAKE_ARGS+=	-DOSGVIEWER_USE_XRANDR:BOOL=OFF
 .endif
 
 post-patch:

Added: head/graphics/osg/files/patch-include-OpenThreads-Atomic
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/osg/files/patch-include-OpenThreads-Atomic	Thu Sep 26 17:19:33 2013	(r328395)
@@ -0,0 +1,11 @@
+--- include/OpenThreads/Atomic.orig	2011-01-31 12:35:50.000000000 +0100
++++ include/OpenThreads/Atomic	2013-09-18 12:41:22.000000000 +0200
+@@ -241,7 +241,7 @@
+ AtomicPtr::assign(void* ptrNew, const void* const ptrOld)
+ {
+ #if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
+-    return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);
++    return __sync_bool_compare_and_swap(&_ptr, (void *)ptrOld, ptrNew);
+ #elif defined(_OPENTHREADS_ATOMIC_USE_MIPOSPRO_BUILTINS)
+     return __compare_and_swap((unsigned long*)&_ptr, (unsigned long)ptrOld, (unsigned long)ptrNew);
+ #elif defined(_OPENTHREADS_ATOMIC_USE_SUN)

Added: head/graphics/osg/files/patch-include-osg-Math
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/osg/files/patch-include-osg-Math	Thu Sep 26 17:19:33 2013	(r328395)
@@ -0,0 +1,29 @@
+--- include/osg/Math.orig	2011-05-26 20:52:08.000000000 +0400
++++ include/osg/Math	2013-09-24 22:00:59.252519925 +0400
+@@ -20,7 +20,7 @@
+ 
+ //certain math functions were not defined until 10.2
+ //so this code checks the version so it can add in workarounds for older versions.
+-#ifdef __APPLE__
++#if defined(__APPLE__)
+ // Using std::isnan will work for OS X, but use of <cmath> 
+ // and std:: are not necessarily portible with other systems so 
+ // the include of <cmath> is isolated here.
+@@ -38,6 +38,8 @@
+         #define APPLE_PRE_10_2
+     #endif
+ #endif
++#elif defined(__FreeBSD__)
++#include <cmath>
+ #endif
+ 
+ #if defined(_MSC_VER)
+@@ -207,7 +209,7 @@
+     inline bool isNaN(float v) { return _isnan(v)!=0; }
+     inline bool isNaN(double v) { return _isnan(v)!=0; }
+ #else
+-    #if defined(__APPLE__)
++    #if defined(__APPLE__) || defined(__FreeBSD__)
+         inline bool isNaN(float v) { return std::isnan(v); }
+         inline bool isNaN(double v) { return std::isnan(v); }
+     #else

Added: head/graphics/osg/files/patch-src-OpenThreads-common-Atomic.cpp
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/graphics/osg/files/patch-src-OpenThreads-common-Atomic.cpp	Thu Sep 26 17:19:33 2013	(r328395)
@@ -0,0 +1,11 @@
+--- src/OpenThreads/common/Atomic.cpp.orig	2011-04-19 13:40:22.000000000 +0200
++++ src/OpenThreads/common/Atomic.cpp	2013-09-18 11:26:03.000000000 +0200
+@@ -143,7 +143,7 @@
+ AtomicPtr::assign(void* ptrNew, const void* const ptrOld)
+ {
+ #if defined(_OPENTHREADS_ATOMIC_USE_GCC_BUILTINS)
+-    return __sync_bool_compare_and_swap(&_ptr, ptrOld, ptrNew);
++    return __sync_bool_compare_and_swap(&_ptr, (void *)ptrOld, ptrNew);
+ #elif defined(_OPENTHREADS_ATOMIC_USE_WIN32_INTERLOCKED)
+     return ptrOld == InterlockedCompareExchangePointer((PVOID volatile*)&_ptr, (PVOID)ptrNew, (PVOID)ptrOld);
+ #elif defined(_OPENTHREADS_ATOMIC_USE_BSD_ATOMIC)

Modified: head/graphics/osg/pkg-plist
==============================================================================
--- head/graphics/osg/pkg-plist	Thu Sep 26 17:17:30 2013	(r328394)
+++ head/graphics/osg/pkg-plist	Thu Sep 26 17:19:33 2013	(r328395)
@@ -672,7 +672,6 @@ lib/osgPlugins-%%OSG_VERSION%%/osgdb_tra
 lib/osgPlugins-%%OSG_VERSION%%/osgdb_txf.so
 lib/osgPlugins-%%OSG_VERSION%%/osgdb_txp.so
 %%VNC%%lib/osgPlugins-%%OSG_VERSION%%/osgdb_vnc.so
-%%OPENVRML%%lib/osgPlugins-%%OSG_VERSION%%/osgdb_vrml.so
 lib/osgPlugins-%%OSG_VERSION%%/osgdb_vtf.so
 lib/osgPlugins-%%OSG_VERSION%%/osgdb_x.so
 %%XINE%%lib/osgPlugins-%%OSG_VERSION%%/osgdb_xine.so
_______________________________________________
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"