Recent

Author Topic: Common File Dialogs Have Been Broken for a Very Long Time (Ex: Ubuntu AARCH64)  (Read 21259 times)

msintle

  • Sr. Member
  • ****
  • Posts: 259
But I'm not trying to focus a hidden control at all. The control I'm hiding when ESC is pressed is a child of the still visible parent control.
Your missing my point.
You said you first hide the control and THEN set focus to the parent.
That's not possible.

You first set focus to the parent and THEN hide the (sub)control.

See the difference (order).

How or what you are actually doing doesn't matter. As long as you don't show any code, this is a non-issue. If you want something resolved (because of a bug or programming error), you need to show the code.

Nope, reordering the call as you suggested did not help.

The widgets probably already handle hiding a control properly even when it has focus.

So there's another issue, around which, my timer workaround helps; at least for now.

I'd love to create a reproducing project for this issue, but I've really got bigger fish to fry for now.

msintle

  • Sr. Member
  • ****
  • Posts: 259
BTW. Can you check if this gives the same directory?
(I could use this in the script instead of find)

Code: Bash  [Select][+][-]
  1. dirname $(gcc --print-file-name=crtbegin.o)

/edit/
Ok, I changed this in my script and it seems to take the correct gcc lib directory.

Code: Bash  [Select][+][-]
  1. cat << EOF >> $HOME/.fpc.cfg
  2. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  3. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  4. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  5. -Fl$(dirname $(gcc --print-file-name=crtbegin.o))
  6. -FD$BASE/fpc/bin
  7. EOF

On to my next issue - investigating why closing common file dialogs now, causes crashes on Qt5 x86_64 Linux operating systems (reproduced on Centos 9 and Fedora 40 thus far).

Might you possibly be having a version of your script that installs the Qt5 version of Lazarus, instead of the GTK2 version?

rvk

  • Hero Member
  • *****
  • Posts: 6643
Might you possibly be having a version of your script that installs the Qt5 version of Lazarus, instead of the GTK2 version?
My RPI4 just became available again today so I can check on that tomorrow.

