Because CC=gcc is not included in unix/Makefile bsd, it is not replaced. Actual Results: # CC=clang MAKEOPTS=-j1 ebuild unzip-6.0-r3.ebuild clean compile >>> Compiling source in /var/tmp/portage/app-arch/unzip-6.0-r3/work/unzip60 ... gmake -j1 -f unix/Makefile bsd gmake unzips CF="-O2 -pipe -I. -Ibzip2 -DUNIX -DBSD" gmake[1]: Entering directory '/var/tmp/portage/app-arch/unzip-6.0-r3/work/unzip60' cc -c -O2 -pipe -I. -Ibzip2 -DUNIX -DBSD unzip.c Expected Results: # CC=clang MAKEOPTS=-j1 ebuild unzip-6.0-r3.ebuild clean compile >>> Compiling source in /var/tmp/portage/app-arch/unzip-6.0-r3/work/unzip60 ... gmake -j1 -f unix/Makefile bsd gmake unzips CF="-O2 -pipe -I. -Ibzip2 -DUNIX -DBSD" gmake[1]: Entering directory '/var/tmp/portage/app-arch/unzip-6.0-r3/work/unzip60' "clang" -c -O2 -pipe -I. -Ibzip2 -DUNIX -DBSD unzip.c FYI, # cat /var/tmp/portage/app-arch/unzip-6.0-r3/work/unzip60/unix/Makefile # UnZip flags CC = cc# try using "gcc" target rather than changing this (CC and LD LD = $(CC)# must match, else "unresolved symbol: ___main" is possible) AS = as <snip> bsd: _bsd # generic BSD (BSD 4.2 & Ultrix handled in unzip.h) _bsd: unix_make $(MAKE) unzips CF="$(CF) -DBSD"
Created attachment 426606 [details, diff] sample patch for unzip-6.0-r3.ebuild
Seems like it would be easier to pass CC on the emake command line than to mess with the Makefile using sed.
(In reply to Mike Gilbert from comment #2) the makefile likes to re-run itself for many targets and clobber CC/etc... so even if we set CC=foo, for many targets, the makefile would override it.
Comment on attachment 426606 [details, diff] sample patch for unzip-6.0-r3.ebuild can you try this patch instead ? - sed -i \ + sed -i -r \ ... - -e "s:\<CC=gcc\>:CC=\"$(tc-getCC)\":" \ - -e "s:\<LD=gcc\>:LD=\"$(tc-getCC)\":" \ - -e "s:\<AS=gcc\>:AS=\"$(tc-getCC)\":" \ + -e "s:\<CC *= *\"?g?cc2?\"?\>:CC=\"$(tc-getCC)\":" \ + -e "s:\<LD *= *\"?(g?cc2?|ld)\"?\>:LD=\"$(tc-getCC)\":" \ + -e "s:\<AS *= *\"?(g?cc2?|as)\"?\>:AS=\"$(tc-getCC)\":" \
(In reply to SpanKY from comment #4) > Comment on attachment 426606 [details, diff] [details, diff] > sample patch for unzip-6.0-r3.ebuild > > can you try this patch instead ? > > - sed -i \ > + sed -i -r \ > ... > - -e "s:\<CC=gcc\>:CC=\"$(tc-getCC)\":" \ > - -e "s:\<LD=gcc\>:LD=\"$(tc-getCC)\":" \ > - -e "s:\<AS=gcc\>:AS=\"$(tc-getCC)\":" \ > + -e "s:\<CC *= *\"?g?cc2?\"?\>:CC=\"$(tc-getCC)\":" \ > + -e "s:\<LD *= *\"?(g?cc2?|ld)\"?\>:LD=\"$(tc-getCC)\":" \ > + -e "s:\<AS *= *\"?(g?cc2?|as)\"?\>:AS=\"$(tc-getCC)\":" \ Works fine. Thanks for your better patch.
thanks for verifying. in the tree now: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f30bed50f18566190979cde0412e9919b0934a44