Source

pyside_aur / shiboken / PKGBUILD

Full commit
# Maintainer: arlx_ignacy <ziphims@gmail.com>
# Contributor: Matthias Maennich <arch@maennich.net>


# modify this to whatever Python 2 interpreter you're targetting; on my
# system I use the vanilla python2
_py2exec=$(which python2)
# modify this to whatever Python 3 interpreter you're targetting; on my
# system I use the vanilla python3
_py3exec=$(which python3)


pkgbase=shiboken
pkgname=('python2-shiboken' 'python-shiboken' 'shiboken-common')
pkgver=1.2.0
pkgrel=1
pkgdesc='Python binding generator that uses API Extractor and outputs CPython code.'
arch=('i686' 'x86_64')
license=('LGPL')
url='http://www.pyside.org'
depends=('qt4>=4.8' 'openssl')
makedepends=('cmake' 'automoc4')
replaces=('shibokengenerator' 'libshiboken')
source=("https://download.qt-project.org/official_releases/pyside/shiboken-$pkgver.tar.bz2"
        'lookup_python33.patch')
md5sums=('946ae0405ff3238d6b72124e07fae06e'
         '2055906a070e9c3bb32c6ab346a474a1')

build() {
    echo ""
}

package_python2-shiboken() {
    if [ "$_py2exec" != "" ]; then
        depends=('python2' 'shiboken-common>=1.2.0')
        makedepends=('sed')

        if [ -d "$srcdir/build" ]; then
            rm -r "$srcdir/build"
        fi
        mkdir -p "$srcdir/build"

        cd "$srcdir/build"
        cmake ../shiboken-$pkgver -DBUILD_TESTS=FALSE          \
                                  -DCMAKE_BUILD_TYPE=Release   \
                                  -DCMAKE_INSTALL_PREFIX=/usr  \
                                  -DENABLE_GCC_OPTIMIZATION=On \
                                  -DUSE_PYTHON3=FALSE
        make DESTDIR=$pkgdir clean install

        # remove files provided by shiboken-common
        rm -r $pkgdir/usr/bin
        rm $pkgdir/usr/lib/cmake/Shiboken-$pkgver/ShibokenConfig{,Version}.cmake
        rm -r $pkgdir/usr/lib/pkgconfig
        rm -r $pkgdir/usr/include
        rm -r $pkgdir/usr/share
    fi
}

package_python-shiboken() {
    if [ "$_py3exec" != "" ]; then
        depends=('python' 'shiboken-common>=1.2.0')
        makedepends=('sed')

        cd "$srcdir/shiboken-$pkgver"
        msg "Applying patches ..."
        # this patch is to make shiboken to use python 3.3
        patch -p1 -N < ../../lookup_python33.patch

        # of course, if you want to undo the patches you can use:
        #  $ patch -p1 -R < ../../lookup_python33.patch

        if [ -d "$srcdir/build" ]; then
            rm -r "$srcdir/build"
        fi
        mkdir -p "$srcdir/build"

        cd "$srcdir/build"
        cmake ../shiboken-$pkgver -DBUILD_TESTS=FALSE          \
                                  -DCMAKE_BUILD_TYPE=Release   \
                                  -DCMAKE_INSTALL_PREFIX=/usr  \
                                  -DENABLE_GCC_OPTIMIZATION=On \
                                  -DUSE_PYTHON3=TRUE
        make DESTDIR=$pkgdir clean install

        # remove files provided by shiboken-common
        rm -r $pkgdir/usr/bin
        rm $pkgdir/usr/lib/cmake/Shiboken-$pkgver/ShibokenConfig{,Version}.cmake
        rm -r $pkgdir/usr/lib/pkgconfig
        rm -r $pkgdir/usr/include
        rm -r $pkgdir/usr/share
    fi
}

package_shiboken-common() {
    cd "$srcdir/build"
    make DESTDIR=$pkgdir install

    # remove library files, we dont need it for common
    rm $pkgdir/usr/lib/libshiboken*.so*
    rm -r $pkgdir/usr/lib/python*

    # remove ShibokenConfig*python*.cmake files
    rm $pkgdir/usr/lib/cmake/Shiboken-$pkgver/ShibokenConfig*python*.cmake
}