updates.
[silc.git] / prepare
1 #! /bin/sh
2 #
3 #  prepare
4 #
5 #  Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
6 #
7 #  Copyright (C) 2000 - 2001 Pekka Riikonen
8 #
9 #  This program is free software; you can redistribute it and/or modify
10 #  it under the terms of the GNU General Public License as published by
11 #  the Free Software Foundation; either version 2 of the License, or
12 #  (at your option) any later version.
13 #
14 #  This program is distributed in the hope that it will be useful,
15 #  but WITHOUT ANY WARRANTY; without even the implied warranty of
16 #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 #  GNU General Public License for more details.
18 #
19
20 #
21 # Prepares SILC source tree for configuration and compilation. This is
22 # done only after checkout from CVS. This is only for developers of SILC
23 # and will never appear in public distribution. When creating distributions
24 # this is always run first. After the distribution is created all
25 # temporary files (including these prepare* scripts) are removed.
26 #
27
28 #
29 # Usage: ./prepare [<distribution> <base version> <package version>]
30 #
31 # If <package version> is omitted <base version> is used as package
32 # version.  The package version appears in the package name and in those
33 # distributions that used the SILC_DIST_VERSION_STRING define in the
34 # code.  The base version is the SILC_VERSION_STRING define.
35 #
36
37 #
38 # SILC Distribution versions. Set here or give the version on the command
39 # line as argument.
40 #
41 SILC_VERSION=0.2.6                      # Base version
42
43
44 #############################################################################
45
46 echo "Preparing SILC source tree for configuration and compilation..."
47
48 distribution=$1
49 if test "$distribution" = ""; then
50   distribution="toolkit";
51 fi
52
53 version=$2
54 if test "$version" = ""; then
55   version=$SILC_VERSION;
56 fi
57
58 dist_version=$3
59 if test "$dist_version" = ""; then
60   dist_version=$version
61 fi
62
63 echo "Preparing $distribution distribution version $version"
64
65 # Go though the subdirs and create the Makefile.ams from the
66 # Makefile.am.pre files.
67
68 subdirs=`grep _"$distribution"_SUBDIRS= distributions |cut -d=  -f2`
69 sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" Makefile.am.pre >Makefile.am
70 path=`pwd`
71 for i in $subdirs
72 do
73   cd $i
74   sub=`grep _"$distribution"_SUBDIRS_"$i"= $path/distributions |cut -d=  -f2`
75   if test "$sub" = ""; then
76     cd $path
77     continue;
78   fi
79   if [ -f Makefile.am.pre ]; then
80     sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
81   fi
82   cd $path
83 done
84 cd $path
85
86 # Replace version string and create configure.in
87 echo "# Automatically generated by ./prepare from configure.in.pre. Do not edit!" >configure.in2
88 sed -e "/SILC_VERSION/s//$dist_version/" configure.in.pre >>configure.in2
89 sed -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in2 >configure.in
90 rm -f configure.in2
91
92 #
93 # Prepare the Makefile.defines
94 #
95 cp Makefile.defines.pre Makefile.defines.in
96 cp Makefile.defines.in irssi
97 cp Makefile.defines_int.pre Makefile.defines_int.in
98 cp Makefile.defines_int.in irssi
99
100 aclocal
101 autoconf
102 autoheader
103 automake
104
105 cd lib/trq
106 aclocal
107 autoconf
108 autoheader
109 automake >/dev/null 2>/dev/null
110 cd ../..
111
112 file=includes/version_internal.h
113 echo "/* Automatically generated by ./prepare */" >$file
114 echo "#define SILC_VERSION_STRING \"$version\"" >>$file
115 echo "#define SILC_DIST_VERSION_STRING \"$dist_version\"" >>$file
116 echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.0-$version\"" >>$file
117 echo "#define SILC_NAME \"SILC $distribution\"" >>$file
118
119 # preparing irssi
120 cd irssi
121 sh autogen.sh 2>/dev/null 1>/dev/null
122 cd ..
123 file=irssi/irssi-version.h.in
124 version_date=`date +%Y%m%d`
125 echo "/* automatically created by autogen.sh */" > $file
126 echo "#define IRSSI_VERSION \"$dist_version (Irssi base: @VERSION@ - SILC base: SILC Toolkit $version)\"" >>$file
127 echo "#define IRSSI_VERSION_DATE \"$version_date\"" >> $file
128
129 echo "Done, now run ./configure and make."