blob: b7a5d941886a33a73207bb409894d3ac92b6c855 (
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
|
#!/usr/bin/env perl
# This script has three uses:
# 1. From the command line to install straight into a given directory:
# bin/ooinstall /opt/Foo
# 2. From the command line to link into a given directory:
# bin/ooinstall -l /opt/FooLinked
# 3. When packaging (called from package-ooo), to install to DESTDIR
use File::Find;
use File::Path qw(mkpath);
use Cwd;
$path = '';
$do_link = 0;
$is_windows = 0;
my $tmp_dir;
die "You need to source Env.Host.sh first " if (!defined $ENV{SRC_ROOT});
if ($ENV{GUI} eq 'WNT') {
$is_windows = 1;
}
if( defined($ENV{TMPDIR}) ) {
$tmp_dir = $ENV{TMPDIR};
} elsif( defined($ENV{TMP}) ) {
$tmp_dir = $ENV{TMP};
} else {
$tmp_dir = '/tmp';
}
if (!-d $tmp_dir) {die "Set TMP or TMPDIR!\n";}
# Workaround for system Mozilla
if ( $ENV{'SYSTEM_MOZILLA'} eq 'YES' ) {
$ENV{'LD_LIBRARY_PATH'} = "$ENV{'MOZ_LIB'}:$ENV{'LD_LIBRARY_PATH'}";
}
# Workaround for the Python
$ENV{'PYTHONPATH'} = "$ENV{'SRC_ROOT'}/instsetoo_native/$ENV{'INPATH'}/bin:$ENV{'SOLARVERSION'}/$ENV{'INPATH'}/lib:$ENV{'SOLARVERSION'}/$ENV{'INPATH'}/lib/python:$ENV{'SOLARVERSION'}/$ENV{'INPATH'}/lib/python/lib-dynload";
for $arg (@ARGV) {
if ($arg eq '-l') {
$do_link = 1;
} elsif ($arg eq '-h' || $arg eq '--help') {
$help = 1;
} else {
# Cwd::realpath does not work if the path does not exist
mkpath($ENV{DESTDIR} . $arg) unless -d $ENV{DESTDIR} . $arg;
$path = Cwd::realpath( $ENV{DESTDIR} . $arg );
}
}
$help = 1 if $path eq '';
if ($help) {
print "ooinstall [-l] <prefix to install to>\n";
print " -l - performs a linkoo on the installed source\n";
exit 1;
}
my $BUILD=undef;
my $LAST_MINOR=undef;
open MINORMK, "$ENV{'SOLARENV'}/inc/minor.mk";
while (<MINORMK>) {
my $t = "\$" . $_;
if(/^BUILD/ || /^LAST_MINOR/) {
eval $t;
}
}
close MINORMK;
$ENV{LAST_MINOR} = $LAST_MINOR;
$ENV{OUT} = "../$ENV{'INPATH'}";
$ENV{LOCAL_OUT} = $ENV{OUT};
$ENV{LOCAL_COMMON_OUT} = $ENV{OUT};
# FIXME: the following variable helps to install localizations even if some
# files are not localized (like Japanese, Chinese wordbook), it makes
# the installer to use the English localization of the file instead.
$ENV{DEFAULT_TO_ENGLISH_FOR_PACKING} = 1;
my @larr;
$langs=$ENV{WITH_LANG};
$langs='en-US' if $langs eq '';
if ($langs eq 'ALL') {
opendir(DIR,$ENV{L10N_MODULE} . "/source");
@larr = readdir(DIR);
@larr = grep { $_ ne '.' } @larr;
@larr = grep { $_ ne '..' } @larr;
@larr = (@larr,"en-US","qtz");
closedir(DIR);
}
else {
@larr = grep { $_ ne '' } split(/ /, $langs);
}
$langs = join (",", @larr);
$destdir='';
if ( defined $ENV{DESTDIR} &&
$ENV{DESTDIR} ne "" ) {
$destdir = "-destdir \"$ENV{DESTDIR}\"";
}
$strip='';
if ( defined $ENV{DISABLE_STRIP} &&
$ENV{DISABLE_STRIP} eq "TRUE" ) {
$strip = "-dontstrip";
}
$msi='';
if ($is_windows) {
$msi = "-msitemplate $ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/misc/openoffice/msi_templates " .
"-msilanguage $ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/misc/win_ulffiles";
}
# FIXME: a better solution would be to fix installer to deal with broken symlinks
# make distro-pack-install shufle with the SDK installation to make it LSB compliant
# it creates symlinks from the orignal path to /usr/share; they are not valid with $DESTDIR
# and potential second ooinstall call fails with strange error messages if the old tree is still there
if ($destdir && "$ENV{DESTDIR}" ne "/" && -d "$ENV{DESTDIR}") {
print "Cleaning destdir...\n";
system ("rm -rf \"$ENV{DESTDIR}\"") && die "Failed to clean up destdir: $!";
}
print "Running LibreOffice installer\n";
system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
"perl -w $ENV{SOLARENV}/bin/make_installer.pl " .
"-f openoffice.lst -l $langs -p LibreOffice " .
"-u $tmp_dir " .
"-buildid $BUILD $destdir $strip $msi " .
"-simple $path") && die "Failed to install: $!";
if ($ENV{BUILD_TYPE} =~ m/ODK/) {
print "Running SDK installer\n";
system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
"perl -w $ENV{SOLARENV}/bin/make_installer.pl " .
"-f openoffice.lst -l en-US -p LibreOffice_SDK " .
"-u $tmp_dir " .
"-buildid $BUILD $destdir $strip $msi" .
"-simple $path") && die "Failed to install: $!";
}
print "Installer finished\n";
if ($do_link && !$is_windows) {
system("$ENV{SOLARENV}/bin/linkoo $path $ENV{SRC_ROOT}") &&
die "linkoo failed: $!";
}
|