python/pybind11: Use CMake

Signed-off-by: Christoph Willing <chris.willing@linux.com>

Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
This commit is contained in:
Christoph Willing 2021-02-12 09:29:54 +10:00 committed by Willy Sudiarto Raharjo
parent d5e3de9b3a
commit 4a9c97e394
No known key found for this signature in database
GPG key ID: 3F617144D7238786

View file

@ -2,7 +2,7 @@
# Slackware build script for pybind11
# Copyright 2019,2020 Christoph Willing, Brisbane, Australia
# Copyright 2019,2021 Christoph Willing, Brisbane, Australia
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -25,7 +25,7 @@
PRGNAM=pybind11
VERSION=${VERSION:-2.5.0}
BUILD=${BUILD:-1}
BUILD=${BUILD:-2}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
@ -70,19 +70,25 @@ find -L . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
python setup.py install --root=$PKG
# Python 3 support.
if $(python3 -c 'import sys' 2>/dev/null); then
python3 setup.py install --root=$PKG
fi
mkdir build && cd build
cmake .. \
-DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DPYBIND11_PYTHON_VERSION=$(python3 --version|cut -d' ' -f2) \
-DPYBIND11_TEST=OFF \
make
make install DESTDIR=$PKG
cd ..
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
cp -a \
CONTRIBUTING.md LICENSE README.md \
CONTRIBUTING.md LICENSE README.md docs/* \
$PKG/usr/doc/$PRGNAM-$VERSION
cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild