1 |
Hello, |
2 |
|
3 |
As suggested by jer@g.o in bug #321165, I would like to raise a proposal |
4 |
on extending toolchain-funcs.eclass with helper functions to compile |
5 |
applications directly. |
6 |
|
7 |
There are many simple applications which come without neither a sophisticated |
8 |
build system or even a tiny Makefile. In some cases, such applications aren't |
9 |
even packages as tarball -- a single, compressed source file is published |
10 |
instead. |
11 |
|
12 |
In case of these applications, ebuilds inherit toolchain-funcs.eclass to |
13 |
retrieve compiler information (tc-getCC/tc-getCXX) and call compiler manually, |
14 |
passing appropriate flags. |
15 |
|
16 |
This way, we get certain amount of code being repeated in many ebuilds, |
17 |
slightly differing in the way of calling the compiler and order of arguments |
18 |
being passed to it (see examples below). Although I haven't heard of any |
19 |
problems related to that, it is certainly not fool-proof and hard to maintain. |
20 |
|
21 |
As jer suggested, I'm providing below a listing of example ebuilds calling |
22 |
the compiler directly and notes on differences between the way they call it. |
23 |
Similar list could be obtained through calling: |
24 |
$ grep tc-getCXX.*CXXFLAGS.*-o /usr/portage/*/*/*.ebuild |
25 |
$ grep tc-getCC.*CFLAGS.*-o /usr/portage/*/*/*.ebuild |
26 |
|
27 |
C++ examples include: |
28 |
* app-misc/clockywock - single C++ file, ${LDFLAGS} before ${CXXFLAGS}, |
29 |
* app-pda/iripdb - two C++ files, with echoing the commands, ${LDFLAGS} |
30 |
ignored, |
31 |
* app-text/duconv - single C++ file with separate compilation and linking, |
32 |
${LDFLAGS} after ${CXXFLAGS}, |
33 |
* dev-cpp/tree - single C++ file, ${LDFLAGS} ignored, |
34 |
* games-arcade/gunocide2ex - multiple C++ files, ${LDFLAGS} after ${CXXFLAGS}, |
35 |
* mail-filter/normalizemime, |
36 |
* media-sound/hearnet/hearnet, |
37 |
* net-misc/l7-protocols, |
38 |
* x11-apps/amlc. |
39 |
|
40 |
C examples include: |
41 |
* app-admin/hwreport - single C file, ${LDFLAGS} after ${CFLAGS}, |
42 |
* app-admin/sysrqd - single C file, ${LDFLAGS} ignored, |
43 |
* app-arch/unlzx - single C file, ${LDFLAGS} after ${CFLAGS}, |
44 |
* app-arch/unmakeself - single C file, '-o' after libraries, |
45 |
* app-cdr/bchunk - ${LDFLAGS} ignored, |
46 |
* app-cdr/{cddetect,nrg2iso,uif2iso} |
47 |
* app-crypt/scsign - '-pthread' at the beginning, '-o' after sources, |
48 |
* app-emacs/mpg123-el - ${LDFLAGS} ignored, |
49 |
* app-forensics/{cmospwd,galleta,pasco,rifiuti} - ${LDFLAGS} ignored, |
50 |
'-o' after sources, |
51 |
* app-misc/hilite - ${LDFLAGS} before ${CFLAGS}, |
52 |
* app-misc/irtrans-irclient - ${LDFLAGS} ignored, |
53 |
* app-misc/sl - '-o' after libs, command echoed, |
54 |
* app-text/unpaper - ${LDFLAGS} before ${CFLAGS}, '-o' after sources, |
55 |
* dev-games/paklib - ${LDFLAGS} ignored, '-o' after sources, |
56 |
* dev-java/rxtx - ${LDFLAGS} before ${CFLAGS}, '-o' after sources, |
57 |
* dev-lang/bff, |
58 |
* dev-libs/libhash - ${LDFLAGS} ignored, |
59 |
* dev-libs/libmemcache - ${LDFLAGS} ignored, |
60 |
* dev-libs/nss - (pseudo-configure check), seems ugly anyway, |
61 |
* dev-tcltk/tclperl - ${LDFLAGS} ignored, '-o' in the middle of flags, |
62 |
* dev-tex/tex4ht - ${CPPFLAGS} used (not many ebuilds care about them), |
63 |
* dev-tinyos/{channelgen,listen,serial-forwarder} - ${LDFLAGS} ignored, |
64 |
* dev-util/bsdiff, |
65 |
* dev-util/lockrun - ${LDFLAGS} ignored, '-o' after sources, |
66 |
* games-puzzle/trimines - creating pseudo-Makefile, ${LDFLAGS} ignored, |
67 |
'sdl-config --cflags' after '-o', '-o' after sources, |
68 |
* games-server/tetrix - ${LDFLAGS} ignored, |
69 |
* games-util/biounzip, |
70 |
* mail-filter/qmail-scanner - ${LDFLAGS} ignored, |
71 |
* media-gfx/pngrewrite - ${LDFLAGS} before ${CFLAGS}, '-o' after libs, |
72 |
* media-sound/cd-discid - echoing commands, |
73 |
* media-sound/modplugplay, |
74 |
* media-sound/mserv - '-o' after sources, |
75 |
* media-sound/mup, |
76 |
* media-sound/wavegain - ${LDFLAGS} before ${CFLAGS}, '-o' after sources, |
77 |
defines after '-o', |
78 |
* media-tv/mythtv - ${LDFLAGS} after sources, |
79 |
* media-video/cpvts - echoing commands, |
80 |
* net-analyzer/bigeye - ${LDFLAGS} ignored, |
81 |
* net-analyzer/nagios-nrpe - ${LDFLAGS} ignored, |
82 |
* net-analyzer/nipper - ${LDFLAGS} ignored, '-o' after sources, |
83 |
* net-analyzer/ttcp - ${LDFLAGS} ignored, |
84 |
* net-dns/bind-dns-keygen - ${LDFLAGS} ignored, |
85 |
* net-dns/tinystats - ${LDFLAGS} after '-o', |
86 |
* net-fs/mount-cifs - ${LDFLAGS} ignored, |
87 |
* net-fs/samba-client, |
88 |
* net-im/bitlbee - ${LDFLAGS} ignored, |
89 |
* net-irc/ircd-hybrid - ${LDFLAGS} ignored, |
90 |
* net-mail/qmailanalog - ${LDFLAGS} ignored, '-o' after sources, |
91 |
* net-misc/connect, |
92 |
* net-misc/{datapipe,getdate} - ${LDFLAGS} ignored, |
93 |
* net-misc/ifenslave, |
94 |
* net-print/cups-pdf - ${LDFLAGS} ignored, |
95 |
* net-print/poster - ${LDFLAGS} ignored, '-o' after libs, |
96 |
* sci-biology/consed - ${LDFLAGS} ignored, '-o' after sources, |
97 |
* sci-chemistry/imosflm - separate compiling and linking, einfo printing, |
98 |
* sci-libs/ufconfig - separate compiling and linking, |
99 |
* sys-apps/netboot-base - ${LDFLAGS} ignored, |
100 |
* sys-apps/usb_modeswitch, |
101 |
* sys-apps/util-linux - (configure-like check), |
102 |
* sys-block/lsiutil, |
103 |
* sys-devel/gcc-config, |
104 |
* x11-libs/gl2ps - separate compiling and linking, |
105 |
* x11-misc/blockdpy, |
106 |
* x11-misc/xidle - echoing, using eval. |
107 |
|
108 |
And that's all for gentoo-x86 -- that's over 80 packages, with over 30 |
109 |
ignoring ${LDFLAGS}, not counting lesser issues. There's also 5 similar |
110 |
packages in Sunrise. |
111 |
|
112 |
I think that number is large enough to seriously consider adding such |
113 |
functions into toolchain-funcs.eclass. I'm attaching an example implementation |
114 |
(as a diff to toolchain-funcs.eclass) and a diff to a sample ebuild |
115 |
(zpaq-1.10.ebuild from Sunrise, in particular). |
116 |
|
117 |
Please notice that I'm not really attached to the calling syntax I used there, |
118 |
and I'm open to hear better ideas. I've decided to pass all additional |
119 |
arguments (flags) through environmental variables to allow user to intuitively |
120 |
supply long input file lists. |
121 |
|
122 |
-- |
123 |
Best regards, |
124 |
Michał Górny |
125 |
|
126 |
<http://mgorny.alt.pl> |
127 |
<xmpp:mgorny@××××××.ru> |