如何编写具有 LINGUAS 支持的 Gentoo ebuild 文件
我想为一些二进制包编写一个ebuild,它包含一个不同语言的文件夹,其结构是:
ls /路径/po:
de fr ja zh_CN zh_TW
我觉得很容易做到,但是Gentoo提供的文档实在是有限,如何过滤掉不需要的语言文件呢?我不应该将所有这些复制到 /usr/share/locale 。
=================================================== ========
@Updates:
我发现了一个简单的方法,它检查 ${LANGUAS} 变量, 就像下面的代码:
insinto /usr/share/locale
for x in "${LANGUAS}";do
if [[ -d "po/${x}" ]];then
doins "po/${x}"
else
einfo "LANGUAGE $x is not supported by this app"
fi
done
只是想知道这是否是官方方法。
I wanted to write a ebuild for some binary package , it contains a folder for different languages , its structure is:
ls /path/po:
de fr ja zh_CN zh_TW
I think it's easy to do it , but the document provided by Gentoo is really limited , how can i filter the unnecessary language files ? I shouldn't be copying all those to /usr/share/locale.
==========================================================
@Updates:
I discovered a simple method , which examines ${LANGUAS} variable ,
like the following code:
insinto /usr/share/locale
for x in "${LANGUAS}";do
if [[ -d "po/${x}" ]];then
doins "po/${x}"
else
einfo "LANGUAGE $x is not supported by this app"
fi
done
Just wondering if it's official approach.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有官方的方法,因为它非常依赖于包。例如,某些包可能需要将附加参数传递给 ./configure,而其他包(例如您的包)则需要更多手动方法。
至于你上面的例子,我相信这是完全可以接受的。您尚未提供整个 ebuild,因此请记住您需要将可接受的语言添加到 IUSE 变量中。
例如,
对于更复杂的示例,您可以查看 openoffice-bin ebuild
There isn't an official approach as it is very package dependent. For example, some packages may require additional parameters to be passed to ./configure while others, like your, require a more manual approach.
As for your example above, I believe it to be perfectly acceptable. You haven't provided the whole ebuild so just remember that you need to be adding the acceptable languages into the IUSE var.
e.g.
For a more complicated example you could check out the openoffice-bin ebuild