(Last time I checked I thought it was automatic but I'll have to check)

msintle

  • Sr. Member
  • ****
  • Posts: 259
Might you possibly be having a version of your script that installs the Qt5 version of Lazarus, instead of the GTK2 version?
My RPI4 just became available again today so I can check on that tomorrow.

Cool.

(Last time I checked I thought it was automatic but I'll have to check)

Automatic, how exactly?

My Linux VMs where this issue happens don't normally have Qt5 installed.

<shamelessplug>So my Qt5 compiled IAMP setup runs in character mode fallback without any GUI since it cannot boot the Qt5 GUI, rendering all setup dialogs in character mode;</shamelessplug> and then IAMP itself can actually launch in GUI mode, as it only then could it find the installed Qt5 libs after it itself has been successfully set up.

How would your script handle this scenario, basically?
« Last Edit: December 05, 2024, 01:13:36 am by msintle »

rvk

  • Hero Member
  • *****
  • Posts: 6643
(Last time I checked I thought it was automatic but I'll have to check)
Automatic, how exactly?
Ok. I see now it wasn't totally automatic.

Last time I did this I just compiled the GTK2 version with the script.
Then... and I just did this on Kali and it worked... I installed libqt5pas-dev and did a make bigide over the GTK2 version.
Worked perfectly.

Code: Bash  [Select][+][-]
  1. sudo apt-get install libqt5pas-dev
  2. cd ~/dev/lazarus
  3. make bigide LCL_PLATFORM=qt5

Result... a Qt5 Lazarus version. BTW instead of Qt5 Lazarus you can also use the GTK2 Lazarus to compile for Qt5 (via widgetset target).
Quote
Lazarus 4.99 (rev main_4_99-578-ga81ad6381b) FPC 3.3.1 x86_64-linux-qt5

See https://wiki.freepascal.org/Qt5_Interface

(I would need to see if Qt5 environment could be detected and used automatically but you see there that Fedora and Debian have different Qt5-dev packages)

msintle

  • Sr. Member
  • ****
  • Posts: 259
So I ran a couple tests on affected systems, and they both failed with your script, because apt-get is missing on them.

Can you think of any other ways to install Lazarus Qt5 on these devices?

Centos 9 and Fedora 41 x86_64.

rvk

  • Hero Member
  • *****
  • Posts: 6643
Centos 9 and Fedora 41 x86_64.
Centos and Fedora don't use APT as package manager.
They normally use YUM.

My script currently only runs with APT.
I'm not sure if the installed packages are called the same.

You could remove the apt-get lines and install the required packages manually.
If the package names are the same I could add YUM as option (after determining that YUM is used instead of APT).

msintle

  • Sr. Member
  • ****
  • Posts: 259
Sounds like a great point to start migrating your script to IAMP, but I was really hoping to get to the bottom of the Qt5 issue before doing any of that.

Maybe I can give FPCUPDLX a try before throwing in the towel?

rvk

  • Hero Member
  • *****
  • Posts: 6643
Sounds like a great point to start migrating your script to IAMP, but I was really hoping to get to the bottom of the Qt5 issue before doing any of that.
I'm not familiar with IAMP (?)
I was thinking about a text-menu.
For my Windows script I do have a text menu in the batch file.

fpcupdeluxe is always a much more elaborate way to install.
I created my script just got me, to just simply install only the options I want/need.

In fpcupdeluxe you have a lot more options from which you can choose.
(I could never fit that into a 'simple' script  ;) )

msintle

  • Sr. Member
  • ****
  • Posts: 259
Oh wow, a text menu!

Well, your script has worked for me on devices where FPCUPDLX fails, so dare I say you've done a great job?

rvk

  • Hero Member
  • *****
  • Posts: 6643
Don't read to much in "text menu"  ;)
It's just a few options. Because on Windows I needed 64 and 32 bit. The Linux script doesn't have (or had) that many options. Architecture and bitness is determined by the system and I had no need for cross-compilation etc.

I also wanted to avoid pulling in too many dependencies for it. For Windows you could for example use something elaborate like Chris Titus has done with iwr (https://christitus.com/windows-tool/). It creates a complete Windows menu from Powershell. On Linux I could have used ncurses for text-menus. But then I would have needed to check (and possibly install) the ncurses dependencies, cluttering the system before I even got to compiling. So I normally try to keep it as simple as possible.

And that also the reason why it worked. The problem with fpcupdeluxe was that it is programmed in Lazarus. And your system just happened to have a problem with all Lazarus compiled applications (due to the not masking of the exception). So fpcupdeluxe just didn't work. A simple script does. Power of simplicity  :D  8-)

Code: Text  [Select][+][-]
  1. ---------------------------------------------------------------------------
  2. "Lazarus & FPC Updater"
  3. ---------------------------------------------------------------------------
  4.  
  5. "Updating current installation in Q:\dev64"
  6.  
  7. 1. [X] Clone or Pull FPC
  8. 2. [X] Compile FPC
  9. 3. [X] Clone or Pull Lazarus
  10. 4. [X] Compile Lazarus
  11. 5. [X] Configure Lazarus
  12.  
  13. 6. [X] Compile 64 bit
  14.  
  15. R = RUN the selected choices
  16. Q = Quit
  17.  
  18. Enter Choice :

msintle

  • Sr. Member
  • ****
  • Posts: 259
So cool!

The IAMP you asked about (InstallAware Multi Platform) has similar tricks I wrote about above - if the GUI cannot boot, it falls back to console rendering - retaining all your custom dialog designs in the process. I really want to take a look at building a Lazarus installer in IAMP, with your script as a starting point.

Anyways, my Fedora FPCUPDLX Qt5 installation ended up producing a GTK2 version of Lazarus instead. I'd installed Lazarus GTK2 earlier from the "Store" of the operating system previously, so I figured that might be to blame. Flattened the VM, downgraded from Fedora 41 to Fedora 40 as a result (turns out I hadn't updated my snapshot for v41).

Now reinstalling with FPCUPDLX Qt5 after installing libqt5pas and libqt5pasdevel using RPM packages. Hopefully this gets the right version of Lazarus installed, and I can start troubleshooting what's wrong with common dialog boxes upon close on this platform.

FPCUPDLX Qt5 failed on Centos 9, the other reproducing OS, sadly. I hate it when it does that - again, your script works where it so very often fails in this manner; but my hands have been tied by the Qt5 constraint this time.

rvk

  • Hero Member
  • *****
  • Posts: 6643
Anyways, my Fedora FPCUPDLX Qt5 installation ended up producing a GTK2 version of Lazarus instead.
If you have the GTK2 version you can just recompile it inside Lazarus itself with Qt5.

You do need qt5pas-devel:
Code: Bash  [Select][+][-]
  1. sudo dnf install qt5pas-devel
But after that, you can start Lazarus and go to Tools > Configure Build Lazarus and then check the LCL widget type as qt5.
After that press Build and Lazarus will rebuild itself as Qt5  8-)
(I just did this and it works under Fedora)

Hardest part in changing my script was finding the correct dependencies (no build-essentials package).
I now have these and am not sure yet if they are sufficient. But I've got it working here (need some rework and I'll post the latest result).
Code: Bash  [Select][+][-]
  1. sudo dnf -y install make binutils gdb git zip unzip pv
  2. sudo dnf -y install libX11-devel gtk2-devel gtk+-devel  # for Lazarus, includes all dependencies
  3. sudo dnf -y install gcc gcc-c++ kernel-devel

