#!/bin/bash
echo "Gentoo specific check follows. Pls remove this from the script, or just"
echo "disregard it, if on some other distro. Owe, not just! But find out"
echo "yourself if Cinelerra is installed in your distro via package manager!"
read FAKE;
gen_inst=$(equery l cinelerra)
if [ "$gen_inst" != "" ]; then
	echo "$gen_inst is installed in your Gentoo"
	echo "Hit Enter to uninstall it, and to install Cinelerra from git."
	read FAKE;
	emerge -C cinelerra
	else
	echo "Cinelerra not installed. Proceeding to install cinelerra from git."
fi
read FAKE;
mkdir -p /var/log/no-portage-tmp
echo ls -l /var/log/no-portage-tmp
read FAKE; 
ls -l /var/log/no-portage-tmp
read FAKE; 
cd cinelerra
pwd
echo autoreconf -i
read FAKE; 
autoreconf -i |& tee /var/log/no-portage-tmp/cinelerra-cv_$(date +%y%m%d_%H%M)_autoreconf-i.log
read FAKE; 
echo intltoolize 
read FAKE; 
intltoolize 
read FAKE; 
# This is here so you get, by "echo $LDFLAGS" echo'd:
# -Wl,-z,noexecstack
# if the LDFLAGS were successfully set. Else Ctrl-C and investigate.
export LDFLAGS+=-Wl,-z,noexecstack && echo $LDFLAGS; read FAKE; 
echo ./configure
read FAKE; 
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-x --with-buildinfo=git |& tee /var/log/no-portage-tmp/cinelerra-cv_$(date +%y%m%d_%H%M)_configure.log
echo make
read FAKE; 
make |& tee /var/log/no-portage-tmp/cinelerra-cv_$(date +%y%m%d_%H%M)_make.log
echo find
read FAKE; 
find / -xdev -name '*' > /root/FIND_$(date +%y%m%d_%H%M)_cinelerra_make_install_BEFOR
echo make install
read FAKE; 
make install |& tee /var/log/no-portage-tmp/cinelerra-cv_$(date +%y%m%d_%H%M)_make_install.log
echo find
read FAKE; 
find / -xdev -name '*' > /root/FIND_$(date +%y%m%d_%H%M)_cinelerra_make_install_AFTER
