new distributions system.
[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 # SILC Distribution versions. Set here or give the version on the command
30 # line, as argument.
31 #
32 SILC_VERSION=0.2.6                      # Base version
33
34
35 #############################################################################
36
37 echo "Preparing SILC source tree for configuration and compilation..."
38
39 distribution=$1
40 if test "$distribution" = ""; then
41   distribution="toolkit";
42 fi
43
44 version=$2
45 if test "$version" = ""; then
46   version=$SILC_VERSION;
47 fi
48
49 echo "Preparing $distribution distribution version $version"
50
51 # Go though the subdirs and create the Makefile.ams from the
52 # Makefile.am.pre files.
53
54 subdirs=`grep _"$distribution"_SUBDIRS= distributions |cut -d=  -f2`
55 sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" Makefile.am.pre >Makefile.am
56 path=`pwd`
57 for i in $subdirs
58 do
59   cd $i
60   sub=`grep _"$distribution"_SUBDIRS_"$i"= $path/distributions |cut -d=  -f2`
61   if test "$sub" = ""; then
62     cd $path
63     continue;
64   fi
65   sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
66   cd $path
67 done
68 cd $path
69
70 # Replace version string and create configure.in
71 sed -e "/SILC_VERSION/s//$version/" configure.in.pre >configure.in
72
73 aclocal
74 autoconf
75 autoheader
76 automake
77
78 cd lib/trq
79 aclocal
80 autoconf
81 autoheader
82 automake >/dev/null 2>/dev/null
83 cd ../..
84
85 file=includes/version_internal.h
86 echo "/* Automatically generated by ./prepare */" >$file
87 echo "#define SILC_VERSION_STRING \"$version\"" >>$file
88 echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.0-$version\"" >>$file
89
90 # preparing irssi
91 cd irssi
92 sh autogen.sh 2>/dev/null 1>/dev/null
93 cd ..
94 file=irssi/irssi-version.h.in
95 version_date=`date +%Y%m%d`
96 echo "/* automatically created by autogen.sh */" > $file
97 echo "#define IRSSI_VERSION \"$version (Irssi base: @VERSION@ - SILC base: SILC Toolkit $version)\"" >> $file
98 echo "#define IRSSI_VERSION_DATE \"$version_date\"" >> $file
99
100 echo "Done, now run ./configure and make."