1 | # Copyright 1999-2010 Gentoo Foundation |
---|
2 | # Distributed under the terms of the GNU General Public License v2 |
---|
3 | # $Header: /var/cvsroot/gentoo-x86/net-p2p/mldonkey/mldonkey-3.0.1.ebuild,v 1.7 2010/01/13 15:02:32 ranger Exp $ |
---|
4 | |
---|
5 | EAPI="2" |
---|
6 | WANT_AUTOCONF=2.5 |
---|
7 | |
---|
8 | inherit flag-o-matic eutils autotools toolchain-funcs |
---|
9 | |
---|
10 | IUSE="doc fasttrack gd gnutella gtk guionly magic +ocamlopt" |
---|
11 | |
---|
12 | DESCRIPTION="MLDonkey is a multi-network P2P application written in Ocaml, coming with its own Gtk GUI, web and telnet interface." |
---|
13 | HOMEPAGE="http://mldonkey.sourceforge.net/" |
---|
14 | SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" |
---|
15 | |
---|
16 | LICENSE="GPL-2" |
---|
17 | SLOT="0" |
---|
18 | KEYWORDS="~alpha amd64 hppa ~ia64 ppc ~sparc x86 ~x86-fbsd" |
---|
19 | |
---|
20 | RDEPEND="dev-lang/perl |
---|
21 | guionly? ( >=gnome-base/librsvg-2.4.0 |
---|
22 | >=dev-ml/lablgtk-2.6 ) |
---|
23 | gtk? ( >=gnome-base/librsvg-2.4.0 |
---|
24 | >=dev-ml/lablgtk-2.6[svg] ) |
---|
25 | gd? ( >=media-libs/gd-2.0.28[truetype] ) |
---|
26 | magic? ( sys-apps/file )" |
---|
27 | |
---|
28 | DEPEND="${RDEPEND} |
---|
29 | >=dev-lang/ocaml-3.10.2[ocamlopt?] |
---|
30 | sys-apps/sed" |
---|
31 | |
---|
32 | MLUSER="p2p" |
---|
33 | |
---|
34 | pkg_setup() { |
---|
35 | if use gtk; then |
---|
36 | echo "" |
---|
37 | einfo "If the compile with gui fails, and you have updated Ocaml" |
---|
38 | einfo "recently, you may have forgotten that you need to run" |
---|
39 | einfo "/usr/portage/dev-lang/ocaml/files/ocaml-rebuild.sh" |
---|
40 | einfo "to learn which ebuilds you need to recompile" |
---|
41 | einfo "each time you update Ocaml to a different version" |
---|
42 | einfo "see the Ocaml ebuild for details" |
---|
43 | echo "" |
---|
44 | fi |
---|
45 | |
---|
46 | # dev-lang/ocaml creates its own objects but calls gcc for linking, which will |
---|
47 | # results in relocations if gcc wants to create a PIE executable |
---|
48 | if gcc-specs-pie ; then |
---|
49 | append-ldflags -nopie |
---|
50 | ewarn "Ocaml generates its own native asm, you're using a PIE compiler" |
---|
51 | ewarn "We have appended -nopie to ocaml build options" |
---|
52 | ewarn "because linking an executable with pie while the objects are not pic will not work" |
---|
53 | fi |
---|
54 | } |
---|
55 | |
---|
56 | src_prepare() { |
---|
57 | cd "${S}"/config |
---|
58 | eautoconf |
---|
59 | cd "${S}" |
---|
60 | use ocamlopt || sed -i -e "s/ocamlopt/idontwantocamlopt/g" "${S}/config/configure" || die "failed to disable ocamlopt" |
---|
61 | } |
---|
62 | |
---|
63 | src_configure() { |
---|
64 | # the dirs are not (yet) used, but it doesn't hurt to specify them anyway |
---|
65 | |
---|
66 | # onlygui Disable all nets support, build only chosen GUI |
---|
67 | |
---|
68 | if use gtk || use guionly; then |
---|
69 | myconf="--enable-gui=newgui2" |
---|
70 | else |
---|
71 | myconf="--disable-gui" |
---|
72 | fi |
---|
73 | |
---|
74 | if use guionly; then |
---|
75 | myconf="${myconf} --disable-multinet --disable-donkey" |
---|
76 | fi |
---|
77 | |
---|
78 | cd "${S}" |
---|
79 | econf \ |
---|
80 | --sysconfdir=/etc/mldonkey \ |
---|
81 | --sharedstatedir=/var/mldonkey \ |
---|
82 | --localstatedir=/var/mldonkey \ |
---|
83 | --enable-checks \ |
---|
84 | --disable-batch \ |
---|
85 | $(use_enable fasttrack) \ |
---|
86 | $(use_enable gnutella) \ |
---|
87 | $(use_enable gnutella gnutella2) \ |
---|
88 | $(use_enable gd) \ |
---|
89 | $(use_enable magic) \ |
---|
90 | --enable-ocamlver=3.10 \ |
---|
91 | ${myconf} || die "econf failed" |
---|
92 | } |
---|
93 | |
---|
94 | src_compile() { |
---|
95 | export OCAMLRUNPARAM="l=256M" |
---|
96 | emake || die "emake failed" |
---|
97 | |
---|
98 | if ! use guionly; then |
---|
99 | emake utils || die "emake utils failed" |
---|
100 | fi; |
---|
101 | } |
---|
102 | |
---|
103 | src_install() { |
---|
104 | local myext="" |
---|
105 | use ocamlopt || myext=".byte" |
---|
106 | use ocamlopt || export STRIP_MASK="*/bin/*" |
---|
107 | if ! use guionly; then |
---|
108 | for i in mlnet mld_hash get_range copysources make_torrent subconv; do |
---|
109 | newbin $i$myext $i || die "failed to install $i" |
---|
110 | done |
---|
111 | |
---|
112 | newconfd "${FILESDIR}/mldonkey.confd-2.8" mldonkey |
---|
113 | fperms 600 /etc/conf.d/mldonkey |
---|
114 | newinitd "${FILESDIR}/mldonkey.initd" mldonkey |
---|
115 | fi |
---|
116 | |
---|
117 | if use gtk; then |
---|
118 | for i in mlgui mlguistarter; do |
---|
119 | newbin $i$myext $i || die "failed to install $i" |
---|
120 | done |
---|
121 | make_desktop_entry mlgui "MLDonkey GUI" mldonkey "Network;P2P" |
---|
122 | newicon "${S}"/packages/rpm/mldonkey-icon-48.png ${PN}.png |
---|
123 | fi |
---|
124 | |
---|
125 | if use doc ; then |
---|
126 | cd "${S}"/distrib |
---|
127 | dodoc ChangeLog *.txt |
---|
128 | dohtml *.html |
---|
129 | |
---|
130 | insinto /usr/share/doc/${PF}/scripts |
---|
131 | doins kill_mldonkey mldonkey_command mldonkey_previewer make_buginfo |
---|
132 | |
---|
133 | cd "${S}"/docs |
---|
134 | dodoc *.txt *.tex *.pdf |
---|
135 | dohtml *.html |
---|
136 | |
---|
137 | cd "${S}"/docs/developers |
---|
138 | dodoc *.txt *.tex |
---|
139 | |
---|
140 | cd "${S}"/docs/images |
---|
141 | insinto /usr/share/doc/${PF}/html/images |
---|
142 | doins * |
---|
143 | fi |
---|
144 | } |
---|
145 | |
---|
146 | pkg_preinst() { |
---|
147 | if ! use guionly; then |
---|
148 | enewuser ${MLUSER} -1 -1 /home/p2p users |
---|
149 | fi |
---|
150 | } |
---|
151 | |
---|
152 | pkg_postinst() { |
---|
153 | if ! use guionly; then |
---|
154 | echo |
---|
155 | einfo "If you want to start MLDonkey as a system service, use" |
---|
156 | einfo "the /etc/init.d/mldonkey script. To control bandwidth, use" |
---|
157 | einfo "the 'slow' and 'fast' arguments. Be sure to have a look at" |
---|
158 | einfo "/etc/conf.d/mldonkey also." |
---|
159 | echo |
---|
160 | einfo "Attention: 2.6 has changed the inifiles structure, so downgrading" |
---|
161 | einfo "will be problematic." |
---|
162 | einfo "User settings (admin) are transferred to users.ini from " |
---|
163 | einfo "downloads.ini" |
---|
164 | einfo "Old ini files are automatically converted to the new format" |
---|
165 | echo |
---|
166 | else |
---|
167 | echo |
---|
168 | einfo "Simply run mlgui to start the chosen MLDonkey gui." |
---|
169 | einfo "It puts its config files into ~/.mldonkey" |
---|
170 | fi |
---|
171 | } |
---|