summaryrefslogtreecommitdiff
path: root/download.in
blob: ed63c3076481479c349461fb05a37d23700d7a5c (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
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
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
#!/usr/bin/env perl
use Switch;
use File::Temp qw/ tempfile tempdir /;

sub download($$$$) {
    my ($remote, $destdir, $targetfile, $extract) = @_;

    my $GET_CMD='@GET_CMD@';
    # option to specify output-filename (or to use remote name)
    my $set_output = "";
    if ($targetfile) {
        if ($GET_CMD =~ /curl$/) {
            $set_output = "-o \"$targetfile\"";
        } else {
            $set_output = "-O \"$targetfile\"";
        }
    } elsif ($GET_CMD =~ /curl$/) {
        $set_output = "-O";
    }

    die "Target directory does not exist!" unless ( -d $destdir );
    my $result = system( "cd \"$destdir\" ; $GET_CMD \"$remote\" $set_output" );

    return $result if ( $extract == 0 );

    # extraction was requested
    die "requested to untar nothing!" unless ($targetfile);
    if ( $result != 0 ) {
        unlink("$destdir/$targetfile");
        return $result;
    }
    my $tarswitch = "j";
    $tarswitch = "z" if ($targetfile =~ /gz$/ );
    $result = system( "cd \"$destdir\" ; tar -x".$tarswitch."f \"$targetfile\" > /dev/null 2>&1");
    unlink($destdir."/".$targetfile);

    return $result;
}

sub webget($$$$)
{
    my ($src, $dest, $name, $is_cgit) = @_;
    my $result;

    if ( $is_cgit && $name ne '' ) {
        # it must be piece source and must be repacked
        my $ooo_sourceversion = '@OOO_SOURCEVERSION@';
        # helper tool to repack ooo piece sources from cgit
        my $ooo_pack_sources = '@TOOLSDIR@' . "/bin/ooo-pack-sources";

        print "Get $src -> $dest/libreoffice-$name-${ooo_sourceversion}.tar.bz2\n";

        # first try to get the tarball into a temporary directory
        my $tempdir = tempdir( 'libreoffice-download-XXXXXX', TMPDIR => 1, CLEANUP =>1 );

        # try to download and extract
        $result = download($src, $tempdir, "temp.tar.bz2", 1);

        # cgit is known to be broken, try plan B (download gzip variant) if bzip2 download failed
        if ( $result != 0 ) {
            my $gzip_src = $src;
            $gzip_src =~ s/\.bz2$/.gz/;

            if ( $gzip_src ne $src ) {
                print "Bad archive, go for plan B: get $gzip_src and repack\n";
                $result = download($gzip_src, $tempdir, "temp.tar.gz", 1);
            }
        }

        # pack the files to the final archive, use the ooo-pack-source helper tool
        if ( $result == 0 ) {
                # pack the files
                # FIXME: it would be more safe to use $temp_dir/$git_tag instead of $tempdir/*
                $result = system( "cd $dest; $ooo_pack_sources --set-version=$ooo_sourceversion --piece=$name $tempdir/*" );
        }
    } else {
        # normal file, easy go
        print "Get $src -> $dest/$name\n";
        $result = download($src, $dest, $name, 0);
    }

    return ( $result == 0 );
}

sub usage {
    print STDERR "\ndownload\n";
    print STDERR "Syntax:  download [--all] [--help]\n\n";
    print STDERR "  --all  downloads all the OOo source packges\n\n";
    print STDERR "download's behavior is coded by your configure options eg.\n";
    print STDERR "if you configure with --with-system-gcc it will not download\n";
    print STDERR "gcc & binutils\n";
};

sub trim($)
{
    my $string = shift;
    $string =~ s/^\s+//;
    $string =~ s/\s+$//;
    return $string;
}

sub download_external_sources() {
        system("./download_external_sources.sh")
}

sub download_tests_dependencies() {
    system('./download_tests_dependencies.sh @SRCDIR@')
}

%SRC_URLS = (
    'http:\/\/.*'                        => '',
    'binutils-.*'                        => '@MIRROR@/support',
    'gcc-.*'                             => '@MIRROR@/support',
    'libreoffice-.*-3\.2\.9.*'           => 'http://download.documentfoundation.org/libreoffice/src/',
    'libreoffice-.*-3\.3\.0.*'           => 'http://download.documentfoundation.org/libreoffice/src/',
    'beb300-m.*'                         => '@MIRROR@/BEB300',
    'dev300-m.*'                         => '@MIRROR@/DEV300',
    'ooo300-m.*'                         => '@MIRROR@/OOO300',
    'swext-dev300-m.*'                   => '@MIRROR@/DEV300',
    'src680-m.*'                         => '@MIRROR@/SRC680',
    'ooa680-m.*'                         => '@MIRROR@/OOA680',
    'oob680-m.*'                         => '@MIRROR@/OOB680',
    'ooc680-m.*'                         => '@MIRROR@/OOC680',
    'ood680-m.*'                         => '@MIRROR@/OOD680',
    'ooe680-m.*'                         => '@MIRROR@/OOE680',
    'oof680-m.*'                         => '@MIRROR@/OOF680',
    'oog680-m.*'                         => '@MIRROR@/OOG680',
    'ooh680-m.*'                         => '@MIRROR@/OOH680',
    'ooo300-m.*'                         => '@MIRROR@/OOO300',
    'ooo310-m.*'                         => '@MIRROR@/OOO310',
    'ooo680-m.*'                         => '@MIRROR@/OOO680',
    'OOO_2_0_2.*'                        => '@MIRROR@/OOB680',
    'OOO_2_0_3.*'                        => '@MIRROR@/OOC680',
    'OOO_2_0_4.*'                        => '@MIRROR@/OOD680',
    'images_gnome-.*'                    => '@MIRROR@/SRC680',
    'images_kde-.*'                      => '@MIRROR@/SRC680',
    'extras-.*'                          => '@MIRROR@/SRC680',
    'ooo_custom_images.*'                => '@MIRROR@/SRC680',
    'ooo_crystal_images.*'               => '@MIRROR@/SRC680',
    'ooo-cli-prebuilt-*'                 => '@MIRROR@/DEV300',
    'mdbtools.*'                         => '@MIRROR@/SRC680',
    'libpixman-.*'                       => '@MIRROR@/SRC680',
    'glitz-.*'                           => '@MIRROR@/SRC680',
    'biblio.*'                           => '@MIRROR@/SRC680',
# Prebuilt dictionaries for Novell Windows builds
    'writingaids.*\.zip'                 => '@MIRROR@/SRC680',

# Prebuilt extension dictionaries for OxygenOffice builds
    'extensionaids.*\.zip'               => 'http://ftp.devall.hu/kami/go-oo/',

# FIXME: Hacky packinfo from setup_native; is needed in bootstrap for the split build
    'setup_native_packinfo-.*'           => '@MIRROR@/DEV300',
# Win32 bits:
    'unicows\.exe'                       => 'http://download.microsoft.com/download/b/7/5/b75eace3-00e2-4aa0-9a6f-0b6882c71642',
    # from http://www.microsoft.com/downloads/release.asp?releaseid=30682'
    'dbghinst\.EXE'                      => 'http://download.microsoft.com/download/platformsdk/Redist/5.0.2195.1/W9XNT4/EN-US',
    'instmsia.exe'                       => 'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/W9XMe/EN-US',
    'instmsiw.exe'                       => 'http://download.microsoft.com/download/WindowsInstaller/Install/2.0/NT45/EN-US',
	'vcredist_x86.exe'                   => 'http://download.microsoft.com/download/d/d/9/dd9a82d0-52ef-40db-8dab-795376989c03',
	'vcredist_x64.exe'                   => 'http://download.microsoft.com/download/2/d/6/2d61c766-107b-409d-8fba-c39e61ca08e8',
    '5_11_98Odma20\.zip'                 => '@MIRROR@/support',
    'openclipart-.*'                     => 'http://www.openclipart.org/downloads/@OPENCLIPART_VER@',
#Update fonts:
    'dejavu-fonts-ttf-.*'                => '@MIRROR@/DEV300',
    'liberation-fonts-ttf-.*'            => '@MIRROR@/DEV300',
# Win32 ant binaries ...
    'apache-ant-.*'                      => 'http://archive.apache.org/dist/ant/binaries',
# Mozilla source and libraries
    'mozilla-source-1\.7\.5.*'           => 'http://download.go-oo.org/src/',
    'seamonkey-.*'                       => 'http://download.go-oo.org/src/',
    'glib-1\.2\..*'                      => 'http://ftp.gtk.org/pub/gtk/v1.2/',
    'libIDL-.*'                          => 'http://ftp.mozilla.org/pub/mozilla.org/mozilla/libraries/source/',
    'wintools\.zip'                      => 'http://ftp.mozilla.org/pub/mozilla.org/mozilla/source/',
# Prebuilt Mozilla bits
    'WNTMSCI.*\.zip'                     => 'http://tools.openoffice.org/moz_prebuild/OOo3.2',
# Windows .ico icons
    'ooo-windows-icons-0.2.tar.bz2'      => '@MIRROR@/OOO300',
# Updated libwpd
    '*libwpd-*'                          => '@MIRROR@/libwpd',
# MS Works importer bits
    '*libwps-*'                          => '@MIRROR@/SRC680',
# WPG importer bits
    '*libwpg-*'                          => '@MIRROR@/SRC680',
# cairo sources
    'cairo-.*'                           => 'http://cairographics.org/releases/',
# OxygenOffice extras
#    'OOOP-.*\.zip'                         => 'http://kent.dl.sf.net/sourceforge/ooop/'
    'OOOP-.*\.zip'                          => 'http://ftp.devall.hu/kami/go-oo/',
# Sun Professional Template Pack
#    'Sun_ODF_Template_Pack_en-US.oxt'         => 'http://extensions.services.openoffice.org/files/273/0/',
#    'Sun_ODF_Template_Pack_de.oxt'         => 'http://extensions.services.openoffice.org/files/295/1/',
#    'Sun_ODF_Template_Pack_it.oxt'         => 'http://extensions.services.openoffice.org/files/299/0/',
#    'Sun_ODF_Template_Pack_fr.oxt'         => 'http://extensions.services.openoffice.org/files/297/0/',
#    'Sun_ODF_Template_Pack_es.oxt'         => 'http://extensions.services.openoffice.org/files/301/1/'
#    'Sun_ODF_Template_Pack_*'         => 'http://kent.dl.sf.net/sourceforge/ooop/',

    'Sun_ODF_Template_Pack_*'            => 'ftp://ftp.devall.hu/kami/go-oo/',

# Lightproof extension
    'lightproof-*'                       => 'http://ftp.devall.hu/kami/go-oo/',

# Numbertext extension
    'numbertext-*'                       => 'http://ftp.fsf.hu/OpenOffice.org_hu/numbertext/',
# Hungarian Cross-reference toolbar extension
    'hunart-*'                           => 'http://ftp.fsf.hu/OpenOffice.org_hu/hunart/',

# Typography toolbar extension
    'typo-*'                         	 => 'http://ftp.fsf.hu/OpenOffice.org_hu/typo/',

# ConvertTextToNumber extension
    'ConvertTextToNumber-*'              => 'http://download.go-oo.org/src/',

# Watch Window extension
    'WatchWindow*'                       => 'http://ftp.devall.hu/kami/go-oo/',

# Google Docs Extension
    'gdocs*'                             => 'http://download.go-oo.org/src/',

# NLPSolver Extension
    'NLPSolver*'                	 => 'http://download.go-oo.org/src/',
    '*nlpsolver*'                	 => 'http://download.go-oo.org/src/',

# oooblogger Extension
    'oooblogger*'                	 => 'http://download.go-oo.org/src/',

# MySQL Connector/C++
    'mysql-connector-cpp.zip'            => 'http://svn.services.openoffice.org/ooo/cws/mysqlnative/mysqlcppconn/download/mysql-connector-cpp.zip',

# Multi-dimensional data structure
    'cf8a6967f7de535ae257fa411c98eb88-mdds_0.3.0.tar.bz2' => 'http://hg.services.openoffice.org/binaries/',
);


if ( '@UPSTREAM_NAME@' ne '' ) {
    $SRC_URLS{'@UPSTREAM_NAME@.*'} = '@MIRROR@/upstream-copy';
}

if ('@SPLIT@' eq '') {
    $SPLIT = 0;
} else {
    $SPLIT = 1;
}

# Files to download
@files = ();

sub source_file
{
    my $file = shift;
    my $save_as = shift;
    my $is_cgit = shift;

    die "No file?" if ( !defined $file );
    $save_as = '' if ( !defined $save_as );
    $is_cgit = 0 if ( !defined $is_cgit );

    push @files, { 'file' => "$file", 'save_as' => "$save_as", 'is_cgit' => $is_cgit };
}

sub source_file_ooo($)
{
    my ($upstream_what) = @_;
    my $what = $upstream_what;

    if (!$SPLIT) {
        if ( "$upstream_what" eq "l10n" ) {
            $what = "lang";
        } elsif ( "$upstream_what" eq "sdk" ) {
            $what = "sdk_oo";
        } elsif ( "$upstream_what" eq "libs_extern_sys" ) {
            $what = "system";
        }
    }

    if ( '@OOO_GIT@' ne "" ) {
		if ( -d "@CLONEDIR@/$what" ) {
			print "* repo already there, skipping " . '@OOO_GIT@' . "/$what (make sure to bin/g pull -r)\n";
		} else {
			if ( -d '@OOO_GIT@' . "/$what" ) {
				print "* git-new-workdir from " . '@OOO_GIT@' . "/$what\n";
				system( "cd @CLONEDIR@ ; @TOOLSDIR@/bin/git-new-workdir " . '@OOO_GIT@' . "/$what " . '@CLONEDIR@' . "/$what" ) && exit 1;
			} else {
				print "* cloning from " . '@OOO_GIT@' . "/$what\n";
				system( "cd @CLONEDIR@ ; git clone " . '@OOO_GIT@' . "/$what " ) && exit 1;
			}
		}

        system( "cd @CLONEDIR@/$what ; git status | grep '^# Your branch is'" );
        system( "for file in `cd git-hooks ; echo *`
                 do
                     cd @CLONEDIR@/$what
                     hook=\".git/hooks/\$file\"
                     if [ ! -x \"\$hook\" -a ! -L \"\$hook\" ] ; then
                         rm -f \"\$hook\"
                         ln -s \"../../../../git-hooks/\$file\" \"\$hook\"
                     fi
                 done" );
        system( "cd @CLONEDIR@/$what ; git config branch.master.rebase true; git config branch.autosetuprebase always" );
    }
    elsif ( '@SOURCE_TYPE@' eq "UPSTREAM" ) {
        die "Up-stream doesn't have a package split" if ($SPLIT);
        source_file( '@UPSTREAM_URI@' . "&lang=$upstream_what", '@UPSTREAM_NAME@' . "_$upstream_what.tar.bz2" );
    }
    elsif ( '@SOURCE_TYPE@' eq "MIRROR" ) {
        source_file( '@UPSTREAM_NAME@' . "_$upstream_what.tar.bz2" );
    }
    elsif ( '@SOURCE_TYPE@' eq "CGIT" ) {
        my $git_tag = '@OOO_SOURCEDIRNAME@';
        $git_tag =~ tr/a-z/A-Z/;
        $git_tag =~ s/-/_/g;
        $git_tag =~ s/\./_/g;

        print "Trying to get http://cgit.freedesktop.org/libreoffice/$what/snapshot/$git_tag.tar.bz2\n";
        source_file( "http://cgit.freedesktop.org/libreoffice/$what/snapshot/$git_tag.tar.bz2", $what, 1);
    }
    else {
        source_file( "libreoffice-$what-" . '@OOO_SOURCEVERSION@' . ".tar.bz2" );
    }
}

sub download_files($$$)
{
    my ($files, $locations, $dest) = @_;

    my @try = @{$files};
    my $try_num = 10;

    do {
        my @failed;
        for my $record ( @try ) {
            my $file = $record->{'file'};
            my $save_as = $record->{'save_as'};
            my $is_cgit = $record->{'is_cgit'};

            if ( $file ne '' ) {
                my $to_check;
                if ( $save_as ne '' ) {
                    if ($is_cgit) {
                        # it must be libreoffice piece source; $save_as include just a file name
                        $to_check = "$dest/libreoffice-$save_as-" . '@OOO_SOURCEVERSION@' . ".tar.bz2";
                    } else {
                        # $save_as provides full file name
                        $to_check = "$dest/$save_as";
                        }
                    } else {
                        $to_check = "$dest/$file";
                    }

                if ( -f "$to_check" ) {
                    print "Skipping $file\n";
                } elsif ( defined $ENV{'DOWNLOADCACHE'} &&
                    -f "$ENV{'DOWNLOADCACHE'}/$file" ) {
                    print "Using cached $file\n";
                    system ("cp $ENV{'DOWNLOADCACHE'}/$file $to_check");
                } else {
                    print "No file $to_check\n";
                    my $location = 'NOT_FOUND';
                    for $regexp (keys %{$locations}) {
                        if ($file =~ m/^$regexp/) {
                            $location = $locations->{$regexp};
                            last;
                        }
                    }

                    my $to_get = $location."/$file";
                    $location eq 'NOT_FOUND' && die "Can't find '$file' to download";
                    if ( $location eq '' ) {
                        $to_get = $file;
                    }

                    if ( !webget( $to_get, $dest, $save_as, $is_cgit ) ) {
                        print "Failed to get '$to_get', will retry later.\n";
                        unlink $to_check;
                        push @failed, $record;
                    }
                }
            }
        }
        @try = @failed;
        --$try_num;
    } while ( $#try >= 0 && $try_num > 0 );

    die "Fetch failed" if ( $try_num == 0 && $#try >= 0 );
}

if (!-d "@SRCDIR@") {
    `mkdir -p @SRCDIR@`;
}
if ( !-d "@CLONEDIR@" ) {
    `mkdir -p @CLONEDIR@`;
}

my $download_all = 0;

while ($arg = shift @ARGV) {
    if ( $arg eq '--help' ) {
        &usage and exit(0);
    }
    elsif ( $arg eq '--all' ) {
        $download_all = 1;
    }
}

# Defaults
print "Downloading files for @OOO_SOURCEDIRNAME@\n";

if ('@SYSTEM_GCC@' eq '') {
    source_file( 'gcc-4.2.3.tar.bz2' );
    source_file( 'binutils-2.18.tar.bz2' );
}

if (!$SPLIT && ($download_all || '@BUILD_WIN32@' ne ''))
{
    source_file_ooo( "system" );
}

if ($download_all && '@BUILD_WIN32@' eq '')
{
    source_file( '@BUILD_MOZILLA_SOURCE@' );
}

my %requires_ant = (
    LibreOfficeLinux      => 1,
    LibreOfficeLinuxDevel => 1,
    LibreOfficeWin32      => 1,
    LibreOfficeMacOSX     => 1,
);
if ('@BUILD_WIN32@' || $requires_ant{@DISTRO@})
{
    source_file( '@APACHE_ANT_TARBALL@' );
}

# Misc. bits for Win32
if ('@BUILD_WIN32@' ne '')
{
    source_file( 'unicows.exe' ) unless '@DISTRO@' =~ m/NovellWin32|GoOoWin32/;
    source_file( 'dbghinst.EXE' );
    source_file( 'instmsiw.exe' );
    source_file( 'instmsia.exe' ) unless '@DISTRO@' =~ m/NovellWin32|GoOoWin32/;
    # instmsiw.exe can't be downloaded without Genuine Windows validation

    source_file( 'vcredist_x86.exe' );
    source_file( 'vcredist_x64.exe' );

# Comment out the Mozilla source bits until we can compile it
# with MSVS2008
    #source_file( '@BUILD_MOZILLA_SOURCE@' );
    #source_file( 'glib-1.2.10.tar.gz' );
    #source_file( 'libIDL-0.6.8.tar.gz' );
# this contains binaries and source, we just use the source
    #source_file( 'wintools.zip' );

    # Icons
    source_file( 'ooo-windows-icons-0.2.tar.bz2' ) if '@DISTRO@' =~ m/NovellWin32|GoOoWin32/;

# We must use the prebuilt Mozilla bits as the compiler to use (MSVS2008) does not compile
# Mozilla 1.7.5 as used here without love that hasn't been applied yet
    source_file( 'WNTMSCIinc.zip' );
    source_file( 'WNTMSCIlib.zip' );
    source_file( 'WNTMSCIruntime.zip' );
}
else
{
    if ('@ENABLE_MONO@' ne 'FALSE') {
        source_file( 'ooo-cli-prebuilt-3.3.tar.bz2' );
    }
    if ( $download_all ) {
        source_file( '@APACHE_ANT_TARBALL@' );
    }
}

# Prebuilt dictionaries
source_file( 'writingaids-@PREBUILT_WRITINGAIDS_TIMESTAMP@.zip' ) if '@DISTRO@' =~ m/NovellWin32|GoOoWin32/;
source_file( 'writingaids-doc-@PREBUILT_WRITINGAIDS_TIMESTAMP@.zip' ) if '@DISTRO@' =~ m/NovellWin32|GoOoWin32/;

source_file( 'extensionaids-@PREBUILT_EXTENSIONAIDS_TIMESTAMP@.zip' ) if '@DISTRO@' =~ m/OxygenOfficeLinux|OxygenOfficeWindows/;

if ('@CAIRO_ENABLED@' eq 'TRUE' && '@SYSTEM_CAIRO@' ne 'TRUE') {
    source_file( 'cairo-@CAIRO_VER@.tar.gz' );
}

if ('@OPENCLIPART_VER@' ne '') {
    source_file( 'openclipart-@OPENCLIPART_VER@.tar.bz2' );
}

if ('@DEJAVU_FONTS_VER@' ne '') {
    source_file( '@DEJAVU_FONTS_PACK_NAME@.zip' );
}

if ('@LIBERATION_FONTS_VER@' ne '') {
    source_file( 'liberation-fonts-ttf-@LIBERATION_FONTS_VER@.zip' );
}

if ('@MDBTOOLS_SRC@' ne '') {
    source_file( '@MDBTOOLS_SRC@' );
}

if ($SPLIT) {
    source_file_ooo( "artwork" );
    source_file_ooo( "base" );
    source_file_ooo( "bootstrap" );
    source_file_ooo( "calc" );
    source_file_ooo( "components" );
    source_file_ooo( "extras" );
    source_file_ooo( "filters" );
    source_file_ooo( "help" );
    source_file_ooo( "impress" );
    source_file_ooo( "libs-gui" );
    source_file_ooo( "libs-core" );
    source_file_ooo( "libs-extern" );
    source_file_ooo( "postprocess" );
    source_file_ooo( "sdk" );
    source_file_ooo( "testing" );
    source_file_ooo( "ure" );
    source_file_ooo( "writer" );
# for now ...
    source_file_ooo( "libs-extern-sys" );
} else {
    source_file_ooo( "core" );
}

if ('@ENABLE_EXTENSIONS@' eq 'YES') {
    source_file_ooo( "extensions" );
}

source_file( '@OOO_CUSTOM_IMAGES@') if '@OOO_CUSTOM_IMAGES@';
source_file( '@OOO_EXTRA_ARTWORK@' ) if '@OOO_EXTRA_ARTWORK@';
# Temporary utf-8ization of bibliograpy bits
source_file( "biblio.tar.bz2" );

if (!$SPLIT && ($download_all || '@ENABLE_BINFILTER@' eq 'TRUE')) {
    source_file_ooo( "binfilter" );
}

if ( $download_all || ( '@OOO_LANGS@' ne '' && '@OOO_LANGS@' ne 'en-US' ) || '@BUILD_WIN32@' ne '' ) {
    source_file_ooo( "l10n" );
}

if ('@PIECE@' eq 'bootstrap') {
   source_file( 'setup_native_packinfo-ooo320-m17.tar.bz2' );
}

if ('@SYSTEM_LIBWPD@' eq 'NO') {
   source_file( '@LIBWPD_TARBALL@' );
}

if ('@SYSTEM_LIBWPS@' eq 'NO') {
   source_file( '@LIBWPS_TARBALL@' );
}

if ('@SYSTEM_LIBWPG@' eq 'NO') {
   source_file( '@LIBWPG_TARBALL@' );
}

if ('@OOOP_FONTS_PACK@' ne '') {
    source_file( '@OOOP_FONTS_PACK@' );
}

if ('@OOOP_GALLERY_PACK@' ne '') {
    source_file( '@OOOP_GALLERY_PACK@' );
}

if ('@OOOP_SAMPLES_PACK@' ne '') {
    source_file( '@OOOP_SAMPLES_PACK@' );
}

if ('@OOOP_TEMPLATES_PACK@' ne '') {
    source_file( '@OOOP_TEMPLATES_PACK@' );
}

$lightprooffilenames = trim('@LIGHTPROOF_FILENAMES@');
@lightprooffile = split (/ /, $lightprooffilenames);
foreach (@lightprooffile) {
            source_file( $_ );
}


if ('@NUMBERTEXT_EXTENSION@' ne '') {
    source_file( '@NUMBERTEXT_EXTENSION@' );
}

if ('@HUNART_EXTENSION@' ne '') {
    source_file( '@HUNART_EXTENSION@' );
}

if ('@TYPO_EXTENSION@' ne '') {
    source_file( '@TYPO_EXTENSION@' );
}

if ('@CT2N_EXTENSION@' ne '') {
    source_file( '@CT2N_EXTENSION@' );
}

if ('@WATCH_WINDOW_EXTENSION@' ne '') {
    source_file( '@WATCH_WINDOW_EXTENSION@' );
}

if ('@GOOGLE_DOCS_EXTENSION@' ne '') {
    source_file( '@GOOGLE_DOCS_EXTENSION@' );
}

if ('@NLPSOLVER_EXTENSION@' ne '') {
    source_file( '@NLPSOLVER_EXTENSION@' );
}

if ('@OOOBLOGGER_EXTENSION@' ne '') {
    source_file( '@OOOBLOGGER_EXTENSION@' );
}

$suntemplang = trim('@SUNTEMPLATES_LANG@');
@templang = split (/ /, $suntemplang);
foreach (@templang) {
    source_file( 'Sun_ODF_Template_Pack_' . $_ . '.oxt');
}

my $distro = '@DISTRO@';
if ($distro eq 'ArchLinux' ||
    $distro eq 'Ark' ||
    $distro eq 'DroplineGNOME' ||
    $distro eq 'Frugalware' || $distro eq 'Frugalware64' ||
    $distro eq 'Gentoo.conf' ||
    $distro eq 'openmamba' ||
    $distro eq 'SUSE-9.1' || $distro eq 'SUSE-9.2' || $distro eq 'SUSE-9.3' ||
    $distro eq 'Slackware' ||
    $distro eq 'NovellWin32' || $distro eq 'GoOoWin32' ||
    $distro eq 'OxygenOfficeLinux' || $distro eq 'OxygenOfficeWindows' ||
    $distro eq 'translate-org-za-linux' || $distro eq 'translate-org-za-win32' || $distro eq 'Pardus') {
    source_file_ooo( "libs_extern_sys" ) if !$SPLIT;
}

if ($download_all ||
    $distro =~ m/Debian/ ||
    $distro =~ m/Ubuntu/ ||
    $distro =~ m/Frugalware/ ||
    $distro eq 'OxygenOfficeLinux' || $distro eq 'OxygenOfficeWindows' ||
    '@BUILD_WIN32@' ne '') {
    source_file_ooo( "sdk" );
}

# Test Dependencies
if ('@TESTS@' eq 'YES') {
    download_tests_dependencies();
}

download_files (\@files, \%SRC_URLS, '@SRCDIR@');

download_external_sources();

open (FILELIST, ">download.list");
foreach $entry (@files) {
    print FILELIST $entry->{file}."\n" if ( $entry->{file} );
}
close FILELIST;

print "Done\n";
# vim: set ts=4 sw=4 expandtab :