summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: c8feed41b3ee2614624a535664fb1cfe308b54f0 (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
# Contributor: Markus Hovorka <m.hovorka@live.de>
# Contributor: Florian Pritz <bluewind@xinu.at>
# Contributor: Jelle van der Waa <jelle@vdwaa.nl>
# Contributor: Hugo Osvaldo Barrera <hugo@barrera.io>
# Contributor: Matthias Maennich <arch@maennich.net>

pkgbase=shiboken2-git
pkgname=(python{2,}-shiboken2-git shiboken2-git)
pkgver=5.9.0.r5542.507beab9
_upver=5.9.0
pkgrel=1
arch=('i686' 'x86_64')
license=('LGPL')
url="http://www.pyside.org"
makedepends=('git' 'llvm' 'clang' 'cmake' 'python2' 'python' 'libxslt'
             'qt5-xmlpatterns')
source=("$pkgbase::git+https://code.qt.io/pyside/pyside-setup.git#branch=5.9")
sha256sums=('SKIP')

pkgver() {
    cd "$srcdir/$pkgbase"
    printf "%s.r%s.%s" "$_upver" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}

prepare() {
    cd "$srcdir/$pkgbase"
}

build() {
    # Build for python2.
    cd "$srcdir"/$pkgbase/sources/shiboken2
    cmake_args="-DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_CXX_COMPILER=/usr/bin/clang++"
    mkdir -p build-py2 && cd build-py2
    cmake \
        -DUSE_PYTHON_VERSION=2 \
        ${cmake_args} ..
    make

    # Build for python3.
    cd "$srcdir"/$pkgbase/sources/shiboken2
    mkdir -p build-py3 && cd build-py3
    cmake \
        -DUSE_PYTHON_VERSION=3 \
        ${cmake_args} ..
    make
}

package_shiboken2-git() {
    pkgdesc="CPython bindings generator for C++ libraries"
    depends=('libxslt' 'clang' 'qt5-xmlpatterns')
    optdepends=("python2-shiboken2-git: for compilation against python2"
                "python-shiboken2-git: for compilation against python")

    cd "$srcdir"/$pkgbase/sources/shiboken2/build-py3
    make DESTDIR="$pkgdir" install

    rm -rf "$pkgdir/usr/lib/python"*
    rm -rf "$pkgdir/usr/lib/libshiboken2"*
    rm -rf "$pkgdir/usr/lib/pkgconfig/"
    rm "$pkgdir"/usr/lib/cmake/Shiboken2-$_upver/Shiboken2Config*python*.cmake
}

package_python2-shiboken2-git() {
    pkgdesc="Support library for Python2 bindings"
    depends=("python2" "shiboken2-git")

    cd "$srcdir"/$pkgbase/sources/shiboken2/build-py2
    make DESTDIR="$pkgdir" install

    mv "$pkgdir"/usr/lib/pkgconfig/shiboken2{,-py2}.pc

    rm -rf "$pkgdir"/usr/{include,bin,share}
    rm "$pkgdir/usr/lib/cmake/Shiboken2-$_upver/Shiboken2ConfigVersion.cmake"
    rm "$pkgdir/usr/lib/cmake/Shiboken2-$_upver/Shiboken2Config.cmake"
}

package_python-shiboken2-git() {
    pkgdesc="Support library for Python bindings"
    depends=("python" "shiboken2-git")

    cd "$srcdir"/$pkgbase/sources/shiboken2/build-py3
    make DESTDIR="$pkgdir" install

    rm -rf "$pkgdir"/usr/{include,bin,share}
    rm "$pkgdir/usr/lib/cmake/Shiboken2-$_upver/Shiboken2ConfigVersion.cmake"
    rm "$pkgdir/usr/lib/cmake/Shiboken2-$_upver/Shiboken2Config.cmake"
}