Bug 184540 - emulators/dolphin-emu: New options framework + DEBUG option set = wrong INSTALL_TARGET
Summary: emulators/dolphin-emu: New options framework + DEBUG option set = wrong INSTA...
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: Ganael LAPLANCHE
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-12-06 14:30 UTC by Ganael LAPLANCHE
Modified: 2015-10-08 21:00 UTC (History)
0 users

See Also:


Attachments
file.diff (4.16 KB, patch)
2013-12-06 14:30 UTC, Ganael LAPLANCHE
no flags Details | Diff
patch-INSTALL_TARGET.txt (1.04 KB, patch)
2014-02-06 07:50 UTC, Ganael LAPLANCHE
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ganael LAPLANCHE freebsd_committer 2013-12-06 14:30:00 UTC
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).

Fix: Patch attached with submission follows:
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'
Comment 1 Edwin Groothuis freebsd_committer 2013-12-07 02:48:18 UTC
Class Changed
From-To: sw-bug->maintainer-update

Fix category (submitter is maintainer) (via the GNATS Auto Assign Tool)
Comment 2 Edwin Groothuis freebsd_committer 2013-12-07 02:48:20 UTC
Responsible Changed
From-To: freebsd-ports-bugs->martymac

Submitter is maintainer and has GNATS access (via the GNATS Auto Assign 
Tool)
Comment 3 Ganael LAPLANCHE freebsd_committer 2013-12-09 07:32:11 UTC
Responsible Changed
From-To: martymac->freebsd-ports-bugs

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.
Comment 4 Mark Linimon freebsd_committer 2013-12-15 18:51:50 UTC
Responsible Changed
From-To: freebsd-ports-bugs->martymac

Over to maintainer.
Comment 5 Ganael LAPLANCHE freebsd_committer 2013-12-16 07:55:34 UTC
Responsible Changed
From-To: martymac->freebsd-ports-bugs

Again, release PR as it is not related to dolphin-emu itself.
Comment 6 Ganael LAPLANCHE freebsd_committer 2014-02-06 07:50:00 UTC
(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
Comment 7 John Marino freebsd_committer 2014-07-11 12:40:23 UTC
hmmm?  Seems the submitter is the maintainer?

So assigning it back to maintainer...
Comment 8 Ganael LAPLANCHE freebsd_committer 2015-10-08 21:00:01 UTC
This bug was related to the way the ports' infrastructure handled DEBUG and INSTALL_TARGET.

I've just made new tests and it seems to be fixed by now, so I'll close that PR.