diff options
Diffstat (limited to 'openvino/openvino.SlackBuild')
| -rw-r--r-- | openvino/openvino.SlackBuild | 175 |
1 files changed, 175 insertions, 0 deletions
diff --git a/openvino/openvino.SlackBuild b/openvino/openvino.SlackBuild new file mode 100644 index 0000000..236c9ce --- /dev/null +++ b/openvino/openvino.SlackBuild @@ -0,0 +1,175 @@ +#!/bin/bash + +# Slackware build script for openvino + +# Copyright 2024 Johannes Schoepfer, Germany +# Copyright 2026 Danilo M. <danix@danix.xyz> +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +cd $(dirname $0) ; CWD=$(pwd) + +PRGNAM=openvino +VERSION=${VERSION:-2026.2.1} +# All bundled deps are pinned to the exact commit openvino references at this +# tag (its git submodule gitlinks), downloaded as archive/<sha> tarballs. +COMMIT_MLAS=d1bc25ec4660cddd87804fcf03b2411b5dfb2e94 +COMMIT_ONEDNN=87f65fdd1927b1d0cbdf0ea37728146abfbffb52 +COMMIT_ONEDNN_GPU=20db47e2d3c4df1b66e93bed2e97d30da175512d +COMMIT_FLATBUFFERS=595bf0007ab1929570c7671f091313c8fc20644e +COMMIT_ONNX=e709452ef2bbc1d113faf678c24e6d3467696e83 +COMMIT_ITTAPI=ca45fef1a12cef3316e6ff362a4d36571270e392 +COMMIT_PROTOBUF=f0dc78d7e6e331b8c6bb2d5283e06aa26883ca7c +COMMIT_XBYAK=0d67fd1530016b7c56f3cd74b3fca920f4c3e2b4 +BUILD=${BUILD:-2} +TAG=${TAG:-_SBo} +PKGTYPE=${PKGTYPE:-tgz} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then + echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE" + exit 0 +fi + +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "aarch64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +elif [ "$ARCH" = "arm" ]; then + SLKCFLAGS="-O2 -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=hard" + LIBDIRSUFFIX="" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -e + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.?z +cd $PRGNAM-$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 {} + + +patch -p1 < $CWD/010-openvino-disable-werror.patch +patch -p1 < $CWD/020-openvino-use-protobuf-shared-libs.patch + +# Each bundled dep ships as a git submodule; upstream leaves an empty +# placeholder dir where it expects the source. We drop in the pinned tarball +# and symlink the placeholder to whatever top-level dir it unpacks, so the +# extracted dir name (a commit hash) never has to be spelled out here. Bumping +# a dep is then just a new SHA/URL/md5 in the vars and .info, no edits below. +# args: <parent-dir> <placeholder-name> <tarball> +bundle_dep() { + ( cd "$1" + rmdir "$2" + top=$(tar tf "$CWD/$3" | head -1 | cut -d/ -f1) + tar xf "$CWD/$3" + ln -s "$top" "$2" + ) +} + +# Flatbuffers from SBo provide broken cmake files (static-lib removed but +# static-lib-cmake-files not removed), so bundle upstream's copy. +bundle_dep thirdparty/flatbuffers flatbuffers "flatbuffers-$COMMIT_FLATBUFFERS.tar.gz" +bundle_dep thirdparty/onnx onnx "onnx-$COMMIT_ONNX.tar.gz" +bundle_dep thirdparty/ittapi ittapi "ittapi-$COMMIT_ITTAPI.tar.gz" +bundle_dep thirdparty/protobuf protobuf "protobuf-$COMMIT_PROTOBUF.tar.gz" +# Bundle xbyak rather than use the system package: its cmake config exports a +# bare -isystem /usr/include, which breaks GCC 15's #include_next <stdlib.h>. +# Its submodule sits directly at thirdparty/xbyak (no nested wrapper dir). +bundle_dep thirdparty xbyak "xbyak-$COMMIT_XBYAK.tar.gz" +bundle_dep src/plugins/intel_cpu/thirdparty mlas "mlas-$COMMIT_MLAS.tar.gz" +bundle_dep src/plugins/intel_cpu/thirdparty onednn "oneDNN-$COMMIT_ONEDNN.tar.gz" +bundle_dep src/plugins/intel_gpu/thirdparty onednn_gpu "oneDNN-$COMMIT_ONEDNN_GPU.tar.gz" + +# npu plugin needs avx and does not build with the default x86_64 arch +mkdir -p build +cd build + # Configure with no network: openvino's cmake otherwise fetches prebuilt + # deps (e.g. TBB) from storage.openvinotoolkit.org via aria2c, which would + # silently pull in unvetted binaries. Skipped where unshare is not permitted + # (containers without CAP_SYS_ADMIN); the pinned bundled deps still apply. + unshare -n true 2>/dev/null && NETNS="unshare -n" || NETNS="" + $NETNS cmake \ + -G Ninja \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_STANDARD=17 \ + -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ + -DCMAKE_INSTALL_PREFIX=/usr/share/openvino \ + -DLIB_SUFFIX=${LIBDIRSUFFIX} \ + -DENABLE_AVX2=OFF \ + -DENABLE_AVX512F=OFF \ + -DENABLE_CPPLINT=OFF \ + -DENABLE_SYSTEM_FLATBUFFERS=OFF \ + -DENABLE_SYSTEM_PUGIXML=ON \ + -DENABLE_SYSTEM_SNAPPY=ON \ + -DENABLE_SYSTEM_TBB=ON \ + -DENABLE_PROFILING_ITT=ON \ + -DENABLE_TBBBIND_2_5=OFF \ + -DENABLE_JS=OFF \ + -DENABLE_SAMPLES=OFF \ + -DENABLE_INTEL_CPU=ON \ + -DENABLE_INTEL_GPU=ON \ + -DENABLE_INTEL_NPU=OFF \ + -DCMAKE_BUILD_TYPE=Release .. + "${NINJA:=ninja}" + DESTDIR=$PKG $NINJA install/strip +cd .. + +# We don't build samples, so we remove samples stub files +rm -rf $PKG/usr/share/openvino/samples + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a LICENSE README.md $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE |
