Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I change the installation path of an autotools-based Bitbake recipe?

I have an autotools-based BitBake recipe which I would like to have binaries installed in /usr/local/bin and libraries installed in /usr/local/lib (instead of /usr/bin and /usr/lib, which are the default target directories).

Here's a part of the autotools.bbclass file which I found important.

CONFIGUREOPTS = " --build=${BUILD_SYS} \
                  --host=${HOST_SYS} \
                  --target=${TARGET_SYS} \
                  --prefix=${prefix} \
                  --exec_prefix=${exec_prefix} \
                  --bindir=${bindir} \
                  --sbindir=${sbindir} \
                  --libexecdir=${libexecdir} \
                  --datadir=${datadir} \
                  --sysconfdir=${sysconfdir} \
                  --sharedstatedir=${sharedstatedir} \
                  --localstatedir=${localstatedir} \
                  --libdir=${libdir} \
                  ...

I thought that the easiest way to accomplish what I wanted to do would be to simply change ${bindir} and ${libdir}, or perhaps change ${prefix} to /usr/local, but I haven't had any success in this area. Is there a way to change these installation variables, or am I thinking about this in the wrong way?


Update:

Strategy 1

As per Ross Burton's suggestion, I've tried adding the following to my recipe:

prefix="/usr/local"
exec_prefix="/usr/local"

but this causes the build to fail during that recipe's do_configure() task, and returns the following:

| checking for GLIB... no
| configure: error: Package requirements (glib-2.0 >= 2.12.3) were not met:
| 
| No package 'glib-2.0' found

This package can be found during a normal build without these modified variables. I thought that adding the following line might allow the system to find the package metadata for glib:

PKG_CONFIG_PATH = " ${STAGING_DIR_HOST}/usr/lib/pkgconfig  "

but this seems to have made no difference.

Strategy 2

I've also tried Ross Burton's other suggestion to add these variable assignments into my distribution's configuration file, but this causes it to fail during meta/recipes-extended/tzdata's do_install() task. It returns that DEFAULT_TIMEZONE is set to an invalid value. Here's the source of the error from tzdata_2015g.bb

# Install default timezone
if [ -e ${D}${datadir}/zoneinfo/${DEFAULT_TIMEZONE} ]; then
    install -d ${D}${sysconfdir}
    echo ${DEFAULT_TIMEZONE} > ${D}${sysconfdir}/timezone
    ln -s ${datadir}/zoneinfo/${DEFAULT_TIMEZONE}      ${D}${sysconfdir}/localtime
else
    bberror "DEFAULT_TIMEZONE is set to an invalid value."
    exit 1
fi

I'm assuming that I've got a problem with ${datadir}, which references ${prefix}.

like image 962
karobar Avatar asked Feb 04 '16 16:02

karobar


People also ask

What is a BitBake recipe?

BitBake recipes specify how a particular package is built. Recipes consist of the source URL (http, https, ftp, cvs, svn, git, local file system) of the package, dependencies and compile or install options. They also store the metadata for the package in standard variables.

What is .BB file in yocto?

1.3. BitBake Recipes, which are denoted by the file extension . bb , are the most basic metadata files. These recipe files provide BitBake with the following: Descriptive information about the package. The version of the recipe.


1 Answers

Do you want to change paths for everything or just one recipe? Not sure why you'd want to change just one recipe to /usr/local, but whatever.

If you want to change all of them, then the simple way is to set prefix in your local.conf or distro configuration (prefix = "/usr/local").

If you want to do it in a particular recipe, then just assigning prefix="/usr/local" and exec_prefix="/usr/local" in the recipe will work.

These variables are defined in meta/conf/bitbake.conf, where you can see that bindir is $exec_prefix/bin, which is probably why assigning prefix didn't work for you.

like image 132
Ross Burton Avatar answered Oct 31 '22 16:10

Ross Burton