~ubuntu-branches/ubuntu/wily/libxml2/wily-proposed

« back to all changes in this revision

Viewing changes to os400/make-src.sh

  • Committer: Package Import Robot
  • Author(s): Aron Xu
  • Date: 2014-10-26 07:04:50 UTC
  • mfrom: (43.2.7 sid)
  • Revision ID: package-import@ubuntu.com-20141026070450-rmcqvcqn8peeuebs
Tags: 2.9.2+dfsg1-1
* New upstream release (Closes: #765722, CVE-2014-3660)
* Remove no-longer-needed upstream patches
* Update distro patch
* Std-ver: 3.9.5 -> 3.9.6, no change.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
#       libxml compilation script for the OS/400.
 
4
#
 
5
#       See Copyright for the status of this software.
 
6
#
 
7
#       Author: Patrick Monnerat <pm@datasphere.ch>, DATASPHERE S.A.
 
8
#
 
9
 
 
10
SCRIPTDIR=`dirname "${0}"`
 
11
. "${SCRIPTDIR}/initscript.sh"
 
12
cd "${TOPDIR}"
 
13
 
 
14
 
 
15
#      Create and compile the identification source file.
 
16
 
 
17
echo '#pragma comment(user, "libxml2 version '"${LIBXML_VERSION}"'")' > os400.c
 
18
echo '#pragma comment(user, __DATE__)' >> os400.c
 
19
echo '#pragma comment(user, __TIME__)' >> os400.c
 
20
echo '#pragma comment(copyright, "Copyright (C) 1998-2014 Daniel Veillard. OS/400 version by P. Monnerat.")' >> os400.c
 
21
make_module     OS400           os400.c
 
22
LINK=                           # No need to rebuild service program yet.
 
23
MODULES=
 
24
 
 
25
 
 
26
#       Get source list.
 
27
 
 
28
foldlines()
 
29
 
 
30
{
 
31
        sed -e ':begin'                                                 \
 
32
            -e '/\\$/{'                                                 \
 
33
            -e 's/\\$/ /'                                               \
 
34
            -e 'N'                                                      \
 
35
            -e 'bbegin'                                                 \
 
36
            -e '}'                                                      \
 
37
            -e 's/\n//g'                                                \
 
38
            -e 's/[[:space:]]*$//'
 
39
}
 
40
 
 
41
 
 
42
get_make_var()
 
43
 
 
44
{
 
45
        foldlines < Makefile.am                                         |
 
46
        sed -e "/^${1}[[:space:]]*=[[:space:]]*/{"                      \
 
47
            -e 's///'                                                   \
 
48
            -e 'q'                                                      \
 
49
            -e '}'                                                      \
 
50
            -e 'd'
 
51
}
 
52
 
 
53
 
 
54
docb_sources=`get_make_var docb_sources`
 
55
trio_sources=`get_make_var trio_sources`
 
56
CSOURCES=`eval echo "\`get_make_var libxml2_la_SOURCES | tr '()' '{}'\`"`
 
57
 
 
58
 
 
59
#       Compile the sources into modules.
 
60
 
 
61
INCLUDES="'`pwd`'"
 
62
 
 
63
#       OS/400 specific modules first.
 
64
 
 
65
make_module     DLFCN           "${SCRIPTDIR}/dlfcn/dlfcn.c"    ''      ebcdic
 
66
make_module     ICONV           "${SCRIPTDIR}/iconv/iconv.c"    ''      ebcdic
 
67
make_module     WRAPPERS        "${SCRIPTDIR}/wrappers.c"       ''      ebcdic
 
68
make_module     TRANSCODE       "${SCRIPTDIR}/transcode.c"
 
69
make_module     RPGSUPPORT      "${SCRIPTDIR}/rpgsupport.c"
 
70
 
 
71
#       Regular libxml2 modules.
 
72
 
 
73
for SRC in ${CSOURCES}
 
74
do      MODULE=`db2_name "${SRC}"`
 
75
        make_module "${MODULE}" "${SRC}"
 
76
done
 
77
 
 
78
 
 
79
#       If needed, (re)create the static binding directory.
 
80
 
 
81
if action_needed "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
 
82
then    LINK=YES
 
83
fi
 
84
 
 
85
if [ "${LINK}" ]
 
86
then    rm -rf "${LIBIFSNAME}/${STATBNDDIR}.BNDDIR"
 
87
        CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${STATBNDDIR})"
 
