Don't search for old (<= 2.0) .NET SDK anymore
[LibreOffice.git] / solenv / bin / ooinstall
blobaca6b01ae11dec5e36f1c551335cedee702f87c2
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 for $arg (@ARGV) {
39 if ($arg eq '-s' || $arg eq '--strip') {
40 $strip = "-strip";
41 } elsif ($arg eq '-h' || $arg eq '--help') {
42 $help = 1;
43 } else {
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 '';
52 if ($help) {
53 print "ooinstall [-s] <prefix to install to>\n";
54 print " -s/--strip - strip the installed binaries\n";
55 exit 1;
58 my $BUILD=$ENV{LIBO_VERSION_PATCH};
59 $ENV{OUT} = "../FIXME";
60 $ENV{LOCAL_OUT} = $ENV{OUT};
61 $ENV{LOCAL_COMMON_OUT} = $ENV{OUT};
63 my @larr;
64 $langs=$ENV{WITH_LANG_LIST};
65 @larr = grep { $_ ne '' } split(/ /, $langs);
66 $langs = join (",", @larr);
68 $destdir='';
69 if (defined $ENV{DESTDIR} &&
70 $ENV{DESTDIR} ne "" ) {
71 $destdir = "-destdir \"$ENV{DESTDIR}\"";
74 $msi='';
75 if ($is_windows) {
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 shufle 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 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
92 "perl " .
93 (scalar keys(%DB::sub) ? "-d " : "") .
94 "-w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
95 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l $langs -p LibreOffice " .
96 "-u $tmp_dir " .
97 "-buildid $BUILD $destdir $strip $msi " .
98 "-simple $path") && die "Failed to install: $!";
100 if ($ENV{BUILD_TYPE} =~ m/ODK/) {
101 print "Running SDK installer\n";
102 system ("cd $ENV{SRC_ROOT}/instsetoo_native/util ; " .
103 "perl -w $ENV{SRCDIR}/solenv/bin/make_installer.pl " .
104 "-f $ENV{BUILDDIR}/instsetoo_native/util/openoffice.lst -l en-US -p LibreOffice_SDK " .
105 "-u $tmp_dir " .
106 "-buildid $BUILD $destdir $strip $msi " .
107 "-simple $path") && die "Failed to install: $!";
109 print "Installer finished\n";
111 # Local Variables:
112 # cperl-indent-level: 4
113 # indent-tabs-mode: nil
114 # End:
115 # vim:set shiftwidth=4 softtabstop=4 expandtab: