3 # This script has three uses:
4 # 1. From the command line to install straight into a given directory:
5 # bin/ooinstall /opt/Foo
6 # 2. From the command line to link into a given directory:
7 # bin/ooinstall -l /opt/FooLinked
8 # 3. When packaging (called from package-ooo), to install to DESTDIR
11 use File
::Path
qw(mkpath);
20 # FIXME: really we should hunt and parse / source the config_host.mk magic I guess.
21 die "You need your environment setup right, eg. run make cmd cmd='ooinstall /path/to/install'" if (!defined $ENV{SRC_ROOT
});
23 if ($ENV{GUI
} eq 'WNT') {
27 if( defined($ENV{TMPDIR
}) ) {
28 $tmp_dir = $ENV{TMPDIR
};
29 } elsif( defined($ENV{TMP
}) ) {
34 if (!-d
$tmp_dir) {die "Set TMP or TMPDIR!\n";}
36 # Workaround for system Mozilla
37 if ( $ENV{'SYSTEM_MOZILLA'} eq 'YES' ) {
38 $ENV{'LD_LIBRARY_PATH'} = "$ENV{'MOZ_LIB'}:$ENV{'LD_LIBRARY_PATH'}";
41 # Workaround for the Python
42 $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";
45 if ($arg eq '-l' || $arg eq '--link') {
47 } elsif ($arg eq '-s' || $arg eq '--strip') {
49 } elsif ($arg eq '-h' || $arg eq '--help') {
52 # Cwd::realpath does not work if the path does not exist
53 mkpath
($ENV{DESTDIR
} . $arg) unless -d
$ENV{DESTDIR
} . $arg;
54 $path = Cwd
::realpath
( $ENV{DESTDIR
} . $arg );
58 $help = 1 if $path eq '';
61 print "ooinstall [-l] [-s] <prefix to install to>\n";
62 print " -l/--link - performs a linkoo on the installed source\n";
63 print " -s/--strip - strip the installed binaries\n";
69 open MINORMK
, "$ENV{'SOLARENV'}/inc/minor.mk";
72 if(/^BUILD/ || /^LAST_MINOR/) {
77 $ENV{LAST_MINOR
} = $LAST_MINOR;
78 $ENV{OUT
} = "../$ENV{'INPATH'}";
79 $ENV{LOCAL_OUT
} = $ENV{OUT
};
80 $ENV{LOCAL_COMMON_OUT
} = $ENV{OUT
};
81 # FIXME: the following variable helps to install localizations even if some
82 # files are not localized (like Japanese, Chinese wordbook), it makes
83 # the installer to use the English localization of the file instead.
84 $ENV{DEFAULT_TO_ENGLISH_FOR_PACKING
} = 1;
87 $langs=$ENV{WITH_LANG
};
88 $langs='en-US' if $langs eq '';
89 if ($langs eq 'ALL') {
90 opendir(DIR
,$ENV{L10N_MODULE
} . "/source");
92 @larr = grep { $_ ne '.' } @larr;
93 @larr = grep { $_ ne '..' } @larr;
94 @larr = (@larr,"en-US","qtz");
98 @larr = grep { $_ ne '' } split(/ /, $langs);
100 $langs = join (",", @larr);
103 if ( defined $ENV{DESTDIR
} &&
104 $ENV{DESTDIR
} ne "" ) {
105 $destdir = "-destdir \"$ENV{DESTDIR}\"";
110 $msi = "-msitemplate $ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/misc/openoffice/msi_templates " .
111 "-msilanguage $ENV{SRC_ROOT}/instsetoo_native/$ENV{INPATH}/misc/win_ulffiles";
114 # FIXME: a better solution would be to fix installer to deal with broken symlinks
115 # make distro-pack-install shufle with the SDK installation to make it LSB compliant
116 # it creates symlinks from the orignal path to /usr/share; they are not valid with $DESTDIR
117 # and potential second ooinstall call fails with strange error messages if the old tree is still there
118 if ($destdir && "$ENV{DESTDIR}" ne "/" && -d
"$ENV{DESTDIR}") {
119 print "Cleaning destdir...\n";
120 system ("rm -rf \"$ENV{DESTDIR}\"") && die "Failed to clean up destdir: $!";
123 print "Running LibreOffice installer\n";
124 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
125 "perl -w $ENV{SOLARENV}/bin/make_installer.pl " .
126 "-f openoffice.lst -l $langs -p LibreOffice " .
128 "-buildid $BUILD $destdir $strip $msi " .
129 "-simple $path") && die "Failed to install: $!";
131 if ($ENV{BUILD_TYPE
} =~ m/ODK/) {
132 print "Running SDK installer\n";
133 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
134 "perl -w $ENV{SOLARENV}/bin/make_installer.pl " .
135 "-f openoffice.lst -l en-US -p LibreOffice_SDK " .
137 "-buildid $BUILD $destdir $strip $msi " .
138 "-simple $path") && die "Failed to install: $!";
140 print "Installer finished\n";
142 if ($do_link && !$is_windows) {
143 system("$ENV{SOLARENV}/bin/linkoo $path $ENV{SRC_ROOT}") &&
144 die "linkoo failed: $!";