aboutsummaryrefslogtreecommitdiff
blob: ef713aab5b879627341615237b7dbb763f7795a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?xml version="1.0"?>
<guide self="ebuild-writing/functions/src_compile/">
<chapter>
<title>src_compile</title>

<body>
<table>
  <tr>
    <th>Function</th>
    <ti><c>src_compile</c></ti>
  </tr>
  <tr>
    <th>Purpose</th>
    <ti>Configure and build the package.<important>the configure parts of <c>src_compile</c> have been splitted out in EAPI=2 to <c>src_configure</c>. see <uri link="::ebuild-writing/functions/src_configure"/></important></ti>
  </tr>
  <tr>
    <th>Sandbox</th>
    <ti>Enabled</ti>
  </tr>
  <tr>
    <th>Privilege</th>
    <ti>user</ti>
  </tr>
  <tr>
    <th>Called for</th>
    <ti>ebuild</ti>
  </tr>
</table>
</body>

<section>
<title>Default <c>src_compile</c></title>
<body>
<subsection>
<title>with EAPI=0,1</title>
<body>
<codesample lang="ebuild">
src_compile() {
	if [ -x ./configure ]; then
		econf
	fi
	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
		emake || die "emake failed"
	fi
}
</codesample>
</body>
</subsection>
<subsection>
<title>with EAPI=2</title>
<body>
<codesample lang="ebuild">
src_compile() {
	if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
		emake || die "emake failed"
	fi
}
</codesample>
</body>
</subsection>
</body>
</section>

<section>
<title>Sample <c>src_compile</c></title>
<body>
<subsection>
<title>with EAPI=0</title>
<body>
<codesample lang="ebuild">
src_compile() {
	use sparc &amp;&amp; filter-flags -fomit-frame-pointer
	append-ldflags -Wl,-z,now

	econf \
		$(use_enable ssl ) \
		$(use_enable perl perlinterp )

	emake || die "Make failed!"
}
</codesample>
<note>
You also need to inherit the <uri link="::eclass-reference/flag-o-matic.eclass/">flag-o-matic</uri> eclass in order to use the <c>append-ldflags</c> function.
</note>
</body>
</subsection>
<subsection>
<title>with EAPI=2</title>
<body>
<p>
porting the above example to EAPI=2, you won't need to define an extra
<c>src_compile</c>, as it only calls <c>emake</c> (which is the default
<c>src_compile</c> function).
</p>
</body>
</subsection>
</body>
</section>

<section>
<title><c>src_compile</c> Processes</title>
<body>
<p>
The following subsections cover different topics which often occur when writing
<c>src_compile</c> functions.
</p>

<contentsTree/>
</body>
</section>

</chapter>

<include href="build-environment/"/>
<!--<include href="configuring/"/>-->
<include href="building/"/>
<include href="no-build-system/"/>
</guide>