Compiling on ALL supported distros

Post

Posted
Rating:
#1 (In Topic #482)
Guru
BruceSteers is in the usergroup ‘Guru’
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
Online now: No Back to the top

Post

Posted
Rating:
#2
Guru
BruceSteers is in the usergroup ‘Guru’
Tip..
to get this to work on an unpacked archive not a gitlab download you can download the file
.gitlab-ci.yml · master · Gambas / gambas · GitLab
and place it in the gambas source dir.
Online now: No Back to the top

Post

Posted
Rating:
#3
Guru
BruceSteers is in the usergroup ‘Guru’
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 said


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 .gitlab-ci.yml · master · Gambas / gambas · GitLab
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

Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
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)

<LIST>
  • <LI>
  • 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.</LI>
    <LI>
  • Linuxmint 20 , all worked as expected.</LI>
</LIST>
Online now: No Back to the top

Post

Posted
Rating:
#5
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
first try on a manjaro/xfce existing installation and …

works fine !

MUCH better than my own script !!! nice work and thanks  :D
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

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 :)
Online now: No Back to the top

Post

Posted
Rating:
#7
Guru
BruceSteers is in the usergroup ‘Guru’
The version  history…
https://github.com/BruceSteers/gambas3-compile-and-install/blob/main/version.txt

And it's now on gitlab…
https://github.com/BruceSteers/gambas3-compile-and-install/

<EMOJI seq="1f60e" tseq="1f60e">😎</EMOJI>
Online now: No Back to the top

Post

Posted
Rating:
#8
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

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-compile-and-install/
Online now: No Back to the top

Post

Posted
Rating:
#9
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
found a liitle problem ... if youre away from keyboard then sudo make install gets timedout and the script ends ...
Online now: No Back to the top

Post

Posted
Rating:
#10
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

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
Online now: No Back to the top

Post

Posted
Rating:
#11
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
 i'm not sure if this can be done but … if you enter the sudo pw first then next sudo's works without prompting for password for a while … MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install …
Online now: No Back to the top

Post

Posted
Rating:
#12
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

i'm not sure if this can be done but … if you enter the sudo pw first then next sudo's works without prompting for password for a while … MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install …

You have thought that would be the case but it times out :(

I'm working on it… :)
Online now: No Back to the top

Post

Posted
Rating:
#13
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

i'm not sure if this can be done but … if you enter the sudo pw first then next sudo's works without prompting for password for a while … MAYBE this time can be raised for the script?

on the other hand is not a big deal to enter sudo make install …

From what i can tell there is a way..
You have to open the /etc/sudoers file and add a line …

Code

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults   env_reset
Defaults   mail_badpass
Defaults   secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
Defaults:bonus timestamp_timeout=60

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root   ALL=(ALL:ALL) ALL

# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

See in that file i've added the line…
Defaults:bonus timestamp_timeout=60

(bonus is my username)

The default timeout for sudo is 15 minutes
There i've set it to 1 hour.
So i get an hour before i'm asked to type the password after last typing it.

Seems to be the only way around it.
Online now: No Back to the top

Post

Posted
Rating:
#14
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
 thats what i tought … but at second sight it seems not that good idea …

what i tried is to put "Defaults:bonus timestamp_timeout=60" in the /etc/sudoers.d/xx-whatever and delete it after the script is trough … not that succesfull at the moment (not enough time because i have to kill six puppies every 30 seconds) but …

1. keep username
2. sudo su
3. touch  /etc/sudoers.d/xx-whatever
4. echo "Defaults:USERNAME timestamp_timeout=60" > /etc/sudoers.d/xx-whatever
5. exit
6. install script goes on as normal user
7. sudo rm /etc/sudoers.d/xx-whatever

any thoughts on that?
Online now: No Back to the top

Post

Posted
Rating:
#15
Guru
BruceSteers is in the usergroup ‘Guru’
 I'll have a play with it myself later after work as will be handy to add it as a function/option i think.

And you gotta do what!! to the puppies??  lol
Online now: No Back to the top

Post

Posted
Rating:
#16
Guru
BruceSteers is in the usergroup ‘Guru’
I added this to /etc/sudoers.d/whatever

Defaults   env_reset, timestamp_timeout=120
Defaults   insults
Defaults   secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"


Seemed to work.
Defaults insults isn't needed but it seemed funny.
gives an insulting message if you type wrong password :)

