graphics/opencolorio: Fix python{2,3} compatibility.

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Christoph Willing 2015-03-27 21:32:13 +07:00 committed by Willy Sudiarto Raharjo
parent 7dd840b9e5
commit fbd5e0caf2
2 changed files with 36 additions and 50 deletions

View file

@ -8,4 +8,5 @@ Color Encoding Specification (ACES) and is LUT-format agnostic,
supporting many popular formats.
This package includes building of a shared object library for each of
python2 and python3 provided python3 is available on the build system.
python2 and python3 provided the respective python version is available
on the build system.

View file

@ -25,15 +25,9 @@
PRGNAM=opencolorio
SRCNAM=OpenColorIO
VERSION=${VERSION:-0.git20150311}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
PYTHON3_INCLUDE_DIR=$(pkg-config --cflags-only-I python3 |sed -e 's/-I//')
PYTHON2_INCLUDE_DIR=$(pkg-config --cflags-only-I python2 |sed -e 's/-I//')
if [ -e /usr/bin/python3 ]; then
PY2SITEDIR=$(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
PY3SITEDIR=$(python3 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
fi
PYTHON_VERSIONS=${PYTHON_VERSIONS:-"2 3"}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
@ -66,51 +60,42 @@ set -e
rm -rf $PKG
mkdir -p $TMP $PKG $OUTPUT
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
mkdir -p build
cd build
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DPYTHON=python2 \
-DPYTHON_INCLUDE_DIR:PATH=$PYTHON2_INCLUDE_DIR \
-DPYTHON_LIBRARY:PATH=$PY2SITEDIR \
-DOCIO_BUILD_STATIC:BOOL=OFF \
-DOCIO_BUILD_JNIGLUE:BOOL=OFF \
-DCMAKE_BUILD_TYPE=Release ..
for v in $PYTHON_VERSIONS ; do
if [ $(which python$v 2>/dev/null) ]; then
PY_INCLUDE_DIR=$(pkg-config --cflags-only-I python$v |sed -e 's/-I//')
PY_SITEDIR=$(python$v -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
make
make install DESTDIR=$PKG
cd $TMP
rm -rf $SRCNAM-$VERSION
tar xvf $CWD/$SRCNAM-$VERSION.tar.gz
cd $SRCNAM-$VERSION
chown -R root:root .
find -L . \
\( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-o -perm 511 \) -exec chmod 755 {} \; -o \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
if [ -e /usr/bin/python3 ]; then
rm -rf *
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DPYTHON=python3 \
-DPYTHON_INCLUDE_DIR:PATH=$PYTHON3_INCLUDE_DIR \
-DPYTHON_LIBRARY:PATH=$PY3SITEDIR \
-DOCIO_BUILD_STATIC:BOOL=OFF \
-DOCIO_BUILD_JNIGLUE:BOOL=OFF \
-DCMAKE_BUILD_TYPE=Release ..
mkdir -p build
cd build
cmake \
-DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DLIB_SUFFIX=${LIBDIRSUFFIX} \
-DPYTHON=python$v \
-DPYTHON_INCLUDE_DIR:PATH=$PY_INCLUDE_DIR \
-DPYTHON_LIBRARY:PATH=$PY_SITEDIR \
-DOCIO_BUILD_STATIC:BOOL=OFF \
-DOCIO_BUILD_JNIGLUE:BOOL=OFF \
-DCMAKE_BUILD_TYPE=Release ..
make
make install DESTDIR=$PKG
fi
done
make
make install DESTDIR=$PKG
fi
cd ..
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \