summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 0d51886fd0b03acb435b04d339597e9d065a3251 (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
# Maintainer:  Gabriel Souza Franco <Z2FicmllbGZyYW5jb3NvdXphQGdtYWlsLmNvbQ==>
# Contributor: Florian Pritz
# Contributor: kachelaqa <kachelaqa at gmail dot com>

pkgbase='python-pyside-tools'
pkgname=('python2-pyside-tools' 'python-pyside-tools' 'pyside-tools-common')
pkgver=0.2.15
pkgrel=3
arch=('i686' 'x86_64')
license=('LGPL')
url='https://qt-project.org/wiki/PySide'
makedepends=('cmake' 'python' 'python2' 'qt4>=4.5' 'shiboken>=1.1.1' python{,2}-pyside)
source=("$pkgbase-$pkgver.tar.gz::https://github.com/PySide/Tools/archive/${pkgver}.tar.gz")
md5sums=('e542b9536bd9d35599ede225c9311cc8')

build() {
    cd "${srcdir}/Tools-${pkgver}"

    mkdir -p build2 && cd build2
    # both PYTHON_SUFFIX & PYTHON_BASENAME are required to
    # ensure PySideConfig-python2.7.cmake is selected
    cmake .. \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=Release \
        -DPYTHON_SUFFIX=-python2.7 \
        -DPYTHON_BASENAME=-python2.7 \
        -DQT_QMAKE_EXECUTABLE=qmake-qt4
    make

    cd "${srcdir}/Tools-${pkgver}"

    mkdir -p build3 && cd build3
    # PySideConfig.cmake defaults to Python 3 config
    cmake .. \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_BUILD_TYPE=Release \
        -DQT_QMAKE_EXECUTABLE=qmake-qt4
    make
}

package_python2-pyside-tools() {
    depends=('python2-pyside' 'pyside-tools-common')
    pkgdesc='PySide lupdate, rcc, and uic development tools (for Python 2)'

    cd "${srcdir}/Tools-${pkgver}/build2"
	make DESTDIR="${pkgdir}" install

    find "${pkgdir}" -type f -exec \
    sed -i -e '1 s|^#! */usr/bin/python[0-9.]*|#!/usr/bin/python2|' \
           -e '1 s|^#! */usr/bin/env python[0-9.]*|#!/usr/bin/env python2|' {} +

    mv "${pkgdir}"/usr/bin/{,python2-}pyside-uic
    mv "${pkgdir}"/usr/share/man/man1/{,python2-}pyside-uic.1

    rm -rf "${pkgdir}"/usr/lib/python2*/site-packages/pysideuic/{port_v3,pyside-uic.1}
    rm -f "${pkgdir}"/usr/bin/pyside-{lupdate,rcc}
    rm -f "${pkgdir}"/usr/share/man/man1/pyside-{lupdate,rcc}*

	python2 -m compileall "${pkgdir}"/usr/lib/python2*/site-packages/pysideuic/
	python2 -O -m compileall "${pkgdir}"/usr/lib/python2*/site-packages/pysideuic/
}

package_python-pyside-tools() {
    depends=('python-pyside' 'pyside-tools-common')
    pkgdesc='PySide lupdate, rcc, and uic development tools (for Python 3)'

    cd "${srcdir}/Tools-${pkgver}/build3"
	make DESTDIR="${pkgdir}" install

    rm -rf "${pkgdir}"/usr/lib/python3*/site-packages/pysideuic/{port_v2,pyside-uic.1}
    rm -f "${pkgdir}"/usr/bin/pyside-{lupdate,rcc}
    rm -f "${pkgdir}"/usr/share/man/man1/pyside-{lupdate,rcc}*

	python3 -m compileall "${pkgdir}"/usr/lib/python3*/site-packages/pysideuic/
	python3 -O -m compileall "${pkgdir}"/usr/lib/python3*/site-packages/pysideuic/
}

package_pyside-tools-common() {
    depends=('qt4>=4.5')
    pkgdesc='PySide lupdate, rcc, and uic development tools (Common Files)'

    cd "${srcdir}/Tools-${pkgver}/build3"
	make DESTDIR="${pkgdir}" install

    rm -rf "${pkgdir}"/usr/lib
    rm -f "${pkgdir}"/usr/bin/pyside-uic
    rm -f "${pkgdir}"/usr/share/man/man1/pyside-uic*
}