On 2022/04/24 12:33, Rafael Sadowski wrote:
> - CFLAGS, CXXFLAGS, LDFLAGS
> cmake.port.mk now respects C/CXX/LD flags. With is CMAKE_*_FLAGS_* is 
> obsolete.

I am 100% happy with doing this for CFLAGS/CXXFLAGS. Those are supported
by other ports modules (autoconf, etc) and already partly supported by
cmake module?.

LDFLAGS not so much. Nothing else in ports infrastructure supports
this. It is used in some ports but that's as an individual thing
within those ports. It is not something that the user can set in the
same way they can override CFLAGS/CXXFLAGS during a build.

(Not saying it would be a bad thing to support it more widely, but having
it honoured automatically in cmake but not in say meson and autoconf
seems like asking for trouble).

Also this gets rid of the distinction betweed CMAKE_SHARED_LINKER_FLAGS,
CMAKE_MODULE_LINKER_FLAGS, CMAKE_EXE_LINKER_FLAGS - is that a good idea?

> --- a/cad/graywolf/Makefile
> +++ b/cad/graywolf/Makefile
> @@ -21,7 +21,7 @@ MODULES =   devel/cmake
>  LIB_DEPENDS =        devel/gsl
>  
>  # Really really not C99
> -CONFIGURE_ARGS = -DCMAKE_C_FLAGS="${CFLAGS} -Wno-return-type"
> +CFLAGS +=    -Wno-return-type"

stray "

> --- a/converters/opencc/Makefile
> +++ b/converters/opencc/Makefile
> @@ -27,8 +27,9 @@ MODULES =           devel/cmake \
>  
>  LIB_DEPENDS =                textproc/libmarisa,-main
>  
> -CONFIGURE_ARGS =     -DUSE_SYSTEM_MARISA=ON \
> -                     -DCMAKE_CXX_FLAGS="-I${LOCALBASE}/include 
> -L${LOCALBASE}/lib"
> +CONFIGURE_ARGS =     -DUSE_SYSTEM_MARISA=ON
> +
> +CXXFLAGS +=          -I${LOCALBASE}/include -I${X11BASE}/include
>  
>  MODPY_RUNDEP =               No

this loses setting -L

> ---- Source/cmComputeLinkInformation.cxx.orig
> -+++ Source/cmComputeLinkInformation.cxx

this definitely wants checking with ld.bfd as well as LLD

> diff --git a/emulators/ppsspp/Makefile b/emulators/ppsspp/Makefile
> index ba22f00f61a..9280479005a 100644
> --- a/emulators/ppsspp/Makefile
> +++ b/emulators/ppsspp/Makefile
> @@ -58,14 +58,14 @@ LIB_DEPENDS =             archivers/snappy \
>                       graphics/png
>  COMPILER =           base-clang ports-gcc
>  
> -CONFIGURE_ARGS =     -DCMAKE_CXX_FLAGS="-I${X11BASE}/include" \
> -                     -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
> -                     -DUSE_SYSTEM_FFMPEG=ON \
> +CONFIGURE_ARGS =     -DUSE_SYSTEM_FFMPEG=ON \
>                       -DUSE_SYSTEM_LIBZIP=ON \
>                       -DUSE_SYSTEM_SNAPPY=ON \
>                       -DUSE_DISCORD=OFF \
>                       -DUSING_EGL=OFF
>  
> +CXXFLAGS +=  -I${X11BASE}/include

I wonder what the original with two separate -DCMAKE_CXX_FLAGS ended
up actually doing.

> --- a/games/gemrb/Makefile
> +++ b/games/gemrb/Makefile
> @@ -37,12 +37,12 @@ RUN_DEPENDS =             devel/desktop-file-utils \
>  CONFIGURE_ARGS +=    -DSYSCONF_DIR=${SYSCONFDIR}/gemrb \
>                       -DEXAMPLE_CONF_DIR=${PREFIX}/share/examples/gemrb/ \
>                       -DMAN_DIR=${PREFIX}/man/man6 \
> -                     -DCMAKE_MODULE_LINKER_FLAGS=-lc \
> -                     -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \
>                       -DDISABLE_WERROR=1 \
>                       -DSDL_BACKEND=SDL \
>                       -Wno-dev
>  
> +LDFLAGS +=           -lc

ugh to the "-lc"

> index c0302100fcd..0b260d888be 100644
> --- a/games/gzdoom/Makefile
> +++ b/games/gzdoom/Makefile
> @@ -32,7 +32,8 @@ MODULES =           devel/cmake
>  CONFIGURE_ARGS +=    -DNO_GTK=ON
>  CONFIGURE_ARGS +=    -DDYN_OPENAL=NO
>  CONFIGURE_ARGS +=    -DHAVE_STDINT_H=1
> -CONFIGURE_ARGS +=    -DCMAKE_CXX_FLAGS="${CXXFLAGS} -I. 
> -I${LOCALBASE}/include"
> +
> +CXXFLAGS +=          -I${LOCALBASE}/include
>  
>  LIB_DEPENDS =                audio/openal \
>                       audio/zmusic \

loses "-I."

> diff --git a/games/irrlamb/Makefile b/games/irrlamb/Makefile
> index 24a7de825dc..837f5834946 100644
> --- a/games/irrlamb/Makefile
> +++ b/games/irrlamb/Makefile
> @@ -26,6 +26,8 @@ RUN_DEPENDS =       devel/desktop-file-utils
>  
>  WRKDIST =    ${WRKDIR}/irrlamb-$Vr613
>  
> +LDFLAGS +=   -L${X11BASE}/lib -L${LOCALBASE}/lib
> +
>  NO_TEST =    Yes
>  
>  .if ${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH} == "i386"

