summaryrefslogtreecommitdiff
path: root/packages/x11-libs/exlibs/qt.exlib
blob: f018df4965b3629ff3adad3861d9c84d8399f837 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Copyright 2008-2010 Bo Ørsted Andresen <zlin@exherbo.org>
# Copyright 2008, 2009, 2010, 2014 Ingmar Vanhassel
# Distributed under the terms of the GNU General Public License v2
# Based in part upon 'qt-4.3.4-r1.ebuild' from Gentoo, which is:
#     Copyright 1999-2008 Gentoo Foundation

if ever at_least 5.10.0-beta4 ; then
    myexparam pn=${MY_PN:-${PN}-everywhere-src}
else
    myexparam pn=${MY_PN:-${PN}-opensource-src}
fi
myexparam pv=${MY_PV:-${PV}}
MY_PNV=$(exparam pn)-$(exparam pv)

require toolchain-funcs

HOMEPAGE="https://www.qt.io/"
if [[ ${PV} == *-@(alpha|beta|rc|RC)* ]] ; then
    BASE_URI="mirror://qt/development_releases/qt/$(ever range 1-2)/${PV/rc1/rc}/"
else
    BASE_URI="mirror://qt/official_releases/qt/$(ever range 1-2)/${PV}/"
fi

if ever is_scm; then
    SCM_REPOSITORY="git://code.qt.io/qt/${PN}.git"
    SCM_BRANCH="5.10"

    require scm-git

    SLOT=5
elif ever at_least 5.2.1; then
    DOWNLOADS="${BASE_URI}submodules/${MY_PNV}.tar.xz"
    # Minor version specific documentation is gone
    UPSTREAM_DOCUMENTATION="https://doc.qt.io/qt-$(ever major)/index.html [[ description = [ Qt Reference Documentation ] ]]"
else
    DOWNLOADS="${BASE_URI}${MY_PNV}.tar.gz"
    UPSTREAM_CHANGELOG="${BASE_URI}changes-${PV}"
    UPSTREAM_DOCUMENTATION="https://doc.qt.io/qt-$(ever range 1-2)/index.html [[ description = [ Qt Reference Documentation ] ]]"
fi

if ! ever is_scm; then
    SLOT=$(ever major)
    WORK=${WORKBASE}/${MY_PNV}
fi

if ever at_least 5.7.0-rc ; then
    LICENCES="|| ( GPL-2 LGPL-3 ) FDL-1.3"
else
    LICENCES="|| ( LGPL-2.1 LGPL-3 ) FDL-1.3"
fi

BUGS_TO="kde@exherbo.org"

DEFAULT_SRC_INSTALL_PARAMS+=( INSTALL_ROOT="${IMAGE}" )

qt_mkspecs_dir() {
     # Allows us to define which mkspecs dir we want to use.
    local spec

    spec="linux"
    if [[ ${CXX} == *c++* ]]; then
        if cxx-is-gcc;then
            spec+="-g++"
        elif cxx-is-clang;then
            spec+="-clang"
        else
            die "Unknown compiler ${CXX}; you will need to add a check for it to qt.exlib"
        fi
    else
        die "Unknown compiler ${CXX}"
    fi

    echo "${spec}"
}

qt_enable() {
    local opt="${1}" feature="${2:-${1}}"
    local prefix="${3:+-}${3}" postfix="${4:+-}${4}"
    (( ${#} >= 4 )) && shift 4 || shift ${#}

    if option "${opt}"; then
        echo "${prefix}-${feature}${postfix}" "${@}"
    else
        echo "-no-${feature}"
    fi
}

qt_build() {
    local opt="${1}" feature="${2:-${1}}"

    if option "${opt}" ; then
        echo "-make ${feature}"
    else
        echo "-nomake ${feature}"
    fi
}