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

130 lines
3.2 KiB
Bash

# Copyright 1999-2019 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{4,5,6,7} )
inherit cmake-utils python-single-r1 readme.gentoo-r1 systemd user
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
EGIT_REPO_URI=${EGIT_REPO_URI:-"https://github.com/znc/znc.git"}
SRC_URI=""
else
MY_PV=${PV/_/-}
MY_P=${PN}-${MY_PV}
SRC_URI="
https://znc.in/releases/archive/${MY_P}.tar.gz
test? ( ${GTEST_URL} )
"
KEYWORDS="~amd64 ~arm ~x86"
S=${WORKDIR}/${MY_P}
fi
HOMEPAGE="https://znc.in"
LICENSE="Apache-2.0"
SLOT="0"
IUSE="+ipv6 +icu libressl nls perl python +ssl sasl tcl test +zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} icu )"
RDEPEND="
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? (
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
)
tcl? ( dev-lang/tcl:0= )
zlib? ( sys-libs/zlib:0= )
"
DEPEND="
${RDEPEND}
virtual/pkgconfig
nls? ( sys-devel/gettext )
perl? ( >=dev-lang/swig-3.0.0 )
python? ( >=dev-lang/swig-3.0.0 )
test? ( dev-qt/qtnetwork:5 )
"
PATCHES=( "${FILESDIR}"/${PN}-1.7.1-inttest-dir.patch )
pkg_setup() {
if use python; 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
cmake-utils_src_prepare
}
src_configure() {
local mycmakeargs=(
-DWANT_ICU="$(usex icu)"
-DWANT_IPV6="$(usex ipv6)"
-DWANT_I18N="$(usex nls)"
-DWANT_PERL="$(usex perl)"
-DWANT_PYTHON="$(usex python)"
-DWANT_CYRUS="$(usex sasl)"
-DWANT_OPENSSL="$(usex ssl)"
-DWANT_TCL="$(usex tcl)"
-DWANT_ZLIB="$(usex zlib)"
)
if [[ ${PV} != *9999* ]] && use test; then
export GTEST_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googletest"
export GMOCK_ROOT="${WORKDIR}/googletest-release-${GTEST_VER}/googlemock"
fi
cmake-utils_src_configure
}
src_test() {
cmake-utils_src_make unittest
if has network-sandbox ${FEATURES}; then
DESTDIR="${T}/inttest" cmake-utils_src_make install
local filter='-'
if ! use perl; then
filter="${filter}:ZNCTest.Modperl*"
fi
if ! use python; then
filter="${filter}:ZNCTest.Modpython*"
fi
# 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-utils_src_make inttest
else
# TODO: don't require sandbox after
# https://github.com/znc/znc/pull/1363 is implemented
ewarn "FEATURES=-network-sandbox; skipping integration tests which"
ewarn "temporary open local ports."
fi
}
src_install() {
cmake-utils_src_install
dodoc NOTICE
}