Gentoo Development Guide

src_compile

Function src_compile
Purpose Configure and build the package.

Important

the configure parts of src_compile have been splitted out in EAPI=2 to src_configure. see src_configure

Sandbox Enabled
Privilege user
Called for ebuild

Default src_compile

with EAPI=0,1

src_compile() {
    if [ -x ./configure ]; then
        econf
    fi
    if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
        emake || die "emake failed"
    fi
}

with EAPI=2

src_compile() {
    if [ -f Makefile ] || [ -f GNUmakefile ] || [ -f makefile ]; then
        emake || die "emake failed"
    fi
}

Sample src_compile

with EAPI=0

src_compile() {
    use sparc && filter-flags -fomit-frame-pointer
    append-ldflags -Wl,-z,now

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

    emake || die "Make failed!"
}

Note

You also need to inherit the flag-o-matic eclass in order to use the append-ldflags function.

with EAPI=2

porting the above example to EAPI=2, you won't need to define an extra src_compile, as it only calls emake (which is the default src_compile function).

src_compile Processes

The following subsections cover different topics which often occur when writing src_compile functions.