Difference between revisions of "HowTo Compile In Gentoo"

From AMule Project FAQ
Jump to: navigation, search
(amule-2.1.3.ebuild)
(The SVN ebuild - updated the ChangeLog)
 
(33 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
</center>
 
</center>
  
English version updated: 23.12.2007 - Newest Gentoo Version are now 2.1.3 as well that 2 CVS versions.
+
English version updated: 01.08.2009 - Newest Gentoo Version are now 2.2.5.
  
 
== Introduction ==
 
== Introduction ==
Gentoo is known for choices. Unfortunately, some choices require more labor than others. As such, [[aMule]] comes in a variety of versions and installation methods based on what version of [[WxWidgets|wxGTK]] you decide to use...
+
Gentoo is known for choices. As such, [[aMule]] comes in a variety of versions. This article will cover the installation of the last PORTAGE version, and of [[aMule SVN]] through a personal overlay.
 
+
Also, if you plan to build a GUI-less core, you might want to take a look at http://bugs.gentoo.org/show_bug.cgi?id=109515, comment #3 contains a patch for wxGTK-2.6 ebuild that removes the dependency on X.
+
  
 
== Methods of Installation ==
 
== Methods of Installation ==
=== amule-2.1.3.ebuild ===
+
=== amule-2.2.5.ebuild ===
This ebuild matches the 2.1.3 stable [[aMule]] release, it is available 13.10.2007 in portage.
+
This ebuild matches the 2.2.5 stable [[aMule]] release, it is available 28.08.2009 in portage.
  
Dependencies: >=x11-libs/wxGTK-2.6.*; >=sys-libs/zlib-1.2.1; >=media-libs/libpng-1.2.0 for remote support; >=media-libs/gd-2.0.26 for unicode support.
+
Dependencies: >=x11-libs/wxGTK-2.8*; >=dev-libs/crypto++-5.5.2; >=sys-libs/zlib-1.2.1
  
=== amule-cvs ===
+
Conditional dependencies: >=dev-libs/geoip for geoip support; >=net-libs/libupnp for Intel UPnP stack support; >=media-libs/libpng-1.2.0 for remote support; >=media-libs/gd-2.0.26 for unicode support and or statistic reporting.
This ebuild is marked as '''unstable''' for all architectures.
+
 
+
Not intended for the general public. If you'd like to test out the daily development snapshot, then this is the version for you.
+
 
+
Dependencies: >=x11-libs/wxGTK-2.6.* or 2.8.*; >=sys-libs/zlib-1.2.1; >=media-libs/gd-2.0.26; >=media-libs/libpng-1.2.0; devs-libs/geoip<br>
+
Status: In development; 2 versions in portage; the latest tarball need a personal portage overlay
+
  
 
== Installation instructions ==
 
== Installation instructions ==
=== amule-2.1.3.ebuild ===
 
1. Emerge package:
 
  emerge --sync
 
  emerge amule -pv
 
  emerge amule
 
 
=== amule CVS (portage) ===
 
Portage have 2 CVS ebuilds: amule-2.2.0_pre20070422.ebuild with wXgtk-2.6 support and amule-2.2.0_pre20071204.ebuild with wXgtk-2.8 support. Both are marked as '''unstable''' for all architectures.
 
 
====To install amule-2.2.0_pre20070422:====
 
1. Add to ''package.keywords'':
 
  echo "net-p2p/amule ~x86" >> /etc/portage/package.keywords
 
 
2. Review installation flags:
 
  emerge amule -pv
 
 
3. Modify ''/etc/portage/package.use'' to suit your needs :
 
  net-p2p/amule -amuled -debug gtk nls -remote -stats unicode
 
 
This would install amule without deamon and remote support.
 
To activate deamons and remote options, leave out the '-' like this:
 
 
  net-p2p/amule amuled -debug gtk nls remote -stats unicode
 
 
As aMule needs unicode support or it won't compile, you might also want to add a line to enable unicode in x11-libs/wxGTK
 
  x11-libs/wxGTK unicode
 
 
Personally, I have the unicode USE flag in /etc/make.conf so that any program that support unicode will be compiled with unicode support.
 
 
4. Install [[aMule]]:
 
  emerge amule
 
  
====To install amule-2.2.0_pre-20071204,====
+
=== amule-2.2.5.ebuild ===
we need to unmask wXgtk-2.8. Process like for amule-2.2.0_pre20070422, but with this supplementary step:
+
1. Show what will be done:
 +
  emerge -pv amule
 +
2. Adjust your USE flags for amule into ''/etc/portage/package.use
  
1. Unmask amule-2.2.0_pre-20071204 and wXgtk-2.8
+
3. Emerge amule:
   echo "=net-p2p/amule-2.2.0_pre20071204" >> /etc/portage/package.unmask
+
   emerge -a amule
  echo "=x11-libs/wxGTK-2.8.7.1" >> /etc/portage/package.unmask
+
  
=== amule CVS (latest one) ===
+
=== amule SVN ===
It is no ebuild for the current [[aMule CVS]] so we need to add one in portage. For that, we will make use of a personal portage overlay. If you don't already have one, just follow this HOWTO article: [http://gentoo-wiki.com/HOWTO_Installing_3rd_Party_Ebuilds HOWTO Installing 3rd Party Ebuilds]
+
It is no ebuild for the current [[aMule SVN]] so we need to add one in portage. For that, we will make use of a personal portage overlay. If you don't already have one, just follow this HOWTO article: [http://en.gentoo-wiki.com/wiki/Overlay#Creating_a_local_overlay Overlay: Creating_a_local_overlay]
  
We will also follow the naming scheme of portage. CVS ebuild from a CVS tarball are not named as '''package_name-cvs''' but as '''package_name-version_date_of_the_tarball'''. That is to distinguish them from real CVS ebuilds (the so called live ebuilds) named as '''package_name-9999''' and using keywords="".
+
We will also follow the naming scheme of portage. SVN ebuild from a SVN tarball are not named as '''package_name-SVN''' but as '''package_name-version_date_of_the_tarball'''. That is to distinguish them from real SVN ebuilds (the so called live ebuilds) named as '''package_name-9999''' and using keywords="". As aMule is using the revision to name the tarball, we will use it for the '''version_date_of_the_tarball'''.
  
 
1. Define ''PORTDIR_OVERLAY''. Open up ''/etc/make.conf'' with your favourite text editor and define the ''PORTDIR_OVERLAY'' variable. We will use:
 
1. Define ''PORTDIR_OVERLAY''. Open up ''/etc/make.conf'' with your favourite text editor and define the ''PORTDIR_OVERLAY'' variable. We will use:
 
   PORTDIR_OVERLAY="/usr/local/portage"
 
   PORTDIR_OVERLAY="/usr/local/portage"
  
2. Create overlay for amule-cvs:
+
2. Create overlay for amule-svn:
 
   mkdir -p /usr/local/net-p2p/amule
 
   mkdir -p /usr/local/net-p2p/amule
  
Line 80: Line 42:
 
   echo "net-p2p/amule ~x86" >> /etc/portage/package.keywords
 
   echo "net-p2p/amule ~x86" >> /etc/portage/package.keywords
  
4. Copy the following ebuild into ''{PORTDIR_OVERLAY}/net-p2p/amule/amule-2.2.0_p20071217.ebuild''
+
4. Copy the following ebuild into ''{PORTDIR_OVERLAY}/net-p2p/amule/amule-9732.ebuild''
  
I use here the tarball from 17 December 2007 that was working fine for me, but you can change the date like you want. I use '''p''' in order to distinguish this ebuild from the ones in portage (using '''pre''').  
+
I use here the tarball from 31 July 2009 revision 9732 that was working fine for me, but you can change the revision like you want. Be careful to choose a version number available on the [http://amule.sourceforge.net/tarballs/ tarballs page], otherwise your ebuild will fail.
  
  # Copyright 1999-2007 Gentoo Foundation
+
==== The SVN ebuild ====
 +
ChangeLog:
 +
* 01-08-2009 Initial SVN ebuild
 +
* 04-08-2009 Updated DEPEND + RDEPEND
 +
* 27-08-2009 Updated for the 2_2_X trunk
 +
* 12-04-2011 USE flag change
 +
* 16-04-2011 Updated to EAPI="3
 +
* 14-10-2011 Workaround debian specific test with USE=plasma
 +
* 04-05-2012 Plasma need kde4-base that need EAPI="3" (Change in portage?). Fix it.
 +
For more details, see the [http://forum.amule.org/index.php?topic=17143.0 forum thread].
 +
 
 +
  # Copyright 1999-2011 Gentoo Foundation
 
  # Distributed under the terms of the GNU General Public License v2
 
  # Distributed under the terms of the GNU General Public License v2
 
  # $Header: $
 
  # $Header: $
 
   
 
   
  inherit eutils flag-o-matic wxwidgets
+
  EAPI="3"
 
   
 
   
  MY_PN=${PN/m/M}
+
  inherit eutils flag-o-matic kde4-base wxwidgets
  MY_PV="${PV/2.2.0_p/}"
+
   
  S="${WORKDIR}/amule-cvs"
+
MY_P="aMule-SVN-r${PV}"
 +
  S="${WORKDIR}"/${MY_P}
 
   
 
   
 
  DESCRIPTION="aMule, the all-platform eMule p2p client"
 
  DESCRIPTION="aMule, the all-platform eMule p2p client"
 
  HOMEPAGE="http://www.amule.org/"
 
  HOMEPAGE="http://www.amule.org/"
  SRC_URI="http://www.hirnriss.net/files/cvs/${MY_PN}-CVS-${MY_PV}.tar.bz2"
+
  SRC_URI="http://amule.sourceforge.net/tarballs/${MY_P}.tar.bz2"
+
RESTRICT="nomirror"
+
 
   
 
   
 
  LICENSE="GPL-2"
 
  LICENSE="GPL-2"
 
  SLOT="0"
 
  SLOT="0"
 
  KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
 
  KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
  IUSE="amuled debug geoip gtk nls remote stats unicode"
+
  IUSE="daemon debug ed2k fileview geoip gtk mmap nls plasma remote static stats unicode upnp xchat"
 
   
 
   
  DEPEND="=x11-libs/wxGTK-2.8*
+
  RESTRICT="nomirror"
>=sys-libs/zlib-1.2.1
+
stats? ( >=media-libs/gd-2.0.26 )
+
geoip? ( dev-libs/geoip )
+
remote? ( >=media-libs/libpng-1.2.0
+
unicode? ( >=media-libs/gd-2.0.26 ) )"
+
 
   
 
   
  pkg_setup() {
+
  DEPEND="=x11-libs/wxGTK-2.8.12*
if ! use gtk && ! use remote && ! use amuled; then
+
>=dev-libs/crypto++-5.5.2
eerror ""
+
>=sys-libs/zlib-1.2.1
eerror "You have to specify at least one of gtk, remote or amuled"
+
stats? ( >=media-libs/gd-2.0.26[jpeg] )
eerror "USE flag to build amule."
+
geoip? ( dev-libs/geoip )
eerror ""
+
plasma? ( kde-base/kdelibs )
die "Invalid USE flag set"
+
upnp? ( >=net-libs/libupnp-1.6.6 )
fi
+
remote? ( >=media-libs/libpng-1.2.0
 +
unicode? ( >=media-libs/gd-2.0.26 ) )"
 
   
 
   
if use stats && ! use gtk; then
+
RDEPEND="$DEPEND
einfo "Note: You would need both the gtk and stats USE flags"
+
xchat? ( net-irc/xchat[perl] )"
einfo "to compile aMule Statistics GUI."
+
einfo "I will now compile console versions only."
+
fi
+
 
   
 
   
if use stats && ! built_with_use media-libs/gd jpeg; then
+
die "media-libs/gd should be compiled with the jpeg use flag when you have the stats use   flag set"
+
pkg_setup() {
  fi
+
if ! use gtk && ! use remote && ! use daemon; then
 +
eerror ""
 +
eerror "You have to specify at least one of gtk, remote or daemon"
 +
eerror "USE flag to build amule."
 +
eerror ""
 +
die "Invalid USE flag set"
 +
fi
 +
 +
if use stats && ! use gtk; then
 +
einfo "Note: You would need both the gtk and stats USE flags"
 +
  einfo "to compile aMule Statistics GUI."
 +
einfo "I will now compile console versions only."
 +
fi
 
  }
 
  }
 
   
 
   
 
  pkg_preinst() {
 
  pkg_preinst() {
  if use amuled || use remote; then
+
  if use daemon || use remote; then
 
  enewgroup p2p
 
  enewgroup p2p
 
  enewuser p2p -1 -1 /home/p2p p2p
 
  enewuser p2p -1 -1 /home/p2p p2p
Line 139: Line 116:
 
  }
 
  }
 
   
 
   
  src_compile() {
+
  src_configure() {
local myconf
+
local myconf
 
   
 
   
WX_GTK_VER="2.8"
+
WX_GTK_VER="2.8"
 
   
 
   
if use gtk; then
+
if use gtk; then
einfo "wxGTK with gtk support will be used"
+
einfo "wxGTK with gtk support will be used"
need-wxwidgets unicode
+
need-wxwidgets unicode
else
+
else
einfo "wxGTK without X support will be used"
+
einfo "wxGTK without X support will be used"
need-wxwidgets base
+
need-wxwidgets base
fi
+
fi
 
   
 
   
if use gtk ; then
+
if use gtk ; then
use stats && myconf="${myconf}
+
use stats && myconf="${myconf}
--enable-wxcas
+
--enable-wxcas
--enable-alc"
+
--enable-alc"
use remote && myconf="${myconf}
+
use remote && myconf="${myconf}
--enable-amule-gui"
+
--enable-amule-gui"
else
+
else
myconf="
+
myconf="
--disable-monolithic
+
--disable-monolithic
--disable-amule-gui
+
--disable-amule-gui
--disable-wxcas
+
--disable-wxcas
--disable-alc"
+
--disable-alc"
fi
+
fi
 
   
 
   
econf \
+
econf \
--with-wx-config=${WX_CONFIG} \
+
--with-wx-config=${WX_CONFIG} \
--with-wxbase-config=${WX_CONFIG} \
+
--enable-amulecmd \
--enable-amulecmd \
+
$(use_enable debug) \
$(use_enable debug) \
+
$(use_enable !debug optimize) \
$(use_enable !debug optimize) \
+
$(use_enable daemon amule-daemon) \
$(use_enable amuled amule-daemon) \
+
$(use_enable ed2k) \
$(use_enable geoip) \
+
$(use_enable fileview) \
$(use_enable nls) \
+
$(use_enable geoip) \
$(use_enable remote webserver) \
+
$(use_enable mmap) \
$(use_enable stats cas) \
+
$(use_enable nls) \
$(use_enable stats alcc) \
+
$(use_enable plasma plasmamule ) \
${myconf} || die
+
$(use_enable remote webserver) \
 +
$(use_enable static) \
 +
$(use_enable stats cas) \
 +
$(use_enable stats alcc) \
 +
$(use_enable upnp) \
 +
$(use_enable xchat xas) \
 +
${myconf} || die
 +
}
 
   
 
   
# we filter ssp until bug #74457 is closed to build on hardened
+
src_compile() {
filter-flags -fstack-protector -fstack-protector-all
+
cd ${S}
+
emake
emake -j1 || die
+
 
  }
 
  }
 
   
 
   
 
  src_install() {
 
  src_install() {
emake DESTDIR="${D}" install || die
+
emake DESTDIR="${D}" install || die
 
   
 
   
if use amuled; then
+
if use daemon; then
newconfd "${FILESDIR}"/amuled.confd amuled
+
newconfd "${FILESDIR}"/amuled.confd amuled
newinitd "${FILESDIR}"/amuled.initd amuled
+
newinitd "${FILESDIR}"/amuled.initd amuled
fi
+
fi
+
if use remote; then
if use remote; then
+
newconfd "${FILESDIR}"/amuleweb.confd amuleweb
newconfd "${FILESDIR}"/amuleweb.confd amuleweb
+
newinitd "${FILESDIR}"/amuleweb.initd amuleweb
newinitd "${FILESDIR}"/amuleweb.initd amuleweb
+
fi
fi
+
 
  }
 
  }
 
   
 
   
 +
  
 
5. Change directory:
 
5. Change directory:
 
   cd /usr/local/portage/net-p2p/amule/
 
   cd /usr/local/portage/net-p2p/amule/
  
6. Digest the ebuild:
+
6. Copy the files directory from PORTAGE:
   ebuild amule-2.2.0_p10071217.ebuild digest
+
   cp -r /usr/portage/net-p2p/amule/files files
  
7. Review installation flags:
+
7. Remove the unneeded files:
 +
  rm files/*.patch
 +
 
 +
8. Digest the ebuild:
 +
  ebuild amule-9732.ebuild digest
 +
 
 +
9. As you can see, this ebuild depend on x11-libs/wxGTK-2.8.12 which is not yet in portage. You can find it at [http://bugs.gentoo.org/show_bug.cgi?id=363319 Gentoo's Bugzilla – Bug 363319]. What you have to do is to dpwnload the ebuild from bugzilla and put it into the x11-libs/wxGTK directory of your overlay. You must also copy the files directory from PORTAGE and digest the ebuild:
 +
  cd /usr/local/portage/x11-libs/wxGTK
 +
  cp -r /usr/portage/x11-libs/wxGTK/files files
 +
  ebuild wxGTK-2.8.12.ebuild digest
 +
 
 +
10. Review installation flags:
 
   emerge amule -pv
 
   emerge amule -pv
  
8. Modify ''/etc/portage/package.use'' to suit your needs (please note that ''debug'' is enabled regardless of ''USE'' flag):
+
11. Modify ''/etc/portage/package.use'' to suit your needs (please note that ''debug'' is enabled regardless of ''USE'' flag):
 
   net-p2p/amule -amuled -debug geoip gtk nls -remote -stats unicode
 
   net-p2p/amule -amuled -debug geoip gtk nls -remote -stats unicode
  
Line 221: Line 215:
 
   x11-libs/wxGTK unicode
 
   x11-libs/wxGTK unicode
  
9. Install [[aMule CVS]]:
+
12. Install [[aMule SVN]]:
 
   emerge amule
 
   emerge amule
  
 
'''PLEASE''' do ''emerge amule -pv'' before installing to determine how you want to compile [[aMule]].
 
'''PLEASE''' do ''emerge amule -pv'' before installing to determine how you want to compile [[aMule]].
  
== aMule 2.1.1 Compilation FAQ ==
+
13. As other programs can depend on wxGTK, it can be a good opportunity to update your system as usual. emerge --sync, and so on as explained into the handbook.
When compiling aMule-2.1.1 on a hardened system with gcc-3.4.5(at least), it will fail with something like:
+
 
  WebServer.h: In member function `T* UpdatableItemsContainer<T, G, I>::GetByID(I) [with T = SharedFile, G = CEC_SharedFile_Tag, I = CMD4Hash]':
+
==== Possible crash ====
  WebServer.h:270: internal compiler error: in sweep_string_variable, at protector.c:1158
+
On my ~amd64 system, I get a crash at amule startup with recent libcrypto++ versions.
 +
To avoid it, mask it into /etc/portage/package.mask:
 +
  echo =dev-libs/crypto++-5.6.0 >> /etc/portage/package.mask
 +
echo =dev-libs/crypto++-5.6.0-r1 >> /etc/portage/package.mask
 +
  echo dev-libs/crypto++-5.6.1 >> /etc/portage/package.mask
 +
emerge -a crypto++ amule
 +
revdep-rebuild
 +
Revdep-rebuild didn't find anything into my system, but it is safer to run it anyway.
  
The possible problem is the -fPIE CFLAG because using `gcc-config` to select ''i386-pc-linux-gnu-3.4.5-hardenednopiessp'' fixed the problem, and you can even remove from the ebuild:
+
Another solution is to use the ebuild and the patch in [http://bugs.gentoo.org/show_bug.cgi?id=322713 bug 322713] for merging the last version of libcrypto++.
if has_hardened; then
+
    filter-flags -fstack-protector -fstack-protector-all
+
fi
+
  
You can read more on the subject following the link http://bugs.gentoo.org/show_bug.cgi?id=74457
+
'''Update:''' It look like to be fixed. If it should append again with the same crypto++ version, please ask to reopen this bug.

Latest revision as of 16:58, 9 May 2012

English | Deutsch | Español

English version updated: 01.08.2009 - Newest Gentoo Version are now 2.2.5.

Introduction

Gentoo is known for choices. As such, aMule comes in a variety of versions. This article will cover the installation of the last PORTAGE version, and of aMule SVN through a personal overlay.

Methods of Installation

amule-2.2.5.ebuild

This ebuild matches the 2.2.5 stable aMule release, it is available 28.08.2009 in portage.

Dependencies: >=x11-libs/wxGTK-2.8*; >=dev-libs/crypto++-5.5.2; >=sys-libs/zlib-1.2.1

Conditional dependencies: >=dev-libs/geoip for geoip support; >=net-libs/libupnp for Intel UPnP stack support; >=media-libs/libpng-1.2.0 for remote support; >=media-libs/gd-2.0.26 for unicode support and or statistic reporting.

Installation instructions

amule-2.2.5.ebuild

1. Show what will be done:

 emerge -pv amule

2. Adjust your USE flags for amule into /etc/portage/package.use

3. Emerge amule:

 emerge -a amule

amule SVN

It is no ebuild for the current aMule SVN so we need to add one in portage. For that, we will make use of a personal portage overlay. If you don't already have one, just follow this HOWTO article: Overlay: Creating_a_local_overlay

We will also follow the naming scheme of portage. SVN ebuild from a SVN tarball are not named as package_name-SVN but as package_name-version_date_of_the_tarball. That is to distinguish them from real SVN ebuilds (the so called live ebuilds) named as package_name-9999 and using keywords="". As aMule is using the revision to name the tarball, we will use it for the version_date_of_the_tarball.

1. Define PORTDIR_OVERLAY. Open up /etc/make.conf with your favourite text editor and define the PORTDIR_OVERLAY variable. We will use:

 PORTDIR_OVERLAY="/usr/local/portage"

2. Create overlay for amule-svn:

 mkdir -p /usr/local/net-p2p/amule

3. Add to package.keywords:

 echo "net-p2p/amule ~x86" >> /etc/portage/package.keywords

4. Copy the following ebuild into {PORTDIR_OVERLAY}/net-p2p/amule/amule-9732.ebuild

I use here the tarball from 31 July 2009 revision 9732 that was working fine for me, but you can change the revision like you want. Be careful to choose a version number available on the tarballs page, otherwise your ebuild will fail.

The SVN ebuild

ChangeLog:

  • 01-08-2009 Initial SVN ebuild
  • 04-08-2009 Updated DEPEND + RDEPEND
  • 27-08-2009 Updated for the 2_2_X trunk
  • 12-04-2011 USE flag change
  • 16-04-2011 Updated to EAPI="3
  • 14-10-2011 Workaround debian specific test with USE=plasma
  • 04-05-2012 Plasma need kde4-base that need EAPI="3" (Change in portage?). Fix it.

For more details, see the forum thread.

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit eutils flag-o-matic kde4-base wxwidgets

MY_P="aMule-SVN-r${PV}"
S="${WORKDIR}"/${MY_P}

DESCRIPTION="aMule, the all-platform eMule p2p client"
HOMEPAGE="http://www.amule.org/"
SRC_URI="http://amule.sourceforge.net/tarballs/${MY_P}.tar.bz2"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha ~amd64 ~hppa ~ppc ~ppc64 ~sparc ~x86"
IUSE="daemon debug ed2k fileview geoip gtk mmap nls plasma remote static stats unicode upnp xchat"

RESTRICT="nomirror"

DEPEND="=x11-libs/wxGTK-2.8.12*
	>=dev-libs/crypto++-5.5.2
	>=sys-libs/zlib-1.2.1
	stats? ( >=media-libs/gd-2.0.26[jpeg] )
	geoip? ( dev-libs/geoip )
	plasma? ( kde-base/kdelibs )
	upnp? ( >=net-libs/libupnp-1.6.6 )
	remote? ( >=media-libs/libpng-1.2.0
	unicode? ( >=media-libs/gd-2.0.26 ) )"

RDEPEND="$DEPEND
	xchat? ( net-irc/xchat[perl] )"


pkg_setup() {
	if ! use gtk && ! use remote && ! use daemon; then
		eerror ""
		eerror "You have to specify at least one of gtk, remote or daemon"
		eerror "USE flag to build amule."
		eerror ""
		die "Invalid USE flag set"
	fi

	if use stats && ! use gtk; then
		einfo "Note: You would need both the gtk and stats USE flags"
		einfo "to compile aMule Statistics GUI."
		einfo "I will now compile console versions only."
	fi
}

pkg_preinst() {
	if use daemon || use remote; then
		enewgroup p2p
		enewuser p2p -1 -1 /home/p2p p2p
	fi
}

src_configure() {
	local myconf

	WX_GTK_VER="2.8"

	if use gtk; then
		einfo "wxGTK with gtk support will be used"
		need-wxwidgets unicode
	else
		einfo "wxGTK without X support will be used"
		need-wxwidgets base
	fi

	if use gtk ; then
		use stats && myconf="${myconf}
			--enable-wxcas
			--enable-alc"
		use remote && myconf="${myconf}
			--enable-amule-gui"
	else
		myconf="
			--disable-monolithic
			--disable-amule-gui
			--disable-wxcas
			--disable-alc"
	fi

	econf \
		--with-wx-config=${WX_CONFIG} \
		--enable-amulecmd \
		$(use_enable debug) \
		$(use_enable !debug optimize) \
		$(use_enable daemon amule-daemon) \
		$(use_enable ed2k) \
		$(use_enable fileview) \
		$(use_enable geoip) \
		$(use_enable mmap) \
		$(use_enable nls) \
		$(use_enable plasma plasmamule ) \
		$(use_enable remote webserver) \
		$(use_enable static) \
		$(use_enable stats cas) \
		$(use_enable stats alcc) \
		$(use_enable upnp) \
		$(use_enable xchat xas) \
		${myconf} || die
}

src_compile() {
	cd ${S}
	emake
}

src_install() {
	emake DESTDIR="${D}" install || die

	if use daemon; then
		newconfd "${FILESDIR}"/amuled.confd amuled
		newinitd "${FILESDIR}"/amuled.initd amuled
	fi
	if use remote; then
		newconfd "${FILESDIR}"/amuleweb.confd amuleweb
		newinitd "${FILESDIR}"/amuleweb.initd amuleweb
	fi
}


5. Change directory:

 cd /usr/local/portage/net-p2p/amule/

6. Copy the files directory from PORTAGE:

 cp -r /usr/portage/net-p2p/amule/files files

7. Remove the unneeded files:

 rm files/*.patch

8. Digest the ebuild:

 ebuild amule-9732.ebuild digest

9. As you can see, this ebuild depend on x11-libs/wxGTK-2.8.12 which is not yet in portage. You can find it at Gentoo's Bugzilla – Bug 363319. What you have to do is to dpwnload the ebuild from bugzilla and put it into the x11-libs/wxGTK directory of your overlay. You must also copy the files directory from PORTAGE and digest the ebuild:

 cd /usr/local/portage/x11-libs/wxGTK
 cp -r /usr/portage/x11-libs/wxGTK/files files
 ebuild wxGTK-2.8.12.ebuild digest

10. Review installation flags:

 emerge amule -pv

11. Modify /etc/portage/package.use to suit your needs (please note that debug is enabled regardless of USE flag):

 net-p2p/amule -amuled -debug geoip gtk nls -remote -stats unicode

This would install amule without deamon and remote support. To activate deamons and remote options, leave out the '-' like this:

 net-p2p/amule amuled -debug geoip gtk nls remote -stats unicode

As aMule needs unicode support or it won't compile, you might also want to add a line to enable unicode in x11-libs/wxGTK

 x11-libs/wxGTK unicode

12. Install aMule SVN:

 emerge amule

PLEASE do emerge amule -pv before installing to determine how you want to compile aMule.

13. As other programs can depend on wxGTK, it can be a good opportunity to update your system as usual. emerge --sync, and so on as explained into the handbook.

Possible crash

On my ~amd64 system, I get a crash at amule startup with recent libcrypto++ versions. To avoid it, mask it into /etc/portage/package.mask:

echo =dev-libs/crypto++-5.6.0 >> /etc/portage/package.mask
echo =dev-libs/crypto++-5.6.0-r1 >> /etc/portage/package.mask
echo dev-libs/crypto++-5.6.1 >> /etc/portage/package.mask
emerge -a crypto++ amule
revdep-rebuild

Revdep-rebuild didn't find anything into my system, but it is safer to run it anyway.

Another solution is to use the ebuild and the patch in bug 322713 for merging the last version of libcrypto++.

Update: It look like to be fixed. If it should append again with the same crypto++ version, please ask to reopen this bug.