Re: autotools gives autopain



BJörn Lindqvist wrote:

> Gnome currently uses the GNU Autotools for building all
> projects. Autotools is hard to work with and complicated and there are
> lots of techically superior build systems out there. Therefore, I
> suggest that GNOME should gradually replace Autotools with scons
> (www.scons.org). My arguments are:

I have to package a few packages using scons. Creating an RPM package
from scons based project became my nightmare. Prepare a working lprof
package for SuSE AMD64 took me about 6 hours of editing and debugging of
scons files and finally it was impossible without patching many files
and scons itself.

Maybe I am doing something incorrectly. If you can advice on creating a
distribution packages from scons based projects, I will be glad.


1) SCons intentionally ignores most standard *FLAGS (documentation says
so). You have to edit one or more SConstruct files to force flags you
want for your platform (it's a SuSE packaging convention), not flags
decided by somebody for it. This is the simplest solution, working only
in some projects:

export CFLAGS="$RPM_OPT_FLAGS"
if test -z "$CFLAGS" ; then
  export CSCFLAGS=
else
  CSCFLAGS="${CFLAGS// /', '}"
  export CSCFLAGS="'$CSCFLAGS'"
fi
echo "env.Append(CCFLAGS = [$CSCFLAGS])" >>SConstruct


> 2. Scons is simple to learn, Autotools is not.

2) It is hard to change hardwired default paths and change, say /usr/lib
to /usr/lib64 for all packages. It took me about 4 hours of debugging to
get rid all of -L/usr/lib causing build failures. This covers only most
common problems:

(
  find -name SConstruct
  find -name SConscript
  echo package.pro build_config.py
  find -name Makefile
) | while read ; do
  sed -i "
s:/lib:/%_lib:g
s:src/%_lib:src/lib:g
" $REPLY
done

> 1. Scons is simply technically superior to GNU Autotools - with a big
>    margin.

3) It is hard to provide custom path for libraries. One again one needs
to to platform dependent editing of SConstruct file to do it.

patch <<EOF
--- SConstruct
+++ SConstruct
@@ -79,20 +79,20 @@
        extra_includes = []
        # z library information
        z_lib = ['z']
-       z_libpath = ['/usr/lib']
+       z_libpath = ['/usr/%_lib']
        z_include = ['/usr/include']
        # png library information
        png_lib = ['png']
-       png_libpath = ['/usr/lib']
+       png_libpath = ['/usr/%_lib']
        png_include = ['/usr/include']
        # jpeg library information
        jpeg_lib = ['jpeg']
-       jpeg_libpath = ['/usr/lib']
+       jpeg_libpath = ['/usr/%_lib']
        jpeg_include = ['/usr/include']
        # OpenGL library information
        opengl_lib = ['GL', 'GLU']
-       opengl_static = ['/usr/lib/libGL.a', '/usr/lib/libGLU.a']
-       opengl_libpath = ['/usr/lib', '/usr/X11R6/lib']
+       opengl_static = ['/usr/%_lib/libGL.a', '/usr/%_lib/libGLU.a']
+       opengl_libpath = ['/usr/%_lib', '/usr/X11R6/%_lib']
        opengl_include = ['/usr/include', '/usr/X11R6/include']
        # SDL library information
        sdl_env.ParseConfig ('sdl-config --cflags --libs')
EOF


4) I did not find any DESTDIR support, needed for comfortable packaging
without root privileges. One has to go back 10 years and use:

scons PREFIX=$RPM_BUILD_ROOT/usr install

Sometimes you have to explicitly add more variables or even edit
SConstruct before calling "scons install".

-- 
Best Regards / S pozdravem,

Stanislav Brabec
software developer
---------------------------------------------------------------------
SuSE CR, s. r. o.                             e-mail: sbrabec suse cz
Drahobejlova 27                               tel: +420 296 542 382
190 00 Praha 9                                fax: +420 296 542 374
Czech Republic                                http://www.suse.cz/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]