office-gobmx/solenv/bin/ooinstall
Fridrich Štrba c7157dd841 Change the paths to ones that exist
Change-Id: I60de04bba401632b01f0da7b772a91a98de5ff07
2013-06-13 14:56:33 +02:00

133 lines
4.4 KiB
Perl
Executable file

#!/usr/bin/env perl
#
# This file is part of the LibreOffice project.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# 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 = '';
$strip = '';
$do_link = 0;
$is_windows = 0;
my $tmp_dir;
# FIXME: really we should hunt and parse / source the config_host.mk magic I guess.
die "You need your environment setup right, eg. run make cmd cmd='ooinstall /path/to/install'" if (!defined $ENV{SRC_ROOT});
if ($ENV{OS} eq 'WNT') {
$is_windows = 1;
}
if (defined($ENV{TMPDIR})) {
$tmp_dir = $ENV{TMPDIR};
}
if (!-d $tmp_dir) {die "Set 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' || $arg eq '--link') {
$do_link = 1;
} elsif ($arg eq '-s' || $arg eq '--strip') {
$strip = "-strip";
} 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] [-s] <prefix to install to>\n";
print " -l/--link - performs a linkoo on the installed source\n";
print " -s/--strip - strip the installed binaries\n";
exit 1;
}
my $BUILD=$ENV{LIBO_VERSION_PATCH};
$ENV{LAST_MINOR} = 'm0';
$ENV{OUT} = "../$ENV{'INPATH'}";
$ENV{LOCAL_OUT} = $ENV{OUT};
$ENV{LOCAL_COMMON_OUT} = $ENV{OUT};
my @larr;
$langs=$ENV{WITH_LANG_LIST};
@larr = grep { $_ ne '' } split(/ /, $langs);
$langs = join (",", @larr);
$destdir='';
if (defined $ENV{DESTDIR} &&
$ENV{DESTDIR} ne "" ) {
$destdir = "-destdir \"$ENV{DESTDIR}\"";
}
$msi='';
if ($is_windows) {
$msi = "-msitemplate $ENV{SRC_ROOT}/workdir/$ENV{INPATH}/CustomTarget/instsetoo_native/install/msi_templates " .
"-msilanguage $ENV{SRC_ROOT}/workdir/$ENV{INPATH}/CustomTarget/instsetoo_native/install/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 " .
(scalar keys(%DB::sub) ? "-d " : "") .
"-w $ENV{SOLARENV}/bin/make_installer.pl " .
"-f $ENV{BUILDDIR}/instsetoo_native/util/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 $ENV{BUILDDIR}/instsetoo_native/util/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{BUILDDIR}") &&
die "linkoo failed: $!";
}
# Local Variables:
# cperl-indent-level: 4
# indent-tabs-mode: nil
# End:
# vim:set shiftwidth=4 softtabstop=4 expandtab: