Sign in Join
Wiki copytemporary

LazarusScripts: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: LazarusScripts

OldNewLine
1+## Windows
2+
3+Here is a windows batch script that takes care of checking out and updating **Lazarus** from **GIT** to a subdirectory and even basic error fixing, because i have no way of knowing where Lazarus is installed it cannot compile or copy the files to your working Lazarus installation. Please save the script as **getlaz.bat** or some other name, however there is no warranty of any kind, use at your own risk, put it in a test directory first and make sure there is no subdirectory already called **lazarus**.
4+
5+```dos
6+@echo off
7+REM Script for checkout and update Lazarus from SVN
8+echo.
9+
10+REM Check if lazarus directory exists to update or checkout first
11+if exist lazarus (
12+echo Updating Lazarus, please wait ...
13+cd lazarus
14+git pull
15+if %errorlevel% NEQ 0 goto CleanupLaz
16+cd ..
17+goto Exit
18+)
19+
20+echo Checking out Lazarus for the first time, this might take a while ...
21+git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git
22+goto Exit
23+
24+:CleanupLaz
25+echo.
26+echo Something went wrong, please check or delete/move/rename the lazarus subdirectory ...
27+goto Exit
28+
29+:Exit
30+```
31+
32+## GNU/Linux
33+
34+A trivial script to update the local repository for Lazarus etc..
35+
36+In home-directory, have a special cvsroot-subdirectory.
37+
38+In this directory have a script for downloading Lazarus and other interesting projects.
39+
40+Lazarus is installed in /usr/share/lazarus.
41+
42+Before building a new version with the current remote repository from GitLab I make a backup, just in case the current remote repository is unstable.
43+
44+This is done by moving the /usr/share/lazarus directory to /usr/share/lazarus.BAK
45+
46+To adapt the script to your system, you need to alter the constants defined at the start of the script.
47+
48+It may not be working, as usual and does not catch any errors.
49+
50+``` bash
51+#!/bin/bash
52+
53+# get a local copy of the repository prior running this script - so first do:
54+# git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git
55+
56+# Define some directories , much better to not put stuff below /usr/ but below /home/
57+# must point the the same root as LAZDIR
58+BASEDIR=/usr/share/
59+# dir of the git repository
60+LAZCVSDIR=~/cvsroot/lazarus/
61+# dir where lazarus is installed to
62+LAZDIR=/usr/share/lazarus/
63+# backup dir with the previous lazarus installation
64+LAZBACKUP=/usr/share/lazarus.BAK
65+
66+# Remove old backup if it exists
67+date +"%T %tStart"
68+if [ -d $LAZBACKUP ]
69+then
70+ date +"%T %tRemoving old backup"
71+ rm $LAZBACKUP -fr
72+else
73+ date +"%T %tNo backup to remove"
74+fi
75+
76+date +"%T %tCreating copy of lazarus dir"
77+cp -R $LAZDIR $LAZBACKUP
78+
79+# Getting stuff from GitLab
80+date +"%T %tUpdate lazarus"
81+git pull > ~/cvs_update.log
82+
83+# Copying cloned files to our laz dir.
84+date +"%T %tcopying files"
85+cp -Rf $LAZCVSDIR $BASEDIR --reply=yes
86+
87+# Make and building of lazarus
88+date +"%T %tmake lazarus"
89+cd $LAZDIR
90+make > /dev/null ### so you don't see all the errors which will inevitably break the script
91+date +"%T %tmake the packages"
92+make idepkg > /dev/null
93+date +"%T %tFinished"
94+```
95+
96+---
97+*From the Free Pascal wiki, page "LazarusScripts", as it stood on 2021-12-27 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
98+Category: Install
99+Category: Lazarus

Back to history