changing gmp install name

Jason Moxham J.L.Moxham@maths.soton.ac.uk
Wed, 8 Jan 2003 10:28:14 +0000


This script appears to do the business except for the info files , c++ ,b=
sd=20
and version numbers. I doubt it will be of much use to anyone but here it=
 is=20
anyway.



#!/bin/bash

# mpfr.info gmp.info gmpxx.h mpfrxx.h libmp libxx libmpfrxx not renamed
# external and internal version numbers not changed

GMPNAME=3DGMP_TEST
gmpname=3Dgmp_test
mpfrname=3Dmpfr_test
MPFRNAME=3DMPFR_TEST
mpf2mpfrname=3Dmpf2mpfr_test
gmpversion=3D4.1.2
newversion=3D4.1.2.0

rm -fr gmp-$gmpversion
rm -fr $gmpname-$newversion
tar xzf gmp-$gmpversion.tar.gz

# apply optional patches
cd patches
cp -r . ../gmp-$gmpversion
cd ../gmp-$gmpversion

sed -e s/LIBGMP/LIB$GMPNAME/g Makefile.am > temp
mv temp Makefile.am

sed -e s/LIBMPFR/LIB$MPFRNAME/g mpfr/Makefile.am > temp
mv temp mpfr/Makefile.am

sed -e s/libgmp/lib$gmpname/g configure.in > temp
mv temp configure.in

for file in `find -name Makefile.am`
do
sed -e s/libgmp/lib$gmpname/g $file > temp
sed -e s/libmpfr/lib$mpfrname/g temp > $file
done

# change gmp.h to gmpname.h=20
# change mpfr.h to mpfrname.h
# change mpf2mpfr.h to mpf2mpfrname.h=20
# for configure.in and all *.c *.cc Makefile.am *.h
for file in `find -name \*.c`
do
sed -e "s/gmp\.h/$gmpname.h/g" $file > temp
sed -e "s/mpfr\.h/$mpfrname.h/g" temp > $file
done
for file in `find -name \*.h`
do
sed -e "s/gmp\.h/$gmpname.h/g" $file > temp
sed -e "s/mpfr\.h/$mpfrname.h/g" temp > $file
done
for file in `find -name \*.cc`
do
sed -e "s/gmp\.h/$gmpname.h/g" $file > temp
sed -e "s/mpfr\.h/$mpfrname.h/g" temp > $file
done
for file in `find -name Makefile.am`
do
sed -e "s/gmp\.h/$gmpname.h/g" $file > temp
sed -e "s/mpfr\.h/$mpfrname.h/g" temp > $file
done
sed -e "s/gmp\.h/$gmpname.h/g" configure.in > temp
sed -e "s/mpfr\.h/$mpfrname.h/g" temp > configure.in

mv mpfr/mpfr.h mpfr/$mpfrname.h
mv mpfr/mpf2mpfr.h mpfr/$mpf2mpfrname.h

rm -f temp
#aclocal
autoconf
automake
autoheader
cd ..
mv gmp-$gmpversion $gmpname-$newversion
rm -f $gmpname-$newversion.tar.bz2
tar cjf $gmpname-$newversion.tar.bz2 $gmpname-$newversion
rm -r $gmpname-$newversion

# now test it

tar xjf $gmpname-$newversion.tar.bz2
cd $gmpname-$newversion
=2E/configure --enable-mpfr
make
make check