LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1191|回复: 4

写了一个FlashGet的ebuild。。写得不好。希望大家能给点意见。。

[复制链接]
发表于 2010-9-6 13:34:08 | 显示全部楼层 |阅读模式
花了点时间写了一个ebuild。。我刚开始看教程。。参照着别的ebuild写的。。感觉写的很拙劣。。。希望大家能不吝赐教,谢谢!


flashget-1.0.3-r0.ebuild:
  1. # Copyright 1999-2010 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. # $Header: Exp $
  4. inherit versionator eutils
  5. MY_PF="${PN}-${PV}"
  6. DESCRIPTION="A popular multi-thread downloader"
  7. HOMEPAGE="http://www.flashget.com/cn/product_Linux.html"
  8. SRC_URI="http://bbs.flashget.com/download/${MY_PF}-0_cn.tar.gz"
  9. LICENSE="EULA"
  10. SLOT="0"
  11. KEYWORDS="~amd64 ~x86"
  12. #IUSE="firefox-embedded"
  13. RDEPEND="amd64? (
  14.         app-emulation/emul-linux-x86-compat
  15.         app-emulation/emul-linux-x86-baselibs
  16.         app-emulation/emul-linux-x86-gtklibs
  17. )"
  18. S="${WORKDIR}/${PN}-${PV}"
  19. SLIB="`whereis libexpat.so.|awk {'print $2'}`"
  20. src_install() {
  21.     exeinto "/opt/${PN}/bin/"
  22.     doexe "${S}/${PN}" || die "Failed to install flashget"
  23.     insinto "/opt/${PN}/share/"
  24.     doins "${S}/flashget.desktop"
  25.     doins "${S}/flashget.png"
  26.     doins "${S}/README"
  27. }
  28. pkg_postinst()
  29. {
  30.     einfo "Fixing libexpat problem"
  31.     if [ "$ARCH" = "amd64" ]; then
  32.         ln -s /usr/lib32/libexpat.so /usr/lib32/libexpat.so.0 2>/dev/null
  33.     else
  34.         ln -s ${SLIB} /usr/lib/libexpat.so.0 2>/dev/null
  35.     fi
  36.     einfo "Fixed"
  37.     einfo "Linking /opt/${PN}/bin/${PN} to /usr/bin/${PN}"
  38.     ln -sf /opt/${PN}/bin/${PN} /usr/bin/${PN}
  39.     ewarn "This is beta-version of FlashGet 1.0. It may fail to run on amd64 systems!"
  40.     einfo "To start flashget type: /opt/${PN}/bin/flashget or just flashget"
  41.     einfo "Enjoy and have fun!"
  42. }
  43. pkg_postrm()
  44. {
  45.     einfo "Unlinking /usr/bin/${PN}"
  46.     unlink /usr/bin/${PN}
  47. }
复制代码
发表于 2010-9-6 20:33:06 | 显示全部楼层
认真的看了一遍,src_install里的几个函数还没搞明白,要学习的东西还真多。
回复 支持 反对

使用道具 举报

发表于 2010-9-7 09:30:35 | 显示全部楼层
支持一下!:)
回复 支持 反对

使用道具 举报

发表于 2010-9-8 16:53:44 | 显示全部楼层
此ebuild已被收入[color="Blue"]gentoo-china-overlay[color="Blue"]r1339

不规范之处很多,可以用repoman检查。楼主应该看看Gentoo官方的[color="Blue"]开发手册

说下两个关键问题:
1. Gentoo下,应该将/opt下的可执行文件的链接放进/opt/bin(包含在PATH变量内)而不是/usr/bin里。
2. 提示信息(einfo或ewarn)应节俭,pkg_postinst()中的提示信息一般包括:升级带来的重大变动、必要的使用技巧,如果要说的太多可以附上一个链接。

此外,要写出优质的ebuild,还需遵守一定的代码标准,如:[color="Blue"]Sunrise overlay coding standards
回复 支持 反对

使用道具 举报

 楼主| 发表于 2010-9-9 09:39:00 | 显示全部楼层
好的。我会多看看文档的。谢谢!
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表