gentoo/net-irc/znc/znc-9999.ebuild

142 lines
3.2 KiB
Bash
Raw Normal View History

2023-05-02 18:00:00 +02:00
# Copyright 1999-2023 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
2022-08-07 22:02:39 +02:00
EAPI=8
2023-11-07 16:58:59 +01:00
PYTHON_COMPAT=( python3_{10..12} )
2020-06-12 18:03:21 +02:00
inherit cmake python-single-r1
2019-01-28 22:51:18 +01:00
GTEST_VER="1.8.1"
GTEST_URL="https://github.com/google/googletest/archive/${GTEST_VER}.tar.gz -> gtest-${GTEST_VER}.tar.gz"
DESCRIPTION="An advanced IRC Bouncer"
if [[ ${PV} == *9999* ]]; then
inherit git-r3
2021-08-25 00:03:53 +02:00
EGIT_REPO_URI="https://github.com/znc/znc.git"
else
MY_PV=${PV/_/-}
MY_P=${PN}-${MY_PV}
SRC_URI="
https://znc.in/releases/archive/${MY_P}.tar.gz
test? ( ${GTEST_URL} )
"
2022-11-06 18:58:35 +01:00
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86"
S=${WORKDIR}/${MY_P}
fi
HOMEPAGE="https://znc.in"
LICENSE="Apache-2.0"
2021-08-25 00:03:53 +02:00
# "If you upgrade your ZNC version, you must recompile all your modules."
2021-07-27 18:34:51 +02:00
# - https://wiki.znc.in/Compiling_modules
SLOT="0/${PV}"
2022-11-06 18:58:35 +01:00
IUSE="+icu nls perl python +ssl sasl tcl test +zlib"
2020-06-12 18:03:21 +02:00
RESTRICT="!test? ( test )"
2023-11-07 16:58:59 +01:00
# tests run znc-buildmod which is a Python script
REQUIRED_USE="
python? ( ${PYTHON_REQUIRED_USE} icu )
test? ( ${PYTHON_REQUIRED_USE} )
"
2021-08-25 00:03:53 +02:00
# perl is a build-time dependency of modpython
2020-06-12 18:03:21 +02:00
BDEPEND="
virtual/pkgconfig
nls? ( sys-devel/gettext )
2020-06-12 18:03:21 +02:00
perl? (
2022-11-06 18:58:35 +01:00
>=dev-lang/swig-4.0.1
2020-06-12 18:03:21 +02:00
>=dev-lang/perl-5.10
)
python? (
2022-11-06 18:58:35 +01:00
>=dev-lang/swig-4.0.1
2020-06-12 18:03:21 +02:00
>=dev-lang/perl-5.10
)
test? (
${PYTHON_DEPS}
dev-qt/qtnetwork:5
)
"
2021-08-25 00:03:53 +02:00
DEPEND="
2023-11-07 16:58:59 +01:00
app-crypt/argon2
2023-04-05 13:55:06 +02:00
dev-cpp/cctz
2021-08-25 00:03:53 +02:00
icu? ( dev-libs/icu:= )
nls? ( dev-libs/boost:=[nls] )
perl? ( >=dev-lang/perl-5.10:= )
python? ( ${PYTHON_DEPS} )
sasl? ( >=dev-libs/cyrus-sasl-2 )
ssl? ( dev-libs/openssl:0= )
tcl? ( dev-lang/tcl:0= )
zlib? ( sys-libs/zlib:0= )
"
2021-08-25 00:03:53 +02:00
PATCHES=(
"${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch
)
pkg_setup() {
2023-11-07 16:58:59 +01:00
if use python || use test; then
python-single-r1_pkg_setup
fi
}
src_prepare() {
# Let SWIG rebuild modperl/modpython to make user patching easier.
if [[ ${PV} != *9999* ]]; then
rm modules/modperl/generated.tar.gz || die
rm modules/modpython/generated.tar.gz || die
fi
sed -i -e "s|DZNC_BIN_DIR:path=|DZNC_BIN_DIR:path=${T}/inttest|" \
test/CMakeLists.txt || die
2021-08-25 00:03:53 +02:00
sed -i "s|--datadir=|&${EPREFIX}|" znc.service.in || die
2020-06-12 18:03:21 +02:00
cmake_src_prepare
}
src_configure() {
local mycmakeargs=(
-DWANT_ICU="$(usex icu)"
2022-11-06 18:58:35 +01:00
-DWANT_IPV6=yes
-DWANT_I18N="$(usex nls)"
-DWANT_PERL="$(usex perl)"
-DWANT_PYTHON="$(usex python)"
2021-08-25 00:03:53 +02:00
-DWANT_PYTHON_VERSION="${EPYTHON#python}"
-DWANT_CYRUS="$(usex sasl)"
-DWANT_OPENSSL="$(usex ssl)"
-DWANT_TCL="$(usex tcl)"
-DWANT_ZLIB="$(usex zlib)"
)
if [[ ${PV} != *9999* ]] && use test; then
2019-01-28 22:51:18 +01:00
export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googletest"
export GMOCK_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googlemock"
fi
2020-06-12 18:03:21 +02:00
cmake_src_configure
}
src_test() {
2020-06-12 18:03:21 +02:00
cmake_build unittest
DESTDIR="${T}/inttest" cmake_build install
local filter='-'
if ! use perl; then
filter="${filter}:ZNCTest.Modperl*"
fi
if ! use python; then
filter="${filter}:ZNCTest.Modpython*"
fi
2020-06-12 18:03:21 +02:00
# CMAKE_PREFIX_PATH and CXXFLAGS are needed for znc-buildmod
# invocations from inside the test
GTEST_FILTER="${filter}" ZNC_UNUSUAL_ROOT="${T}/inttest" \
CMAKE_PREFIX_PATH="${T}/inttest/usr/share/znc/cmake" \
CXXFLAGS="${CXXFLAGS} -isystem ${T}/inttest/usr/include" \
cmake_build inttest
}
src_install() {
2020-06-12 18:03:21 +02:00
cmake_src_install
dodoc NOTICE
}