1. arsooy
  2. pyside_aur

Source

pyside_aur / python-shibokengenerator / PKGBUILD

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

# modify these two to whatever Python 3 interpreter you're targetting; on my
# system I use the vanilla python3
_pyver=3
_pyexec=/usr/bin/python$_pyver

pkgname=python-shibokengenerator
pkgver=1.1.0
pkgrel=1
pkgdesc='Python 3 bindings generator that uses API Extractor and outputs CPython code.'
arch=('i686' 'x86_64')
license=('LGPL')
url='http://www.pyside.org'
depends=('python' 'qt>=4.7' 'openssl' 'generatorrunner>=0.6.16')
makedepends=('cmake' 'automoc4' 'sed' 'patch')
replaces=('shibokengenerator-py3')
source=("http://www.pyside.org/files/shiboken-$pkgver.tar.bz2"
        'py3build.patch'
        'pacman_vars.patch')
md5sums=('9c9d696c8c426fb5abf28a6bd3759558'
         'f8ea281b3e22e7ccc9752e301f40cd67'
         '2ed6e5f86e3daed2c50a32ef6a7b88a5')

build() {
    cd "$srcdir/shiboken-$pkgver"

    msg "Applying patches ..."
    # this patch is to differentiate our build as Python 3
    patch -p1 -N < ../py3build.patch
    # this patch is to make it much easier to veriables from cmake
    patch -p1 -N < ../pacman_vars.patch

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

    cd ..
    if [ -d build ] ; then
        msg "Removing last build ..."
        rm -rf build
    fi

    mkdir -p build
    cd build

    cmake ../shiboken-$pkgver -DCMAKE_INSTALL_PREFIX=/usr  \
                              -DCMAKE_BUILD_TYPE=Release   \
                              -DBUILD_TESTS=FALSE          \
                              -DPYTHON_EXECUTABLE=$_pyexec \
                              -DUSE_PYTHON3=TRUE
    make shiboken
}

package() {
    cd "$srcdir/build/generator"
    make DESTDIR=$pkgdir install

    # get some variables for our purpose
    SHIBOKEN_SUFFIX=$(sed -n '2p' ../data/pacman_vars)
    PYTHON_SUFFIX=$(sed -n '3p' ../data/pacman_vars)

    mkdir -m 755 -p $pkgdir/usr/lib/cmake/Shiboken$SHIBOKEN_SUFFIX-$pkgver/
    install -m 755 ../data/ShibokenConfig.cmake $pkgdir/usr/lib/cmake/Shiboken$SHIBOKEN_SUFFIX-$pkgver/
    install -m 755 ../data/ShibokenConfigVersion.cmake $pkgdir/usr/lib/cmake/Shiboken$SHIBOKEN_SUFFIX-$pkgver/
    if [ -e ../data/ShibokenConfig-python$_pyver.cmake ] ; then
        install -m 755 ../data/ShibokenConfig-python$_pyver.cmake $pkgdir/usr/lib/cmake/Shiboken$SHIBOKEN_SUFFIX-$pkgver/
    else
        if [ -e ../data/ShibokenConfig$PYTHON_SUFFIX.cmake ] ; then
            install -m 755 ../data/ShibokenConfig$PYTHON_SUFFIX.cmake $pkgdir/usr/lib/cmake/Shiboken$SHIBOKEN_SUFFIX-$pkgver/
        else
            msg "Unable to resolve cmake config file for \"$PYTHON_SUFFIX\"."
            return 1
        fi
    fi

    mkdir -m 755 -p $pkgdir/usr/lib/pkgconfig/
    install -m 755 ../data/shiboken$SHIBOKEN_SUFFIX.pc $pkgdir/usr/lib/pkgconfig/
}