88
        CMD="${CMD} TEXT('libxml2 static binding directory')"
 
89
        system "${CMD}"
 
90
 
 
91
        for MODULE in ${MODULES}
 
92
        do      CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${STATBNDDIR})"
 
93
                CMD="${CMD} OBJ((${TARGETLIB}/${MODULE} *MODULE))"
 
94
                system "${CMD}"
 
95
        done
 
96
fi
 
97
 
 
98
 
 
99
#       The exportation file for service program creation must be in a DB2
 
100
#               source file, so make sure it exists.
 
101
 
 
102
if action_needed "${LIBIFSNAME}/TOOLS.FILE"
 
103
then    CMD="CRTSRCPF FILE(${TARGETLIB}/TOOLS) RCDLEN(112)"
 
104
        CMD="${CMD} CCSID(${TGTCCSID}) TEXT('libxml2: build tools')"
 
105
        system "${CMD}"
 
106
fi
 
107
 
 
108
 
 
109
#       Generate all exported symbol table versions in a binding source file.
 
110
 
 
111
BSF="${LIBIFSNAME}/TOOLS.FILE/BNDSRC.MBR"
 
112
PGMEXPS=
 
113
 
 
114
OS400SYMS=`cat os400/transcode.h os400/rpgsupport.h                     |
 
115
           sed -e 'H'                                                   \
 
116
               -e 'g'                                                   \
 
117
               -e 's/\n/ /'                                             \
 
118
               -e 's/\\$/ /'                                            \
 
119
               -e 's/.*/& /'                                            \
 
120
               -e 's/\/\*.*\*\// /g'                                    \
 
121
               -e 'h'                                                   \
 
122
               -e ':loop'                                               \
 
123
               -e 'g'                                                   \
 
124
               -e '/\/\*/d'                                             \
 
125
               -e '/;/!d'                                               \
 
126
               -e 's/[^;]*;//'                                          \
 
127
               -e 'x'                                                   \
 
128
               -e 's/[[:space:]]*;.*$//'                                \
 
129
               -e '/XMLPUBFUN/{'                                        \
 
130
               -e 's/[[:space:]]*(.*$//'                                \
 
131
               -e 's/.*[[:space:]*]//'                                  \
 
132
               -e 'p'                                                   \
 
133
               -e 'bloop'                                               \
 
134
               -e '}'                                                   \
 
135
               -e '/XMLPUBVAR/!bloop'                                   \
 
136
               -e ':loop2'                                              \
 
137
               -e '/\[[^][]*\]/{'                                       \
 
138
               -e 's///'                                                \
 
139
               -e 'bloop2'                                              \
 
140
               -e '}'                                                   \
 
141
               -e 's/[[:space:]]*,[[:space:]]*/,/g'                     \
 
142
               -e 's/[^,]*[[:space:]*]//'                               \
 
143
               -e 's/[^[:alnum:]_,]//g'                                 \
 
144
               -e 's/,/\n/g'                                            \
 
145
               -e 'p'                                                   \
 
146
               -e 'bloop'`
 
147
 
 
148
sed -e 's/#.*//'                                                        \
 
149
    -e 's/[[:space:]]*$//'                                              \
 
150
    -e 's/^[[:space:]]*//'                                              \
 
151
    -e '/^*global:$/d'                                                  \
 
152
    -e '/^$/d'                                                          \
 
153
    -e '/[[:space:]]*{$/{'                                              \
 
154
    -e   's///'                                                         \
 
155
    -e   'h'                                                            \
 
156
    -e   's/[^A-Za-z0-9]/_/g'                                           \
 
157
    -e   's/^[0-9]/_&/'                                                 \
 
158
    -e   'x'                                                            \
 
159
    -e   'G'                                                            \
 
160
    -e   's/\(.*\)\n\(.*\)/\2_SIGNATURE="\1"/'                          \
 
161
    -e   'p'                                                            \
 
162
    -e   's/.*//'                                                       \
 
163
    -e   'x'                                                            \
 
164
    -e   "s/.*/SONAME='&'/"                                             \
 
165
    -e   'b'                                                            \
 
