summaryrefslogtreecommitdiff
path: root/bin/unpack
blob: f06be460174e37e194d20da6c2fe7ae169fb1f8a (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
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
#!/bin/sh

#
# See setup for user tweakables.
#
. ./setup

check_tarball()
{
    echo -n "Looking for $1 ... ";
    if test ! -f $1; then
	echo "missing the $1 archive; run './download'"
	exit 1;
    else
	echo "ok"
    fi
}

check_file()
{
    echo -n "Looking for $1 ... ";
    if test ! -f $1; then
	echo "missing required archive; run ./download'";
	exit 1;
    else
	echo "ok"
    fi
}

mkdir -p $SRCDIR
cd $SRCDIR

echo "Checking for source packages in $SRCDIR";
if test "z$SYSTEM_GCC" = "z"; then
    check_tarball $GCC_TARBALL
    if test "z$BINUTILS_TARBALL" != "z"; then
	check_tarball $BINUTILS_TARBALL
    fi
fi
check_tarball $OOO_TARBALL

mkdir -p $BUILDDIR
cd $BUILDDIR

if test "z$BUILD_WIN32" != "z"; then
    check_file $UNICOWS_SRC
    check_file $DBGINST_SRC
#    check_file $ODMA_SRC
    check_file $SRCDIR/$BUILD_MOZILLA_SOURCE
    check_file $SRCDIR/glib-1.2.10.tar.gz
    check_file $SRCDIR/glib-1.2.10-ooo.patch
    check_file $SRCDIR/libIDL-0.6.8.tar.gz
    check_file $SRCDIR/libIDL-0.6.8-ooo.patch
    check_file $SRCDIR/wintools.zip
fi

if test "z$SYSTEM_GCC" = "z"; then
    # unpack binutils
    cd $BUILDDIR
    echo "Unpacking compiler bits"

    if test "z$BINUTILS_TARBALL" != "z"; then
	tar $BINUTILS_UNTAR_OPTIONS $SRCDIR/$BINUTILS_TARBALL || exit 1;
	patch -p0 < $BINUTILS_PATCH || exit 1;
    fi
    tar $GCC_UNTAR_OPTIONS $SRCDIR/$GCC_TARBALL || exit 1;
    for P in $GCC_PATCHES ; do
	patch -d "$GCC_VER" -p1 -s < "$SRCDIR/$P"
    done
fi

echo "Unpacking OO.o build tree - [ go make some tea ] ..."
echo "Unpacking $OOO_TARBALL..."
tar $OOO_UNTAR_OPTIONS $SRCDIR/$OOO_TARBALL || exit 1

# -system source
if test -f $SRCDIR/$OOO_SYSTEM_TARBALL; then
    # System is optional, but parts of it are useful
    echo "Unpacking $OOO_SYSTEM_TARBALL..."
    tar $OOO_UNTAR_OPTIONS $SRCDIR/$OOO_SYSTEM_TARBALL
fi
# -binfilter source
if test -f $SRCDIR/$OOO_BINFILTER_TARBALL; then
   echo "Unpacking $OOO_BINFILTER_TARBALL..."
   tar $OOO_UNTAR_OPTIONS $SRCDIR/$OOO_BINFILTER_TARBALL
fi
# -lang source
if test -f $SRCDIR/$OOO_LANG_TARBALL; then
   echo "Unpacking $OOO_LANG_TARBALL..."
    tar $OOO_UNTAR_OPTIONS $SRCDIR/$OOO_LANG_TARBALL
fi
# -sdk_oo source
if test -f $SRCDIR/$OOO_SDK_OO_TARBALL; then
   echo "Unpacking $OOO_SDK_OO_TARBALL"
    tar $OOO_UNTAR_OPTIONS $SRCDIR/$OOO_SDK_OO_TARBALL
fi

if test "$ENABLE_CCACHE" = "yes" ; then
    if test "$BUILDDIR/$CVSTAG" != "$OOBUILDDIR" ; then
        mv "$BUILDDIR/$CVSTAG" "$OOBUILDDIR"
    fi
    echo "$CVSTAG" > "$OOBUILDDIR/.tag"
fi

echo "Fixing unfortunate snafus"
INDUSTRIAL_DIR=$OOBUILDDIR/ooo_custom_images/industrial/res/commandimagelist
# more unfortunate bits i#65746
cp -a $INDUSTRIAL_DIR/lc_basicshapes.diamond.png $INDUSTRIAL_DIR/lc_basicshapes.png 
cp -a $INDUSTRIAL_DIR/sc_basicshapes.diamond.png $INDUSTRIAL_DIR/sc_basicshapes.png 
cd $BUILDDIR

# Work around component-schema.dtd mess in m142 up to m151; seems to be fixed in m152
if test -e "$OOBUILDDIR/officecfg/registry/component-schema.dtd"; then
    cp $OOBUILDDIR/officecfg/registry/component-schema.dtd $OOBUILDDIR/officecfg/registry/schema
fi

# copy in unowinreg.dll if we need to
# it is necessary in ODK
# it can be built even on linux by mingw32, though
if test "$USE_PREBUILD_UNOWINREG_DLL" = "YES" ; then
    cp -f $SRCDIR/unowinreg.dll $OOBUILDDIR/external/unowinreg/ || exit 1;
fi

# copy in misc Mono related dlls if we need to
# we can't build them on Unix.
CLI_TYPES=cli_types.dll
if test -f "$SRCDIR/$CLI_TYPES"; then
    mkdir -p $OOBUILDDIR/external/cli
    cp -af $SRCDIR/$CLI_TYPES $SRCDIR/cli_types_bridgetest.dll $OOBUILDDIR/external/cli
fi

# copy oowintool into the tree
if test -f $OOBUILDDIR/config_office/oowintool; then
    :
else
    cp -af $TOOLSDIR/bin/oowintool $OOBUILDDIR/config_office
    chmod a+x $OOBUILDDIR/config_office/oowintool
fi

# Win32 prerequisites ...
if test "z$BUILD_WIN32" != "z"; then
# FIXME: add check for system bits ...

    # ODMA
	echo "ODMA disabled for now."
#    cd $BUILDDIR;
#    DEST=$OOBUILDDIR/ucb/source/ucp/odma
#    if test ! -f $DEST/ODMA.H; then
#	echo -n "Extracting ODMA SDK "
#	unzip -o $ODMA_SRC
#	TARGET=Odma20.exe
#	if test ! -f $TARGET; then
#	    echo "failed";
#	    exit 1;
#	fi
#	mkdir -p $DEST
#	cd $DEST
#	unzip -o $BUILDDIR/$TARGET
#	echo "done";
#    else
#	echo "Already have ODMA SDK";
#    fi

    # dbghelp
    cd $BUILDDIR;
    if test ! -f $OOBUILDDIR/external/dbghelp/DbgHelp.Dll; then
	echo -n "Extracting dbghelp "
	cabextract -q $DBGINST_SRC
	TARGET=dbghelp.exe
	if test ! -f $TARGET; then
	    echo "failed";
	    exit 1;
	fi
	unzip -o $TARGET
	mv -f License.Txt dbghelp-license.txt
	mv -f redist.txt dbghelp-redist.txt
	echo "done";
    else
	echo "Already have dbghelp";
    fi
    
    # unicows
    cd $BUILDDIR;
    if test ! -f $OOBUILDDIR/external/unicows/unicows.dll; then
	echo -n "Extracting unicows "
	cabextract -q $UNICOWS_SRC
	TARGET=unicows.dll
	if test ! -f $TARGET; then
	    echo "failed";
	    exit 1;
	fi
	mv -f license.txt unicows-license.txt
	mv -f redist.txt unicows-redist.txt
	echo "done";
    else
	echo "Already have unicows";
    fi

    cd $BUILDDIR;
    APACHE_ANT='apache-ant-1.6.5'
    APACHE_ANT_TARBALL=$APACHE_ANT-bin.tar.gz
    if test -f $TOOLSDIR/src/$APACHE_ANT_TARBALL; then
	echo -n "Extracting ant "
	tar xzf $TOOLSDIR/src/$APACHE_ANT_TARBALL || exit 1;
	echo "done";
    else
	echo "Don't need to unpack ant";
    fi

    cd $BUILDDIR;
    if test -f $TOOLSDIR/src/$BUILD_MOZILLA_SOURCE;  then
        echo -n "Installing mozilla source "
	cp -f $TOOLSDIR/src/$BUILD_MOZILLA_SOURCE $OOBUILDDIR/moz/download || exit 1;
	echo "done";
    else
	echo "Don't need to unpack mozilla source";
    fi
    MOZILLA_IDL_SRC='libIDL-0.6.8.tar.gz'
    MOZILLA_IDL_PATCH='libIDL-0.6.8-ooo.patch'
    MOZILLA_GLIB_SRC='glib-1.2.10.tar.gz'
    MOZILLA_GLIB_PATCH='glib-1.2.10-ooo.patch'
    MOZILLA_WINTOOLS_BIN='wintools.zip'
    if test -f $TOOLSDIR/src/$MOZILLA_IDL_SRC; then
        echo -n "Installing mozilla IDL source "
	cp -f $TOOLSDIR/src/$MOZILLA_IDL_SRC $OOBUILDDIR/moz/download || exit 1;
	cp -f $TOOLSDIR/src/$MOZILLA_IDL_PATCH $OOBUILDDIR/moz/download || exit 1;
	echo "done";
    else
	echo "Don't need to unpack mozilla IDL source";
    fi
    if test -f $TOOLSDIR/src/$MOZILLA_GLIB_SRC; then
        echo -n "Installing mozilla glib source "
	cp -f $TOOLSDIR/src/$MOZILLA_GLIB_SRC $OOBUILDDIR/moz/download || exit 1;
	cp -f $TOOLSDIR/src/$MOZILLA_GLIB_PATCH $OOBUILDDIR/moz/download || exit 1;
	echo "done";
    else
	echo "Don't need to unpack mozilla glib source";
    fi
    if test -f $TOOLSDIR/src/$MOZILLA_WINTOOLS_BIN; then
        echo -n "Installing mozilla wintools "
	cp -f $TOOLSDIR/src/$MOZILLA_WINTOOLS_BIN $OOBUILDDIR/moz/download || exit 1;
	echo "done";
    else
	echo "Already have mozilla wintools";
    fi

    if test -f $TOOLSDIR/src/$AGFA_MONOTYPE_FONTS_SOURCE; then
        if test ! -f $OOBUILDDIR/agfa_monotype_fonts/download/$AGFA_MONOTYPE_FONTS_SOURCE; then
	    echo -n "Installing Agfa Monotype fonts "
	    mkdir -p $OOBUILDDIR/agfa_monotype_fonts/download
	    cp -f $TOOLSDIR/src/$AGFA_MONOTYPE_FONTS_SOURCE $OOBUILDDIR/agfa_monotype_fonts/download || exit 1
	    echo "done"
	else
            echo "Already have Agfa Monotype fonts"
        fi
	if grep 'Agfa Monotype' $OOBUILDDIR/readlicense_oo/html/THIRDPARTYLICENSEREADME.html; then
	  echo "THIRDPARTYLICENSEREADME.html already contains Agfa Monotype EULA"
	else
	  echo "Adding Agfa Monotype EULA to THIRDPARTYLICENSEREADME.html"
	  $TOOLSDIR/bin/amt-license-patch <$OOBUILDDIR/readlicense_oo/html/THIRDPARTYLICENSEREADME.html >/tmp/amt.$$ &&
	  mv /tmp/amt.$$ $OOBUILDDIR/readlicense_oo/html/THIRDPARTYLICENSEREADME.html
	fi
    fi

    if test "x$DEJAVU_FONTS_VER" != "x"; then
        DEJAVU_FONTSDEST=$OOBUILDDIR/dejavufonts/download
        DEJAVU_FONTSSRC=dejavu-ttf-$DEJAVU_FONTS_VER.tar.gz
        if test ! -f $DEJAVU_FONTSDEST/$DEJAVU_FONTSSRC; then
            echo "Installing DejaVu fonts"
            mkdir -p $DEJAVU_FONTSDEST || exit 1;
            cp -f $SRCDIR/$DEJAVU_FONTSSRC $DEJAVU_FONTSDEST || exit 1;
            echo "done"
        else
            echo "Already have DejaVu fonts"
        fi
    fi
fi

if test "z$SYSTEM_GCC" = "z"; then
    if test ! -d "$BUILDDIR/$GCC_VER" ||
	test ! -d "$BUILDDIR/$BINUTILS_VER"; then
        echo "Missing some of the helper source";
        exit 1;
    fi
    
fi

# Construct bits that should be in the up-stream tar.bz2
cd $OOBUILDDIR
CUSTOM_DIR=$OOBUILDDIR/ooo_custom_images

if test "x$OOO_EXTRA_ARTWORK" != "x"; then
# Html export rulers etc.
    cd $OOBUILDDIR
    tar xjf $SRCDIR/$OOO_EXTRA_ARTWORK || exit 1;
fi

if test "x$OPENCLIPART_VER" != "x"; then
    echo "Unpacking open clipart"
    check_tarball $SRCDIR/openclipart-$OPENCLIPART_VER.tar.bz2
    cd $BUILDDIR
    tar xjf $SRCDIR/openclipart-$OPENCLIPART_VER.tar.bz2 || exit 1;
fi

if test "x$MDBTOOLS_SRC" != "x" -a "z$SYSTEM_MDBTOOLS" != "YES"; then
    echo "Copying mdbtools into the tree"
    MDBDEST=$OOBUILDDIR/mdbtools/download
    mkdir -p $MDBDEST || exit 1;
    cp -a $SRCDIR/$MDBTOOLS_SRC $MDBDEST || exit 1;
fi

XT_ZIP=xt-20051206-src-only.zip
check_tarball $SRCDIR/$XT_ZIP
echo "Copying $XT_ZIP into the tree"
mkdir -p $OOBUILDDIR/xt/download || exit 1
cp $SRCDIR/$XT_ZIP $OOBUILDDIR/xt/download/ || exit 1

if test "x$GRAPHITE_SRC" != "x"; then
    echo "Copying graphite into the tree"
    GRAPHITE_DEST=$OOBUILDDIR/graphite/download
    mkdir -p $GRAPHITE_DEST || exit 1;
    cp -a $SRCDIR/$GRAPHITE_SRC $GRAPHITE_DEST || exit 1;
fi

echo "Copying default evolution database into tree"
cp -af $TOOLSDIR/src/evolocal.odb $OOBUILDDIR/extras/source/database || exit 1;

echo "Installing bibliography overwrides";
tar xjf $SRCDIR/biblio.tar.bz2 -C $OOBUILDDIR/extras/source/database

echo "Copying custom user-dicts into tree"
cp -af $TOOLSDIR/src/*.dic $OOBUILDDIR/extras/source/wordbook || exit 1;

if test "$CAIRO_ENABLED" = "TRUE" -a "$SYSTEM_CAIRO" != "TRUE"; then

    if test "z$BUILD_WIN32" = "z"; then
         echo "Copying glitz into tree"
	mkdir -p $OOBUILDDIR/glitz
	check_tarball $SRCDIR/glitz-${GLITZ_VER}.tar.gz
	mkdir -p $OOBUILDDIR/glitz/download
	cp -a $SRCDIR/glitz-${GLITZ_VER}.tar.gz $OOBUILDDIR/glitz/download/
    fi

    echo "Copying cairo into tree"
    mkdir -p $OOBUILDDIR/cairo
    check_tarball $SRCDIR/cairo-${CAIRO_VER}.tar.gz
    mkdir -p $OOBUILDDIR/cairo/download
    cp -a $SRCDIR/cairo-${CAIRO_VER}.tar.gz $OOBUILDDIR/cairo/download/
fi

if test "x$HUNSPELL_UNO_SRC" != "x"; then
    echo "Unpacking hunspell UNO sources"
    tar -xzf $SRCDIR/$HUNSPELL_UNO_SRC -C $OOBUILDDIR || exit 1;
fi

if test "x$HUNSPELL_LIB_SRC" != "x"; then
    echo "Copying hunspell library sources into the tree"
    mkdir -p $OOBUILDDIR/libhunspell/download || exit 1;
    cp -a $SRCDIR/$HUNSPELL_LIB_SRC $OOBUILDDIR/libhunspell/download || exit 1;
fi

LPSOLVE_PACKAGE=lp_solve_5.5.tar.gz
check_tarball $SRCDIR/$LPSOLVE_PACKAGE
echo "Copying lp_solve package into the tree"
mkdir -p $OOBUILDDIR/lpsolve/download || exit 1
cp -a $SRCDIR/$LPSOLVE_PACKAGE $OOBUILDDIR/lpsolve/download/ || exit 1

# add license-fixed rhino
if test "$VENDORNAME" = "Debian"; then
	if echo $CVSTAG | grep -q ood680 && test "`echo $CVSTAG | cut -d'-' -f2`" = "m1"; then
		cp $SRCDIR/rhino1_5R4.patch $OOBUILDDIR/rhino || exit 1
	fi
fi