Some additional configuration.
[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 echo "Patching files in man subdirectory..."
65 cd $libiconvdir/man
66 for file in iconv_open.3 iconv_open.3.html
67 do
68   echo "  $file"
69   patch -s -b -p0 < $topdir/$file.patch
70 done
71
72 #############################################################################
73 echo "Patching files in libcharset/lib subdirectory..."
74 cd $libiconvdir/libcharset/lib
75 for file in config.charset
76 do
77   echo "  $file"
78   patch -s -b -p0 < $topdir/$file.patch
79 done
80
81 #############################################################################
82 echo "Generating flags..."
83 cd $libiconvdir/lib
84 gcc -o genflags genflags.c
85 ./genflags > flags.h
86
87 #############################################################################
88 echo "Generating aliases..."
89 gcc -o genaliases genaliases.c
90 ./genaliases > aliases.gperf
91
92 #############################################################################
93 echo "Generating hash function..."
94 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
95
96 #############################################################################
97 echo "Making distribution..."
98
99 package_name=`grep 'PACKAGE_NAME=' $libiconvdir/configure`
100 package_name=`echo $package_name | sed "s/^PACKAGE_NAME='//" | sed "s/'$//"`
101
102 package_ver=`grep 'PACKAGE_VERSION=' $libiconvdir/configure`
103 package_ver=`echo $package_ver | sed "s/^PACKAGE_VERSION='//" | sed "s/'$//"`
104
105 cd $topdir
106 cp -RL $libiconvdir $package_name-$package_ver
107 tar cvfz $package_name-$package_ver.tar.gz $package_name-$package_ver >/dev/null
108 rm -rf $package_name-$package_ver