[Gambas-devel] gbmake. A drop-in replacement to automake

Sebastian Kulesz sebikul at ...176...
Thu Sep 6 05:19:52 CEST 2012


On Wed, Sep 5, 2012 at 4:01 PM, Benoît Minisini
<gambas at ...1...> wrote:
> Le 05/09/2012 13:43, Benoît Minisini a écrit :
>> Le 05/09/2012 05:02, Sebastian Kulesz a écrit :
>>> Hi all !!
>>>
>>> I really think Gambas is a great language to work with, but lets face
>>> it, from the point of view of a beginner, distributing an application
>>> is a pain in the a**. There is no *standard* way to build a project
>>> (other than executing gbc3/gba3 directly if we let the IDE aside),
>>> this makes it difficult to create debian packages, PPAs, etc. as they
>>> all require some sort of autoconf script to manage the process.
>>> Without the IDE, an user can do much. And with it, this implies
>>> installing every component it depends on (a total of 15).
>>>
>>> To create a PPA of a gambas application, for example, the user has 2
>>> choices. He can either write a Makefile (more bugs, no portability,
>>> etc) or create a dummy autoconf package, skim the files and replace
>>> what is needed (package name, version, etc), and merge it with his
>>> project.
>>>
>>> These are really just a few examples of the problems i faced not so
>>> long ago. With this in mind, i created this little tool to automate
>>> the building of gambas apps. It works as a *drop in* replacement for
>>> make (*seriously*, you can run "make", "make clean", and "sudo make
>>> install" without a single script, autoconf, automake, m4 macro).
>>>
>>> I also wrote the app with Quickly [0] in mind. For example, if you
>>> want to debianize a project, you can run "gbmake debianize" or just
>>> "make debianize" and that is it. It will automatically create a
>>> skeleton debian/ folder which should work out-of-the-box. Maybe a
>>> "make source" to create a source archive?
>>>
>>> I just started it today, so only the building process is really
>>> implemented (build, clean, install) but I really see a lot of
>>> potential here. Once it's completed, the autotools package may be
>>> dropped (it will be completely replaced and the user will have to do
>>> nothing). Uploading packages to a PPA will be much easier. Users won't
>>> depend on the IDE to perform administrative tasks, such as building a
>>> package or a source archive.
>>>
>>> I will need some help to port the packaging code in the IDE to work in
>>> headless mode. I'm trying to make this tool to only depend on the
>>> interpreter, so no single component has to be installed for it to
>>> work. This means implementing a custom option parser, and settings
>>> parser. I have zero knowledge of Slackware, OpenSUSE, Mandriva, Mageia
>>> and Fedora (and it's derivatives), so i will only be able to port the
>>> code, but i can't test for any bugs or regressions.
>>>
>>> How does it works? It's really simple actually. You will see 2
>>> Makefiles included. the one named Makefile.1 should be used to install
>>> the app in the first place.
>>>
>>> sudo make -f Makefile.1 install
>>>
>>> This command will build the project and install it (/usr/bin/gbmake).
>>> The second Makefile only wraps the commands sent to "make" to
>>> "gbmake". It's really the same, but we are all used to type make *,
>>> aren't we? ;-)
>>>
>>> In this case, only adding this Makefile to a project will let "make"
>>> work out of the box, otherwise, "gbmake" will work just fine.
>>>
>>> I will try to have the Debian part finished by the end of the week so
>>> i can provide a working example, this is just a *proof of concept*,
>>> and a call for everybody who would like to help. I'm a little skeptic
>>> about merging this to trunk (even as a branch), as it's a work in
>>> progress, and it will just confuse the users. Besides, 3.3 is around
>>> the corner and this will only bring more bugs. Maybe 3.4 if we hurry.
>>>
>>> I'm really anxious to hear your comments!
>>>
>>> Thanks!
>>>
>>> [0] https://wiki.ubuntu.com/Quickly
>>>
>>
>> Good idea, but the problem is code duplication between "gbmake" and the IDE.
>>
>> I suggest taking the code from the IDE instead of rewriting your own (or
>> mix them if yours is better).
>>
>
> Yep. You tried to rewrite things already done by the IDE, but you didn't
> do it correctly.
>
> You should make a list of all project management features you need (how
> to clean a project, how to compile it...), and I will centralize all
> these features into an IDE module that will be able to be shared by the
> gambas make utility.
>
> Regards,
>
> --
> Benoît Minisini
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> Gambas-devel mailing list
> Gambas-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-devel

For the moment there *will* be code duplication, but in the end, using
gbmake over the available implementations will require much less code.

A few examples:

I just finished the archlinux packaging module. If you take a look at
the code the IDE uses to package it (more than 200 loc only to
package, leaving dependency checks out), you will see a lot of
"install" commands, conditionals that check what type of project we
are dealing with, etc.
With gbmake, we only need to execute 2 commands ("make" and "make
install"). gbmake will itself check for dependencies (the package
manager should do it, but if installed from source they have to be
ignored), determine what type of project it is, and install the
required files (this last part is not yet implemented, only basic
installation")
That 200 loc where reduced to just (fully abstracted) 80, *including
dependency checks*.

I'm planning the same with the debian part. There are more than 200
loc *only* to build a deb package. gbmake can do that by just
"debianizing" a temporary folder ("gbmake debianize" will customize
the files under debian/* using data prom the proejct configuration)
and running "debuild -b", even from a terminal.

I don't think gbmake should depend on a module inside the IDE, because
we are missing the fact that it can run without a gui. Besides, i'm
trying to abstract specific code into separate modules, so that
functions that deal with debian packages, for example, resides in a
separate module that only gets called when needed (easier to code,
easier to maintain).

> I don't understand why you need two Makefiles. I imagine that the IDE
> would automatically generate a Makefile file inside the source directory
> with a configure script to detect that Gambas is installed. That way,
> you just have to uncompress the Gambas source archive, run
> './configure', 'make' and 'make install', and everything works as
> expected. Is it what you have in mind?

Makefile.1 was only included so that you can install the tool without
much trouble. The other Makefile is a generic one, this should be put
inside every project if you wish to run gbmake trough make, but that's
optional. The configure script should *only* check if the gambas
interpreter is installed, everything else is done automatically.

As i said on the first mail, that was just a proof of concept. I'm
rewriting most of the packaging code (while still adding some missing
features), but still using some parts of it. It will take some time to
get it to work stable enough to be merged.

I will send another source package once i finish the debian module, so
those who want can play with it.

Thanks!




More information about the Devel mailing list