#! /bin/sh

name=gmp
version=4.2.2

djver1=`echo $version | sed -e 's:\.::2g'`
djver2=`echo $version | sed -e 's:\.::g'`
dname=$name-$djver1

rm -rf inst.djg
make install prefix=`pwd`/inst.djg

mkdir -p inst.djg/manifest
mkdir -p inst.djg/gnu/$dname

touch inst.djg/manifest/$name${djver2}b.mft

cat >inst.djg/manifest/$name${djver2}b.ver <<E2
gmp${djver2}b.zip: GMP - GNU Multiple Precision Arithmetic Library (version $version binaries)
E2

cp -v authors COPYING* inst.djg/gnu/$dname/
cp -v news readme* inst.djg/gnu/$dname/
rm -rf inst.djg/share

rm -f inst.djg/info/dir

info_sed_opt=
for file in $(cd inst.djg/info && ls -1b $name.info*); do
  nn=$(echo $file | sed -e 's/\.info\-\([^.]*\)$/.i\1/')
  sed -e 's/^'$name'\.info\-\([^:]*\):/'$name'\.i\1:/' inst.djg/info/$file >inst.djg/info/$file.new
  rm -f inst.djg/info/$file
  mv -f inst.djg/info/$file.new inst.djg/info/$nn
done

( cd inst.djg && find . -type f | sed -e 's:^\./::' | sort >manifest/$name${djver2}b.mft )
( cd inst.djg && cat manifest/$name${djver2}b.mft | zip -9@ ../$name${djver2}b.zip )
