On Monday 23 August 2004 14:02, Victor STINNER wrote:
> Le lun 23/08/2004 à 13:56, Isaac Clerencia a écrit :
> > On Monday 23 August 2004 01:14, Victor STINNER wrote:
> > > Someone hate autotools ?
> >
> > I've almost finished the work, I hate autotools, but they are great when
> > they already work ;)
> >
> :-D Don't forget to explain scripts because I think that not body know
>
> them here :-) Explain the main lines.

Ok, it's done. I think it's not perfect and will need some extra work, but 
basically works.

I've created a .tar.gz which contains a complete Wormux directory with all the 
changes i've done. I've removed all the data in the data/ directory to make 
the package smaller, so you should copy the contents of data/ to have it 
correctly working.

You can download it here: http://pulsar.unizar.es/~isaac/wormux.tar.gz

I'm going to explain the main lines of the autoconf/automake scripts, 
basically autoconf is a program that reads a file named 
"configure.ac" (sometimes named "configure.in") and generates a script called 
"configure".

This "configure" script checks for libraries (clanlib and libxml++ in this 
project) and other things, but the most important job is to read files called 
"Makefile.in" and generate "Makefile" files from them substituting variables 
there, like @PACKAGE@ for the package name, @CXXFLAGS@ for the C++ flags, ...

"automake" adds an extra layer, it also reads "configure.ac" and generates the 
"Makefile.in" files from "Makefile.am" files.

So each directory where you would like to have a Makefile you need to put a 
Makefile.am file which some generic rules, for example the main Wormux 
directory Makefile.am only contains:
SUBDIRS = data src po intl

which basically generates a Makefile which calls Makefiles in SUBDIRS.

The Makefile.am in data contains:
nobase_dist_pkgdata_DATA = @DATA_FILES@

It will generate a Makefile.in which installs @DATA_FILES@ in @datadir@, and
the "configure" script will change @datadir@ and @DATA_FILES@ into their real 
values, the DATA_FILES variable is created in configure.ac like this:
DATA_FILES=`cd data ; find . -name CVS -prune -o -name ".cvs*" -o -name ".#*" 
-o -type d -o -print`
DATA_FILES=`echo $DATA_FILES`

The Makefile.am in src/ contains:
bin_PROGRAMS = wormux

pkgdatadir=$(datadir)/@DATADIR@/
localedir=$(datadir)/locale/

wormux_SOURCES = main.cpp \
   game/config.cpp \
   game/debug.cpp \
...
   weapon/weapon_tools.cpp

AM_CXXFLAGS = @CLANLIB_CFLAGS@ @LIBXMLPP_CFLAGS@ 
-DINSTALL_DATADIR=\"$(pkgdatadir)\" -DINSTALL_LOCALEDIR=\"$(localedir)\" 
-I../intl -I$(top_srcdir)/intl

LIBS = $(CLANLIB_LIBS) $(LIBXMLPP_LIBS)

Taking this "Makefile.am", automake will generate a Makefile.in which builds a 
wormux program, using the files listed in wormux_SOURCES with the needed C++ 
FLAGS and LIBS.

After that, configure will change @CLANLIB_CFLAGS@ and @LIBXMLPP_CFLAGS@ to 
the values get during library checking.

There is a script called "autogen.sh" which calls this programs to completely 
rebuild all the stuff (except last ./configure).

Basically, to build and install wormux you need to do:
./configure
make
make install (as root)

If the script configure doesn't exist you also need to run ./autogen.sh before 
that commands.

Don't doubt asking me any doubt.

Best regards

Attachment: pgp9omh4e1s0t.pgp
Description: PGP signature

Répondre à