Hi,

i've had a look at why cmake insists on striping libs/binaries (even if
it seems upstream states it isnt the case by default.. no 100% sure
about this statment), rendering our DEBUG_PACKAGES framework useless for
(some?) cmake ports.  CMAKE_BUILD_TYPE=RelWithDebInfo doesnt really work
as it produces different binaries, and it would be great to have a
'generic' solution that would work for all cmake ports.

after looking at the cmake code there are two things/knobs:
CMAKE_INSTALL_DO_STRIP seem to control which sub makefile is called, but
upstream wants to hide it from the API:
https://gitlab.kitware.com/cmake/cmake/commit/d5b722bbbd684477e8b8a979ba62a2f1b45a720c

CMAKE_STRIP is the path to the strip utility, looked for in
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Modules/CMakeFindBinUtils.cmake#L113

the 'interesting' generator bits are here:
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmGlobalGenerator.cxx#L2663
https://gitlab.kitware.com/cmake/cmake/-/blob/master/Source/cmInstallTargetGenerator.cxx#L785

those could be patched out,i'd say 'remove the line force-adding
-DCMAKE_INSTALL_DO_STRIP=1' but then that would affect all cmake-using
ports, where we'd have to change more bits to actually do the striping
somewhere else ? but first, id prefer something less invasive, using
only user-knobs via DEBUG_CONFIGURE_ARGS.

tried:
* -DCMAKE_INSTALL_DO_STRIP=0 -> no dice, not meant as a user-visible knob:
  Manually-specified variables were not used by the project:
    CMAKE_INSTALL_DO_STRIP

* -UCMAKE_STRIP to avoid cmake looking for CMAKE_STRIP -> still finds it.

* -DCMAKE_STRIP=/usr/bin/true seems to be taken into account:
/usr/obj/ports/freerdp-2.0.0rc1/build-amd64/CMakeCache.txt:CMAKE_STRIP:FILEPATH=/usr/bin/true

and the resulting package seems to provide debug syms:
[08:53] nikki:~/ $egdb /usr/local/bin/xfreerdp
Reading symbols from /usr/local/bin/xfreerdp...Reading symbols from 
/usr/local/bin/.debug/xfreerdp.dbg...done.

so it seems this:
Index: Makefile
===================================================================
RCS file: /cvs/ports/x11/freerdp/Makefile,v
retrieving revision 1.39
diff -u -r1.39 Makefile
--- Makefile    4 Nov 2019 10:30:20 -0000       1.39
+++ Makefile    19 Apr 2020 06:55:41 -0000
@@ -8,6 +8,8 @@
 PKGNAME =              freerdp-2.0.0rc1
 REVISION =             4
 CATEGORIES =           x11 net
+DEBUG_PACKAGES=                ${BUILD_PACKAGES}
+DEBUG_CONFIGURE_ARGS+= -DCMAKE_STRIP=/usr/bin/true

actually works for freerdp (but apparently, after retesting twice and
being puzzled, without overriding CMAKE_STRIP i have a working
debug-freerdp package). Can others check with various cmake ports that
were reluctant to work with only DEBUG_PACKAGES set ?  Should
DEBUG_CONFIGURE_ARGS be set by default in cmake.port.mk - leaving the
DEBUG_PACKAGES knob to be the only line added to ports Makefiles as is
the case with autohell-based ports ?

Landry

Reply via email to