Page 1 of 4

Compiling on ALL supported distros

Posted: Sunday 11th October 2020 7:16pm
by BruceSteers
I've made a text script to help with getting compiling your own Gambas

In trying to get debian and raspbian right Benoit let me on to a bit of information about a file on gitlab that not only contains ALL the required dependencies for each distro to compile gambas it also has some custom ",.configure -C" commands relevant to the linux.

So i have written a bash script to take advantage of this.
Supported distros are
ubuntu (various)
debian (various)
archlinux and archlinux-clang
alpine
raspbian

So what this script does....
you have to load it into a text editor and uncomment the line for your distro before running.
Then run from a terminal if first asks of you want to clone from gitlab to the current dir or you can select an existing downloaded cloned dir.
it then reads the ".gitlab-ci.yml" file and extracts the dependency list and ./configure command.
I added Raspbian support :)
It then offers you a y or n question to run each command needed to compile and install gambas from the installing the depencies to the 'make install'.
you can type 'a' for yes to all.

Todo.
Make it auto detect linux version.
Make it install application menu item or desktop launcher as the files are there in /app/desktop but the install doesn't add them on debian, not sure about other distros.

Give it a test
[attachment removed]

Update:
I have now made (and refined) this script and also made 2 gambas applications that do a similar thing.
See and download them here...
http://gambaswiki.org/wiki/installtools

All the best

Re: Compiling on ALL supported distros

Posted: Sunday 11th October 2020 7:24pm
by BruceSteers
Tip..
to get this to work on an unpacked archive not a gitlab download you can download the file
https://gitlab.com/gambas/gambas/-/blob ... lab-ci.yml
and place it in the gambas source dir.

Re: Compiling on ALL supported distros

Posted: Monday 12th October 2020 2:40pm
by BruceSteers
Updated....

Script now auto-detects linux distro (or can still be set manually)

Can be launched from the gambas3 source dir and so not ask for dir.

Offers to create a desktop icon and/or menu item using xdg and the desktop files in the gambas source dir.

Todo..
Add more distros.
I was able to add Raspbian support as i have a RaspberryPI4 so could test it and make the adjustments needed.

Hoping it may help some :)
Bruce


The Readme file....
In the Readme I wrote:
This is a script to help ensure the fantastic Gambas3 basic latest version can be compiled
and installed on various linux disrtros it supports.

Version 2.0
Written by Bruce steers

Intention/Introduction:
Compiling and installing Gambas3 from source can be a bit tricky if you do not have all the correct software and dependencies you need installed first.
There is installation info on the Gambas wiki website giving a list of required packages for
each distro but it is not auto-created and needs updating at times as things change.
Whilst trying to get the Gambas wiki pages for Debian and Raspbian up to date I asked on the
developers mailing list for some "expert" advice.
I was told by the main Gambas developer Benoît Minisini of a file that exists in the GitLab
repository called ".gitlab-ci.yml" that is used when a "ppa" type install would happen.
This file contains up to date lists of package requirements for various systems.

With this new knowledge I have made a shell script that does the following...

# Offers to download/clone the latest Gambas3 or lets you select an existing folder.
# Offers to install all dependencies/packages needed for compilation/install.
# Offers yes or no options to run all commands needed to compile/install Gambas3
from the './reconf-all' to the 'make install'
# Offers to make a desktop icon and/or a menu item.
# Supports Ubuntu, Mint, Debian, Raspbian, Archlinux, Alpine


How to use...

Simply put...
Run it from terminal, follow the instructions.
If first install say yes to everything.
Dependencies/packages will install, Gambas will compile and install,
Desktop icon and menu are made.

IMPORTANT NOTE: any previous Gambas3 version installed from a package manager must be
removed before installing this way to avoid conflicts.
eg. type 'sudo apt-get purge gambas3*'
This is not needed to install over an existing compiled version only a repository installed one.


Full explanation / instructions.

Run this Script from terminal.
Either place the script in an already existing Gambas3 Gitlab clone folder and run
it from there or it will ask to either download/clone to the current dir or you can
select an existing dir on your disk.

By default the script tries to detect the linux version you are running. If that's not
working you can un-comment (delete the '#') one of the #BUILD= lines at the begining of
the script to manually set the linux version you have.
Supported variations are...
Ubuntu/Mint (various versions), Debian (various versions), Raspbian, Archlinux, Alpine

Note. if you are using Archlinux please set manually as i do not know how to
differntiate between archlinux and archlinux-clang

Once your linux is detected if not run from the Gambas source folder you are asked to
download a new clone or select an existing clone dir.

Note. if your Gambas source folder is not a GitLab clone but an unpacked tarball it
may be missing a vital ".gitlab-ci.yml" file.
To fix this go to https://gitlab.com/gambas/gambas/-/blob ... lab-ci.yml
and download the .gitlab-ci.yml file and copy it to your Gambas source directory.

