61b8da502e711212e3611680b677e7141d409fa4
[platform/upstream/gettext.git] / gettext-tools / misc / add-to-archive
1 #! /bin/sh
2 #
3 # Copyright (C) 2002, 2006, 2009-2010 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 3 of the License, or
8 # (at your option) 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, see <http://www.gnu.org/licenses/>.
17 #
18
19 # Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz
20 # Adds the infrastructure files for gettext version 0.xx.yy to the reposutory
21 # in the archive.dir.tar.gz file.
22
23 if test $# != 1; then
24   echo "Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz"
25   exit 1
26 fi
27
28 sourcetgz="$1"
29 case "$sourcetgz" in
30   *.tar.gz) ;;
31   *) echo "$0: first argument should be a gettext release tar.gz file"; exit 1;;
32 esac
33
34 pack_ver=`basename "$sourcetgz" | sed -e 's/\.tar\.gz$//'`
35 if test -d "$pack_ver"; then
36   echo "$0: directory $pack_ver already exists"; exit 1
37 fi
38 pack=`echo "$pack_ver" | sed -e 's/^\([^-]*\)-.*/\1/'`
39 ver=`echo "$pack_ver" | sed -e 's/^[^-]*-\(.*\)/\1/'`
40
41 # Unpack, build and install the source distribution.
42 myprefix=`pwd`/${pack_ver}-inst
43 gunzip -c < "$sourcetgz" | tar xvf -
44 cd $pack_ver
45 ./configure --prefix="$myprefix"
46 make
47 make install
48 cd ..
49 rm -rf $pack_ver
50
51 # Copy the relevant files into an empty directory.
52 work_dir=tmpwrk$$
53 mkdir "$work_dir"
54 mkdir "$work_dir/archive"
55 work_archive=`pwd`/"$work_dir/archive"
56 (cd "$myprefix"/share/gettext
57  for file in *; do
58    case $file in
59      ABOUT-NLS)
60        cp -p $file "$work_archive/$file" ;;
61      config.rpath)
62        cp -p $file "$work_archive/$file" ;;
63    esac
64  done
65  mkdir "$work_archive/intl"
66  cd intl
67  for file in *; do
68    if test $file != COPYING.LIB-2 && test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
69      cp -p $file "$work_archive/intl/$file"
70    fi
71  done
72  cd ..
73  mkdir "$work_archive/po"
74  cd po
75  for file in *; do
76    if test $file != Makevars; then
77      cp -p $file "$work_archive/po/$file"
78    fi
79  done
80  cd ..
81  mkdir "$work_archive/m4"
82  cd "$myprefix"/share/aclocal
83  for file in *; do
84    cp -p $file "$work_archive/m4/$file"
85  done
86 )
87
88 # Add the contents of this directory to the repository.
89 mkdir autopoint-files
90 (cd autopoint-files && tar xfz ../archive.dir.tar.gz)
91 mkdir autopoint-files/$pack_ver
92 (cd "$work_archive" && tar cf - .) | (cd autopoint-files/$pack_ver && tar xf -)
93 (cd autopoint-files && tar cfz ../archive.dir.tar.gz --owner=root --group=root *)
94
95 # Clean up.
96 rm -rf autopoint-files
97 rm -rf "$work_dir"
98 rm -f cvsuser.so
99 rm -rf "$myprefix"
100
101 exit 0