Blob Blame History Raw
# Generate libint2 source tarball.
# 2013-05-12 Susi Lehtola

# Before running this script, make sure that you have all the
# buildrequires for building libint2 w/ bootstrapping

# Read hg release from spec file
hgrel=`grep "global hgrel" libint2.spec|awk '{print $3}'`
# Read the version from the spec file
ver=`grep "Version" libint2.spec|awk '{print $2}'`

echo "Using hg release $hgrel of version $ver."

# Get the sources
if [ ! -d libint2 ]; then
 hg clone -u $hgrel http://hg.code.sf.net/p/libint/mercurial libint2
else
 cd libint2

 # Get the current version
 cur=`hg parent | head -n 1 |sed 's|:| |g' | awk '{print $2}'`

 # Check if we are not at the wanted revision
 if [ $cur != $hgrel ]; then
     # Remove the generated tarball
     echo "Removing tarball generated from revision $cur"
     rm -rf objdir/libint-*.tgz

     # Pull update
     hg pull
     hg update -r $hgrel
 else
     echo "Old version was $cur, current is $hgrel"
 fi

 cd ..
fi

# Generate source tarball
if [ ! -f libint2-${hgrel}hg.tar.xz ]; then
 tar Jcf libint2-${hgrel}hg.tar.xz --exclude=.hg/ --exclude=objdir* libint2
fi

# Go into the directory
cd libint2

# Run autoconf
aclocal -I lib/autoconf
autoconf

# Object directory
if [ ! -d objdir ]; then
 mkdir objdir
fi

cd objdir
# Configure the options for the target library
if [ ! -f libint-${ver}-stable.tgz ]; then
    echo "libint-${ver}-stable.tgz does not exist, generating."

    export CXX=g++
    # Optimization flags to use for the compiler (just speeds up the generation)
    export OPTFLAGS=`rpm --eval %{optflags}`

    ../configure --enable-shared --disable-static \
	--enable-eri=2 --enable-eri3=2 --enable-eri2=2 \
	--with-eri-max-am=7,5,4 --with-eri-opt-am=3 \
	--with-eri3-max-am=7 --with-eri2-max-am=7 \
	--with-g12-max-am=5 --with-g12-opt-am=3 \
	--with-g12dkh-max-am=5 --with-g12dkh-opt-am=3 \
	--disable-unrolling --enable-generic-code --enable-contracted-ints \
	--with-cxx-optflags="$OPTFLAGS" \
	| tee configure.log
    
    # Generate the library sources
    echo "Running make export, follow progress in export.log"
    make export > export.log
else
    echo "Found previously generated tarball."
fi

# Compress the source tarball
cp libint-${ver}-stable.tgz libint-${ver}-${hgrel}hg.tar.gz
gunzip libint-${ver}-${hgrel}hg.tar.gz
xz libint-${ver}-${hgrel}hg.tar
mv libint-${ver}-${hgrel}hg.tar.xz ../..