|
| 1 | +# Copyright 1999-2023 Gentoo Authors |
| 2 | +# Distributed under the terms of the GNU General Public License v2 |
| 3 | + |
| 4 | +EAPI=8 |
| 5 | +WX_GTK_VER="3.0-gtk3" |
| 6 | + |
| 7 | +inherit autotools flag-o-matic wxwidgets xdg-utils |
| 8 | + |
| 9 | +if [[ ${PV} == 9999 ]] ; then |
| 10 | + EGIT_REPO_URI="https://github.com/amule-project/amule" |
| 11 | + inherit git-r3 |
| 12 | +else |
| 13 | + MY_P="${PN/m/M}-${PV}" |
| 14 | + SRC_URI="https://download.sourceforge.net/${PN}/${MY_P}.tar.xz" |
| 15 | + S="${WORKDIR}/${MY_P}" |
| 16 | + KEYWORDS="~alpha ~amd64 ~arm ~ppc ~ppc64 ~riscv ~sparc ~x86" |
| 17 | +fi |
| 18 | + |
| 19 | +DESCRIPTION="aMule, the all-platform eMule p2p client" |
| 20 | +HOMEPAGE="http://www.amule.org/" |
| 21 | + |
| 22 | +LICENSE="GPL-2+" |
| 23 | +SLOT="0" |
| 24 | +IUSE="daemon debug geoip nls remote stats upnp +X" |
| 25 | + |
| 26 | +RDEPEND=" |
| 27 | + dev-libs/boost:= |
| 28 | + dev-libs/crypto++:= |
| 29 | + sys-libs/binutils-libs:0= |
| 30 | + sys-libs/readline:0= |
| 31 | + sys-libs/zlib |
| 32 | + >=x11-libs/wxGTK-3.0.4:${WX_GTK_VER}[X?] |
| 33 | + daemon? ( acct-user/amule ) |
| 34 | + geoip? ( dev-libs/geoip ) |
| 35 | + nls? ( virtual/libintl ) |
| 36 | + remote? ( |
| 37 | + acct-user/amule |
| 38 | + media-libs/libpng:0= |
| 39 | + ) |
| 40 | + stats? ( media-libs/gd:=[jpeg,png] ) |
| 41 | + upnp? ( net-libs/libupnp:0 ) |
| 42 | +" |
| 43 | +DEPEND="${RDEPEND} |
| 44 | + X? ( dev-util/desktop-file-utils ) |
| 45 | +" |
| 46 | +BDEPEND=" |
| 47 | + virtual/pkgconfig |
| 48 | + >=sys-devel/boost-m4-0.4_p20221019 |
| 49 | + nls? ( sys-devel/gettext ) |
| 50 | +" |
| 51 | + |
| 52 | +PATCHES=( |
| 53 | + "${FILESDIR}/${PN}-2.3.2-disable-version-check.patch" |
| 54 | + "${FILESDIR}/${PN}-2.3.3-fix-exception.patch" |
| 55 | + "${FILESDIR}/${P}-autoconf-2.70.patch" |
| 56 | + "${FILESDIR}/${PN}-2.3.3-backport-pr368.patch" |
| 57 | +) |
| 58 | + |
| 59 | +pkg_setup() { |
| 60 | + setup-wxwidgets |
| 61 | +} |
| 62 | + |
| 63 | +src_prepare() { |
| 64 | + default |
| 65 | + rm m4/boost.m4 || die |
| 66 | + |
| 67 | + if [[ ${PV} == 9999 ]]; then |
| 68 | + ./autogen.sh || die |
| 69 | + else |
| 70 | + eautoreconf |
| 71 | + fi |
| 72 | +} |
| 73 | + |
| 74 | +src_configure() { |
| 75 | + use debug || append-cppflags -DwxDEBUG_LEVEL=0 |
| 76 | + append-cxxflags -std=gnu++14 |
| 77 | + |
| 78 | + local myconf=( |
| 79 | + --with-denoise-level=0 |
| 80 | + --with-wx-config="${WX_CONFIG}" |
| 81 | + --enable-amulecmd |
| 82 | + --with-boost |
| 83 | + $(use_enable debug) |
| 84 | + $(use_enable daemon amule-daemon) |
| 85 | + $(use_enable geoip) |
| 86 | + $(use_enable nls) |
| 87 | + $(use_enable remote webserver) |
| 88 | + $(use_enable stats cas) |
| 89 | + $(use_enable stats alcc) |
| 90 | + $(use_enable upnp) |
| 91 | + ) |
| 92 | + |
| 93 | + if use X; then |
| 94 | + myconf+=( |
| 95 | + $(use_enable remote amule-gui) |
| 96 | + $(use_enable stats alc) |
| 97 | + $(use_enable stats wxcas) |
| 98 | + ) |
| 99 | + else |
| 100 | + myconf+=( |
| 101 | + --disable-monolithic |
| 102 | + --disable-amule-gui |
| 103 | + --disable-alc |
| 104 | + --disable-wxcas |
| 105 | + ) |
| 106 | + fi |
| 107 | + |
| 108 | + econf "${myconf[@]}" |
| 109 | +} |
| 110 | + |
| 111 | +src_test() { |
| 112 | + emake check |
| 113 | +} |
| 114 | + |
| 115 | +src_install() { |
| 116 | + default |
| 117 | + |
| 118 | + if use daemon; then |
| 119 | + newconfd "${FILESDIR}"/amuled.confd-r1 amuled |
| 120 | + newinitd "${FILESDIR}"/amuled.initd amuled |
| 121 | + fi |
| 122 | + if use remote; then |
| 123 | + newconfd "${FILESDIR}"/amuleweb.confd-r1 amuleweb |
| 124 | + newinitd "${FILESDIR}"/amuleweb.initd amuleweb |
| 125 | + fi |
| 126 | + |
| 127 | + if use daemon || use remote; then |
| 128 | + keepdir /var/lib/${PN} |
| 129 | + fowners amule:amule /var/lib/${PN} |
| 130 | + fperms 0750 /var/lib/${PN} |
| 131 | + fi |
| 132 | +} |
| 133 | + |
| 134 | +pkg_postinst() { |
| 135 | + local ver |
| 136 | + |
| 137 | + if use daemon || use remote; then |
| 138 | + for ver in ${REPLACING_VERSIONS}; do |
| 139 | + if ver_test ${ver} -lt "2.3.2-r4"; then |
| 140 | + elog "Default user under which amuled and amuleweb daemons are started" |
| 141 | + elog "have been changed from p2p to amule. Default home directory have been" |
| 142 | + elog "changed as well." |
| 143 | + echo |
| 144 | + elog "If you want to preserve old download/share location, you can create" |
| 145 | + elog "symlink /var/lib/amule/.aMule pointing to the old location and adjust" |
| 146 | + elog "files ownership *or* restore AMULEUSER and AMULEHOME variables in" |
| 147 | + elog "/etc/conf.d/{amuled,amuleweb} to the old values." |
| 148 | + |
| 149 | + break |
| 150 | + fi |
| 151 | + done |
| 152 | + fi |
| 153 | + |
| 154 | + use X && xdg_desktop_database_update |
| 155 | +} |
| 156 | + |
| 157 | +pkg_postrm() { |
| 158 | + use X && xdg_desktop_database_update |
| 159 | +} |
0 commit comments