Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 575710 - app-arch/unzip: does not use CC env on amd64-fbsd.
Summary: app-arch/unzip: does not use CC env on amd64-fbsd.
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All FreeBSD
: Normal normal (vote)
Assignee: Gentoo's Team for Core System packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-26 11:43 UTC by Yuta SATOH
Modified: 2016-02-28 19:16 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
sample patch for unzip-6.0-r3.ebuild (bug575710.patch,438 bytes, patch)
2016-02-26 11:55 UTC, Yuta SATOH
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yuta SATOH 2016-02-26 11:43:28 UTC
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"
Comment 1 Yuta SATOH 2016-02-26 11:55:37 UTC
Created attachment 426606 [details, diff]
sample patch for unzip-6.0-r3.ebuild
Comment 2 Mike Gilbert gentoo-dev 2016-02-26 16:09:46 UTC
Seems like it would be easier to pass CC on the emake command line than to mess with the Makefile using sed.
Comment 3 SpanKY gentoo-dev 2016-02-27 17:07:36 UTC
(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 4 SpanKY gentoo-dev 2016-02-27 17:08:14 UTC
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)\":" \
Comment 5 Yuta SATOH 2016-02-28 11:55:21 UTC
(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.
Comment 6 SpanKY gentoo-dev 2016-02-28 19:16:43 UTC
thanks for verifying.  in the tree now:
https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=f30bed50f18566190979cde0412e9919b0934a44