#!/bin/bash
# this declares that current user is a sudoer
sudo tee /etc/sudoers.d/$USER <<END
END

GST_DEVPACKAGES="v c m"

NEWPREFIX=/media/build/usr
BUILDDIR=$HOME/GIT/GSTREAMER/UBUNTU1604/gst
for DEVPACKAGE in $GST_DEVPACKAGES ; do
cd $BUILDDIR/gst-devtools
PATH=$NEWPREFIX/bin:$PATH PKG_CONFIG_PATH=$NEWPREFIX/lib/pkgconfig ./configure --prefix $NEWPREFIX -$DEVPACKAGE
make CFLAGS+="-I$NEWPREFIX/include -I$NEWPREFIX/include/gstreamer-1.0 -I$NEWPREFIX/lib/gstreamer-1.0/include" LDFLAGS+="-L$NEWPREFIX/lib -L$NEWPREFIX/lib/gstreamer-1.0" && \
sudo make install
done
# then to remove the sudo access from the current user
sudo /bin/rm /etc/sudoers.d/$USER
sudo -k
