如何更改基于自动工具的Bitbake配方的安装路径? [英] How can I change the installation path of an autotools-based Bitbake recipe?
问题描述
我有一个基于自动工具的BitBake食谱,我想在/usr/local/bin
中安装二进制文件,并在/usr/local/lib
中安装库(而不是默认目标目录/usr/bin
和/usr/lib
).
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).
这是我认为很重要的autotools.bbclass
文件的一部分.
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} \
...
我认为完成我想做的最简单的方法就是简单地将${bindir}
和${libdir}
更改,或者将${prefix}
更改为/usr/local
,但是我在这方面没有任何成功区域.有没有办法更改这些安装变量,或者我是否以错误的方式考虑了此问题?
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?
根据罗斯·伯顿(Ross Burton)的建议,我尝试在食谱中添加以下内容:
As per Ross Burton's suggestion, I've tried adding the following to my recipe:
prefix="/usr/local"
exec_prefix="/usr/local"
但这会导致在该配方的do_configure()
任务期间构建失败,并返回以下内容:
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
可以在没有这些已修改变量的常规构建过程中找到此软件包.我认为添加以下行可能会使系统找到glib的软件包元数据:
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.
我还尝试了Ross Burton的其他建议,将这些变量分配添加到我的发行版的配置文件中,但这导致它在meta/recipes-extended/tzdata
的do_install()
任务期间失败.它返回DEFAULT_TIMEZONE is set to an invalid value.
.这是tzdata_2015g.bb
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
我假设${datadir}
出现问题,它引用了${prefix}
.
I'm assuming that I've got a problem with ${datadir}
, which references ${prefix}
.
推荐答案
您要更改所有内容还是仅更改一个配方的路径?不确定为什么只想将一个食谱更改为/usr/local
,但是无论如何.
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.
如果要全部更改,则简单的方法是在local.conf
或发行版配置(prefix = "/usr/local"
)中设置prefix
.
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"
).
如果要在特定配方中执行此操作,则只需在配方中分配prefix="/usr/local"
和exec_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.
这些变量在meta/conf/bitbake.conf
中定义,您可以在其中看到bindir
是$exec_prefix/bin
,这可能就是为什么分配prefix
对您不起作用的原因.
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.
这篇关于如何更改基于自动工具的Bitbake配方的安装路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!