bump product version to 5.0.4.1
[LibreOffice.git] / solenv / bin / ooinstall
blobcf4d3db240530294301542d5e29a7bbb9be9d97a
1 #!/usr/bin/env perl
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
17 use File::Find;
18 use File::Path qw(mkpath);
19 use Cwd;
21 $path = '';
22 $strip = '';
23 $is_windows = 0;
24 my $tmp_dir;
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') {
30 $is_windows = 1;
33 if (defined($ENV{TMPDIR})) {
34 $tmp_dir = $ENV{TMPDIR};
36 if (!-d $tmp_dir) {die "Set TMPDIR!\n";}
38 # Workaround for system Mozilla
39 if ($ENV{'SYSTEM_MOZILLA'} eq 'YES') {
40 $ENV{'LD_LIBRARY_PATH'} = "$ENV{'MOZ_LIB'}:$ENV{'LD_LIBRARY_PATH'}";
43 for $arg (@ARGV) {
44 if ($arg eq '-s' || $arg eq '--strip') {
45 $strip = "-strip";
46 } elsif ($arg eq '-h' || $arg eq '--help') {
47 $help = 1;
48 } else {
49 # Cwd::realpath does not work if the path does not exist
50 mkpath($ENV{DESTDIR} . $arg) unless -d $ENV{DESTDIR} . $arg;
51 $path = Cwd::realpath($ENV{DESTDIR} . $arg);
55 $help = 1 if $path eq '';
57 if ($help) {
58 print "ooinstall [-s] <prefix to install to>\n";
59 print " -s/--strip - strip the installed binaries\n";
60 exit 1;
63 my $BUILD=$ENV{LIBO_VERSION_PATCH};
64 $ENV{LAST_MINOR} = 'm0';
65 $ENV{OUT} = "../FIXME";
66 $ENV{LOCAL_OUT} = $ENV{OUT};
67 $ENV{LOCAL_COMMON_OUT} = $ENV{OUT};
69 my @larr;
70 $langs=$ENV{WITH_LANG_LIST};
71 @larr = grep { $_ ne '' } split(/ /, $langs);
72 $langs = join (",", @larr);
74 $destdir='';
75 if (defined $ENV{DESTDIR} &&
76 $ENV{DESTDIR} ne "" ) {
77 $destdir = "-destdir \"$ENV{DESTDIR}\"";
80 $msi='';
81 if ($is_windows) {
82 $msi = "-msitemplate $ENV{SRC_ROOT}/workdir/CustomTarget/instsetoo_native/install/msi_templates " .
83 "-msilanguage $ENV{SRC_ROOT}/workdir/CustomTarget/instsetoo_native/install/win_ulffiles";
86 # FIXME: a better solution would be to fix installer to deal with broken symlinks
87 # make distro-pack-install shufle with the SDK installation to make it LSB compliant
88 # it creates symlinks from the orignal path to /usr/share; they are not valid with $DESTDIR
89 # and potential second ooinstall call fails with strange error messages if the old tree is still there
90 if ($destdir && "$ENV{DESTDIR}" ne "/" && -d "$ENV{DESTDIR}") {
91 print "Cleaning destdir...\n";
92 system ("rm -rf \"$ENV{DESTDIR}\"") && die "Failed to clean up destdir: $!";
95 print "Running LibreOffice installer\n";
97 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
98 "perl " .
99 (scalar keys(%DB::sub) ? "-d " : "") .
100 "-w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
101 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l $langs -p LibreOffice" . ($ENV{ENABLE_RELEASE_BUILD} ? "" : "_Dev") . " " .
102 "-u $tmp_dir " .
103 "-buildid $BUILD $destdir $strip $msi " .
104 "-simple $path") && die "Failed to install: $!";
106 if ($ENV{BUILD_TYPE} =~ m/ODK/) {
107 print "Running SDK installer\n";
108 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
109 "perl -w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
110 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l en-US -p LibreOffice_SDK " .
111 "-u $tmp_dir " .
112 "-buildid $BUILD $destdir $strip $msi " .
113 "-simple $path") && die "Failed to install: $!";
115 print "Installer finished\n";
117 # Local Variables:
118 # cperl-indent-level: 4
119 # indent-tabs-mode: nil
120 # End:
121 # vim:set shiftwidth=4 softtabstop=4 expandtab: