How to create a software package on Unix / Linux

How can we create a software package. So after extracting our tar ball software, the user can take the typical steps:

$ gunzip < mycode.tar.gz | tar xvf - $ ./configure $ make $ make install 
+6
c ++ unix boilerplate software-packaging
source share
6 answers

An alternative to hard to understand GNU / Autools is CMake.

http://www.cmake.org/cmake/help/examples.html

eg. KDE uses it.

+7
source share

Take a look at the GNU autoconf / automake toolchain. Here is a free tutorial / book.

+6
source share

In the old days, this process was carried out manually. Each Makefile was written manually (the make file is used as a kind of script). This became problematic when it came to portability, and so a configure script was created. ./configure script was written manually for each project. Ultimately, it was automated by GNU with the autotools package. It consists of autoconf , automake and some others. Although there are alternatives, especially for make , autotools most widely used .... At least on GNU / Linux systems. Alternatives include the already mentioned CMake , Boost.Build , Boost.Jam , SCons , etc.

+3
source share

Use autotools to create a configure script (which will generate the Makefile needed for the last two steps), and then create a tarball with all your code, etc.

+1
source share

rpmbuild is a command to build rpm packages

man page

tutorial

+1
source share

Autotools.

You need to write configure.ac and Makefile.am scripts.

Configure.ac is quite simple and can be mostly autogenerated from running "autoscan" in the source code. This will create a configure.scan file that you will need to configure to create the final configure.ac file.

Automake.am file is based on conventions. You will probably need something like:

 AUTOMAKE_OPTIONS = foreign subdir-objects AM_CXXFLAGS = -std=c++11 -static-libstdc++ -Wall -Werror \ -Wfatal-errors -I blah AM_LDFLAGS = blah bin_PROGRAMS = mybinary mybinary_SOURCES = \ blah.h blah.cc 

everything is based on a naming scheme:

  • dist vs nodist = should it be built
  • inst vs noinst = should be installed
  • DATA = data files
  • MANS = man pages
  • SOURCES = source code

therefore, dist_noinst_DATA is for data files needed for assembly, but not installed.

Once you have both of these files, you usually need to run something like:

aclocal && autoheader && automake --add-missing && & autoconf

to configure the autotools files needed to create. This can be placed in a shell script and executed before running. / Configure.

+1
source share

All Articles