xref: /aoo4110/main/solenv/bin/linkoo (revision b1cdbd2c)
1*b1cdbd2cSJim Jagielski:
2*b1cdbd2cSJim Jagielski    eval 'exec perl -S $0 ${1+"$@"}'
3*b1cdbd2cSJim Jagielski        if 0;
4*b1cdbd2cSJim Jagielski
5*b1cdbd2cSJim Jagielski#**************************************************************
6*b1cdbd2cSJim Jagielski#
7*b1cdbd2cSJim Jagielski#  Licensed to the Apache Software Foundation (ASF) under one
8*b1cdbd2cSJim Jagielski#  or more contributor license agreements.  See the NOTICE file
9*b1cdbd2cSJim Jagielski#  distributed with this work for additional information
10*b1cdbd2cSJim Jagielski#  regarding copyright ownership.  The ASF licenses this file
11*b1cdbd2cSJim Jagielski#  to you under the Apache License, Version 2.0 (the
12*b1cdbd2cSJim Jagielski#  "License"); you may not use this file except in compliance
13*b1cdbd2cSJim Jagielski#  with the License.  You may obtain a copy of the License at
14*b1cdbd2cSJim Jagielski#
15*b1cdbd2cSJim Jagielski#    http://www.apache.org/licenses/LICENSE-2.0
16*b1cdbd2cSJim Jagielski#
17*b1cdbd2cSJim Jagielski#  Unless required by applicable law or agreed to in writing,
18*b1cdbd2cSJim Jagielski#  software distributed under the License is distributed on an
19*b1cdbd2cSJim Jagielski#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
20*b1cdbd2cSJim Jagielski#  KIND, either express or implied.  See the License for the
21*b1cdbd2cSJim Jagielski#  specific language governing permissions and limitations
22*b1cdbd2cSJim Jagielski#  under the License.
23*b1cdbd2cSJim Jagielski#
24*b1cdbd2cSJim Jagielski#**************************************************************
25*b1cdbd2cSJim Jagielski#
26*b1cdbd2cSJim Jagielski#    This app makes it easy to link a live build
27*b1cdbd2cSJim Jagielski# set into an install set. Then your devel iteration
28*b1cdbd2cSJim Jagielski# is: 'build', execute.
29*b1cdbd2cSJim Jagielski#
30*b1cdbd2cSJim Jagielski#*************************************************************************
31*b1cdbd2cSJim Jagielski
32*b1cdbd2cSJim Jagielski# ends up in program/ooenv
33*b1cdbd2cSJim Jagielski( $moz_lib = `pkg-config --variable=libdir mozilla-nss` ) =~ tr/\n/:/;
34*b1cdbd2cSJim Jagielski$env_script = '
35*b1cdbd2cSJim Jagielskijava_path=`./javaldx`
36*b1cdbd2cSJim Jagielskiexport LD_LIBRARY_PATH=".:$java_path:' . $moz_lib . '$LD_LIBRARY_PATH"
37*b1cdbd2cSJim Jagielskiulimit -c unlimited
38*b1cdbd2cSJim Jagielskiexport PATH=".:$PATH"
39*b1cdbd2cSJim Jagielskiexport GNOME_DISABLE_CRASH_DIALOG=1
40*b1cdbd2cSJim Jagielskiexport STAR_RESOURCEPATH=`pwd`/resource
41*b1cdbd2cSJim Jagielski# debugging assistance
42*b1cdbd2cSJim Jagielskiexport OOO_FORCE_SYSALLOC=1
43*b1cdbd2cSJim Jagielskiexport MALLOC_CHECK_=2
44*b1cdbd2cSJim Jagielskiexport OOO_DISABLE_RECOVERY=1
45*b1cdbd2cSJim Jagielski';
46*b1cdbd2cSJim Jagielski
47*b1cdbd2cSJim Jagielski$program_dir = 'program';
48*b1cdbd2cSJim Jagielski$program_dir = 'MacOS' if ($ENV{OS} eq 'MACOSX');
49*b1cdbd2cSJim Jagielski
50*b1cdbd2cSJim Jagielskimy @exceptions = ( 'cppuhelper', 'sunjavaplugin', 'libjvmfwk' );
51*b1cdbd2cSJim Jagielski
52*b1cdbd2cSJim Jagielski%replaceable = (
53*b1cdbd2cSJim Jagielski	$program_dir => '\.so',
54*b1cdbd2cSJim Jagielski    $program_dir . '/resource' => '\.res$',
55*b1cdbd2cSJim Jagielski    $program_dir . '/classes' => '\.jar$',
56*b1cdbd2cSJim Jagielski    'share/config' => '\.zip$',
57*b1cdbd2cSJim Jagielski#    'share/uno_packages' => '\.zip$'
58*b1cdbd2cSJim Jagielski);
59*b1cdbd2cSJim Jagielski
60*b1cdbd2cSJim Jagielski# strangely enough, OSX has those small differences...
61*b1cdbd2cSJim Jagielski$replaceable{$program_dir} = '\.dylib$' if ($ENV{OS} eq 'MACOSX');
62*b1cdbd2cSJim Jagielski
63*b1cdbd2cSJim Jagielski@search_dirs = ( 'lib', 'bin', 'class' );
64*b1cdbd2cSJim Jagielski
65*b1cdbd2cSJim Jagielski@known_duplicates = ( 'db.jar', 'libi18n' );
66*b1cdbd2cSJim Jagielski
67*b1cdbd2cSJim Jagielskisub sniff_target($)
68*b1cdbd2cSJim Jagielski{
69*b1cdbd2cSJim Jagielski    my $build_dir = shift;
70*b1cdbd2cSJim Jagielski    my ($dirhandle, $fname);
71*b1cdbd2cSJim Jagielski    my ($target, $libver, $lang) = ( 'unxlngi4.pro', '680', 'en-US' ); # defaults
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski    opendir ($dirhandle, $build_dir) || die "Can't open $build_dir";
74*b1cdbd2cSJim Jagielski    while ($fname = readdir ($dirhandle)) {
75*b1cdbd2cSJim Jagielski	$fname =~ /Set.sh$/ || next;
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski	my $file;
78*b1cdbd2cSJim Jagielski	open ($file, "$build_dir/$fname") || die "Can't open $build_dir/$fname";
79*b1cdbd2cSJim Jagielski	while (<$file>) {
80*b1cdbd2cSJim Jagielski	    /\s*(\S+)\s*=\s*\"(\S+)\"/ || next;
81*b1cdbd2cSJim Jagielski	    if ($1 eq 'INPATH') {
82*b1cdbd2cSJim Jagielski		$target = $2;
83*b1cdbd2cSJim Jagielski	    }
84*b1cdbd2cSJim Jagielski	    if ($1 eq 'UPD') {
85*b1cdbd2cSJim Jagielski		$libver = $2;
86*b1cdbd2cSJim Jagielski	    }
87*b1cdbd2cSJim Jagielski	}
88*b1cdbd2cSJim Jagielski	close ($file);
89*b1cdbd2cSJim Jagielski    }
90*b1cdbd2cSJim Jagielski
91*b1cdbd2cSJim Jagielski    closedir ($dirhandle);
92*b1cdbd2cSJim Jagielski
93*b1cdbd2cSJim Jagielski    print "Sniffed target: $target, $libver\n";
94*b1cdbd2cSJim Jagielski
95*b1cdbd2cSJim Jagielski    return ($target, $libver, $lang);
96*b1cdbd2cSJim Jagielski}
97*b1cdbd2cSJim Jagielski
98*b1cdbd2cSJim Jagielskisub build_installed_list($)
99*b1cdbd2cSJim Jagielski{
100*b1cdbd2cSJim Jagielski    my $path = shift;
101*b1cdbd2cSJim Jagielski    my %files = ();
102*b1cdbd2cSJim Jagielski
103*b1cdbd2cSJim Jagielski    for my $suffix (keys %replaceable) {
104*b1cdbd2cSJim Jagielski	my $dirname = "$path/$suffix";
105*b1cdbd2cSJim Jagielski	my $dirhandle;
106*b1cdbd2cSJim Jagielski	my $pattern = $replaceable{$suffix};
107*b1cdbd2cSJim Jagielski	if (opendir ($dirhandle, $dirname)) {
108*b1cdbd2cSJim Jagielski	    while (my $fname = readdir ($dirhandle)) {
109*b1cdbd2cSJim Jagielski		$fname =~ m/$pattern/ || next;
110*b1cdbd2cSJim Jagielski
111*b1cdbd2cSJim Jagielski		my $skip = 0;
112*b1cdbd2cSJim Jagielski		for $pattern (@exceptions) {
113*b1cdbd2cSJim Jagielski		    $fname =~ /$pattern/ || next;
114*b1cdbd2cSJim Jagielski		    $skip = 1;
115*b1cdbd2cSJim Jagielski		}
116*b1cdbd2cSJim Jagielski		$files{$fname} = $dirname if !$skip;
117*b1cdbd2cSJim Jagielski	    }
118*b1cdbd2cSJim Jagielski	    closedir ($dirhandle);
119*b1cdbd2cSJim Jagielski	} else {
120*b1cdbd2cSJim Jagielski	    print "Couldn't find '$dirname': skipping\n";
121*b1cdbd2cSJim Jagielski	}
122*b1cdbd2cSJim Jagielski    }
123*b1cdbd2cSJim Jagielski    return \%files;
124*b1cdbd2cSJim Jagielski}
125*b1cdbd2cSJim Jagielski
126*b1cdbd2cSJim Jagielskisub check_create_linked($)
127*b1cdbd2cSJim Jagielski{
128*b1cdbd2cSJim Jagielski    my $path = shift;
129*b1cdbd2cSJim Jagielski    my $linked_dir = "$path/linked";
130*b1cdbd2cSJim Jagielski    if (! -d $linked_dir) {
131*b1cdbd2cSJim Jagielski	mkdir $linked_dir || die "Can't make $linked_dir: $!";
132*b1cdbd2cSJim Jagielski    }
133*b1cdbd2cSJim Jagielski}
134*b1cdbd2cSJim Jagielski
135*b1cdbd2cSJim Jagielskisub do_link($$$$@)
136*b1cdbd2cSJim Jagielski{
137*b1cdbd2cSJim Jagielski    my $src = shift;
138*b1cdbd2cSJim Jagielski    my $dest = shift;
139*b1cdbd2cSJim Jagielski    my $src_name = shift;
140*b1cdbd2cSJim Jagielski    my $dest_name = shift;
141*b1cdbd2cSJim Jagielski    my $dont_check_link = shift;
142*b1cdbd2cSJim Jagielski
143*b1cdbd2cSJim Jagielski    if (-l "$dest/$dest_name" ) {
144*b1cdbd2cSJim Jagielski	my $link = readlink ("$dest/$dest_name");
145*b1cdbd2cSJim Jagielski	if ($link =~ /^\//) { # Absolute path
146*b1cdbd2cSJim Jagielski	    if (!$dry_run) {
147*b1cdbd2cSJim Jagielski		# re-write the link
148*b1cdbd2cSJim Jagielski		unlink ("$dest/$dest_name");
149*b1cdbd2cSJim Jagielski		symlink ("$src/$src_name", "$dest/$dest_name") || die "Failed to symlink: $!";
150*b1cdbd2cSJim Jagielski		print " [$dest_name]";
151*b1cdbd2cSJim Jagielski	    } else {
152*b1cdbd2cSJim Jagielski		print "re-make link $src/$src_name => $dest/$dest_name\n";
153*b1cdbd2cSJim Jagielski	    }
154*b1cdbd2cSJim Jagielski	} elsif ($dry_run) {
155*b1cdbd2cSJim Jagielski	    print "skipping symbolic link $dest/$dest_name -> $link\n";
156*b1cdbd2cSJim Jagielski	}
157*b1cdbd2cSJim Jagielski    } else {
158*b1cdbd2cSJim Jagielski	check_create_linked ($dest);
159*b1cdbd2cSJim Jagielski	if (!$dry_run) {
160*b1cdbd2cSJim Jagielski	    # move / write the link
161*b1cdbd2cSJim Jagielski	    rename ("$dest/$dest_name", "$dest/linked/$dest_name") ||
162*b1cdbd2cSJim Jagielski		defined $dont_check_link || die "Failed rename of $dest/$dest_name: $!";
163*b1cdbd2cSJim Jagielski
164*b1cdbd2cSJim Jagielski	    symlink ("$src/$src_name", "$dest/$dest_name") || die "Failed to symlink: $!";
165*b1cdbd2cSJim Jagielski	    print " $dest_name";
166*b1cdbd2cSJim Jagielski	} else {
167*b1cdbd2cSJim Jagielski	    print "move / symlink $src/$src_name => $dest/$dest_name\n";
168*b1cdbd2cSJim Jagielski	}
169*b1cdbd2cSJim Jagielski    }
170*b1cdbd2cSJim Jagielski}
171*b1cdbd2cSJim Jagielski
172*b1cdbd2cSJim Jagielskisub scan_and_link_files($$$)
173*b1cdbd2cSJim Jagielski{
174*b1cdbd2cSJim Jagielski    my $build_path = shift;
175*b1cdbd2cSJim Jagielski    my $installed_files = shift;
176*b1cdbd2cSJim Jagielski    my $target = shift;
177*b1cdbd2cSJim Jagielski
178*b1cdbd2cSJim Jagielski    my @modules = ();
179*b1cdbd2cSJim Jagielski    my $dirh_toplevel;
180*b1cdbd2cSJim Jagielski    opendir ($dirh_toplevel, $build_path) || die "Can't open '$build_path': $!";
181*b1cdbd2cSJim Jagielski    while (my $subdir = readdir ($dirh_toplevel)) {
182*b1cdbd2cSJim Jagielski	$subdir =~ m/\./ && next; # eg. vcl.old,
183*b1cdbd2cSJim Jagielski	my $test = "$build_path/$subdir/$target";
184*b1cdbd2cSJim Jagielski	-d $test || next;
185*b1cdbd2cSJim Jagielski	push @modules, $test;
186*b1cdbd2cSJim Jagielski    }
187*b1cdbd2cSJim Jagielski    closedir ($dirh_toplevel);
188*b1cdbd2cSJim Jagielski
189*b1cdbd2cSJim Jagielski# FIXME: re-implement the $product functionality
190*b1cdbd2cSJim Jagielski    my $module;
191*b1cdbd2cSJim Jagielski    my %build_files;
192*b1cdbd2cSJim Jagielski    for $module (@modules) {
193*b1cdbd2cSJim Jagielski	for $elem (@search_dirs) {
194*b1cdbd2cSJim Jagielski	    my $dirh_module;
195*b1cdbd2cSJim Jagielski	    my $module_path = "$module/$elem";
196*b1cdbd2cSJim Jagielski	    if (opendir ($dirh_module, $module_path)) {
197*b1cdbd2cSJim Jagielski			while (my $file = readdir($dirh_module)) {
198*b1cdbd2cSJim Jagielski				if (defined $installed_files->{$file}) {
199*b1cdbd2cSJim Jagielski					if (defined $build_files{$file}) {
200*b1cdbd2cSJim Jagielski						my $known = 0;
201*b1cdbd2cSJim Jagielski						for my $regexp (@known_duplicates) {
202*b1cdbd2cSJim Jagielski							if ($file =~ m/$regexp/) {
203*b1cdbd2cSJim Jagielski								$known = 1;
204*b1cdbd2cSJim Jagielski							}
205*b1cdbd2cSJim Jagielski						}
206*b1cdbd2cSJim Jagielski						if (!$known) {
207*b1cdbd2cSJim Jagielski							print "Unknown duplicate file '$file' in: '" .
208*b1cdbd2cSJim Jagielski							$build_files{$file} . "' vs '" .
209*b1cdbd2cSJim Jagielski							$module_path . "' in module $module\n";
210*b1cdbd2cSJim Jagielski							exit (1);
211*b1cdbd2cSJim Jagielski						}
212*b1cdbd2cSJim Jagielski					}
213*b1cdbd2cSJim Jagielski					$build_files{$file} = $module_path;
214*b1cdbd2cSJim Jagielski				}
215*b1cdbd2cSJim Jagielski			}
216*b1cdbd2cSJim Jagielski		}
217*b1cdbd2cSJim Jagielski	    closedir ($dirh_module);
218*b1cdbd2cSJim Jagielski	}
219*b1cdbd2cSJim Jagielski    }
220*b1cdbd2cSJim Jagielski
221*b1cdbd2cSJim Jagielski    for my $file (keys %build_files) {
222*b1cdbd2cSJim Jagielski	my $src = $build_files{$file};
223*b1cdbd2cSJim Jagielski	my $dest = $installed_files->{$file};
224*b1cdbd2cSJim Jagielski
225*b1cdbd2cSJim Jagielski	do_link ($src, $dest, $file, $file);
226*b1cdbd2cSJim Jagielski    }
227*b1cdbd2cSJim Jagielski    print "\n";
228*b1cdbd2cSJim Jagielski}
229*b1cdbd2cSJim Jagielski
230*b1cdbd2cSJim Jagielskisub evilness($)
231*b1cdbd2cSJim Jagielski{
232*b1cdbd2cSJim Jagielski    my $doit = shift;
233*b1cdbd2cSJim Jagielski    my $name = 'librecentfile.so';
234*b1cdbd2cSJim Jagielski    my $src  = "$OOO_BUILD/shell/$TARGET/lib/$name";
235*b1cdbd2cSJim Jagielski    my $dest = "$OOO_BUILD/sfx2/$TARGET/lib/$name";
236*b1cdbd2cSJim Jagielski
237*b1cdbd2cSJim Jagielski    if ($doit eq 'undo') {
238*b1cdbd2cSJim Jagielski	if (-l $dest) {
239*b1cdbd2cSJim Jagielski	    print " unlink $name\n";
240*b1cdbd2cSJim Jagielski	    unlink $dest;
241*b1cdbd2cSJim Jagielski	}
242*b1cdbd2cSJim Jagielski    } else {
243*b1cdbd2cSJim Jagielski	$doit eq 'do' || die;
244*b1cdbd2cSJim Jagielski        if (-f $src) {
245*b1cdbd2cSJim Jagielski	    print " link $name\n";
246*b1cdbd2cSJim Jagielski	    symlink $src, $dest;
247*b1cdbd2cSJim Jagielski	}
248*b1cdbd2cSJim Jagielski    }
249*b1cdbd2cSJim Jagielski}
250*b1cdbd2cSJim Jagielski
251*b1cdbd2cSJim Jagielskisub link_iso_res()
252*b1cdbd2cSJim Jagielski{
253*b1cdbd2cSJim Jagielski    print "Special iso.res case: ";
254*b1cdbd2cSJim Jagielski    my $ooo_res="$OOO_INSTALL/" . $program_dir . "/resource/ooo".$LIBVER.$LANG.".res";
255*b1cdbd2cSJim Jagielski    my $star_res="$OOO_INSTALL/" . $program_dir . "/resource/iso".$LIBVER.$LANG.".res";
256*b1cdbd2cSJim Jagielski    if (-l $ooo_res && -l $star_res) {
257*b1cdbd2cSJim Jagielski	if ($dry_run) {
258*b1cdbd2cSJim Jagielski	    print "link $ooo_res to $star_res";
259*b1cdbd2cSJim Jagielski	} else {
260*b1cdbd2cSJim Jagielski	    unlink ($star_res);
261*b1cdbd2cSJim Jagielski	    symlink ($ooo_res, $star_res);
262*b1cdbd2cSJim Jagielski	    print "clobbered";
263*b1cdbd2cSJim Jagielski	}
264*b1cdbd2cSJim Jagielski    }
265*b1cdbd2cSJim Jagielski    print "\n";
266*b1cdbd2cSJim Jagielski}
267*b1cdbd2cSJim Jagielski
268*b1cdbd2cSJim Jagielski# Hack for (renamed) types.rdb (types.db)
269*b1cdbd2cSJim Jagielskisub link_types_rdb()
270*b1cdbd2cSJim Jagielski{
271*b1cdbd2cSJim Jagielski    print "Types.rdb case:";
272*b1cdbd2cSJim Jagielski    my $src  = "$OOO_BUILD/offapi/$TARGET/ucr";
273*b1cdbd2cSJim Jagielski    my $dest = "$OOO_INSTALL/" . $program_dir;
274*b1cdbd2cSJim Jagielski    do_link ($src, $dest, 'types.db', 'types.rdb');
275*b1cdbd2cSJim Jagielski    print "\n";
276*b1cdbd2cSJim Jagielski}
277*b1cdbd2cSJim Jagielski
278*b1cdbd2cSJim Jagielski# link installed files back into src tree:
279*b1cdbd2cSJim Jagielskisub link_soffice_bin_files()
280*b1cdbd2cSJim Jagielski{
281*b1cdbd2cSJim Jagielski    my $dest;
282*b1cdbd2cSJim Jagielski    my $src = "$OOO_INSTALL/" . $program_dir;
283*b1cdbd2cSJim Jagielski
284*b1cdbd2cSJim Jagielski    print "soffice files";
285*b1cdbd2cSJim Jagielski    $dest = "$OOO_BUILD/desktop/$TARGET/bin";
286*b1cdbd2cSJim Jagielski    do_link ($src, $dest, 'soffice', 'soffice.bin', 1);
287*b1cdbd2cSJim Jagielski    do_link ($src, $dest, 'bootstraprc', 'bootstraprc', 1);
288*b1cdbd2cSJim Jagielski    do_link ($src, $dest, 'intro.bmp', 'intro.bmp', 1);
289*b1cdbd2cSJim Jagielski    do_link ("$OOO_INSTALL", "$OOO_BUILD/desktop/$TARGET", 'share', 'share', 1);
290*b1cdbd2cSJim Jagielski
291*b1cdbd2cSJim Jagielski    print "\n";
292*b1cdbd2cSJim Jagielski}
293*b1cdbd2cSJim Jagielski
294*b1cdbd2cSJim Jagielskimy $a;
295*b1cdbd2cSJim Jagielskimy $usage = 0;
296*b1cdbd2cSJim Jagielskifor $a (@ARGV) {
297*b1cdbd2cSJim Jagielski
298*b1cdbd2cSJim Jagielski# options
299*b1cdbd2cSJim Jagielski    if ($a =~ /--product/) {
300*b1cdbd2cSJim Jagielski	$product = 1;
301*b1cdbd2cSJim Jagielski    } elsif ($a =~ /--dry-run/) {
302*b1cdbd2cSJim Jagielski        $dry_run = 1;
303*b1cdbd2cSJim Jagielski    } elsif (($a eq '--help') || ($a eq '-h')) {
304*b1cdbd2cSJim Jagielski	$usage = 1;
305*b1cdbd2cSJim Jagielski
306*b1cdbd2cSJim Jagielski# ordered arguments
307*b1cdbd2cSJim Jagielski    } elsif (!defined $OOO_INSTALL) {
308*b1cdbd2cSJim Jagielski	$OOO_INSTALL = $a;
309*b1cdbd2cSJim Jagielski    } elsif (!defined $OOO_BUILD) {
310*b1cdbd2cSJim Jagielski	$OOO_BUILD = $a;
311*b1cdbd2cSJim Jagielski    } else {
312*b1cdbd2cSJim Jagielski	print "Unknown argument '$a'\n";
313*b1cdbd2cSJim Jagielski	$usage = 1;
314*b1cdbd2cSJim Jagielski    }
315*b1cdbd2cSJim Jagielski}
316*b1cdbd2cSJim Jagielski
317*b1cdbd2cSJim Jagielskiif (!defined $OOO_BUILD && defined $ENV{SRC_ROOT}) {
318*b1cdbd2cSJim Jagielski    $OOO_BUILD = $ENV{SRC_ROOT};
319*b1cdbd2cSJim Jagielski}
320*b1cdbd2cSJim Jagielski
321*b1cdbd2cSJim Jagielskiif ($usage || !defined $OOO_INSTALL || !defined $OOO_BUILD) {
322*b1cdbd2cSJim Jagielski    printf "Usage: linkoo </path/to/ooo/install> [</path/to/ooo/build/tree>] [--product] [--dry-run]\n";
323*b1cdbd2cSJim Jagielski    exit (1);
324*b1cdbd2cSJim Jagielski}
325*b1cdbd2cSJim Jagielski
326*b1cdbd2cSJim Jagielskisubstr ($OOO_INSTALL, 0, 1) eq '/' || die "linkoo requires absolute paths ($OOO_INSTALL does not qualify)";
327*b1cdbd2cSJim Jagielskisubstr ($OOO_BUILD, 0, 1)   eq '/' || die "linkoo requires absolute paths ($OOO_BUILD does not qualify)";
328*b1cdbd2cSJim Jagielski
329*b1cdbd2cSJim Jagielski-d $OOO_INSTALL || die "No such directory $OOO_INSTALL";
330*b1cdbd2cSJim Jagielski-w $OOO_INSTALL || die "You need write access to $OOO_INSTALL";
331*b1cdbd2cSJim Jagielski-d $OOO_BUILD || die "No such directory $OOO_BUILD";
332*b1cdbd2cSJim Jagielski-d "$OOO_INSTALL/" . $program_dir . "/resource" || die "$OOO_INSTALL doesn't look like an OO install";
333*b1cdbd2cSJim Jagielski
334*b1cdbd2cSJim Jagielski($TARGET, $LIBVER, $LANG) = sniff_target ($OOO_BUILD);
335*b1cdbd2cSJim Jagielski
336*b1cdbd2cSJim Jagielskievilness ('undo');
337*b1cdbd2cSJim Jagielski
338*b1cdbd2cSJim Jagielskimy $installed_files = build_installed_list ($OOO_INSTALL);
339*b1cdbd2cSJim Jagielski
340*b1cdbd2cSJim Jagielskiscan_and_link_files ($OOO_BUILD, $installed_files, $TARGET);
341*b1cdbd2cSJim Jagielskilink_iso_res();
342*b1cdbd2cSJim Jagielskilink_types_rdb();
343*b1cdbd2cSJim Jagielskilink_soffice_bin_files();
344*b1cdbd2cSJim Jagielski
345*b1cdbd2cSJim Jagielskiif (!-f "$OOO_INSTALL/" . $program_dir . "/ooenv") {
346*b1cdbd2cSJim Jagielski    print "Creating '$OOO_INSTALL/", $program_dir, "/ooenv'\n";
347*b1cdbd2cSJim Jagielski    open ($ooenv, ">$OOO_INSTALL/" . $program_dir . "/ooenv") || die "Can't open $OOO_INSTALL/" . $program_dir . "/ooenv: $!";
348*b1cdbd2cSJim Jagielski    print $ooenv $env_script;
349*b1cdbd2cSJim Jagielski    close ($ooenv);
350*b1cdbd2cSJim Jagielski}
351*b1cdbd2cSJim Jagielski
352*b1cdbd2cSJim Jagielskievilness ('do');
353*b1cdbd2cSJim Jagielski
354*b1cdbd2cSJim Jagielskiprint "\nlinkoo finished, please don't forget to source ooenv before ./soffice.\n";
355