Skip to content

Instantly share code, notes, and snippets.

@aligoren
Last active November 3, 2015 21:43
Show Gist options
  • Save aligoren/9805f9e250afd34b84f4 to your computer and use it in GitHub Desktop.
Save aligoren/9805f9e250afd34b84f4 to your computer and use it in GitHub Desktop.
user="$(whoami)"
gtkd_url="http://gtkd.org/Downloads/sources/Latest"
echo Downloading...
# show only progressbar
progressBar()
{
local flag=false c count cr=$'\r' nl=$'\n'
while IFS='' read -d '' -rn 1 c
do
if $flag
then
printf '%c' "$c"
else
if [[ $c != $cr && $c != $nl ]]
then
count=0
else
((count++))
if ((count > 1))
then
flag=true
fi
fi
fi
done
}
sudo wget --progress=bar:force -O /home/${user}/Downloads/gtkd.zip $gtkd_url
2>&1 | progressBar
sudo unzip /home/${user}/Downloads/gtkd.zip -d /home/${user}/Downloads/gtkd/
cd /home/${user}/Downloads/gtkd/
echo Installation...
sudo make all
sudo make install
#echo Configuration...
# for auto link: dmd sample.d -ofSample
#env32="[Environment32]"
#env64="[Environment64]"
#dflg32="DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -I/usr/local/include/d/gtkd-3 -L-lgtkd-3 -L-lgtkdgl-3 -L-lgtkdsv-3 -L-ldl"
#dflg64="DFLAGS=-I/usr/include/dmd/phobos -I/usr/include/dmd/druntime/import -I/usr/local/include/d/gtkd-3 -L-lgtkd-3 -L-lgtkdgl-3 -L-lgtkdsv-3 -L-ldl"
#sudo mv /etc/dmd.conf /etc/dmd.conf.backup
#sudo touch /etc/dmd.conf
#cat << EOF | sudo tee /etc/dmd.conf &> /dev/null
#${env32}
#${dflg32}
#${env64}
#${dflg64}
#EOF
echo Installation Complete...
read -p "Delete Cache File?(Press D or d)" -n 1 -r
if [[ $REPLY =~ ^[Dd]$ ]]
then
sudo rm /home/${user}/Downloads/gtkd.zip
sudo rm -rf /home/${user}/Downloads/gtkd
else
echo "Only D-d"
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment