gentoo/net-im/swift/swift-9999.ebuild

215 lines
4.2 KiB
Bash
Raw Normal View History

# Copyright 1999-2020 Gentoo Authors
2018-09-20 12:16:35 +02:00
# Distributed under the terms of the GNU General Public License v2
2020-08-14 20:28:41 +02:00
EAPI=7
2018-09-20 12:16:35 +02:00
LUA_COMPAT=( lua5-{1..2} luajit )
PYTHON_COMPAT=( python3_{6..9} )
2020-12-21 05:05:50 +01:00
inherit lua-single python-any-r1 scons-utils toolchain-funcs
2018-09-20 12:16:35 +02:00
DESCRIPTION="An elegant, secure, adaptable and intuitive XMPP Client"
HOMEPAGE="https://www.swift.im/"
if [[ ${PV} = "9999" ]] ; then
EGIT_REPO_URI="https://github.com/${PN}/${PN}.git"
2018-09-20 12:16:35 +02:00
EGIT_BRANCH="swift-4.x"
inherit git-r3
KEYWORDS=""
else
RESTRICT="mirror"
SRC_URI="https://swift.im/downloads/releases/${P}/${P}.tar.gz"
2018-09-20 12:16:35 +02:00
KEYWORDS="~amd64 ~x86"
2020-08-14 20:28:41 +02:00
2018-09-20 12:16:35 +02:00
fi
LICENSE="BSD BSD-1 CC-BY-3.0 GPL-3 OFL-1.1"
SLOT="4/0"
2020-12-21 05:05:50 +01:00
IUSE="expat +icu +idn lua test zeroconf"
REQUIRED_USE="
|| ( icu idn )
lua? ( ${LUA_REQUIRED_USE} )
"
2018-09-20 12:16:35 +02:00
RDEPEND="
dev-db/sqlite:3
2018-09-20 12:16:35 +02:00
dev-libs/boost:=
dev-libs/openssl:0=
net-libs/libnatpmp
net-libs/miniupnpc:=
2020-08-14 20:28:41 +02:00
sys-libs/zlib
expat? ( dev-libs/expat )
!expat? ( dev-libs/libxml2:2 )
icu? ( dev-libs/icu:= )
2018-09-20 12:16:35 +02:00
idn? ( net-dns/libidn:= )
lua? ( ${LUA_DEPS} )
"
2018-09-20 12:16:35 +02:00
DEPEND="
${RDEPEND}
2018-09-20 12:16:35 +02:00
>=dev-util/scons-3.0.1-r3
test? ( net-dns/avahi )
"
2018-11-18 17:56:52 +01:00
# Tests don't run, as they fail with "[QA/UnitTest/**dummy**] Error -6".
RESTRICT="test"
2018-09-20 12:16:35 +02:00
DOCS=(
"DEVELOPMENT.md"
"README.md"
"Swiften/ChangeLog.md"
)
2020-08-14 20:28:41 +02:00
PATCHES=(
"${FILESDIR}"/${PN}-4.0.2-python3-compatibility.patch
"${FILESDIR}"/${PN}-4.0.2-qt-5.15-compatibility.patch
2020-08-14 20:28:41 +02:00
)
pkg_setup() {
python-any-r1_pkg_setup
use lua && lua-single_pkg_setup
}
2020-08-14 20:28:41 +02:00
src_unpack() {
if [[ ${PV} = "9999" ]] ; then
git-r3_src_unpack
fi
default
}
2018-09-20 12:16:35 +02:00
src_prepare() {
default
2020-08-14 20:28:41 +02:00
# Don't include '/usr/lib*' in the link command line for `swiften-config`
sed -e '/_LIBDIRFLAGS/d' -i Swiften/Config/SConscript || die
# Use correct LIBDIR for Lua
sed -e "s/lib/$(get_libdir)/g" -i Sluift/SConscript.variant || die
# Hack for finding Qt system libs
mkdir "${T}"/qt || die
ln -s "${EPREFIX}"/usr/$(get_libdir)/qt5/bin "${T}"/qt/bin || die
ln -s "${EPREFIX}"/usr/$(get_libdir)/qt5 "${T}"/qt/lib || die
ln -s "${EPREFIX}"/usr/include/qt5 "${T}"/qt/include || die
2018-09-20 12:16:35 +02:00
# Remove parts of Swift, which a user don't want to compile
2020-12-21 05:05:50 +01:00
rm -fr Swift Slimber || die
if ! use lua; then rm -fr Sluift || die; fi
2020-12-21 05:05:50 +01:00
if ! use zeroconf; then rm -fr Limber || die; fi
2018-09-20 12:16:35 +02:00
# Remove '3rdParty', as the system libs should be used
2018-11-18 17:56:52 +01:00
# `CppUnit`, `GoogleTest` and `HippoMocks` are needed for tests
local my3rdparty=(
Boost
Breakpad
DocBook
Expat
LCov
Ldns
LibIDN
LibMiniUPnPc
LibNATPMP
Lua
OpenSSL
SCons
SQLite
Unbound
ZLib
)
if use test; then
cd 3rdParty && rm -fr "${my3rdparty[@]}" || die
else
rm -fr 3rdParty || die
fi
2018-09-20 12:16:35 +02:00
}
src_configure() {
MYSCONS=(
ar="$(tc-getAR)"
allow_warnings="yes"
assertions="no"
build_examples="yes"
boost_bundled_enable="false"
boost_force_bundled="false"
cc="$(tc-getCC)"
ccache="no"
ccflags="${CFLAGS}"
coverage="no"
cxx="$(tc-getCXX)"
cxxflags="${CXXFLAGS}"
debug="no"
distcc="no"
experimental="yes"
experimental_ft="yes"
2020-12-21 05:05:50 +01:00
hunspell_enable="no"
2018-09-20 12:16:35 +02:00
icu="$(usex icu)"
install_git_hooks="no"
libidn_bundled_enable="false"
libminiupnpc_force_bundled="false"
libnatpmp_force_bundled="false"
link="$(tc-getCXX)"
linkflags="${LDFLAGS}"
max_jobs="no"
optimize="no"
qt="${T}/qt"
2020-12-21 05:05:50 +01:00
qt5="no"
2018-09-20 12:16:35 +02:00
swiften_dll="true"
swift_mobile="no"
target="native"
test="none"
2020-12-21 05:05:50 +01:00
try_avahi="no"
2018-09-20 12:16:35 +02:00
try_expat="$(usex expat)"
2020-12-21 05:05:50 +01:00
try_gconf="no"
2018-09-20 12:16:35 +02:00
try_libidn="$(usex idn)"
try_libxml="$(usex !expat)"
tls_backend="openssl"
unbound="no"
2018-09-20 12:16:35 +02:00
V="1"
valgrind="no"
zlib_bundled_enable="false"
)
2020-12-28 14:15:21 +01:00
if use lua; then
MYSCONS+=(
lua_includedir="$(lua_get_include_dir)"
lua_libdir="${EPREFIX}/usr/$(get_libdir)"
lua_libname="$(basename -s '.so' $(lua_get_shared_lib))"
)
fi
2018-09-20 12:16:35 +02:00
}
src_compile() {
local myesconsinstall=(
2018-09-20 12:16:35 +02:00
Swiften
$(usex lua Sluift '')
$(usex zeroconf Limber '')
)
escons "${MYSCONS[@]}" "${myesconsinstall[@]}"
2018-09-20 12:16:35 +02:00
}
src_test() {
2018-11-18 17:56:52 +01:00
MYSCONS=(
V="1"
)
escons "${MYSCONS[@]}" test=unit QA
2018-09-20 12:16:35 +02:00
}
src_install() {
local myesconsinstall=(
2020-08-14 20:28:41 +02:00
SWIFTEN_INSTALLDIR="${ED}/usr"
SWIFTEN_LIBDIR="${ED}/usr/$(get_libdir)"
$(usex lua "SLUIFT_DIR=${ED}/usr" '')
$(usex lua "SLUIFT_INSTALLDIR=${ED}/usr" '')
"${ED}"
2018-09-20 12:16:35 +02:00
)
escons "${MYSCONS[@]}" "${myesconsinstall[@]}"
2018-09-20 12:16:35 +02:00
use zeroconf && dobin Limber/limber
einstalldocs
}