summaryrefslogtreecommitdiffstats
path: root/debian/gettext-kde/gettext-kde-0.10.35/misc/combine-sh
blob: b26fb4fa1f2e7dc1144e8fea183805de2561c7ef (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#!/bin/sh

TMPDIR=/tmp
TMPNAME=/tmp/combine1.$$.sed

trap 'rm -fr $TMPNAME combine; exit 1' 1 2 15

rm -f $TMPNAME
cat > $TMPNAME <<EOF
/@@ end of prolog @@/,/@@ begin of epilog @@/!d
/@@ end of prolog @@/ {
  =
  d
}
/@@ begin of epilog @@/d
EOF


rm -fr combine
mkdir combine
cat > combine/libintl.c <<EOF
/* Combined sources of GNU gettext library
   Copyright (C) 1995 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 2, 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

#ifdef HAVE_CONFIG_H
# include <config.h>
#endif

#define USE_COMBINED_HEADER 1
#include "libintlP.h"

#if HAVE_CATGETS

#include <stdlib.h>

#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif

#ifdef HAVE_NL_TYPES_H
# include <nl_types.h>
#endif

EOF

CATCFILES=cat-compat.c
GETCFILES="bindtextdom.c dcgettext.c dgettext.c finddomain.c gettext.c \
loadmsgcat.c textdomain.c"

for file in $CATCFILES; do
  sed -f $TMPNAME < $file \
    | sed -e '1s/.*/#line & "'$file'"/' >> combine/libintl.c
done
cat >> combine/libintl.c <<EOF

#else /* !HAVE_CATGETS */

#include <alloca.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>

#ifdef HAVE_LOCALE_H
# include <locale.h>
#endif

#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif

#ifdef HAVE_MMAP
# include <sys/mman.h>
#endif

EOF
for file in $GETCFILES; do
  sed -f $TMPNAME < $file \
    | sed -e '1s/.*/#line & "'$file'"/' >> combine/libintl.c
done
cat >> combine/libintl.c <<EOF
#endif /* HAVE_CATGETS */
EOF

cat > combine/libintlP.h <<EOF
/* Combined header files of GNU gettext library
   Copyright (C) 1995 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 2, 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, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */

EOF

PUBHEAD=libgettext.h
PRIVHEAD="gettext.h gettextP.h hash-string.h"

for file in $PUBHEAD; do
  sed -f $TMPNAME < $file \
    | sed -e '1s/.*/#line & "'$file'"/' >> combine/libintlP.h
done
cat >> combine/libintlP.h <<EOF

#ifdef USE_COMBINED_HEADER
EOF
for file in $PRIVHEAD; do
  sed -f $TMPNAME < $file \
    | sed -e '1s/.*/#line & "'$file'"/' >> combine/libintlP.h
done
cat >> combine/libintlP.h <<EOF
#endif /* USE_COMBINED_HEADER */
EOF


rm -f $TMPNAME
exit 0