You are next asked a series of questions and must give a y/n/a answer.
y = YES, n = NO (default if no answer given) , a = Ask no more and say Yes to All
You can abort at any time pressing Ctrl-C.
The commands come in the following order...

"Run dependency install?"
Installs packages, needed first time or if dependencies change.

"Run './reconf-all' ?"
Sets up the compiling environment, needed first time, or to update environment.

"Run './configure' (y for yes, v for verbose error messages only) ?"
Configures all the source code ready for compilation.
(./configere produces a lot of output text making error messages hard to find,
type 'v' to only show the error messages not the rest of the output.)

"Run 'make' ?"
Compiles ALL source code ready for installation.

"Run 'make install' ?"
Installs Gambas into the System.

IMPORTANT: if you already have Gambas on your system either installed by using your
package manager to install the distro's default version or via adding the PPA then
it MUST be completely removed first or you will get conflicts.
on debian/ubuntu type 'sudo apt-get purge gambas3*'
After installing from compilation Gambas3 will not show as installed in your
package manager.

"Install Icon, desktop launcher and menu item?"
If yes the Gambas Icon is installed then you are given 2 options...

"Install a desktop launcher?"
"Install a menu launcher?"

Icon/Launcher installation uses xdg

Re: Compiling on ALL supported distros

Posted: Monday 12th October 2020 6:09pm
by BruceSteers
I had not had a chance to test this on a fresh system at first upload but now i have.
There was a bug in the installing 'git' routine. (already had git on my machine so the function had not run for me)
also setting the BUILD manually wasn't working.
Now tested and fixed.

Currently tested from Fresh operating system installs on the following...
(will add more to list as more are tested)
  • Raspberry PI4 with ubuntu 20. installed but xdg did not set executable flag on the desktop icon and it did not update the menu so i have accounted for this.
  • Linuxmint 20 , all worked as expected.

Re: Compiling on ALL supported distros

Posted: Monday 12th October 2020 10:15pm
by PJBlack
first try on a manjaro/xfce existing installation and ...

works fine !

MUCH better than my own script !!! nice work and thanks :D

Re: Compiling on ALL supported distros

Posted: Monday 12th October 2020 11:50pm
by BruceSteers
PJBlack wrote: Monday 12th October 2020 10:15pm first try on a manjaro/xfce existing installation and ...

works fine !

MUCH better than my own script !!! nice work and thanks :D
haha, thank you :)

I've refined it some, added error handling, tidied up the messages a bit.
I re-uploaded it to the post above :)

I'm not sure how auto-dectection will work on manjaro so i'm downloading it to test.
Currently my instructions say for Archlinux set it manually :(
That'll be the next update :)

Re: Compiling on ALL supported distros

Posted: Tuesday 13th October 2020 11:57am
by BruceSteers

Re: Compiling on ALL supported distros

Posted: Tuesday 13th October 2020 11:13pm
by BruceSteers
PJBlack wrote: Monday 12th October 2020 10:15pm first try on a manjaro/xfce existing installation and ...

works fine !

MUCH better than my own script !!! nice work and thanks :D
It failed for me !! lol. :lol:

found a bug in the way pacman was being called.
it was using this format..
pacman -Syu --needed --noconfirm big long list of package items

Turns out that if on a fresh system that hasn't had 'pacman -Syu' run to setup the database, if you try to run pacman that way so it upgrades as well as installs packages it complains that it can only do one operation at once :-\
Seemed okay running the command from terminal but the script wasn't having it.

so now the script runs
pacman -Syu --noconfirm
Just once before any other call to pacman is made. Then it runs...
pacman -S --needed big long list of package items
To install the packages

It also failed because it said installing dbus conflicted with dbus-X11 and with the --noconfirm option set it just failed at that point.
So i removed the --noconfirm to fix this but you now have to confirm yes to the install operation and answer if to remove dbus-X11.

So now it should (hopefully) fully support Manjaro and hopefully other arch distros :)
I got it as far as running pacman okay, the rest of the procedure should run as the others once past that part but my internet speed was running about 12kps so i didn't wait for it as got bored. :)

https://github.com/BruceSteers/gambas3- ... d-install/

Re: Compiling on ALL supported distros

Posted: Wednesday 14th October 2020 5:06am
by PJBlack
found a liitle problem ... if youre away from keyboard then sudo make install gets timedout and the script ends ...

Re: Compiling on ALL supported distros

Posted: Wednesday 14th October 2020 8:37pm
by BruceSteers
PJBlack wrote: Wednesday 14th October 2020 5:06am found a liitle problem ... if youre away from keyboard then sudo make install gets timedout and the script ends ...
aah no gutted lol :)

I'm not sure what can be done about that.
the sudo command will ask for password each time it's called so entering the password earlier don't help.

Only option i think is to add an option to make the script pause before running make install.

Add an "Away from Keyboard" mode