Problem is that I couldn't do make bigide from the terminal after a successful compile to switch to Qt5 (it gave me target errors).

msintle

  • Sr. Member
  • ****
  • Posts: 259
Music to my ears.

In my latest test, Fedora failed to install Qt5 Lazarus with FPCUPDLX, so whatever had happened in my immediately preceding test succeeding with the GTK2 version of Lazarus probably only succeeded because FPCUPDLX got confused about the widgets somehow and built the wrong thing instead of the right thing, which would have failed.

So yes your latest post is music to my ears, as I just checked official downloads for Lazarus on the site and there's no mention of widgets at all for the RPM downloads (meaning they're GTK2). I was about to ask what next I could try.

As I await your latest script I'll reinstall the GTK2 version of Lazarus and try to rebuild Lazarus manually for Qt5 and try to get things rolling that way. Hopefully by then you'll have a solid grasp on why bigide is failing and even a fix for it, perhaps.

Many thanks once again for your support, and wishing you an awesome weekend!

rvk

  • Hero Member
  • *****
  • Posts: 6643
Here is my new version. Tested in Fedora and will compile Qt5 directly.
(see the LCL_PLATFORM option at the top)

Currently zip=1 so it will use the zip download from github instead of cloning the entire repository.
You'll loose the ability to browse through all the changes in the repository but for testing this doesn't matter.
(Those options would be where a menu comes in handy ;) )

I also see I need to copy the desktop shortcut to ~/.local/share/applications because Fedora doesn't have a desktop but it needs the shortcut there to appear in the All Programs.