166
    -e '}'                                                              \
 
167
    -e '/[[:space:]]*;$/!d'                                             \
 
168
    -e 's///'                                                           \
 
169
    -e '/^xmlDllMain$/d'                                                \
 
170
    -e '/^}[[:space:]]*/!{'                                             \
 
171
    -e   'H'                                                            \
 
172
    -e   'd'                                                            \
 
173
    -e '}'                                                              \
 
174
    -e 's///'                                                           \
 
175
    -e '/^$/!{'                                                         \
 
176
    -e   's/[^A-Za-z0-9]/_/g'                                           \
 
177
    -e   's/^[0-9]/_&/'                                                 \
 
178
    -e   's/.*/${&}/'                                                   \
 
179
    -e   'x'                                                            \
 
180
    -e   'H'                                                            \
 
181
    -e   's/.*//'                                                       \
 
182
    -e '}'                                                              \
 
183
    -e 'x'                                                              \
 
184
    -e 's/\n/ /g'                                                       \
 
185
    -e 's/^[[:space:]]*//'                                              \
 
186
    -e 's/.*/declare ${SONAME}="&"/'                                    \
 
187
    -e 's/.*/&; PGMEXPS="${SONAME} ${PGMEXPS}"/'                        \
 
188
        < "${TOPDIR}/libxml2.syms"    > bndvars
 
189
. ./bndvars
 
190
 
 
191
PGMLVL=CURRENT
 
192
for PGMEXP in ${PGMEXPS}
 
193
do      SIGNATURE=`echo "${PGMEXP}" | sed 's/^LIBXML2_//'`
 
194
        eval ENTRIES=\"\${${PGMEXP}}\"
 
195
        echo " STRPGMEXP PGMLVL(*${PGMLVL}) SIGNATURE('${SIGNATURE}')"
 
196
        for ENTRY in ${ENTRIES} ${OS400SYMS}
 
197
        do      echo " EXPORT    SYMBOL('${ENTRY}')"
 
198
        done
 
199
        echo ' ENDPGMEXP'
 
200
        PGMLVL=PRV
 
201
done            > "${BSF}"
 
202
 
 
203
 
 
204
#       Build the service program if needed.
 
205
 
 
206
if action_needed "${LIBIFSNAME}/${SRVPGM}.SRVPGM"
 
207
then    LINK=YES
 
208
fi
 
209
 
 
210
if [ "${LINK}" ]
 
211
then    CMD="CRTSRVPGM SRVPGM(${TARGETLIB}/${SRVPGM})"
 
212
        CMD="${CMD} SRCFILE(${TARGETLIB}/TOOLS) SRCMBR(BNDSRC)"
 
213
        CMD="${CMD} MODULE(${TARGETLIB}/OS400)"
 
214
        CMD="${CMD} BNDDIR((${TARGETLIB}/${STATBNDDIR})"
 
215
        if [ "${WITH_ZLIB}" -ne 0 ]
 
216
        then    CMD="${CMD} (${ZLIB_LIB}/${ZLIB_BNDDIR})"
 
217
        fi
 
218
        CMD="${CMD})"
 
219
        CMD="${CMD} BNDSRVPGM(QADRTTS)"
 
220
        CMD="${CMD} TEXT('libxml2 dynamic library')"
 
221
        CMD="${CMD} TGTRLS(${TGTRLS})"
 
222
        system "${CMD}"
 
223
        LINK=YES
 
224
fi
 
225
 
 
226
 
 
227
#       If needed, (re)create the dynamic binding directory.
 
228
 
 
229
if action_needed "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
 
230
then    LINK=YES
 
231
fi
 
232
 
 
233
if [ "${LINK}" ]
 
234
then    rm -rf "${LIBIFSNAME}/${DYNBNDDIR}.BNDDIR"
 
235
        CMD="CRTBNDDIR BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
 
236
        CMD="${CMD} TEXT('libxml2 dynamic binding directory')"
 
237
        system "${CMD}"
 
238
        CMD="ADDBNDDIRE BNDDIR(${TARGETLIB}/${DYNBNDDIR})"
 
239
        CMD="${CMD} OBJ((*LIBL/${SRVPGM} *SRVPGM))"
 
240
        system "${CMD}"
 
241
fi