I need to compile a software from the sources.
./config && make && make install
On that, it does install a bunch of stuff everywhere(Libraries, etc)
But the thing is, that I also need to copy that software after to another set of machines that I do not want to install gcc on.
How could I make that software install in one "directory" to then just copy to the other machines ?
If you intend to distribute the software to other machines, you definitely need to package it.
You don't specify which distribution you are using, so general guidance follows.
Software in the GNU/Linux and *BSD worlds is usually distributed in packaged form and source code when its license allows it.
Different distributions use different frontends or package managers to update, install and remove this software.
Software compiled from source code is commonly (but not always) built using a known workflow (
configure && make && make install
), the option you mention (--prefix
) is an option present when using a common set of tools to build software from the GNU project known as theautotools
. Briefly explained, it is possible to pass an option to modify the default location (/usr/local
) thatmake install
will use to copy the compiled software in the local system.Packaging software includes this compilation step, but is more convoluted, as it leverages the use of metadata to manage dependencies, transactionality and other functionality not present in the bare-bones
autotools
schema.Take a look at the output of:
In this case, the package format is RPM, other distributions use DEB, and the package managers are also different (
yum
/dnf
,zypper
,pkgsrc
,dpkg
orapt
/aptitude
, ...).Depending on the amount of machines you need to distribute this software to, and the process you use to build it, QA it and store it, different methods (or parts of them) apply:
Learn how the standard packaging system works in your platform of choice. For example, in Red Hat and derivatives, you need to write an SPEC file and use
rpmbuild
. There are also lightweight alternatives likefpm
that can save you time.Learn how to configure and manage a private repository to host your custom packages. Some tools in this field include
createrepo
andapt-utils
, but also higher level applications likecobbler
,pulp
ornexus
.If your workflow is more convoluted, for example if it includes QA of the package, you might need tools to automate this. There are many.
Document the process.