I think the secure_path bit might be needed though to tell sudo where the timeout settings allowed commands are.

Also i couldn't just
sudo echo "blah blah" >/etc/sudoers.d/whatever
It said permission denied. I had to ..
sudo su -c "echo "blah blah" >/etc/sudoers.d/whatever"

This worked inside the script…

Code

sudo su -c 'echo -e "Defaults env_reset, timestamp_timeout=120\nDefaults insults\nDefaults secure_path=\"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin\"" >/etc/sudoers.d/g3make_temp'
Online now: No Back to the top

Post

Posted
Rating:
#17
Guru
BruceSteers is in the usergroup ‘Guru’
Updated…

Now it can 'git clone' the dir or 'curl download' a zip archive and unpack it for you.

Now it can temporarily up the sudo timeout to 2 hours so you don't have to be there to catch the password request when 'make install' is run.
Should be fully automatic now if you press 'a' for Yes to all at some point.

I've made a "testing" branch on git for the updated version and will transfer it to the master branch after more testing.
https://github.com/BruceSteers/gambas3-compile-and-install/tree/testing
Online now: No Back to the top

Post

Posted
Rating:
#18
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
wow … "little" script …

i'm on autoreconf right now but i found allready a little inaccuracy … answering the first question with 'a' will further lead to the sudo question …  ;)  ;)  ;)  ;)  ;)  … but you may overread this comment i'm not sure if its worth it  :)

thank you again for that great work !
Online now: No Back to the top

Post

Posted
Rating:
#19
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

wow … "little" script …

i'm on autoreconf right now but i found allready a little inaccuracy … answering the first question with 'a' will further lead to the sudo question …  ;)  ;)  ;)  ;)  ;)  … but you may overread this comment i'm not sure if its worth it  :)

thank you again for that great work !

Hmm It didn't for me i just tried it?
Have you still experimental files in your /etc/sudoers.d folder ?

It's likely to ask again i'd say at 'make install'
Like i say after i first entered sudo password when offered the fix and i got to the dependency installer, pressed  'a' and away it went, no further password request.

And you're welcome :)

And thank you for the help in testing fella, much appreciated :)
Online now: No Back to the top

Post

Posted
Rating:
#20
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
2 files

10-installer which give rights for the group wheel
ctdb which give rights to rpc
and
(g3make_temp) no idea where it come from  ;)
Online now: No Back to the top

Post

Posted
Rating:
#21
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
script runs succesfull but did not delete g3make_temp ...
Online now: No Back to the top

Post

Posted
Rating:
#22
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

2 files

10-installer which give rights for the group wheel
ctdb which give rights to rpc
and
(g3make_temp) no idea where it come from  ;)

lol, guilty as charged ;)

i better load up the old Manjaro and test it.  I've only tested it on mint.
Online now: No Back to the top

Post

Posted
Rating:
#23
Guru
BruceSteers is in the usergroup ‘Guru’

PJBlack said

script runs succesfull but did not delete g3make_temp …

Bugger it should do.
I've set it to delete it at all exit points and also added a handler to catch Ctrl-C presses to make sure it deletes it then too.

It just ran without problem for me on Mint and removed the g3make_temp file.

I'll get on Manjaro and check it out.
Thank you for letting me know :)
Online now: No Back to the top

Post

Posted
Rating:
#24
Guru
BruceSteers is in the usergroup ‘Guru’

BruceSteers said

PJBlack said

script runs succesfull but did not delete g3make_temp …

I'll get on Manjaro and check it out.
Thank you for letting me know :)

I'm running Manjaro now.
I didn't get asked for password again after applying the fix  :-\

I think the
 if [ -e "/etc/sudoers.d/g3make_temp" ]
couldn't get permission to test
So I've changed it to do "ls /etc/sudoers.d/" with sudo

I can confirm , yes it didn't delete ,, now it does :)

new file has been uploaded to "testing" branch.

Ps. if you want to test it launch it and answer yes to upping sudo timeout but don't answer yes to anything after just Ctrl-C at some point.
Online now: No Back to the top

Post

Posted
Rating:
#25
Avatar
Enthusiast
PJBlack is in the usergroup ‘Enthusiast’
 testing …

- by entering manually the git directory ~/ is not expanded to /home/user
- i know i'm a annoying pain in the ass but
Online now: No Back to the top
1 guest and 0 members have just viewed this.