Hi @all,
for all who want to use the latest fpc and lazarus from the svn, are faced with the problem to manually update the svn's and compile fpc and lazarus separately.
I wrote a a script to do all this automatically and install the newly build fpc, so that lazarus can be build with the latest fpc. It also creates an desktop file to easily start lazarus from the start menu.
Just modify the directory variable "dir" where both fpc svn and lazaraus svn are :-)
#!/bin/bash
dir=$HOME/Programme
packagedir=$dir #thats a backup directory for you fpc.deb and fpc-src.deb
# the fpc svn should be in:
# svn checkout http://svn.freepascal.org/svn/fpc/trunk $dir/fpc
#the lazarus svn is:
# svn co http://svn.freepascal.org/svn/lazarus/trunk $dir/lazarus
function Ask()
{
#0 = description
#1= variables
local args=("$@")
echo "##############################"
echo ${args[0]}
unset args[0] # deltes description value
echo "---------- Optionen ---------- [1] is default"
#echo ${#variables[*]} # anzahl der elemente
for index in ${!args[*]}
do
printf "[$index] = ${args[$index]}\n"
done
read inputkey
# test if it is numeric
if [[ "$inputkey" != +([0-9]) ]]
then
#echo "is not an Integer"
inputkey=1
fi
result=${args[$inputkey]}
echo "Option is [$inputkey] = $result"
}
echo 'Please enter your admin password to install the deb packages'
sudo echo 'Thanks'
if [ "`dpkg-query -W -f='${Status}\n' fp-compiler`" = "unknown ok not-installed" ] ; then
echo ""
echo "No fp-compiler installed yet.... checking if there is already a debfile"
cd $dir/lazarus/tools/install
if [ "`ls | grep "\.deb"`" = "" ] ; then
echo ""
echo "Search in $packagedir"
cd "$packagedir"
else
echo ""
echo "Search in $dir/lazarus/tools/install"
fi
echo ""
echo "Installing..."
sudo dpkg -i *.ftp://newwiki.freepascal.org/pub/lazarus/snapshotsdeb
echo ""
if [ "`dpkg-query -W -f='${Status}\n' fp-compiler`" = "unknown ok not-installed" ] ; then
echo ""
echo "compiler deb wasn't found... trying online version"
mkdir /tmp/fpcmy
cd /tmp/fpcmy
wget ftp://newwiki.freepascal.org/pub/lazarus/snapshots/fpc-2.6.0-1.amd64.deb.tar
tar -xf *.amd64.deb.tar
sudo dpkg -i *.deb
fi
if [ "`dpkg-query -W -f='${Status}\n' fpc`" = "unknown ok not-installed" ] ; then
echo ""
echo "fp-compiler couldn't be installed"
exit
else
echo ""
echo "fpc was sucessfully installed"
fi
fi
Ask "Debug Modus" "no" "yes"
debug=$result
if [ "$debug" = "yes" ]
then
echo ""
echo "If Libary Errors occur try:"
echo "sudo apt-get install libgpm-dev libgtk2.0-dev libx11-dev libglut-dev libncurses5-dev libglib2.0-dev libgl1-mesa-dev"
echo ""
fi
Ask "Clean up svn directories?" "no" "yes"
if [ "$result" = "yes" ]
then
cd $dir/lazarus
svn st | awk '{print $2}' | xargs rm -rvf
cd $dir/fpc
svn st | awk '{print $2}' | xargs rm -rvf
fi
cd $dir/lazarus
svn update
cd $dir/fpc
svn update
if [ "$debug" = "yes" ]
then
echo "That was:"
echo "svn update"
echo "Everything ok?"
read lineinput
fi
cd $dir/lazarus/tools/install
rm *.deb
rm *.tar.gz
nice -n 19 ./create_fpc_deb.sh fpc $dir/fpc/
if [ "$debug" = "yes" ]
then
echo "That was:"
echo "./create_fpc_deb.sh fpc $dir/fpc/"
echo "Everything ok?"
read lineinput
fi
nice -n 19 ./create_fpc_deb.sh fpc-src $dir/fpc/
if [ "$debug" = "yes" ]
then
echo "That was:"
echo "./create_fpc_deb.sh fpc-src $dir/fpc/"
echo "Everything ok?"
read lineinput
fi
#neustes zu den paketen kopieren
if [ "$debug" != "yes" ]
then
cd "$packagedir"
rm fpc*.deb
fi
cd $dir/lazarus/tools/install
cp *.deb "$packagedir"
#installieren
sudo dpkg -i *.deb
if [ "$debug" = "yes" ]
then
echo "That was:"
echo "sudo dpkg -i *.deb"
echo "Everything ok?"
read lineinput
fi
#echo 'Lazarus neu erstellen?'
cd $dir/lazarus/
echo "
Compiling Lazarus"
make clean all
echo "
Deleting tmp files"
rm -R ~/tmp/fpc_patchdir
rm -R ~/tmp/fpc
#create desktop link:
echo "[Desktop Entry]
Name=Lazarus
Comment=Lazarus IDE
Exec=$dir/lazarus/lazarus
Type=Application
Icon=$dir/lazarus/images/ide_icon48x48.png
Categories=Application;IDE;Development;GTK;GUIDesigner;
MimeType=text/x-pascal;text/lazarus-project-source;text/lazarus-project-information;text/lazarus-form;text/lazarus-resource;text/lazarus-package;text/lazarus-package-link;text/lazarus-code-inlay;
[Property::X-KDE-NativeExtension]
Type=QString
Value=.pas
X-Ubuntu-Gettext-Domain=desktop_kdelibs" > /tmp/lazarus.desktop
sudo mv /tmp/lazarus.desktop /usr/share/applications/
sudo rm /usr/bin/lazarus
sudo ln -s $dir/lazarus/lazarus /usr/bin/lazarus
Ask "Start Lazarus" "yes" "no"
if [ "$result" = "yes" ] ;then
$dir/lazarus/lazarus &
fi