summaryrefslogtreecommitdiff
path: root/gettext-tools/misc/add-to-archive
blob: 300234dfbae4fb5b665d8900ae9a36ff8e1da11d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#! /bin/sh
#
# Copyright (C) 2002, 2006, 2009-2010, 2015 Free Software Foundation,
# Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

# Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz
# Adds the infrastructure files for gettext version 0.xx.yy to the reposutory
# in the archive.dir.tar file.

if test $# != 1; then
  echo "Usage: add-to-archive /somewhere/gettext-0.xx.yy.tar.gz"
  exit 1
fi

sourcetgz="$1"
case "$sourcetgz" in
  *.tar.gz) ;;
  *) echo "$0: first argument should be a gettext release tar.gz file"; exit 1;;
esac

pack_ver=`basename "$sourcetgz" | sed -e 's/\.tar\.gz$//'`
if test -d "$pack_ver"; then
  echo "$0: directory $pack_ver already exists"; exit 1
fi
pack=`echo "$pack_ver" | sed -e 's/^\([^-]*\)-.*/\1/'`
ver=`echo "$pack_ver" | sed -e 's/^[^-]*-\(.*\)/\1/'`

# Unpack, build and install the source distribution.
myprefix=`pwd`/${pack_ver}-inst
gunzip -c < "$sourcetgz" | tar xvf -
cd $pack_ver
./configure --prefix="$myprefix"
make
make install
cd ..
rm -rf $pack_ver

# Copy the relevant files into an empty directory.
work_dir=tmpwrk$$
mkdir "$work_dir"
mkdir "$work_dir/archive"
work_archive=`pwd`/"$work_dir/archive"
(cd "$myprefix"/share/gettext
 for file in *; do
   case $file in
     ABOUT-NLS)
       cp -p $file "$work_archive/$file" ;;
     config.rpath)
       cp -p $file "$work_archive/$file" ;;
   esac
 done
 mkdir "$work_archive/intl"
 cd intl
 for file in *; do
   if test $file != COPYING.LIB-2 && test $file != COPYING.LIB-2.0 && test $file != COPYING.LIB-2.1; then
     cp -p $file "$work_archive/intl/$file"
   fi
 done
 cd ..
 mkdir "$work_archive/po"
 cd po
 for file in *; do
   if test $file != Makevars; then
     cp -p $file "$work_archive/po/$file"
   fi
 done
 cd ..
 mkdir "$work_archive/m4"
 cd "$myprefix"/share/aclocal
 for file in *; do
   cp -p $file "$work_archive/m4/$file"
 done
)

# Add the contents of this directory to the repository.
mkdir autopoint-files
(cd autopoint-files && tar xf ../archive.dir.tar)
mkdir autopoint-files/$pack_ver
(cd "$work_archive" && tar cf - .) | (cd autopoint-files/$pack_ver && tar xf -)
(cd autopoint-files && tar cf ../archive.dir.tar --owner=root --group=root *)

# Clean up.
rm -rf autopoint-files
rm -rf "$work_dir"
rm -f cvsuser.so
rm -rf "$myprefix"

exit 0