I have three scripts to make FreePascal/Lazarus installation on OpenBSD easy:
install_freepascal_binaries.sh:
#!/bin/sh
if [ "$1" = "" ]
then
echo 'Usage: install_freepascal.sh <x86_64/i386> <version> [1=force install]'
exit 0
fi
case "$1" in
"i386")
CARCH="386"
;;
"x86_64")
CARCH="x64"
;;
*)
echo "Invalid architecture."
exit 2
;;
esac
if [ -f "/usr/bin/ppc""$CARCH" -a "$3" != "1" ]
then
echo "FreePascal binaries seems to be already installed. Force install if you want to reinstall them."
exit 0
fi
cd /tmp
DNAME="fpc-""$2"".""$1""-openbsd"
ANAME="$DNAME"".tar"
ftp "https://downloads.sourceforge.net/project/freepascal/OpenBSD/""$2""/""$ANAME"
if [ ! -f "$ANAME" ]
then
echo "Could not download FreePascal binaries."
exit 1
fi
tar -xvf "$ANAME"
rm "$ANAME"
cd "$DNAME"
echo "Install to /usr/ instead of /usr/local/"
./install.sh
cd ..
rm -rf "$DNAME"
echo "FreePascal binaries have been successfully installed."
install_freepascal_sources.sh:
#!/bin/sh
if [ "$1" = "" ]
then
echo 'Usage: install_freepascal_sources.sh <version> [1=force install]'
exit 0
fi
TNAME="/usr/share/fpcsrc/""$1"
if [ -f "$TNAME""/Makefile" -a "$2" != "1" ]
then
echo "FreePascal sources seems to be already installed. Force install if you want to reinstall them."
exit 0
fi
cd /tmp
DNAME="fpc-""$1"
ANAME="$DNAME"".source.zip"
ftp "https://netcologne.dl.sourceforge.net/project/freepascal/Source/""$1""/""$ANAME" -o "$ANAME" -S dont
if [ ! -f "$ANAME" ]
then
echo "Could not download FreePascal sources."
exit 1
fi
unzip "$ANAME"
rm "$ANAME"
mkdir -p `dirname "$TNAME"`
mv "fpc-""$1" "$TNAME"
cd "$TNAME"
FTOED="packages/fcl-net/fpmake.pp"
if [ ! -f "$FTOED" ]
then
echo "$FTOED"" is missing."
exit 2
fi
sed -i "s/'cnetdb\.pp',\[linux,freebsd,solaris,android\]/'cnetdb\.pp',\[linux,freebsd,openbsd,dragonfly,solaris,android\]/" "$FTOED"
echo "FreePascal sources have been successfully installed."
install_lazarus.sh:
#!/bin/sh
if [ "$1" = "" ]
then
echo 'Usage: install_lazarus.sh <version> [revision] [1=force install]'
exit 0
fi
TNAME="/usr/local/share/lazarus/lazarus"
if [ -f "$TNAME" -a "$3" != "1" ]
then
echo "Lazarus seems to be already installed. Force install if you want to reinstall it."
exit 0
fi
cd /tmp
if [ ! -d "lazarus" ];
then
REV=""
if [ "$2" != "" ];
then
REV="-""$2"
fi
ANAME="lazarus-""$1""$REV"".zip"
ftp "https://netix.dl.sourceforge.net/project/lazarus/Lazarus%20Zip%20_%20GZip/Lazarus%20""$1""/""$ANAME" -o "$ANAME" -S dont
if [ ! -f "$ANAME" ];
then
echo "Could not download Lazarus sources."
exit 1
fi
unzip "$ANAME"
rm "$ANAME"
fi
cd lazarus
gmake clean bigide
if [ -f lazarus ];
then
mkdir -p `dirname "$TNAME"`
gmake install
if [ -f "$TNAME" ];
then
cd ..
rm -rf lazarus
else
echo "Install failed."
exit 2
fi
else
echo "Build failed."
exit 3
fi
echo "Lazarus has been successfully installed."
When i do:
install_freepascal_binaries.sh x86_64 3.2.2
install_freepascal_sources.sh 3.2.2
install_lazarus.sh 3.4 0
The compiling dies at one point by stating:
Can't find unit cNetDB used by netdb
This is the very same message
as earlier, however, this time
/usr/share/fpcsrc/3.2.2/packages/fcl-net/fpmake.pp is already patched to have
T:=P.Targets.AddUnit('cnetdb.pp',[linux,freebsd,openbsd,dragonfly,solaris,android]);
instead of
T:=P.Targets.AddUnit('cnetdb.pp',[linux,freebsd,dragonfly,solaris,android]);
yet the compiling dies with this message.
Am i doing something wrong? Should not the sources of FreePascal reside in
/usr/share/fpcsrc/3.2.2? Or is it
/usr/share/fpcsrc/fpc-3.2.2? AFAIK, it should be the first, but in my current OpenBSD 7.4 system, it is the latter one. Granted, i did not use these scripts last time to build Lazarus, but
ibara's port, which worked. Until now.
OpenBSD 7.5 broke something again and after upgrading the system and - more precisely -
harfbuzz, Lazarus dies with this error message:
(lazarus:40076): GLib-GObject-CRITICAL **: 15:58:36.054: g_object_unref: assertion 'G_IS_OBJECT (object)' failed
[FORMS.PP] ExceptionOccurred
Sender=EAccessViolation
Exception=Access violation
Stack trace:
$000008A747750768
$000008A74774E80E
$000008A74774F02F
$000008A7664A56BE
$000008A74773A44D
$000008A7664A3B16
$000008A7663D7572
$000008A747734410
$000008A747751052
$000008A74774E80E
$000008A74774F02F
$000008A7664A56BE
$000008A74773A44D
$000008A7664A3B16
$000008A4E5F94652 FREESTYLEOBJECT, line 7715 of gtk2proc.inc
$000008A4E5F94777 RELEASEALLSTYLES, line 7742 of gtk2proc.inc
$000008A4E5E2BFF1 FREEALLSTYLES, line 1650 of gtk2widgetset.inc
[FORMS.PP] ExceptionOccurred
And if i try to rebuild Lazarus from the ports (
cd /usr/ports/devel/lazarus && make clean='all depends' && make install), then this:
gmake -C ide ide
gmake[1]: Entering directory '/usr/ports/pobj/lazarus-2.2.0_0/lazarus/ide'
/bin/mkdir -p ../units/x86_64-openbsd/gtk2
../tools/svn2revisioninc .. revision.inc
Created /usr/ports/pobj/lazarus-2.2.0_0/lazarus/ide/revision.inc for revision: Unversioned directory
An unhandled exception occurred at $00000B4CF72602F2:
EAccessViolation:
$00000B4CF72602F2 line 177 of /usr/src/lib/libc/stdlib/atexit.c
$00000B4CF72727E5 line 54 of /usr/src/lib/libc/stdlib/exit.c
$00000B4A04264983
An unhandled exception occurred at $00000B4A0427FB50:
EAccessViolation:
$00000B4A0427FB50
$00000B4CF72727E5 line 54 of /usr/src/lib/libc/stdlib/exit.c
$00000B4A04264983
And then this latter error message repeats forever.
This is why i decided to dust off my old approach and build Lazarus from scratch, but that does not work either.
Any ideas are appreciated.