#!/bin/sh -e

export DESTDIR="$1"

sed -i 's/SHARED/STATIC/' gmmlib/Source/GmmLib/CMakeLists.txt

cd media

cmake -B build \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=/usr/lib \
    -DBS_DIR_GMMLIB="$OLDPWD/gmmlib/Source/GmmLib" \
    -DINSTALL_DRIVER_SYSCONF=OFF \
    -DRUN_TEST_SUITE=OFF

cmake --build   build
cmake --install build

rm -rf "$1/usr/include/igdgmm" \
       "$1/usr/lib/pkgconfig/igdgmm.pc"
