Libiconv changes for ANSEL encoding.
[gedcom-parse.git] / iconv / libiconv / patch_dist
1 #!/bin/sh
2
3 expected_version=1.8
4 tarfile="libiconv-$expected_version.tar.gz"
5 topdir=`pwd`
6 libiconvdir=`basename $tarfile .tar.gz`
7 libiconvdir="$topdir/$libiconvdir"
8
9 #############################################################################
10 echo "Checking tar file..."
11 if [ ! -r $tarfile ]
12 then
13   echo "Base package '$tarfile' not found"
14   if [ `which wget` ]
15   then
16     echo -n "Press ENTER to automatically download it..."
17     read
18     wget "ftp://ftp.gnu.org/pub/gnu/libiconv/$tarfile"
19   else
20     exit 1
21   fi
22 fi
23
24 #############################################################################
25 echo "Unpacking tar file..."
26 if [ -d $libiconvdir ]
27 then
28   rm -rf $libiconvdir
29 fi
30
31 tar xvfz $tarfile > /dev/null
32
33 #############################################################################
34 echo "Adding top level files..."
35 cd $libiconvdir
36 cp $topdir/ChangeLog.gedcom .
37 cp $topdir/NEWS.gedcom .
38
39 #############################################################################
40 echo "Creating header file..."
41 cd $libiconvdir/lib
42 ln -s $topdir/ansi_z39_47.h .
43 ln -s $topdir/../ANSI_Z39.47-tables.h .
44
45 #############################################################################
46 echo "Patching files in top directory..."
47 cd $libiconvdir
48 for file in configure.in configure README
49 do
50   echo "  $file"
51   patch -s -b -p0 < $topdir/$file.patch
52 done
53
54 #############################################################################
55 echo "Patching files in lib subdirectory..."
56 cd $libiconvdir/lib
57 for file in encodings.def converters.h Makefile.in
58 do
59   echo "  $file"
60   patch -s -b -p0 < $topdir/$file.patch
61 done
62
63
64 #############################################################################
65 echo "Patching files in man subdirectory..."
66 cd $libiconvdir/man
67 for file in iconv_open.3 iconv_open.3.html
68 do
69   echo "  $file"
70   patch -s -b -p0 < $topdir/$file.patch
71 done
72
73 #############################################################################
74 echo "Generating flags..."
75 cd $libiconvdir/lib
76 gcc -o genflags genflags.c
77 ./genflags > flags.h
78
79 #############################################################################
80 echo "Generating aliases..."
81 gcc -o genaliases genaliases.c
82 ./genaliases > aliases.gperf
83
84 #############################################################################
85 echo "Generating hash function..."
86 gperf -t -L ANSI-C -H aliases_hash -N aliases_lookup -G -W aliases -7 -C -k '1,3-11,$' -i 1 aliases.gperf > aliases.h
87
88 #############################################################################
89 echo "Making distribution..."
90
91 package_name=`grep 'PACKAGE_NAME=' $libiconvdir/configure`
92 package_name=`echo $package_name | sed "s/^PACKAGE_NAME='//" | sed "s/'$//"`
93
94 package_ver=`grep 'PACKAGE_VERSION=' $libiconvdir/configure`
95 package_ver=`echo $package_ver | sed "s/^PACKAGE_VERSION='//" | sed "s/'$//"`
96
97 cd $topdir
98 cp -RL $libiconvdir $package_name-$package_ver
99 tar cvfz $package_name-$package_ver.tar.gz $package_name-$package_ver >/dev/null
100 rm -rf $package_name-$package_ver