On 2017/07/13 12:45, Marc Espie wrote:
> So, vlc gets too complicated.
> 
> The LIBCXX / LIBECXX thingy predates new COMPILER choice.
> 
> Now that it's there, after some thinking it's possible to do
> things in a simpler way.
> 
> The following patch creates a variable that's correctly set for the 
> current compiler in every case, unsurprisingly named (for now) 
> COMPILER_LIBCXX.
> 
> 
> Stuart had the radical idea that it should be even shorter, and replace
> LIBCXX...  I pointed out that the transition period would be chaos.
> 
> The current plan is
> - introduce that variable
> - use it everywhere that it is possible to use it.

As this is a common single variable that means "whichever libs are
needed for C++ for the current compiler", we could also get rid of the
automagic WANTLIB addition in gcc4.port.mk/clang.port.mk, as this gives
us a clean mechanism to do the same thing.

(This automatic addition is part of the problem really, it adds c++ libs
to WANTLIB when the compiler is ports gcc/clang but does not do so if the
compiler is base clang).

> - see what's left of direct use of LIBCXX and LIBECXX (a few ports "inherit"
> a C++ lib from other ports)
> - rename things accordingly (iirr, the renaming would be
> COMPILER_LIBCXX -> LIBCXX
> LIBCXX -> LIBCXX_BASE
> LIBECXX -> LIBCXX11)

Since the latter two would only show up when there's a dirty mixture
of C++ standard libraries, I was thinking LIBCXX_CXX11 so it's more
visible in the Makefile, and is visually similar to LIBCXX_BASE.

> It will get rid of one problematic development, namely that there is exactly
> zero check that we have the right library on a clang arch... so having the
> compiler choose correctly gets rid of that problem in most cases...
> 
> Index: bsd.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
> retrieving revision 1.1352
> diff -u -p -r1.1352 bsd.port.mk
> --- bsd.port.mk       31 May 2017 08:08:16 -0000      1.1352
> +++ bsd.port.mk       11 Jul 2017 17:02:07 -0000
> @@ -302,6 +302,7 @@ _MODULES_DONE =
>  .  include "${PORTSDIR}/infrastructure/mk/modules.port.mk"
>  .endif
>  
> +COMPILER_LIBCXX ?= ${LIBCXX}
>  ###
>  ### Variable setup that can happen after modules
>  ###
> Index: compiler.port.mk
> ===================================================================
> RCS file: /cvs/ports/infrastructure/mk/compiler.port.mk,v
> retrieving revision 1.1
> diff -u -p -r1.1 compiler.port.mk
> --- compiler.port.mk  31 May 2017 08:08:16 -0000      1.1
> +++ compiler.port.mk  11 Jul 2017 17:02:07 -0000
> @@ -67,3 +67,10 @@ CHOSEN_COMPILER = error
>  .endfor
>  # okay we went through, we didn't find anything
>  CHOSEN_COMPILER ?= old
> +.if $(CHOSEN_COMPILER) == "clang" || $(CHOSEN_COMPILER) == "gcc"
> +.  if ${COMPILER_LANGS:Mc++}
> +COMPILER_LIBCXX = ${LIBECXX}
> +.  endif
> +.endif
> +
> +

Reply via email to