#! /bin/bash
DEBIAN_FRONTEND=noninteractive
# Clone Upstream
git clone https://github.com/intel/gmmlib ./intel-gmmlib -b intel-gmmlib-22.3.12
cp -rvf ./debian ./intel-gmmlib/
cd ./intel-gmmlib/
for i in $(cat ../patches/series) ; do echo "Applying Patch: $i" && patch -Np1 -i ../patches/$i || bash -c "echo "Applying Patch $i Failed!" && exit 2"; done
# Get build deps
apt-get build-dep ./ -y
# Build package
dpkg-buildpackage --no-sign
# Move the debs to output
cd ../
mkdir -p ./output
mv ./*.deb ./output/