3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # This script has three uses:
11 # 1. From the command line to install straight into a given directory:
12 # bin/ooinstall /opt/Foo
13 # 2. From the command line to link into a given directory:
14 # bin/ooinstall -l /opt/FooLinked
15 # 3. When packaging (called from package-ooo), to install to DESTDIR
18 use File
::Path
qw(mkpath);
26 # FIXME: really we should hunt and parse / source the config_host.mk magic I guess.
27 die "You need your environment setup right, eg. run make cmd cmd='ooinstall /path/to/install'" if (!defined $ENV{SRC_ROOT
});
29 if ($ENV{OS
} eq 'WNT') {
33 if (defined($ENV{TMPDIR
})) {
34 $tmp_dir = $ENV{TMPDIR
};
36 if (!-d
$tmp_dir) {die "Set TMPDIR!\n";}
39 if ($arg eq '-s' || $arg eq '--strip') {
41 } elsif ($arg eq '-h' || $arg eq '--help') {
44 # Cwd::realpath does not work if the path does not exist
45 mkpath
($ENV{DESTDIR
} . $arg) unless -d
$ENV{DESTDIR
} . $arg;
46 $path = Cwd
::realpath
($ENV{DESTDIR
} . $arg);
50 $help = 1 if $path eq '';
53 print "ooinstall [-s] <prefix to install to>\n";
54 print " -s/--strip - strip the installed binaries\n";
58 my $BUILD=$ENV{LIBO_VERSION_PATCH
};
59 $ENV{OUT
} = "../FIXME";
60 $ENV{LOCAL_OUT
} = $ENV{OUT
};
61 $ENV{LOCAL_COMMON_OUT
} = $ENV{OUT
};
64 $langs=$ENV{WITH_LANG_LIST
};
65 @larr = grep { $_ ne '' } split(/ /, $langs);
66 $langs = join (",", @larr);
69 if (defined $ENV{DESTDIR
} &&
70 $ENV{DESTDIR
} ne "" ) {
71 $destdir = "-destdir \"$ENV{DESTDIR}\"";
76 $msi = "-msitemplate $ENV{SRC_ROOT}/workdir/CustomTarget/instsetoo_native/install/msi_templates " .
77 "-msilanguage $ENV{SRC_ROOT}/workdir/CustomTarget/instsetoo_native/install/win_ulffiles";
80 # FIXME: a better solution would be to fix installer to deal with broken symlinks
81 # make distro-pack-install shuffle with the SDK installation to make it LSB compliant
82 # it creates symlinks from the original path to /usr/share; they are not valid with $DESTDIR
83 # and potential second ooinstall call fails with strange error messages if the old tree is still there
84 if ($destdir && "$ENV{DESTDIR}" ne "/" && -d
"$ENV{DESTDIR}") {
85 print "Cleaning destdir...\n";
86 system ("rm -rf \"$ENV{DESTDIR}\"") && die "Failed to clean up destdir: $!";
89 print "Running LibreOffice installer\n";
91 my $PRODUCTNAME_no_spaces = $ENV{PRODUCTNAME
};
92 $PRODUCTNAME_no_spaces =~ s/ //g;
94 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
96 (scalar keys(%DB::sub) ?
"-d " : "") .
97 "-w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
98 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l $langs -p $PRODUCTNAME_no_spaces " .
100 "-buildid $BUILD $destdir $strip $msi " .
101 "-simple $path") && die "Failed to install: $!";
103 if ($ENV{BUILD_TYPE
} =~ m/ODK/) {
104 print "Running SDK installer\n";
105 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
106 "perl -w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
107 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l en-US -p LibreOffice_SDK " .
109 "-buildid $BUILD $destdir $strip $msi " .
110 "-simple $path") && die "Failed to install: $!";
112 print "Installer finished\n";
115 # cperl-indent-level: 4
116 # indent-tabs-mode: nil
118 # vim:set shiftwidth=4 softtabstop=4 expandtab: