1#! /bin/sh
2#
3# Copyright (C) 2002, 2006 Free Software Foundation, Inc.
4#
5# This program is free software; you can redistribute it and/or modify
6# it under the terms of the GNU General Public License as published by
7# the Free Software Foundation; either version 2, or (at your option)
8# any later version.
9#
10# This program is distributed in the hope that it will be useful,
11# but WITHOUT ANY WARRANTY; without even the implied warranty of
12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13# GNU General Public License for more details.
14#
15# You should have received a copy of the GNU General Public License
16# along with this program; if not, write to the Free Software Foundation,
17# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18#
19
20# Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz
21# Adds the infrastructure files for gettext version 0.xx.yy to the compressed
22# CVS repository in the archive.tar.gz file.
23
24if test $# != 1; then
25  echo "Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz"
26  exit 1
27fi
28
29sourcetgz="$1"
30case "$sourcetgz" in
31  *.tar.gz) ;;
32  *) echo "$0: first argument should be a gettext release tar.gz file"; exit 1;;
33esac
34
35pack_ver=`basename "$sourcetgz" | sed -e 's/\.tar\.gz$//'`
36if test -d "$pack_ver"; then
37  echo "$0: directory $pack_ver already exists"; exit 1
38fi
39pack=`echo "$pack_ver" | sed -e 's/^\([^-]*\)-.*/\1/'`
40ver=`echo "$pack_ver" | sed -e 's/^[^-]*-\(.*\)/\1/'`
41
42# Set a nonstandard variable, for a good-looking cvs history.
43cvsuser=bruno
44gcc -shared -O cvsuser.c -o cvsuser.so
45cvsuser_hack=`pwd`/cvsuser.so
46
47# Unpack, build and install the source distribution.
48myprefix=`pwd`/${pack_ver}-inst
49gunzip -c < "$sourcetgz" | tar xvf -
50cd $pack_ver
51./configure --prefix="$myprefix"
52make
53make install
54cd ..
55rm -rf $pack_ver
56
57# Copy the relevant files into an empty directory.
58work_dir=tmpwrk$$
59mkdir "$work_dir"
60mkdir "$work_dir/archive"
61work_archive=`pwd`/"$work_dir/archive"
62(cd "$myprefix"/share/gettext
63 for file in *; do
64   case $file in
65     ABOUT-NLS)
66       cp -p $file "$work_archive/$file" ;;
67     config.rpath)
68       cp -p $file "$work_archive/$file" ;;
69   esac
70 done
71 mkdir "$work_archive/intl"
72 cd intl
73 for file in *; do
74   if test $file != COPYING.LIB-2 && test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
75     cp -p $file "$work_archive/intl/$file"
76   fi
77 done
78 cd ..
79 mkdir "$work_archive/po"
80 cd po
81 for file in *; do
82   if test $file != Makevars; then
83     cp -p $file "$work_archive/po/$file"
84   fi
85 done
86 cd ..
87 mkdir "$work_archive/m4"
88 cd "$myprefix"/share/aclocal
89 for file in *; do
90   cp -p $file "$work_archive/m4/$file"
91 done
92)
93
94# Add the contents of this directory to the repository.
95cvsroot=`pwd`/autopoint-files
96mkdir "$cvsroot"
97cvs -d "$cvsroot" init
98(cd autopoint-files && tar xvfz ../archive.tar.gz)
99cvsver=$pack-`echo "$ver" | sed -e 's/\./_/g'`
100(cd "$work_archive"
101 CVSUSER=$cvsuser LD_PRELOAD=$cvsuser_hack \
102 cvs -d "$cvsroot" import -m "Import $pack_ver" archive release "$cvsver"
103)
104(cd autopoint-files && tar cvfz ../archive.tar.gz --owner=root --group=root archive)
105(cd autopoint-files && du archive)
106
107# Clean up.
108rm -rf "$cvsroot"
109rm -rf "$work_dir"
110rm -rf "$myprefix"
111
112exit 0
113