forked from pocoproject/poco
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmkrelease
More file actions
executable file
·468 lines (391 loc) · 11.7 KB
/
mkrelease
File metadata and controls
executable file
·468 lines (391 loc) · 11.7 KB
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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
#! /bin/bash
#
# $Id: //poco/1.4/release/script/mkrelease#8 $
#
# mkrelease
#
# Create a release for distribution.
#
# usage: mkrelease [-i] [-f specfile] <version> [<component>...]
#
if [ "$1" = "" ] ; then
echo "usage: $0 [-i] <version> [<component>...]"
echo " -i - include internal tools"
echo " -f specfile - read component list from specfile"
echo " -o dir - specify output directory"
echo " -c location - specify line-ending conversion utility (enables conversion)"
echo " -l - include licensing"
exit 1
fi
comps="Foundation XML JSON Util Net"
internal=0
specfile=""
version=""
output=""
lineEndConv=""
licensingDep=""
while [ "$1" != "" ] ;
do
if [ "$1" = "-i" ] ; then
shift
internal=1
elif [ "$1" = "-f" ] ; then
shift
specfile=$1
shift
elif [ "$1" = "-o" ] ; then
shift
output=$1
shift
elif [ "$1" = "-c" ] ; then
shift
lineEndConv=$1
shift
elif [ "$1" = "-l" ] ; then
shift
licensingDep="Licensing-libexec"
comps="$comps Licensing"
elif [ "$version" = "" ] ; then
version=$1
shift
else
comps="$comps $1"
shift
fi
done
if [ "$specfile" != "" ] ; then
while read c
do
comps="$comps $c"
done <$specfile
fi
if [ "$version" = "" ] ; then
echo "Error: no version specified."
exit 1
fi
if [ "$output" != "" ] ; then
target=$output
else
target=$POCO_BASE/releases/poco-${version}
fi
mkdir -p ${target}
mkdir -p ${target}/doc
mkdir -p ${target}/contrib
mkdir -p ${target}/patches
#
# readme files, etc.
#
echo ${version} "(`date +%Y-%m-%d`)" >${target}/VERSION
cp ${POCO_BASE}/LICENSE ${target}
cp ${POCO_BASE}/NEWS ${target}
cp ${POCO_BASE}/README ${target}
cp ${POCO_BASE}/CHANGELOG ${target}
cp ${POCO_BASE}/CONTRIBUTORS ${target}
cp ${POCO_BASE}/DLLVersion.rc ${target}
cp ${POCO_BASE}/doc/Acknowledgements.html ${target}/doc
cp ${POCO_BASE}/doc/*.page ${target}/doc
cp -R ${POCO_BASE}/contrib/* ${target}/contrib
cp -R ${POCO_BASE}/patches/* ${target}/patches
#
# build system
#
mkdir -p ${target}/build/config
mkdir -p ${target}/build/rules
mkdir -p ${target}/build/script
mkdir -p ${target}/build/vms
mkdir -p ${target}/build/vxconfig
cp ${POCO_BASE}/build/config/* ${target}/build/config
cp ${POCO_BASE}/build/rules/* ${target}/build/rules
cp ${POCO_BASE}/build/vxconfig/* ${target}/build/vxconfig
cp ${POCO_BASE}/build/script/makedepend.* ${target}/build/script
cp ${POCO_BASE}/build/script/makeldpath ${target}/build/script
cp ${POCO_BASE}/build/script/shlibln ${target}/build/script
cp ${POCO_BASE}/build/script/projname ${target}/build/script
cp ${POCO_BASE}/build/script/vxprogen ${target}/build/script
cp ${POCO_BASE}/build/vms/* ${target}/build/vms
cp ${POCO_BASE}/buildwin.cmd ${target}
cp ${POCO_BASE}/configure ${target}
cp ${POCO_BASE}/buildvms.com ${target}
cp ${POCO_BASE}/libversion ${target}
if [ $internal = 1 ] ; then
cp ${POCO_BASE}/build/script/testall ${target}/build/script
cp ${POCO_BASE}/build/script/waitfortest ${target}/build/script
fi
#
# CppUnit
#
mkdir -p ${target}/CppUnit
mkdir -p ${target}/CppUnit/doc
mkdir -p ${target}/CppUnit/include/CppUnit
mkdir -p ${target}/CppUnit/src
mkdir -p ${target}/CppUnit/WinTestRunner
mkdir -p ${target}/CppUnit/WinTestRunner/include/WinTestRunner
mkdir -p ${target}/CppUnit/WinTestRunner/src
mkdir -p ${target}/CppUnit/WinTestRunner/res
cp ${POCO_BASE}/CppUnit/doc/* ${target}/CppUnit/doc
cp ${POCO_BASE}/CppUnit/include/CppUnit/* ${target}/CppUnit/include/CppUnit
cp ${POCO_BASE}/CppUnit/src/* ${target}/CppUnit/src
cp ${POCO_BASE}/CppUnit/*.sln ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vcproj ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vcxproj ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vcxproj.filters ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vcxproj.user ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/Makefile ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vmsbuild ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.vxbuild ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/*.progen ${target}/CppUnit
cp ${POCO_BASE}/CppUnit/WinTestRunner/include/WinTestRunner/* ${target}/CppUnit/WinTestRunner/include/WinTestRunner
cp ${POCO_BASE}/CppUnit/WinTestRunner/src/* ${target}/CppUnit/WinTestRunner/src
cp ${POCO_BASE}/CppUnit/WinTestRunner/res/WinTestRunner.rc ${target}/CppUnit/WinTestRunner/res
cp ${POCO_BASE}/CppUnit/WinTestRunner/res/Resource.h ${target}/CppUnit/WinTestRunner/res
cp ${POCO_BASE}/CppUnit/WinTestRunner/*.vcproj ${target}/CppUnit/WinTestRunner
cp ${POCO_BASE}/CppUnit/WinTestRunner/*.vcxproj ${target}/CppUnit/WinTestRunner
cp ${POCO_BASE}/CppUnit/WinTestRunner/*.vcxproj.filters ${target}/CppUnit/WinTestRunner
cp ${POCO_BASE}/CppUnit/WinTestRunner/*.vcxproj.user ${target}/CppUnit/WinTestRunner
cp ${POCO_BASE}/CppUnit/WinTestRunner/*.progen ${target}/CppUnit/WinTestRunner
#
# Copy components
#
for comp in $comps ;
do
cpproj ${POCO_BASE}/$comp ${target}/$comp
done
#
# Create components file
#
echo "CppUnit" >${target}/components
echo "CppUnit/WinTestRunner" >>${target}/components
for comp in $comps ;
do
echo $comp >>${target}/components
done
#
# Make all files writeable
#
chmod -R +w ${target}
#
# Generate Makefile
#
cat >${target}/Makefile <<'ENDOFSCRIPT'
#
# Makefile
#
# The global Makefile for POCO [generated by mkrelease]
#
sinclude config.make
sinclude config.build
ifndef POCO_BASE
$(warning WARNING: POCO_BASE is not defined. Assuming current directory.)
export POCO_BASE=$(shell pwd)
endif
ifndef POCO_PREFIX
export POCO_PREFIX=/usr/local
endif
ifndef POCO_BUILD
export POCO_BUILD=$(POCO_BASE)
endif
.PHONY: poco all libexecs cppunit tests samples cleans clean distclean install
# TESTS and SAMPLES are set in config.make
poco: libexecs $(if $(TESTS),tests) $(if $(SAMPLES),samples)
all: libexecs tests samples
INSTALLDIR = $(DESTDIR)$(POCO_PREFIX)
ENDOFSCRIPT
echo "COMPONENTS = $comps" >>${target}/Makefile
cat >>${target}/Makefile <<'ENDOFSCRIPT'
cppunit:
$(MAKE) -C $(POCO_BASE)/CppUnit
CppUnit-clean:
\$(MAKE) -C \$(POCO_BASE)/CppUnit clean
install: libexecs
mkdir -p $(INSTALLDIR)/include/Poco
mkdir -p $(INSTALLDIR)/lib
mkdir -p $(INSTALLDIR)/bin
for comp in $(COMPONENTS) ; do \
if [ -d "$(POCO_BASE)/$$comp/include" ] ; then \
cp -Rf $(POCO_BASE)/$$comp/include/* $(INSTALLDIR)/include/ ; \
fi ; \
if [ -d "$(POCO_BUILD)/$$comp/bin" ] ; then \
find $(POCO_BUILD)/$$comp/bin -perm -700 -type f -exec cp -f {} $(INSTALLDIR)/bin \; ; \
fi ; \
done
find $(POCO_BUILD)/lib -name "libPoco*" -type f -exec cp -f {} $(INSTALLDIR)/lib \;
find $(POCO_BUILD)/lib -name "libPoco*" -type l -exec cp -Rf {} $(INSTALLDIR)/lib \;
ENDOFSCRIPT
libexecs=""
tests=""
samples=""
cleans=""
for comp in $comps ;
do
libexecs="$libexecs ${comp}-libexec"
cleans="$cleans ${comp}-clean"
if [ -d "${POCO_BASE}/${comp}/testsuite" ] ; then
tests="$tests ${comp}-tests"
fi
if [ -d "${POCO_BASE}/${comp}/samples" ] ; then
samples="$samples ${comp}-samples"
fi
done
echo "libexecs = $libexecs" >>${target}/Makefile
echo "tests = $tests" >> ${target}/Makefile
echo "samples = $samples" >> ${target}/Makefile
echo "cleans = $cleans" >> ${target}/Makefile
echo "" >>${target}/Makefile
echo '.PHONY: $(libexecs)' >>${target}/Makefile
echo '.PHONY: $(tests)' >>${target}/Makefile
echo '.PHONY: $(samples)' >>${target}/Makefile
echo '.PHONY: $(cleans)' >>${target}/Makefile
echo "" >>${target}/Makefile
echo 'libexecs: $(filter-out $(foreach f,$(OMIT),$f%),$(libexecs))' >>${target}/Makefile
echo 'tests: $(filter-out $(foreach f,$(OMIT),$f%),$(tests))' >>${target}/Makefile
echo 'samples: $(filter-out $(foreach f,$(OMIT),$f%),$(samples))' >>${target}/Makefile
echo 'cleans: $(filter-out $(foreach f,$(OMIT),$f%),$(cleans))' >>${target}/Makefile
for comp in $comps ;
do
if [ "`grep -c POCO_LICENSING "${POCO_BASE}/${comp}/Makefile"`" != 0 ] ; then
dependencies=$licensingDep
else
dependencies=""
fi
if [ -f "${POCO_BASE}/${comp}/dependencies" ] ; then
for dep in `cat "${POCO_BASE}/${comp}/dependencies"` ;
do
# get rid of surrounding whitespace (trailing \r on Cygwin)
read dep <<< "$dep"
dependencies="$dependencies ${dep}-libexec"
done
fi
cat >>${target}/Makefile <<ENDOFSCRIPT
${comp}-libexec: $dependencies
\$(MAKE) -C \$(POCO_BASE)/${comp}
ENDOFSCRIPT
if [ -d "${POCO_BASE}/${comp}/testsuite" ] ; then
cat >>${target}/Makefile <<ENDOFSCRIPT
${comp}-tests: ${comp}-libexec cppunit
\$(MAKE) -C \$(POCO_BASE)/${comp}/testsuite
ENDOFSCRIPT
fi
if [ -d "${POCO_BASE}/${comp}/samples" ] ; then
sdependencies=""
if [ -f "${POCO_BASE}/${comp}/samples/dependencies" ] ; then
for dep in `cat "${POCO_BASE}/${comp}/samples/dependencies"` ;
do
# get rid of surrounding whitespace (trailing \r on Cygwin)
read dep <<< ${dep}
sdependencies="$sdependencies ${dep}-libexec"
done
fi
cat >>${target}/Makefile <<ENDOFSCRIPT
${comp}-samples: ${comp}-libexec $sdependencies
\$(MAKE) -C \$(POCO_BASE)/${comp}/samples
ENDOFSCRIPT
fi
cat >>${target}/Makefile <<ENDOFSCRIPT
${comp}-clean:
\$(MAKE) -C \$(POCO_BASE)/${comp} clean
ENDOFSCRIPT
if [ -f "${POCO_BASE}/${comp}/testsuite/Makefile" ] ; then
cat >>${target}/Makefile <<ENDOFSCRIPT
\$(MAKE) -C \$(POCO_BASE)/${comp}/testsuite clean
ENDOFSCRIPT
fi
if [ -f "${POCO_BASE}/${comp}/samples/Makefile" ] ; then
cat >>${target}/Makefile <<ENDOFSCRIPT
\$(MAKE) -C \$(POCO_BASE)/${comp}/samples clean
ENDOFSCRIPT
fi
done
cat >>${target}/Makefile <<ENDOFSCRIPT
clean: cleans CppUnit-clean
distclean:
rm -rf \$(POCO_BUILD)/lib
find \$(POCO_BUILD) -name obj -type d -print0 | xargs -0 rm -rf
find \$(POCO_BUILD) -name .dep -type d -print0 | xargs -0 rm -rf
find \$(POCO_BUILD) -name bin -type d -print0 | xargs -0 rm -rf
ENDOFSCRIPT
#
# Create Visual Studio 7.1 build script
#
cat >${target}/build_vs71.cmd <<'ENDOFSCRIPT'
@echo off
if defined VS71COMNTOOLS (
call "%VS71COMNTOOLS%\vsvars32.bat")
buildwin 71 build shared both Win32 samples
ENDOFSCRIPT
#
# Create Visual Studio 8 build script
#
cat >${target}/build_vs80.cmd <<'ENDOFSCRIPT'
@echo off
if defined VS80COMNTOOLS (
call "%VS80COMNTOOLS%\vsvars32.bat")
buildwin 80 build shared both Win32 samples
ENDOFSCRIPT
#
# Create Visual Studio 9 build script
#
cat >${target}/build_vs90.cmd <<'ENDOFSCRIPT'
@echo off
if defined VS90COMNTOOLS (
call "%VS90COMNTOOLS%\vsvars32.bat")
buildwin 90 build shared both Win32 samples
ENDOFSCRIPT
#
# Create Visual Studio 10 build script
#
cat >${target}/build_vs100.cmd <<'ENDOFSCRIPT'
@echo off
if defined VS100COMNTOOLS (
call "%VS100COMNTOOLS%\vsvars32.bat")
buildwin 100 build shared both Win32 samples
ENDOFSCRIPT
#
# Create Visual Studio 9 WinCE build script
#
cat >${target}/build_CE_vs90.cmd <<'ENDOFSCRIPT'
@echo off
buildwin 90 build static_mt both WinCE samples
ENDOFSCRIPT
#
# Create Visual C++ Express 2008 build script
#
cat >${target}/build_vcexpress2008.cmd <<'ENDOFSCRIPT'
@echo off
buildwin 90 build shared both Win32 samples vcexpress
ENDOFSCRIPT
#
# Create Visual C++ Express 2010 build script
#
cat >${target}/build_vcexpress2010.cmd <<'ENDOFSCRIPT'
@echo off
buildwin 100 build shared both Win32 samples vcexpress
ENDOFSCRIPT
#
# Fix line endings
#
if [ "$lineEndConv" != "" ] ; then
$lineEndConv ${target}/build_vs71.cmd
$lineEndConv ${target}/build_vs80.cmd
$lineEndConv ${target}/build_vs90.cmd
$lineEndConv ${target}/build_vs100.cmd
$lineEndConv ${target}/build_CE_vs90.cmd
$lineEndConv ${target}/build_vcexpress2008.cmd
$lineEndConv ${target}/build_vcexpress2010.cmd
$lineEndConv ${target}/Makefile
$lineEndConv ${target}/components
fi
#
# Create .tar and .zip archives
#
if [ "$output" = "" ] ; then
cd releases
find ${target}/ -print | sed "s:^${target}/*::" >${target}/MANIFEST
tar cf poco-${version}.tar poco-${version}
gzip poco-${version}.tar
tar cf poco-${version}.tar poco-${version}
bzip2 poco-${version}.tar
if [ -x /usr/bin/zip ] ; then
/usr/bin/zip -r -q poco-${version}.zip poco-${version}
fi
fi
exit 0