As described in the title, I'd like to remove the global WITH_DEBUG
configuration and make it a proper option leveraging the OPTIONS
framework.
I have prepared a patch to that effect which generally works, altough
there are a few edges which need smoothing.
I "engineered" the patch by hiding the WITH_DEBUG as _WITH_DEBUG,
leveraging existing code using the old flag and adding a mechanism
for global options forced on all ports, so they can silently affect
all ports if enabled, but not show as an option dialog in ports not
already showing one. (that is, not using OPTIONS_DEFINE itself)
In writing the patch I tried to keep the behaviour of ports the
same as it is now while moving from WITH_DEBUG to DEBUG option. If,
in some part of the patch, I have diverged from this guideline
please point me at it, with the few exceptions I'll explain shortly.
Advantage for moving to DEBUG are gaining all the tools the options
framework gives us, f.e. an easier way to manage it globally from
make.conf, option helpers and so on.
The global WITH_DEBUG will still work, thanks to options compatibility
still living in bsd.options.mk. I also preserved the WITH_DEBUG_PORTS
behaviour, renaming it to DEBUG_PORTS, but I suspect keeping the
old name would be better for POLA.
Many ports are already providing an options framework driven DEBUG
option, but the dualism with WITH_DEBUG also creates confusion.
While cooking up this patch I also noticed some antipatters and
errors I have corrected when seen:
- redefining STRIP="" (Already done by framework)
- wrapping ${STRIP} in .if (not needed due to the above)
- wrapping INSTALL_TARGET=install-strip in .if (substituted with install by framework)
Some ports are already failing (due to check-sanity) when globally
setting WITH_DEBUG or the DEBUG option, due to them having other
options conflicting with DEBUG (usually OPTIMIZED_CFLAGS or more
rarely RELEASE, due to SINGLE or PREVENTS usage) enabled by default.
In the patch I address it in the java/openjdk8 port, which I modified
to avoid the issue. I'd like feedback on what I've done there. I'm
especially not sure how fragile the double definition of JDK_BUILD_TYPE
is, maybe there's a better way.
some examples I have observed showing the above behaviour (which
I have not modified in the patch) are:
www/gatling
net/udpxy
math/pari
There are a few others, if a complete list is required I'll try to
create one.
Regarding this ports, which are already failing if WITH_DEBUG is
defined globally and no further configuration is performed, is it
required for my patch to fix them or can these be dealt with and
new guidelines added to tha porter's handbook added to explain one
should take care not to conflict with DEBUG option in the future?
Thanks for all suggestions and reviews!