1 # Copyright 1999-2015 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
8 inherit flag-o-matic eutils autotools toolchain-funcs user
10 IUSE="bittorrent doc fasttrack gd gnutella gtk guionly magic +ocamlopt"
12 DESCRIPTION="A multi-network P2P application written in Ocaml, with its own Gtk GUI, web and telnet interface"
13 HOMEPAGE="http://mldonkey.sourceforge.net/"
14 SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2"
18 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~sparc ~x86 ~x86-fbsd"
20 RDEPEND="dev-lang/perl
22 guionly? ( >=gnome-base/librsvg-2.4.0
23 >=dev-ml/lablgtk-2.6 )
24 gtk? ( >=gnome-base/librsvg-2.4.0
25 >=dev-ml/lablgtk-2.6[svg] )
26 gd? ( >=media-libs/gd-2.0.28[truetype] )
27 magic? ( sys-apps/file )"
30 >=dev-lang/ocaml-3.10.2[ocamlopt?]"
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"
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
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"
60 use ocamlopt || sed -i -e "s/ocamlopt/idontwantocamlopt/g" "${S}/config/configure" || die "failed to disable ocamlopt"
61 epatch "${FILESDIR}/ocaml4.patch"
65 # the dirs are not (yet) used, but it doesn't hurt to specify them anyway
67 # onlygui Disable all nets support, build only chosen GUI
69 if use gtk || use guionly; then
70 myconf="--enable-gui=newgui2"
72 myconf="--disable-gui"
76 myconf="${myconf} --disable-multinet --disable-donkey"
86 econf LIBS="${my_extra_libs}"\
87 --sysconfdir=/etc/mldonkey \
88 --sharedstatedir=/var/mldonkey \
89 --localstatedir=/var/mldonkey \
92 $(use_enable bittorrent) \
93 $(use_enable fasttrack) \
94 $(use_enable gnutella) \
95 $(use_enable gnutella gnutella2) \
102 export OCAMLRUNPARAM="l=256M"
105 if ! use guionly; then
112 use ocamlopt || myext=".byte"
113 use ocamlopt || export STRIP_MASK="*/bin/*"
114 if ! use guionly; then
115 for i in mlnet mld_hash get_range copysources subconv; do
118 use bittorrent && newbin make_torrent$myext make_torrent
120 newconfd "${FILESDIR}/mldonkey.confd-2.8" mldonkey
121 fperms 600 /etc/conf.d/mldonkey
122 newinitd "${FILESDIR}/mldonkey.initd" mldonkey
126 for i in mlgui mlguistarter; do
129 make_desktop_entry mlgui "MLDonkey GUI" mldonkey "Network;P2P"
130 newicon "${S}"/packages/rpm/mldonkey-icon-48.png ${PN}.png
135 dodoc ChangeLog *.txt
137 insinto /usr/share/doc/${PF}/scripts
138 doins kill_mldonkey mldonkey_command mldonkey_previewer make_buginfo
141 dodoc *.txt *.tex *.pdf
144 cd "${S}"/docs/developers
147 cd "${S}"/docs/images
148 insinto /usr/share/doc/${PF}/html/images
154 if ! use guionly; then
155 enewuser ${MLUSER} -1 -1 /home/p2p users
160 if ! use guionly; then
162 einfo "If you want to start MLDonkey as a system service, use"
163 einfo "the /etc/init.d/mldonkey script. To control bandwidth, use"
164 einfo "the 'slow' and 'fast' arguments. Be sure to have a look at"
165 einfo "/etc/conf.d/mldonkey also."
169 einfo "Simply run mlgui to start the chosen MLDonkey gui."
170 einfo "It puts its config files into ~/.mldonkey"