updates.
[crypto.git] / prepare
diff --git a/prepare b/prepare
index 740cbc943f01d82a093a6d1e2cca21e69be4ffbf..a2295ede9568ffc927da46b900251b01ed252736 100755 (executable)
--- a/prepare
+++ b/prepare
 # temporary files (including these prepare* scripts) are removed.
 #
 
+#
+# Usage: ./prepare [<distribution> <base version> <package version>]
+#
+# If <package version> is omitted <base version> is used as package
+# version.  The package version appears in the package name and in those
+# distributions that used the SILC_DISTRIBUTION_VERSION define in the
+# code.  The base version is the SILC_VERSION_STRING define.
+#
+
 #
 # SILC Distribution versions. Set here or give the version on the command
-# line, as argument.
+# line as argument.
 #
 SILC_VERSION=0.2.6                     # Base version
 
@@ -46,6 +55,11 @@ if test "$version" = ""; then
   version=$SILC_VERSION;
 fi
 
+dist_version=$3
+if test "$dist_version" = ""; then
+  dist_version=$version
+fi
+
 echo "Preparing $distribution distribution version $version"
 
 # Go though the subdirs and create the Makefile.ams from the
@@ -62,13 +76,20 @@ do
     cd $path
     continue;
   fi
-  sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
+  if [ -f Makefile.am.pre ]; then
+    sed -e "/SILC_DISTRIBUTION_SUBDIRS/s//$sub/" Makefile.am.pre >Makefile.am 2>/dev/null
+  fi
   cd $path
 done
 cd $path
 
 # Replace version string and create configure.in
-sed -e "/SILC_VERSION/s//$version/" configure.in.pre >configure.in
+echo "# Automatically generated by ./prepare from configure.in.pre. Do not edit!" >configure.in2
+sed -e "/SILC_VERSION/s//$dist_version/" configure.in.pre >>configure.in2
+sed -e "/SILC_PACKAGE/s//silc-"$distribution"/" configure.in2 >configure.in
+rm -f configure.in2
+
+cp Makefile.defines.in Makefile.defines
 
 aclocal
 autoconf
@@ -85,6 +106,7 @@ cd ../..
 file=includes/version_internal.h
 echo "/* Automatically generated by ./prepare */" >$file
 echo "#define SILC_VERSION_STRING \"$version\"" >>$file
+echo "#define SILC_DISTRIBUTION_VERSION \"$dist_version\"" >>$file
 echo "#define SILC_PROTOCOL_VERSION_STRING \"SILC-1.0-$version\"" >>$file
 
 # preparing irssi