1 # Copyright 1999-2018 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
6 inherit versionator flag-o-matic eutils autotools toolchain-funcs user
8 IUSE="bittorrent doc fasttrack gd gnutella gtk guionly magic +ocamlopt upnp"
10 DESCRIPTION="Multi-network P2P application written in Ocaml, with Gtk, web & telnet interface"
11 HOMEPAGE="http://mldonkey.sourceforge.net/"
12 SRC_URI="https://github.com/ygrek/mldonkey/releases/download/release-$(replace_all_version_separators '-')/${P}.tar.bz2"
16 KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~ppc ~ppc64 ~sparc ~x86 ~x86-fbsd"
18 RDEPEND="dev-lang/perl
20 guionly? ( >=gnome-base/librsvg-2.4.0
21 >=dev-ml/lablgtk-2.6 )
22 gtk? ( >=gnome-base/librsvg-2.4.0
23 >=dev-ml/lablgtk-2.6[svg] )
24 gd? ( >=media-libs/gd-2.0.28[truetype] )
25 magic? ( sys-apps/file )
26 upnp? ( net-libs/miniupnpc:= net-libs/libnatpmp:= )
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"
66 # the dirs are not (yet) used, but it doesn't hurt to specify them anyway
68 # onlygui Disable all nets support, build only chosen GUI
70 if use gtk || use guionly; then
71 myconf="--enable-gui=newgui2"
73 myconf="--disable-gui"
77 myconf="${myconf} --disable-multinet --disable-donkey"
87 econf LIBS="${my_extra_libs}"\
88 --sysconfdir=/etc/mldonkey \
89 --sharedstatedir=/var/mldonkey \
90 --localstatedir=/var/mldonkey \
93 $(use_enable bittorrent) \
94 $(use_enable fasttrack) \
95 $(use_enable gnutella) \
96 $(use_enable gnutella gnutella2) \
99 $(use_enable upnp upnp-natpmp) \
100 --disable-force-upnp-natpmp \
105 export OCAMLRUNPARAM="l=256M"
108 if ! use guionly; then
115 use ocamlopt || myext=".byte"
116 use ocamlopt || export STRIP_MASK="*/bin/*"
117 if ! use guionly; then
118 for i in mlnet mld_hash get_range copysources subconv; do
121 use bittorrent && newbin make_torrent$myext make_torrent
123 newconfd "${FILESDIR}/mldonkey.confd-2.8" mldonkey
124 fperms 600 /etc/conf.d/mldonkey
125 newinitd "${FILESDIR}/mldonkey.initd" mldonkey
129 for i in mlgui mlguistarter; do
132 make_desktop_entry mlgui "MLDonkey GUI" mldonkey "Network;P2P"
133 newicon "${S}"/packages/rpm/mldonkey-icon-48.png ${PN}.png
138 dodoc ChangeLog *.txt
140 insinto /usr/share/doc/${PF}/scripts
141 doins kill_mldonkey mldonkey_command mldonkey_previewer make_buginfo
144 dodoc *.txt *.tex *.pdf
147 cd "${S}"/docs/developers
150 cd "${S}"/docs/images
151 insinto /usr/share/doc/${PF}/html/images
157 if ! use guionly; then
158 enewuser ${MLUSER} -1 -1 /home/p2p users
163 if ! use guionly; then
165 einfo "If you want to start MLDonkey as a system service, use"
166 einfo "the /etc/init.d/mldonkey script. To control bandwidth, use"
167 einfo "the 'slow' and 'fast' arguments. Be sure to have a look at"
168 einfo "/etc/conf.d/mldonkey also."
172 einfo "Simply run mlgui to start the chosen MLDonkey gui."
173 einfo "It puts its config files into ~/.mldonkey"