these weren't needed before, why are they now? same/similar in most
of the others in games/ (some gain both X11BASE and LOCALBASE, some
gain one or the other, openmw changes X11BASE to LOCALBASE)
and in geo/lib2geom, graphics/gdcm, actually so many others that
I stopped keeping notes.

Seems this change is causing it to override existing paths set inside
the ports CMakeFiles themselves?

> diff --git a/graphics/ksnip/Makefile b/graphics/ksnip/Makefile
> index 8b4c5fe1cf6..4fe09d135bf 100644
> --- a/graphics/ksnip/Makefile
> +++ b/graphics/ksnip/Makefile
> @@ -26,7 +26,7 @@ LIB_DEPENDS =               graphics/kcolorpicker \
>                       graphics/kimageannotator>=0.4.1 \
>                       x11/qt5/qtx11extras
>  
> -CONFIGURE_ARGS +=    -DCMAKE_CXX_FLAGS="-I${LOCALBASE}/include"
> -CONFIGURE_ENV +=     LDFLAGS="-L${X11BASE}/lib -L${LOCALBASE}/lib"
> +CXXFLAGS +=  -I${LOCALBASE}/include -I${X11BASE}/include
> +LDFLAGS +=   -L${X11BASE}/lib -L${LOCALBASE}/lib

only had LOCALBASE/include before not also X11BASE

> diff --git a/math/imath/Makefile b/math/imath/Makefile
> index 5b64fa9d459..cd06446544b 100644
> --- a/math/imath/Makefile
> +++ b/math/imath/Makefile
> @@ -34,8 +34,7 @@ LIB_DEPENDS=                devel/boost
>  CXXFLAGS +=          -mxgot
>  .endif
>  
> -CONFIGURE_ARGS=              -DCMAKE_EXE_LINKER_FLAGS="-L${LOCALBASE}/lib" \
> -                     -DPYTHON:BOOL=ON
> +LDFLAGS +=           -L${LOCALBASE}/lib

loses -DPYTHON

>  DEBUG_PACKAGES=              ${BUILD_PACKAGES}
>  
> diff --git a/math/mlpack/Makefile b/math/mlpack/Makefile
> index af65060c027..d51af26d565 100644
> --- a/math/mlpack/Makefile
> +++ b/math/mlpack/Makefile
> @@ -89,6 +89,8 @@ CONFIGURE_ARGS +=   -DCMAKE_DISABLE_FIND_PACKAGE_Git=TRUE \
>                       -DBUILD_PYTHON_BINDINGS=ON \
>                       -DCMAKE_INSTALL_MANDIR=${PREFIX}/man/man1
>  
> +#LDFLAGS= -L${LOCALBASE}/lib

commented-out

> diff --git a/math/rstudio/Makefile b/math/rstudio/Makefile
> index 9f47f35987a..479df3057da 100644
> --- a/math/rstudio/Makefile
> +++ b/math/rstudio/Makefile
> @@ -67,8 +67,10 @@ RUN_DEPENDS =      devel/desktop-file-utils \
>  CONFIGURE_ARGS =     -DBoost_INCLUDE_DIR="${LOCALBASE}/include" \
>                       -DQT_QMAKE_EXECUTABLE="${LOCALBASE}/bin/qmake-qt5" \
>                       
> -DQt5WebEngine_DIR="${LOCALBASE}/lib/qt5/cmake/Qt5WebEngine" \
> -                     
> -DQt5WebEngineWidgets_DIR="${LOCALBASE}/lib/qt5/cmake/Qt5WebEngineWidgets" \
> -                     -DCMAKE_EXE_LINKER_FLAGS="-L${LOCALBASE}/lib/inotify 
> -linotify -rpath ${LOCALBASE}/lib/inotify -rpath ${LOCALBASE}/lib/R/lib"
> +                     
> -DQt5WebEngineWidgets_DIR="${LOCALBASE}/lib/qt5/cmake/Qt5WebEngineWidgets
> +
> +LDFLAGS +=           -L${LOCALBASE}/lib/inotify -linotify -rpath
> +LDFLAGS +=           -L${LOCALBASE}/lib/inotify -rpath ${LOCALBASE}/lib/R/lib

the way this is broken onto two LDFLAGS lines is confusing and has an
extra -L which looks wrong, would be better keeping flag and argument together
like this (but my more general comments about LDFLAGS still stand)

LDFLAGS +=              -L${LOCALBASE}/lib/inotify -linotify
LDFLAGS +=              -rpath ${LOCALBASE}/lib/inotify
LDFLAGS +=              -rpath ${LOCALBASE}/lib/R/lib

> diff --git a/x11/polkit-qt5/Makefile b/x11/polkit-qt5/Makefile
> index d6ebba42a5f..b35a6fbd99a 100644
> --- a/x11/polkit-qt5/Makefile
> +++ b/x11/polkit-qt5/Makefile
> @@ -34,7 +34,7 @@ LIB_DEPENDS=        sysutils/polkit
>  # polkit(8) almost always needs to know the "active" session
>  RUN_DEPENDS +=       sysutils/consolekit
>  
> -CONFIGURE_ARGS= -DCMAKE_SHARED_LINKER_FLAGS:STRING="-L${LOCALBASE}/lib"
> +CXXFLAGS +=  -L${LOCALBASE}/lib
>  
>  NO_TEST=     Yes

moves from linker flags to CXXFLAGS

Reply via email to