summaryrefslogtreecommitdiff
path: root/net-p2p/amule/amule-3.0.1.ebuild
blob: f523ee3db75336a98772f7b371c40e046e2f1c39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8

WX_GTK_VER="3.2-gtk3"

inherit cmake flag-o-matic wxwidgets xdg-utils

if [[ ${PV} == 9999 ]] ; then
	EGIT_REPO_URI="https://github.com/amule-org/amule"
	inherit git-r3
else
	SRC_URI="https://github.com/amule-org/amule/archive/refs/tags/${PV}.tar.gz -> ${P}.tar.gz"
	KEYWORDS="~alpha amd64 ~arm ~mips ppc ppc64 ~riscv ~sparc ~x86"
fi

DESCRIPTION="aMule, the all-platform eMule p2p client"
HOMEPAGE="https://amule-org.github.io/"

LICENSE="GPL-2+"
SLOT="0"
IUSE="bfd daemon debug geoip +gui nls remote stats test upnp"
# Make the package useful and simplify dependency management
REQUIRED_USE="|| ( daemon gui remote )"

RESTRICT="!test? ( test )"

RDEPEND="
	dev-libs/crypto++:=
	sys-libs/readline:0=
	virtual/zlib:=
	x11-libs/wxGTK:${WX_GTK_VER}=[curl]
	bfd? ( sys-libs/binutils-libs:0= )
	daemon? (
		acct-user/amule
		dev-libs/boost:=
	)
	gui? (
		dev-libs/boost:=
		x11-libs/wxGTK:${WX_GTK_VER}=[X]
		geoip? ( dev-libs/libmaxminddb )
	)
	nls? ( virtual/libintl )
	remote? (
		acct-user/amule
		media-libs/libpng:0=
	)
	stats? ( media-libs/gd:=[jpeg,png] )
	upnp? ( net-libs/libupnp:0= )
"
BDEPEND="
	virtual/pkgconfig
	nls? ( sys-devel/gettext )
"

PATCHES=(
	"${FILESDIR}/${P}-32-bit-libatomic.patch"
	"${FILESDIR}"/${P}-gcc16-lto.patch
)

src_configure() {
	setup-wxwidgets

	use debug || append-cppflags -DwxDEBUG_LEVEL=0
	CMAKE_BUILD_TYPE=$(usex debug Debug ${CMAKE_BUILD_TYPE})

	local mycmakeargs=(
		-DBUILD_ALCC=YES
		-DBUILD_ED2K=YES
		-DDEFAULT_VERSION_CHECK=NO
		-DBUILD_ALC="$(usex gui)"
		-DBUILD_AMULECMD="$(usex remote)"
		-DBUILD_DAEMON="$(usex daemon)"
		-DBUILD_CAS="$(usex stats)"
		-DBUILD_MONOLITHIC="$(usex gui)"
		-DBUILD_TESTING="$(usex test)"
		-DBUILD_WEBSERVER="$(usex remote)"
		-DENABLE_BFD="$(usex bfd)"
		-DENABLE_NLS="$(usex nls)"
		-DENABLE_UPNP="$(usex upnp)"
	)

	if use gui; then
		mycmakeargs+=(
			-DBUILD_REMOTEGUI="$(usex remote)"
			-DBUILD_WXCAS="$(usex stats)"
			-DENABLE_IP2COUNTRY="$(usex geoip)"
		)
	else
		mycmakeargs+=(
			-DBUILD_REMOTEGUI=NO
			-DBUILD_WXCAS=NO
			-DENABLE_IP2COUNTRY=NO
		)
	fi

	cmake_src_configure
}

src_install() {
	cmake_src_install

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

	if use daemon || use remote; then
		keepdir /var/lib/${PN}
		fowners amule:amule /var/lib/${PN}
		fperms 0750 /var/lib/${PN}
	fi
}

pkg_postinst() {
	if use gui; then
		xdg_desktop_database_update
		xdg_icon_cache_update
	fi
}

pkg_postrm() {
	if use gui; then
		xdg_desktop_database_update
		xdg_icon_cache_update
	fi
}