summaryrefslogtreecommitdiff
path: root/packages/net-im/swiften/swiften.exlib
blob: f7755be730247abff67145faf3514bf39082f0f5 (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
# Distributed under the terms of the GNU General Public License v2
# Copyright 2018 Gluzskiy Alexandr <sss@sss.chaoslab.ru>

SCM_REPOSITORY="git://swift.im/swift"

if ever is_scm; then
    SCM_BRANCH="swift-4.x"
else
    SCM_TAG=swift-${PV}
fi

require scons scm-git

export_exlib_phases src_prepare src_install

SUMMARY="Just a perfect C++ XMPP library"
HOMEPAGE="http://swift.im/"
SLOT="0"
LICENCES="GPL-3"

MYOPTIONS="
    avahi
    ( providers: libressl openssl ) [[ number-selected = exactly-one ]]
"

DEPENDENCIES="
    build+run:
        dev-libs/boost[>=1.65]
        dev-libs/expat
        dev-libs/libxml2:=
        net-dns/libidn[>=1.10]
        net-libs/miniupnpc
        sys-libs/zlib
        avahi? ( net-dns/avahi )
        providers:libressl? ( dev-libs/libressl:= )
        providers:openssl? ( dev-libs/openssl )
    build:
        sys-apps/sed
"


DEFAULT_SRC_PREPARE_PATCHES=(
    "${FILES}"/boost.patch
    "${FILES}"/sconstruct.patch
    "${FILES}"/ranlib.patch
)

swiften_src_prepare() {
    edo pushd 3rdParty
    edo rm -rf Boost CAres DocBook Expat LCov LibIDN OpenSSL SCons SQLite ZLib
    edo popd
    edo rm -rf Swiften/Examples
    default
    edo sed -i -e "s/\"ranlib\"/\"$(exhost --target)-ranlib\"/g" BuildTools/SCons/SConscript.boot
}

BASE_OPTIONS=(
    cc=$(exhost --target)-cc
    cxx=$(exhost --target)-c++
    ar=$(exhost --target)-ar
    link=$(exhost --target)-c++
    swiften_dll=1
    allow_warnings=1
    optimize=1
    Swiften
)

SCONS_SRC_CONFIGURE_PARAMS=( "${BASE_OPTIONS[@]}" )

SCONS_SRC_COMPILE_PARAMS=( "${BASE_OPTIONS[@]}" )

SCONS_SRC_INSTALL_PARAMS=( "${BASE_OPTIONS[@]}" )

swiften_src_install() {
    escons --config=cache \
        "${SCONS_SRC_INSTALL_PARAMS[@]}" \
        SWIFTEN_INSTALLDIR="${IMAGE}"/usr/$(exhost --target) \
        SWIFTEN_LIBDIR="${IMAGE}"/usr/$(exhost --target)/lib \
        "${IMAGE}"/usr/$(exhost --target)
}