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