7

How can we create a software package, so that after extracting our software tar ball user can do the typical steps?

$ gunzip < mycode.tar.gz | tar xvf -
$ ./configure
$ make
$ make install
NoDataDumpNoContribution
  • 10,591
  • 9
  • 64
  • 104
neversaint
  • 60,904
  • 137
  • 310
  • 477

6 Answers6

7

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

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

e.g. KDE is using it.

Svante
  • 50,694
  • 11
  • 78
  • 122
Lennart Koopmann
  • 20,313
  • 4
  • 26
  • 33
6

Look into the GNU autoconf/automake toolchain. Here's a free tutorial/book.

Hank
  • 2,907
  • 3
  • 20
  • 15
4

In the old days, this process was done by hand. Each Makefile was written by hand (the file make uses as a sort of script). This became problematic when it came to portability, and so the configure script was made. The ./configure script was written by hand for each project as well. Eventually this was automated by GNU with their autotools package. This consists of autoconf, automake, and a few others. While alternatives exist, particularly for make, autotools is most widely used. ...At least on GNU/Linux systems. Alternatives include the already mentioned CMake, Boost.Build, Boost.Jam, SCons, and more.

fow
  • 556
  • 3
  • 6
1

Autotools.

You'll need to write a configure.ac and a Makefile.am scripts.

Configure.ac is pretty easy and can be mostly autogenerated from running 'autoscan' on your source code. That will generate a 'configure.scan' file that you'll need to tweak to generate the final configure.ac file.

The Automake.am file is all based off of conventions. You'll 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 schema:

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

so dist_noinst_DATA is for data files required for building but are not installed.

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

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

to setup autotools files required for building. This can be put in a shell script and run prior to running ./configure.

ascotan
  • 1,634
  • 11
  • 8
1

Use autotools to create the configure script (which will generate the Makefile necessary for the last two steps), then make a tarball with all your code and stuff in it.

womble
  • 12,033
  • 5
  • 52
  • 66
1

rpmbuild is a command to build rpm packages

man page

tutorial

Sharique
  • 4,199
  • 6
  • 36
  • 54
  • When I read the linked manpage, it doesn't seem to answer the question I believe was asked: that how do you provide a platform flexible build in the first place (i.e. help with writing configure and makefile)... rpmbuild appear to assume that you have such a thing in place. – dmckee --- ex-moderator kitten Feb 21 '09 at 16:49