It seems that using git-version-gen directly makes it impossible
to avoid dirtying the version name.  Next play time, I'll hack on
git-version-gen to "allow" a specified it-has-been-modified suffix.

Attached is the current version of the gnulib/libposix/bootstrap script.
It is a little more complicated.  If you want to look at the
distro I created out of it:

   
http://autogen.sourceforge.net/data/libposix-0.0.4381-e633b-modified-dirty.tar.gz

Also, I still do not have a cause for the two make check failures
on my x86-64 openSuSE 11.3 platform.  I'd need to modify the .c files
and print a message some place where it won't get hidden.

FAIL: test-dprintf-posix2.sh
FAIL: test-fprintf-posix3.sh

$ uname -a
Linux beethoven 2.6.34.7-0.4-desktop #1 SMP PREEMPT 2010-10-07 19:07:51 +0200 
x86_64 x86_64 x86_64 GNU/Linux
#! /bin/sh
# -*- Mode: Shell-script -*-

die() {
    echo "mk-libposix-module.sh error:  $*" >&2
    trap '' EXIT
    test ${#clean_list} -gt 1 && \
        echo '*NOT*:  rm -rf' ${clean_list}
    kill -TERM $progpid
    exit 1
}

clean_list=''
cleanup() {
    trap '' EXIT
    test ${#clean_list} -gt 1 && \
        rm -rf ${clean_list}
    return 0
}

init() {
    progpid=$$
    progdir=`dirname $0`
    prognam=`basename $0`
    glibdir=`cd ${progdir} >/dev/null && cd .. && pwd`

    cd ${progdir}
    PATH=$glibdir:$PATH
    trap die EXIT

    case "X$1" in
    X--all )
        set -- --clean --distro
        ;;
    esac

    case "X$1" in
    X--clean* )
        git clean -f -d -x .
        shift
        test $# -eq 0 && exit 0
        ;;
    esac

    case "X$1" in
    X--dist* )
        do_distro=true
        ;;

    * ) do_distro=false
        ;;
    esac
}

mk_module() {
    mkdir tmp
    clean_list=tmp
    mkdir tmp/modules
    (   echo alloca
        posix-modules
    ) | sort -u > tmp/posix-list

    cmd='1,/^Depends-on:/d
        /^[a-zA-Z][a-zA-Z._-]*:$/ {
          s/.*//
          q
        }'

    posix_list=$(grep -v '^$' tmp/posix-list)

    cat > tmp/modules/libposix <<- _EOF_
        Description:
        Wrap up all the posix modules into an installable libposix.la.

        Files:

        Depends-on:
        ${posix_list}

        configure.ac:

        Makefile.am:
        lib_LTLIBRARIES = libposix.la

        Include:

        License:
        LGPL

        Maintainer:
        Bruce Korb
        Gary V. Vaughan
        _EOF_
}

run_glt() {
    opts='
        --local-dir=tmp
        --import
        --lib=libposix
        --makefile-name=gnulib.mk
        --macro-prefix=LIBPOSIX
        --libtool
        --no-changelog
        --symlink
        --with-tests
        --with-c++-tests
        --with-longrunning-tests'

    gnulib-tool ${opts} git-version-gen libposix || \
        die "gnulib-tool failed"

    ./git-version-gen ./.tarball-version | \
        sed 's/-dirty/-modified/' > ./.tarball-version
    sed -i 's/-dirty$/-modified/' .tarball-version
    # No need to maintain a Makefile.am just to include gnulib.mk.
    mv tests/gnulib.mk tests/Makefile.am
}

run_reconf() {
    # Run autotools.
    autoreconf --force --install --verbose --symlink || \
        die "autoreconf failed"
}

mk_distro() {
    mkdir _build _install
    dd=$PWD/_install
    cd _build
    ../configure --prefix=/usr/local || die configure failed
    make       || die make
    make dist  || die make dist
    make install DESTDIR=${dd} || make install DESTDIR=${dd}
    make check || die make check
}

PS4='>${FUNCNAME:-bs}> ' ; set -x

init ${1+"$@"}
mk_module
run_glt
run_reconf
${do_distro} && mk_distro
cleanup

Reply via email to