5 # Author: Pekka Riikonen <priikone@poseidon.pspt.fi>
7 # Copyright (C) 2000 - 2001 Pekka Riikonen
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.
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.
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.
29 # Usage: ./prepare [<distribution> <base version> <package version>]
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.
38 # SILC Distribution versions. Set here or give the version on the command
41 SILC_VERSION=0.2.6 # Base version
44 #############################################################################
46 echo "Preparing SILC source tree for configuration and compilation..."
49 if test "$distribution" = ""; then
50 distribution="toolkit";
54 if test "$version" = ""; then
55 version=$SILC_VERSION;
59 if test "$dist_version" = ""; then
63 echo "Preparing $distribution distribution version $version"
66 # Go though the subdirs and create the Makefile.ams from the
67 # Makefile.am.pre files. Create also the acconfig.h for the distribution.
69 subdirs=`grep _"$distribution"_SUBDIRS= distributions |cut -d= -f2`
70 sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$subdirs/" Makefile.am.pre >Makefile.am
75 sub=`grep _"$distribution"_SUBDIRS_"$i"= $path/distributions |cut -d= -f2`
76 if test "$sub" = ""; then
80 if [ -f Makefile.am.pre ]; then
81 sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
87 distlabel=`grep _"$distribution"_DISTLABEL= distributions |cut -d= -f2`
88 cp acconfig.h.pre acconfig.h
89 echo "#undef $distlabel" >>acconfig.h
93 # Replace version string, package name and distribution infos, and create
94 # the actual configure.in
96 echo "# Automatically generated by ./prepare from configure.in.pre. Do not edit!" >configure.in2
97 sed -e "/SILC_VERSION/s//$dist_version/" configure.in.pre >>configure.in2
98 sed -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in2 >configure.in3
99 sed -e "/SILC_DIST_DEFINE/s//$distlabel/" configure.in3 >configure.in4
100 sed -e "/SILC_DIST_DEFINE/s//$distlabel/" configure.in4 >configure.in
101 rm -f configure.in2 configure.in3 configure.in4
105 # Prepare the Makefile.defines
107 cp Makefile.defines.pre Makefile.defines.in
108 cp Makefile.defines.in irssi
109 cp Makefile.defines_int.pre Makefile.defines_int.in
110 cp Makefile.defines_int.in irssi
121 automake >/dev/null 2>/dev/null
124 file=includes/version_internal.h
125 echo "/* Automatically generated by ./prepare */" >$file
126 echo "#define SILC_VERSION_STRING \"$version\"" >>$file
127 echo "#define SILC_DIST_VERSION_STRING \"$dist_version\"" >>$file
128 echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.0-$version\"" >>$file
129 echo "#define SILC_NAME \"SILC $distribution\"" >>$file
134 sh autogen.sh 2>/dev/null 1>/dev/null
136 file=irssi/irssi-version.h.in
137 version_date=`date +%Y%m%d`
138 echo "/* automatically created by autogen.sh */" > $file
139 echo "#define IRSSI_VERSION \"$dist_version (Irssi base: @VERSION@ - SILC base: SILC Toolkit $version)\"" >>$file
140 echo "#define IRSSI_VERSION_DATE \"$version_date\"" >> $file
142 echo "Done, now run ./configure and make."