Code: Bash  [Select][+][-]
  1. #!/bin/bash
  2. # ======================================================
  3. # by rvk (v.2.1, 2024-12-06)
  4. # ======================================================
  5.  
  6. echo ""
  7. echo "=============================================================="
  8. echo "Running on: $(sed 's/\x0/ /' /sys/firmware/devicetree/base/model 2>/dev/null || cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null || echo Unknown)"
  9.  
  10. # ======================================================
  11. # setup versions, download and compile
  12. # ======================================================
  13.  
  14. #fpc_version="release_3_2_0"
  15. #laz_version="lazarus_2_0_12"
  16.  
  17. #fast
  18. zip=1
  19.  
  20. # repository
  21. fpc_git=1
  22. laz_git=1
  23.  
  24. # compile
  25. fpc_compile=1
  26. laz_compile=1
  27.  
  28. LCL_PLATFORM=qt5
  29. #LCL_PLATFORM=gtk2
  30.  
  31. # ======================================================
  32. # check if we are running in bash instead of sh
  33. ps $$ 2>&1 | grep bash > /dev/null 2>&1 && echo "Running in bash. continuing..." || { echo "Not running in bash. Aborting..."; exit 1; }
  34.  
  35. # ======================================================
  36. # optional use zram as swapfile
  37. # ======================================================
  38. # not done yet
  39.  
  40. # ======================================================
  41. # minimal swap space needed is 1024MB
  42. # ======================================================
  43. while true; do
  44.  
  45.   FREESWAP=$(free | grep -i swap | awk '{print $2}')
  46.   if [ $FREESWAP -lt 900000 ]; then
  47.  
  48.     echo "=============================================================="
  49.     echo "Current swapsize is $FREESWAP"
  50.     echo "Swapsize is really small. Recomended size is 1024MB (1GB).";
  51.     echo "=============================================================="
  52.  
  53.     read -n1 -p "Do you want to increase it to 1024MB (1GB) or continue without swap? [y/n/c] " yn
  54.     echo ""
  55.     case $yn in
  56.       [Cc]* ) break;;
  57.       [Yy]* ) ;;
  58.       [Nn]* ) echo >&2 "Please increase the swap space manually. Aborting..."; exit 1;;
  59.       [Qq]* ) exit 1;;
  60.       * ) echo "Please answer yes or no."; echo ""; continue;;
  61.     esac
  62.  
  63.     # we can increase this if /etc/dphys-swapfile exists
  64.     [ -f /etc/dphys-swapfile ] && {
  65.       echo "=============================================================="
  66.       echo "Setting in /etc/dphys-swapfile $(cat /etc/dphys-swapfile | grep CONF_SWAPSIZE)"
  67.       echo "Increasing value and restarting swap"
  68.       sudo sed -i 's/CONF_SWAPSIZE=[0-9]*$/CONF_SWAPSIZE=1024/g' /etc/dphys-swapfile
  69.       sudo /etc/init.d/dphys-swapfile stop
  70.       sudo /etc/init.d/dphys-swapfile restart
  71.       echo "=============================================================="
  72.     } || {
  73.       echo "=============================================================="
  74.       echo "Setting up /swapfile"
  75.       DATE=$(date +%s)
  76.       sudo fallocate -l 4G "/swapfile.$DATE" \
  77.       && sudo chmod 600 "/swapfile.$DATE" \
  78.       && sudo mkswap "/swapfile.$DATE" \
  79.       && sudo swapon "/swapfile.$DATE" \
  80.       && sudo swapon --show \
  81.       && echo "Created and turned on /swapfile.$DATE" \
  82.       && echo "Note: This is not permanent."
  83.       echo "=============================================================="
  84.     }
  85.  
  86.   else
  87.     echo "Current swapsize is $FREESWAP. Ok"
  88.     break;
  89.   fi
  90.  
  91. done
  92.  
  93. # ======================================================
  94. begin=$(date +%s)
  95.  
  96. # ======================================================
  97. # update packages list to latest version
  98. # ======================================================
  99. echo "=============================================================="
  100. echo ""
  101. echo "Updating package list to latest version (sudo needed)"
  102. echo ""
  103.  
  104. PKG_MANAGER=""
  105. command -v dnf >&1 >/dev/null && PKG_MANAGER="dnf"
  106. command -v apt-get >&1 >/dev/null && PKG_MANAGER="apt"
  107.  
  108. # ======================================================
  109. # some other essentials
  110. # ======================================================
  111. echo "=============================================================="
  112. echo ""
  113. echo "Installing required packages (sudo used)"
  114. echo ""
  115. if [ "$PKG_MANAGER" = "apt" ]; then
  116.   sudo apt-get -y install make binutils build-essential gdb git subversion zip unzip pv
  117.   sudo apt-get -y install libx11-dev libgtk2.0-dev  # for Lazarus, includes all dependencies
  118.  
  119.   if [ "$LCL_PLATFORM" = "qt5" ]; then sudo apt-get -y install libqt5pas-dev; fi
  120.  
  121. elif [ "$PKG_MANAGER" = "dnf" ]; then
  122.   # dnf search gtk2*
  123.   sudo dnf -y install make binutils gdb git zip unzip pv
  124.   sudo dnf -y install libX11-devel gtk2-devel gtk+-devel  # for Lazarus, includes all dependencies
  125.   sudo dnf -y install gcc gcc-c++ kernel-devel
  126.  
  127.   if [ "$LCL_PLATFORM" = "qt5" ]; then sudo dnf -y install qt5pas-devel; fi
  128.  
  129. else
  130.   echo >&2 "Neither yum/dnf nor apt-get found. Aborting."; exit 1;
  131. fi
  132.  
  133. # sudo apt-get -y install libx11-dev libgdk-pixbuf2.0-dev libcairo2-dev lpango-1.0 libpangox-1.0-dev xorg-dev libatk1.0-dev libgtk2.0-dev
  134. # libgtk2.0-dev libcairo2-dev libpango1.0-dev libgdk-pixbuf2.0-dev libatk1.0-dev libghc-x11-dev
  135. # or
  136. # xorg-dev libssl-dev libx11-dev libgdk-pixbuf2.0-dev
  137. # libcairo2-dev lpango-1.0 libpangox-1.0-dev libatk1.0-dev libgtk2.0-dev
  138.  
  139. git --version >/dev/null 2>&1 || { echo >&2 "I require git but it's not installed. Aborting."; exit 1; }
  140.  
  141. # ======================================================
  142. #
  143. # ======================================================
  144. BASE=$HOME/dev
  145. mkdir -p $BASE
  146. cd $BASE
  147.  
  148. # ======================================================
  149. # We need a bootstrap compiler fpc 3.2.2
  150. # There is NONE AVAILABLE so we need to download complete
  151. # fpc-3.2.2.arm-linux-raspberry1wq.tar
  152. # in virtualbox Rasbian stretch we need i386
  153. # ======================================================
  154.  
  155. echo "=============================================================="
  156. echo ""
  157. CPU=$(uname -m)                  # armv7l, aarch64, x86_64 # note L not 1
  158. #CPU=$(dpkg --print-architecture) # armhf, arm64,
  159. if [ "$CPU" = "armv7l" ]; then # note L not 1
  160.   echo "Compiling for ARMv7 Processor (Pi2 and higher only)"
  161.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_ARMHF"
  162.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  163.   OS_TARGET="linux"
  164.   CPU_TARGET="arm"
  165.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/arm-linux/fpc-3.2.2.arm-linux.tar" # complete version
  166.   COMP=ppcarm
  167. elif [ "$CPU" = "aarch64" ]; then
  168.   echo "Compiling for ARM64 Processor (Pi2 and higher only)"
  169.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_ARMHF"
  170.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  171.   OS_TARGET="linux"
  172.   CPU_TARGET="aarch64"
  173.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/aarch64-linux/fpc-3.2.2.aarch64-linux.tar" # complete version
  174.   COMP=ppca64
  175. elif [ "$CPU" = "x86_64" ]; then
  176.   echo "Compiling for x64 Processor"
  177.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0"
  178.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  179.   OS_TARGET="linux"
  180.   CPU_TARGET="x86_64"
  181.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/x86_64-linux/fpc-3.2.2.x86_64-linux.tar" # complete version
  182.   COMP=ppcx64
  183. elif [ "$CPU" = "i686" ]; then
  184.   echo "Compiling for i686 Processor"
  185.   OPTIONS_FPC="-g -gl -gw3 -O2 -Xs -CX -XX -v0 -dFPC_I386"
  186.   OPTIONS_LAZ="-g -gl -gw3 -v0"
  187.   OS_TARGET="linux"
  188.   CPU_TARGET="i386"
  189.   COMP3_DOWNLOAD="https://downloads.freepascal.org/fpc/dist/3.2.2/i386-linux/fpc-3.2.2.i386-linux.tar" # complete version
  190.   COMP=ppc386
  191. else
  192.   echo >&2 "$CPU is not supported as processor (needed armv7l/x86_64/i686). Aborting."; exit 1;
  193. fi
  194.  
  195. # ------------------------------------------------------
  196.  
  197. echo "=============================================================="
  198. if [ ! -x ./bootstrap/$COMP ]; then
  199.   echo "Downloading compiler 3.2.2"
  200.   echo ""
  201.   wget --continue --quiet -O- $COMP3_DOWNLOAD |\
  202.   tar -O -xf- --wildcards --no-anchored "binary*-linux.tar" --strip=1 |\
  203.   tar -O -xf- --wildcards --no-anchored "base.*-linux.tar.gz" |\
  204.   tar -xzf- --wildcards --no-anchored "lib/fpc/*/ppc*" --transform "s|lib/fpc/.*/ppc|./bootstrap/ppc|"
  205. fi
  206. [ -x ./bootstrap/$COMP ] || { echo >&2 "Bootstrap $BASE/bootstrap/$COMP compiler not found. Aborting."; exit 1; }
  207.  
  208. echo "Using bootstrap $BASE/bootstrap/$COMP compiler"
  209. echo ""
  210.  
  211. # ======================================================
  212. # downloading fpc and lazarus
  213. # ======================================================
  214. if [ "$zip" = "1" ]; then
  215.  
  216.   wget --continue --quiet -O fpc.zip "https://gitlab.com/freepascal.org/fpc/source/-/archive/main/source-main.zip"
  217.   wget --continue --quiet -O laz.zip "https://gitlab.com/freepascal.org/lazarus/lazarus/-/archive/main/lazarus-main.zip"
  218.   unzip -q fpc.zip
  219.   unzip -q laz.zip
  220.   mv lazarus-main lazarus
  221.   mv source-main fpc
  222.  
  223. else
  224.  
  225.   if [ "$fpc_git" = "1" ]; then
  226.  
  227.     echo "=============================================================="
  228.     echo ""
  229.     echo "Downloading FPC sources $(git -C fpc log -1 2>&1 | grep Date)"
  230.     echo ""
  231.     [ -d ./fpc ] && { git -C fpc reset --hard && git -C fpc pull -q; } || { git clone https://gitlab.com/freepascal.org/fpc/source.git fpc; }
  232.     [ -f ./fpc/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  233.     echo "Now: $(git -C fpc log -1 | grep Date 2>&1)"
  234.     echo ""
  235.  
  236.   fi
  237.  
  238.   if [ "$laz_git" = "1" ]; then
  239.  
  240.     echo "Downloading Lazarus sources $(git -C lazarus log -1 2>&1 | grep Date)"
  241.     [ -d ./lazarus ] && { git -C lazarus reset --hard && git -C lazarus pull -q; } || { git clone https://gitlab.com/freepascal.org/lazarus/lazarus.git lazarus; }
  242.     [ -f ./lazarus/Makefile ] || { echo >&2 "Download of fpc failed. Aborting."; exit 1; }
  243.     echo "Now: $(git -C lazarus log -1 | grep Date 2>&1)"
  244.     echo ""
  245.  
  246.   fi
  247.  
  248.   if [ "$fpc_version" != "" ]; then
  249.     echo "Switch to fpc $fpc_version"
  250.     git -C fpc checkout tags/$fpc_version
  251.   fi
  252.  
  253.   if [ "$laz_version" != "" ]; then
  254.     echo "Switch to lazarus $laz_version"
  255.     git -C lazarus checkout tags/$laz_version
  256.   fi
  257.  
  258. fi
  259.  
  260. # ======================================================
  261. # compiling fpc
  262. # ======================================================
  263. if [ "$fpc_compile" = "1" ]; then
  264.  
  265. echo "=============================================================="
  266. echo ""
  267. echo "Now compiling FPC, this will take some time"
  268. echo ""
  269. cd $BASE/fpc
  270.  
  271. echo "Cleaning up"
  272. # find . -name "*.ppu" -type f -delete
  273. # find . -name "*.o" -type f -delete
  274. # make clean distclean cleanall > /dev/null 2>&1
  275. git clean -xdf > /dev/null 2>&1    # will clean untracked files and directories
  276.  
  277. echo "make -s all install OPT=\"$OPTIONS_FPC\" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/bootstrap/$COMP"
  278.  
  279. make -s all install OPT="$OPTIONS_FPC" OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET INSTALL_PREFIX=$BASE/fpc PP=$BASE/bootstrap/$COMP \
  280.   | pv -l -bp -s2500 >$BASE/fpc.log \
  281.   || { echo >&2 "Compilation of FPC failed. Aborting."; exit 1; }
  282. cd $BASE
  283. [ -x ./fpc/bin/fpc ] || { echo >&2 "Something went wrong compiling FPC. Aborting."; exit 1; }
  284.  
  285. echo ""
  286. echo "Doing some extra configuration"
  287.  
  288. # remove old config
  289. [ -f $HOME/.fpc.cfg ] && rm $HOME/.fpc.cfg
  290. ln -sf $(find $BASE/fpc/lib -name $COMP    ) $BASE/fpc/bin/$COMP
  291. ln -sf $(find $BASE/fpc/lib -name samplecfg) $BASE/fpc/bin/samplecfg
  292. # ln -sf $BASE/fpc/lib/fpc/3.3.1/$COMP $BASE/fpc/bin/$COMP
  293. # ln -sf $BASE/fpc/lib/fpc/3.3.1/samplecfg $BASE/fpc/bin/samplecfg
  294. $BASE/fpc/bin/fpcmkcfg -d basepath=$BASE/fpc -o $HOME/.fpc.cfg
  295.  
  296. # sudo find / -name crtbegin.o
  297. # This library needs to be added to the fpc.cfg file.
  298.  
  299. cat << EOF >> $HOME/.fpc.cfg
  300. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget
  301. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/*
  302. -Fu$BASE/fpc/lib/fpc/\$fpcversion/units/\$fpctarget/rtl
  303. -Fl$(dirname $(gcc --print-file-name=crtbegin.o))
  304. -FD$BASE/fpc/bin
  305. EOF
  306.  
  307. echo ""
  308. echo "Doing some extra configuration"
  309. echo ""
  310.  
  311. # set path withhout old fpc
  312. PATH=$(echo $PATH | sed "s|$BASE/fpc/bin\:||g")
  313.  
  314. # strip previous $BASE from .profile
  315. sed -i '/# FPC PATH/,/fi/d' $HOME/.bash_profile
  316.  
  317. cat << EOF >> $HOME/.bash_profile
  318.  
  319. # FPC PATH
  320. if [ -d $BASE/fpc/bin ] ; then
  321.     PATH="$BASE/fpc/bin:\$PATH"
  322. fi
  323. EOF
  324.  
  325. # replace all double empty lines with one
  326. sed -i '/^$/N;/^\n$/D' $HOME/.bash_profile
  327.  
  328. echo ""
  329.  
  330. fi # fpc_compile
  331.  
  332. # ======================================================
  333. # compiling lazarus
  334. # ======================================================
  335. if [ "$laz_compile" = "1" ]; then
  336.  
  337. echo "=============================================================="
  338. echo ""
  339. echo "Now compiling Lazarus, this will take some time"
  340. echo ""
  341. cd $BASE/lazarus
  342.  
  343. echo "Cleaning up"
  344. # find . -name "*.ppu" -type f -delete
  345. # find . -name "*.o" -type f -delete
  346. # make clean distclean cleanall > /dev/null 2>&1
  347. git clean -xdf > /dev/null 2>&1    # will clean untracked files and directories
  348.  
  349. echo "make -s bigide OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT=\"$OPTIONS_LAZ\" PP=$BASE/fpc/bin/fpc"
  350.  
  351. # make bigide OS_TARGET="linux" CPU_TARGET="x86_64" OPT="-g -gl -gw3 -v0" LCL_PLATFORM=qt5
  352. # make bigide LCL_PLATFORM=qt5
  353.  
  354. make -s bigide LCL_PLATFORM=$LCL_PLATFORM OS_TARGET=$OS_TARGET CPU_TARGET=$CPU_TARGET OPT="$OPTIONS_LAZ" PP=$BASE/fpc/bin/fpc \
  355.   | pv -l -bp >$BASE/laz.log \
  356.   || { echo >&2 "Compilation of Lazarus failed. Aborting."; exit 1; }
  357. cd $BASE
  358. [ -f ./lazarus/lazarus ] || { echo >&2 "Something went wrong compiling Lazarus. Aborting."; exit 1; }
  359.  
  360. echo ""
  361. echo "Creating desktop icon"
  362. echo ""
  363.  
  364. # ~/.local/share/applications/Lazarus.desktop
  365. # $HOME/Desktop/Lazarus.desktop
  366. # $(INSTALL_PREFIX)/share/applications/lazarus.desktop
  367.  
  368. cat << EOF > $HOME/Desktop/Lazarus.desktop
  369. [Desktop Entry]
  370. Name=Lazarus
  371. Comment=Lazarus
  372. Icon=$BASE/lazarus/images/ide_icon48x48.png
  373. Exec=$BASE/lazarus/startlazarus
  374. Path=$BASE/lazarus
  375. Type=Application
  376. Encoding=UTF-8
  377. Terminal=false
  378. Categories=None;
  379. EOF
  380.  
  381. fi
  382.  
  383. end=$(date +%s)
  384. echo "=============================================================="
  385. echo ""
  386. echo "$((($end-$begin) / 60)) minutes and $((($end-$begin) % 60)) seconds elapsed."
  387. echo ""
  388. echo "We are done. Please logout and back in before starting Lazarus"
  389. echo "Otherwise you need to supply the fpc location on 1st start"
  390. echo ""
  391. echo "=============================================================="
  392. echo ""
« Last Edit: December 06, 2024, 05:59:20 pm by rvk »

 

TinyPortal © 2005-2018