From nobody@FreeBSD.org  Fri Dec  6 14:25:58 2013
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
	(using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by hub.freebsd.org (Postfix) with ESMTPS id EFFFD9C2
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Dec 2013 14:25:58 +0000 (UTC)
Received: from oldred.freebsd.org (unknown [IPv6:2001:1900:2254:206a::50:4])
	(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by mx1.freebsd.org (Postfix) with ESMTPS id D09B31207
	for <freebsd-gnats-submit@FreeBSD.org>; Fri,  6 Dec 2013 14:25:58 +0000 (UTC)
Received: from oldred.freebsd.org ([127.0.1.6])
	by oldred.freebsd.org (8.14.5/8.14.7) with ESMTP id rB6EPwLB043329
	for <freebsd-gnats-submit@FreeBSD.org>; Fri, 6 Dec 2013 14:25:58 GMT
	(envelope-from nobody@oldred.freebsd.org)
Received: (from nobody@localhost)
	by oldred.freebsd.org (8.14.5/8.14.5/Submit) id rB6EPwgZ043328;
	Fri, 6 Dec 2013 14:25:58 GMT
	(envelope-from nobody)
Message-Id: <201312061425.rB6EPwgZ043328@oldred.freebsd.org>
Date: Fri, 6 Dec 2013 14:25:58 GMT
From: Ganael Laplanche <martymac@FreeBSD.org>
To: freebsd-gnats-submit@FreeBSD.org
Subject: New options framework + DEBUG option set = wrong INSTALL_TARGET
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         184540
>Category:       ports
>Synopsis:       emulators/dolphin-emu: New options framework + DEBUG option set = wrong INSTALL_TARGET
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          maintainer-update
>Submitter-Id:   current-users
>Arrival-Date:   Fri Dec 06 14:30:00 UTC 2013
>Closed-Date:    
>Last-Modified:  Thu Feb  6 07:50:00 UTC 2014
>Originator:     Ganael Laplanche
>Release:        10-STABLE
>Organization:
http://contribs.martymac.org
>Environment:
FreeBSD laptop.martymac.org 10.0-BETA3 FreeBSD 10.0-BETA3 #0 r258683M: Wed Nov 27 20:49:22 CET 2013     root@laptop.martymac.org:/usr/obj/files/Src/sys/GENERIC  amd64
>Description:
I would like to update emulators/dolphin-emu and use the new options framework to handle the DEBUG option (see the attached patch).

Unfortunately, with the DEBUG option set to on, INSTALL_TARGET keeps being
defined to 'install/strip' while it should be set to 'install'.

FYI, including <bsd.port.options.mk> just before <bsd.port.pre.mk> in the port fixes the problem (but that's not a clean way of fixing it :p).
>How-To-Repeat:
Use the attached patch, then :

# cd /usr/ports/dolphin-emu && make config
=> uncheck the DEBUG option
# make -V INSTALL_TARGET
install/strip
=> that is OK

# make config
=> check the DEBUG option
# make -V INSTALL_TARGET
install/strip
=> still the same, should be 'install'
>Fix:


Patch attached with submission follows:

diff -aurN emulators/dolphin-emu.orig/Makefile emulators/dolphin-emu/Makefile
--- emulators/dolphin-emu.orig/Makefile	2013-12-04 19:48:48.000000000 +0100
+++ emulators/dolphin-emu/Makefile	2013-12-05 06:13:09.140779000 +0100
@@ -1,9 +1,9 @@
 # Created by: Ganael Laplanche <ganael.laplanche@martymac.org>
-# $FreeBSD: emulators/dolphin-emu/Makefile 335626 2013-12-04 18:48:48Z makc $
+# $FreeBSD: emulators/dolphin-emu/Makefile 335549 2013-12-03 08:34:29Z martymac $
 
 PORTNAME=	dolphin-emu
 PORTVERSION=	4.0.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	emulators
 MASTER_SITES=	http://contribs.martymac.org/FreeBSD-ports/distfiles/ \
 		LOCAL/martymac
@@ -28,8 +28,6 @@
 WX_UNICODE=	yes
 USE_GL=	gl glew glu
 
-USE_GCC=	yes
-
 USES=		dos2unix cmake pkgconfig iconv
 DOS2UNIX_REGEX=	.*\.(h|c|cpp)
 
@@ -41,61 +39,39 @@
 		-DUSE_X11:BOOL=ON \
 		-DCMAKE_INSTALL_RPATH_USE_LINK_PATH:BOOL=ON
 
-OPTIONS_DEFINE=	PULSEAUDIO PORTAUDIO DEBUG FRAMEDUMPS UPNP
+OPTIONS_DEFINE=	PULSEAUDIO PORTAUDIO DEBUG FRAMEDUMPS UPNP NLS
+OPTIONS_DEFAULT=	PORTAUDIO FRAMEDUMPS UPNP NLS
+OPTIONS_SUB=	yes
+PULSEAUDIO_LIB_DEPENDS=	libpulse.so:${PORTSDIR}/audio/pulseaudio
+PULSEAUDIO_CMAKE_ON=	-DDISABLE_PULSEAUDIO:BOOL=OFF
+PULSEAUDIO_CMAKE_OFF=	-DDISABLE_PULSEAUDIO:BOOL=ON
 PORTAUDIO_DESC=	Enable PortAudio (mic) support
+PORTAUDIO_LIB_DEPENDS=	libportaudio.so.2:${PORTSDIR}/audio/portaudio2
+PORTAUDIO_CMAKE_ON=	-DDISABLE_PORTAUDIO:BOOL=OFF
+PORTAUDIO_CMAKE_OFF=	-DDISABLE_PORTAUDIO:BOOL=ON
+DEBUG_MAKE_ENV=	VERBOSE=yes
+DEBUG_CMAKE_ON=	-DFASTLOG:BOOL=ON
+DEBUG_CMAKE_OFF=	-DFASTLOG:BOOL=OFF
 FRAMEDUMPS_DESC=	Encode framedumps in AVI format
-OPTIONS_DEFAULT=	PORTAUDIO FRAMEDUMPS UPNP
-
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MNLS}
-USES+=		gettext
-PLIST_SUB+=	NLS=""
-.else
-CMAKE_ARGS+=	-DDISABLE_NLS:BOOL=ON
-PLIST_SUB+=	NLS="@comment "
-.endif
-
-.if ${PORT_OPTIONS:MDEBUG}
-CMAKE_ARGS+=	-DFASTLOG:BOOL=ON
-MAKE_ENV+=	VERBOSE=yes
-.endif
-
-.if ${PORT_OPTIONS:MPULSEAUDIO}
-LIB_DEPENDS+=	libpulse.so:${PORTSDIR}/audio/pulseaudio
-.else
-CMAKE_ARGS+=	-DDISABLE_PULSEAUDIO:BOOL=ON
-.endif
-
-.if ${PORT_OPTIONS:MPORTAUDIO}
-LIB_DEPENDS+=	libportaudio.so.2:${PORTSDIR}/audio/portaudio2
-.else
-CMAKE_ARGS+=	-DDISABLE_PORTAUDIO:BOOL=ON
-.endif
-
-.if ${PORT_OPTIONS:MFRAMEDUMPS}
-CMAKE_ARGS+=	-DENCODE_FRAMEDUMPS:BOOL=ON
-LIB_DEPENDS+=	libavcodec.so:${PORTSDIR}/multimedia/ffmpeg \
-		libavformat.so:${PORTSDIR}/multimedia/ffmpeg \
-		libswscale.so:${PORTSDIR}/multimedia/ffmpeg \
-		libavutil.so:${PORTSDIR}/multimedia/ffmpeg
-.else
-CMAKE_ARGS+=	-DENCODE_FRAMEDUMPS:BOOL=OFF
-.endif
-
-.if ${PORT_OPTIONS:MUPNP}
-CMAKE_ARGS+=	-DUSE_UPNP:BOOL=ON
-LIB_DEPENDS+=	libminiupnpc.so:${PORTSDIR}/net/miniupnpc
-.else
-CMAKE_ARGS+=	-DUSE_UPNP:BOOL=OFF
-.endif
+FRAMEDUMPS_LIB_DEPENDS=	libavcodec.so:${PORTSDIR}/multimedia/ffmpeg \
+			libavformat.so:${PORTSDIR}/multimedia/ffmpeg \
+			libswscale.so:${PORTSDIR}/multimedia/ffmpeg \
+			libavutil.so:${PORTSDIR}/multimedia/ffmpeg
+FRAMEDUMPS_CMAKE_ON=	-DENCODE_FRAMEDUMPS:BOOL=ON
+FRAMEDUMPS_CMAKE_OFF=	-DENCODE_FRAMEDUMPS:BOOL=OFF
+UPNP_LIB_DEPENDS=	libminiupnpc.so:${PORTSDIR}/net/miniupnpc
+UPNP_CMAKE_ON=	-DUSE_UPNP:BOOL=ON
+UPNP_CMAKE_OFF=	-DUSE_UPNP:BOOL=OFF
+NLS_USES=	gettext
+NLS_CMAKE_ON=	-DDISABLE_NLS:BOOL=OFF
+NLS_CMAKE_OFF=	-DDISABLE_NLS:BOOL=ON
 
 .include <bsd.port.pre.mk>
 
 .if !empty(ICONV_LIB)
-CMAKE_ARGS+=	-DUSE_ICONV:BOOL=ON
+CMAKE_ARGS+=	-DICONV_LINK:BOOL=ON
 .else
-CMAKE_ARGS+=	-DUSE_ICONV:BOOL=OFF
+CMAKE_ARGS+=	-DICONV_LINK:BOOL=OFF
 .endif
 
 .include <bsd.port.post.mk>
diff -aurN emulators/dolphin-emu.orig/files/patch-Source-Core-DolphinWX-CMakeLists.txt emulators/dolphin-emu/files/patch-Source-Core-DolphinWX-CMakeLists.txt
--- emulators/dolphin-emu.orig/files/patch-Source-Core-DolphinWX-CMakeLists.txt	2013-10-16 09:16:57.000000000 +0200
+++ emulators/dolphin-emu/files/patch-Source-Core-DolphinWX-CMakeLists.txt	2013-12-04 17:02:59.552168000 +0100
@@ -14,12 +14,12 @@
  else()
 -	set(LIBS ${LIBS} png iconv)
 +	set(LIBS ${LIBS} png)
-+	set(USE_ICONV True)
++	set(ICONV_LINK True)
 +endif()
 +
-+if(USE_ICONV)
-+	message( "-- Adding iconv")
-+	set(LIBS  ${LIBS} iconv)
++if(ICONV_LINK)
++	message( "-- Linking to libiconv")
++	set(LIBS ${LIBS} iconv)
  endif()
  
  if(LIBAV_FOUND)


>Release-Note:
>Audit-Trail:
Class-Changed-From-To: sw-bug->maintainer-update 
Class-Changed-By: edwin 
Class-Changed-When: Sat Dec 7 02:48:18 UTC 2013 
Class-Changed-Why:  
Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184540 
Responsible-Changed-From-To: freebsd-ports-bugs->martymac 
Responsible-Changed-By: edwin 
Responsible-Changed-When: Sat Dec 7 02:48:20 UTC 2013 
Responsible-Changed-Why:  
Submitter is maintainer and has GNATS access (via the GNATS Auto Assign 
Tool) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184540 
Responsible-Changed-From-To: martymac->freebsd-ports-bugs 
Responsible-Changed-By: martymac 
Responsible-Changed-When: Mon Dec 9 07:32:11 UTC 2013 
Responsible-Changed-Why:  
Release PR as it is not related to dolphin-emu itself.  I think we have 
a bug somewhere in options handling that prevents INSTALL_TARGET from 
being defined to the correct by Uses/cmake.mk. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184540 
Responsible-Changed-From-To: freebsd-ports-bugs->martymac 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Sun Dec 15 18:51:50 UTC 2013 
Responsible-Changed-Why:  
Over to maintainer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=184540 
Responsible-Changed-From-To: martymac->freebsd-ports-bugs 
Responsible-Changed-By: martymac 
Responsible-Changed-When: Mon Dec 16 07:55:34 UTC 2013 
Responsible-Changed-Why:  
Again, release PR as it is not related to dolphin-emu itself.

http://www.freebsd.org/cgi/query-pr.cgi?pr=184540 

From: "Ganael LAPLANCHE" <martymac@FreeBSD.org>
To: bug-followup@FreeBSD.org
Cc: freebsd-ports-bugs@FreeBSD.org
Subject: Re: ports/184540: emulators/dolphin-emu: New options framework + DEBUG option set = wrong INSTALL_TARGET
Date: Thu, 06 Feb 14 07:50:00 UTC

 This is a multi-part message in MIME format.
 
 ------=OPENWEBMAIL_ATT_0.499544649458588
 Content-Type: text/plain; charset=iso-8859-15
 
 (the original patch included in this PR is no more useful, as Dolphin
 has now been updated and includes a fix for the described problem.
 Anyway, the problem still exists, so here is a more detailed explanation)
 
 Well, here is what happens :
 
 - ${STRIP} is set by default to '-s' by /usr/share/mk/bsd.own.mk
 - ${INSTALL_TARGET} is defined by Mk/Uses/cmake.mk:70 given
   ${STRIP} value : if ${STRIP} is not empty, ${INSTALL_TARGET}
   is forced to 'install/strip'. In my case, the problem is that
   ${STRIP} is never empty, even when DEBUG is on (through PORT_OPTIONS)
 - Mk/Uses/cmake.mk is included by Mk/bsd.ports.mk:1518
   (within pre-makefile section)
 - ${STRIP} can be unset by Mk/bsd.ports.mk:1312 (within options
   section) if DEBUG is on (it currently only handles WITH_DEBUG, not
   DEBUG through PORT_OPTIONS)
 
 This means that if I want to handle DEBUG as a standard PORT_OPTIONS,
 I can :
 - patch line 1311 of bsd.ports.mk to handle PORT_OPTIONS, i.e. :
   -.if defined(WITH_DEBUG) && !defined(WITHOUT_DEBUG)
   +.if (defined(WITH_DEBUG) || !empty(PORT_OPTIONS:MDEBUG)) &&
 !defined(WITHOUT_DEBUG)
 - include <bsd.port.options.mk> before <bsd.port.pre.mk> or else
   ${STRIP} will never be set properly when used by Mk/Uses/cmake.mk
 
 The port currently fixes the problem by manually resetting
 ${INSTALL_TARGET} to 'install' if DEBUG is set. The fix described above
 would also have worked, but required to patch bsd.ports.mk and include
 <bsd.port.options.mk> before <bsd.port.pre.mk>, which seems weird, just
 to handle the DEBUG option.
 
 Find attached a patch that removes the need for a fix within the port
 itself. It handles PORT_OPTIONS as well as moves the section that
 unsets ${STRIP} (Mk/bsd.ports.mk:1312) from the options section to the
 beginning of the pre-makefile section. That fixes the problem for
 emulators/dolphin-emu but I don't know if it can have side-effects for
 other ports or usage.
 
 Also note that handling DEBUG as a standard PORT_OPTIONS will probably
 need more code, see for example :
 
 http://lists.freebsd.org/pipermail/freebsd-ports/2013-November/088064.html
 
 --
 Ganael LAPLANCHE <ganael.laplanche@martymac.org>
 http://www.martymac.org | http://contribs.martymac.org
 FreeBSD: martymac <martymac@FreeBSD.org>, http://www.FreeBSD.org
 
 ------=OPENWEBMAIL_ATT_0.499544649458588
 Content-Type: text/plain;
 	name="patch-INSTALL_TARGET.txt"
 Content-Disposition: attachment; filename="patch-INSTALL_TARGET.txt"
 Content-Transfer-Encoding: base64
 
 LS0tIGJzZC5wb3J0Lm1rLm9yaWcJMjAxNC0wMi0wMyAwODozOTozOS4wMDAwMDAwMDAgKzAxMDAK
 KysrIGJzZC5wb3J0Lm1rCTIwMTQtMDItMDUgMTg6MTk6MzMuNzg5NDU0MDQxICswMTAwCkBAIC0x
 MzAxLDYgKzEzMDEsMTUgQEAKIENPTkZJR1VSRV9FTlYrPQlUTVBESVI9IiR7VE1QRElSfSIKIC5l
 bmRpZiAj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