On Wed, 2021-06-02 at 20:33 +0530, Nilesh Patra wrote:
> wmcpu Fails to cross build because it hardcodes gcc as build
> compiler in CC=gcc.
> Simply removing this line would do the trick for us, however I've
> replaced this with CC ?= gcc
> Although this is a no-op for us, but this will help getting this
> upstreamed.
> Please consider applying the attched patch
> 
> PS: Since this package hasn't been uploaded for more than 13 years,
> which is a *really really* long time, I intend to NMU it post bullseye
> release, with this patch applied - if not uploaded on time ofcourse.
> 
> --- a/Makefile
> +++ b/Makefile
> @@ -1,4 +1,4 @@
> -CC           = gcc
> +CC           ?= gcc

But doesn't this line always do nothing, not just in Debian, but
upstream as well? Per POSIX, CC is always pre-defined to a suitable C
compiler such as 'c99', so the ?= operator will always leave the
variable untouched.

I think what you're looking for, borrowed from a wiki page describing
the problem [1], is this GNU Make-specific syntax:
ifeq ($(origin CC),default)
CC = gcc
endif

This means "if CC is still its GNU Make default of 'cc' or (in POSIX
mode) 'c99' and hasn't been set by the user, set it to gcc." This ought
to be more suitable for upstream.
If they're willing to do it they should, in my opinion, just rely on
the preset value of $(CC) and not bother with setting it to gcc at all,
unless they genuinely rely on gcc-specific features like warnings.

Note: I've not taken a look at the packages, but believe the foregoing
advice applies in general to upstream Makefile build systems.

[1] https://wiki.debian.org/CrossBuildPackagingGuidelines

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to