forthebadge forthebadge Gem Version

About this project

This project, called easycompile, allows the user to quickly compile a given local archive, such as the foobar-1.2.3.tar.xz tarball or barfoo-2.2.zip.

In fact: this is the primary use-case for this project, and explains why it has been created years ago. I needed a quick way to compile a program into the /usr/ prefix.

Let's showcase a few more specific usage examples for easycompile, in ruby:

Easycompile.new('php-7.0.6.tar.xz')
Easycompile.compile('php-7.0.6.tar.xz')
Easycompile['php']

The above statements all essentially do the same thing: the file called php-7.0.6.tar.xz will be compiled, if it exists locally in the current directory.

The last statement, Easycompile['php'] tries to find matching files in the current working directory. This is done via a glob operation, such as via Dir[]. The advantage here is that it is generic - you do not need to provide the full name of an archive to Easycompile. This can be useful if you do not really care about any particular version.

You can also specify the full location to the target file, e. g. the path too, such as '/opt/php-7.1.2.tar.xz', as the first argument to Easycompile.new.

.gem files can also be used, such as shown by the following example:

easycompile rack-2.0.1.gem

Remote files could be used as well, in theory, including programs offered through the http/https protocol. That is, you could simply pass in the complete URL, and Easycompile will try to download this remote fila via wget. However had, this approach is not very reliable - it may be best to just simply download the remote archive for now, on your own (via wget), and then work on a local copy directly.

History of the Easycompile project

The easycompile project was created primarily because I managed to break another, larger project, called rbt (ruby build tools) quite a lot in the past. When that other project was broken, it typically took some time to fix it, sometimes days or even weeks, and I did not always have that time available at my disposal to fix it properly. Since I did not want to use shell scripts for compiling different programs, I quickly created this smaller project (easycompile), and since that day the project helps me to quickly compile something if rbt is not available, or not working, for whatever reason. This sums up most of the origins of this project - it is a surrogate helper project.

Since RBT has also improved since these old days, the need for easycompile has diminished significantly - but I keep it around still, just in case. One day I may break something again ... :)

One evident design goal following this history is that the Easycompile project has to work when RBT is not available - but if RBT is available then Easycompile can tap into some of the functionality, to enhance support of individual aspects necessary for compiling a program. A good example for this is to re-use the default configure options that the RBT project is tracking or querying information stored in yaml files.

Commandline usage for easycompile

The commandline variant can be invoked via the bin/ecompile file. I recommend to use the --user-install option when installing easycompile, as all bin/ files will be in a specific subdirectory, to which you can then simply modify $PATH for.

Say that you have a local file called php-7.2.0.tar.xz.

Then simply do the following on the commandline:

easycompile php-7.2.0.tar.xz
easycompile php* # Or this variant; is shorter, evidently.

Support for meson and ninja

The easycompile project can compile meson/ninja based programs, provided that a file called meson.build can be found in the extracted directory. This requires a separate build directory, which will default to the name BUILD_DIRECTORY/ as far as the easycompile project is concerned. The name of that build directory is kept in a .yml file, the one at easycompile/yaml/name_of_the_build_directory.yml.

Commandline options

This subsection will show some examples hwo to use the easycompile project from the commandline.

To compile all local PHP archives in the current working directory:

ecompile php*

To do the same but specify a particular temp-directory for extracting the source archive specifically:

ecompile php* --extract-to=/Depot/opt/
ecompile php* --extract-to=/tmp/

To get an overview over the available help options, try:

ecompile --help

Querying whether a given file is an archive

A simple toplevel-method can be used to query whether a given input (String, such as a filename or filepath) is an archive.

Usage example:

Easycompile.is_an_archive? 'foo.tar.xz' # => true
Easycompile.is_an_archive? 'foo.zip'    # => true
Easycompile.is_an_archive? 'foo.zap'    # => false

Making use of extended configure options

If you have the RBT project installed (see it being available on rubygems.org) then you can make use of extended configure options as well.

What are 'extended configure options'?

Take the program called sed. In the RBT project, the information in how to compile this program from source are stored in the file called sed.yml.

If you look at that file you will notice that it has entries for GNU configure, such as --disable-nls and --disable-dependency-tracking. These are options that the user typically supplies on the commandline, during configure, before running make and make install.

By default this is NOT used, so you have to specifically enable this for the current invocation of easycompile.

Invocation examples:

ecompile --sco php*xz
ecompile --extended-configure-options php*xz
ecompile --use-configure-options  php*xz

This would try to compile the php*xz tarball (which has to exist, so download it prior to invoking easycompile).

Note that ecompile is an alias to easycompile on my computer system.

Maintenance mode since as of January 2020

Do note that the project is in light maintenance mode since as of January 2020.

What this means is that I will mostly do some bug-fixes here and there, and perhaps add a few new light features every some months, at best.

For a more complete suite of software that goes beyond the somewhat narrowly defined goals for Easycompile, I recommend to make use of the rbt (Ruby Build Tools) software suite instead, which has a much wider scope and is more sophisticated than easycompile. Easycompile was mostly created as a light-weight alternative to RBT, in the event that I have to rewrite the RBT project.

Using the home directory as the user prefix

You can pass in --home or --homedir to compile into your home directory, for the current compilation run. This has been added in June 2020 mostly as a convenience feature.

Contact information

If your creative mind has ideas and specific suggestions to make this gem more useful in general, feel free to drop me an email at any time, via:

shevy@inbox.lt

Before that email I used an email account at Google gmail, but in 2021 I decided to slowly abandon gmail for various reasons. In part this is because the UI annoys me (on non-chrome browser loading takes too long), but also because of Google's attempt to establish mass surveillance via its federated cohorts sniffing (FLoC). I do not know what happened at Google, but enough is enough - there is only so much you can take while supporting greed. When it comes to data mining done by private groups, ultimately the user became the product.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment, due to reallife time constraints. I will, however had, read feedback eventually. Patches and code changes are welcome too, of course, as long as they are in the spirit of the project at hand, e. g. fitting to the general theme. For this I may make use of github as a discussion site, but this has a low priority right now.