pyside_aur / pyside / PKGBUILD

# Maintainer: arlx_ignacy <ziphims@gmail.com>
# Contributor: Douglas Soares de Andrade <douglas@archlinux.org>


# 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=pyside
pkgname=('python2-pyside' 'python-pyside' 'pyside-common')
pkgver=1.1.2
pkgrel=1
pkgdesc='CPython Qt bindings generated using the Shiboken generator.'
arch=('i686' 'x86_64')
license=('LGPL')
url='http://www.pyside.org'
depends=('qt>=4.8' 'phonon' 'mesa')
makedepends=('automoc4' 'shiboken-common>=1.1.2')
replaces=('pyside')
source=("http://www.pyside.org/files/pyside-qt4.8+$pkgver.tar.bz2")
md5sums=('59c8653734b020b0128b82adc98ee704')


build() {
    echo ""
}

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

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

        # change this to point to shiboken cmake macros for python2, previously
        # I compile shiboken using arch's vanilla python2, which by cmake
        # indentified as python2.7, this is a hacky way to reconstruct the
        # PYTHON_SUFFIX variable for cmake, if it doesnt match your target
        # python interpreter feel free to manually change this
        _PYTHON2SUFFIX=-python$($_py2exec -c "from distutils import sysconfig;print sysconfig.get_python_version()")
        echo "Using PYTHON_SUFFIX: $_PYTHON2SUFFIX"

        # make build for python2
        cd "$srcdir/build"
        cmake ../pyside-qt4.8+$pkgver -DCMAKE_INSTALL_PREFIX=/usr  \
                                      -DCMAKE_BUILD_TYPE=Release   \
                                      -DENABLE_GCC_OPTIMIZATION=On \
                                      -DPYTHON_SUFFIX=$_PYTHON2SUFFIX
        make DESTDIR=$pkgdir clean install

        # remove PySideConfig files
        rm $pkgdir/usr/lib/cmake/PySide-$pkgver/PySideConfig{,Version}.cmake
        # remove pkgconfig
        rm -r $pkgdir/usr/lib/pkgconfig

        # remove include files
        rm -r $pkgdir/usr/include
        # remove share files
        rm -r $pkgdir/usr/share
    fi
}

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

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

        cd "$srcdir/build"
        cmake ../pyside-qt4.8+$pkgver -DCMAKE_INSTALL_PREFIX=/usr \
                                      -DCMAKE_BUILD_TYPE=Release  \
                                      -DENABLE_GCC_OPTIMIZATION=On
        make DESTDIR=$pkgdir clean install

        # remove PySideConfig files
        rm $pkgdir/usr/lib/cmake/PySide-$pkgver/PySideConfig{,Version}.cmake
        # remove pkgconfig
        rm -r $pkgdir/usr/lib/pkgconfig

        # remove include files
        rm -r $pkgdir/usr/include
        # remove share files
        rm -r $pkgdir/usr/share
    fi
}

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

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

    # remove PySideConfig*python*.cmake files
    rm $pkgdir/usr/lib/cmake/PySide-$pkgver/PySideConfig*python*.cmake
}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.