src_prepare

Function src_prepare
Purpose Prepare source packages and do any necessary patching or fixes.
Sandbox Enabled
Privilege user
Called for ebuild

Default src_prepare

Starting from EAPI=2, the src_prepare function is the appropriate area to perform any kind of patching and source code manipulation, instead of src_unpack.

src_prepare() {
	true;
}

Sample src_prepare

src_prepare() {
    epatch "${FILESDIR}/${PV}/${P}-fix-bogosity.patch"
    use pam && epatch "${FILESDIR}/${PV}/${P}-pam.patch"

    sed -i -e 's/"ispell"/"aspell"/' src/defaults.h || die "Sed failed!"
}

src_prepare Processes

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