2008-03-18 06:56:41 -05:00
|
|
|
#*************************************************************************
|
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2010-02-12 08:01:35 -06:00
|
|
|
# Copyright 2000, 2010 Oracle and/or its affiliates.
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# OpenOffice.org - a multi-platform office productivity suite
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# This file is part of OpenOffice.org.
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
# only, as published by the Free Software Foundation.
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU Lesser General Public License version 3 for more details
|
|
|
|
# (a copy is included in the LICENSE file that accompanied this code).
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
2008-04-10 10:50:54 -05:00
|
|
|
# You should have received a copy of the GNU Lesser General Public License
|
|
|
|
# version 3 along with OpenOffice.org. If not, see
|
|
|
|
# <http://www.openoffice.org/license.html>
|
|
|
|
# for a copy of the LGPLv3 License.
|
2008-03-18 06:56:41 -05:00
|
|
|
#
|
|
|
|
#*************************************************************************
|
|
|
|
|
|
|
|
use lib ("$ENV{SOLARENV}/bin/modules");
|
|
|
|
use macosxotoolhelper;
|
|
|
|
|
|
|
|
sub action($$$)
|
|
|
|
{
|
|
|
|
my %action =
|
|
|
|
('app/UREBIN/URELIB' => '@executable_path/../lib',
|
|
|
|
'app/OOO/URELIB' => '@executable_path/../ure-link/lib',
|
2011-10-24 15:56:33 -05:00
|
|
|
'app/OOO/OOO' => '@executable_path',
|
2008-07-11 08:42:49 -05:00
|
|
|
'app/SDK/URELIB' => '@executable_path/../../ure-link/lib',
|
2009-02-19 05:42:47 -06:00
|
|
|
'app/NONE/URELIB' => '@__VIA_LIBRARY_PATH__',
|
|
|
|
'app/NONE/OOO' => '@__VIA_LIBRARY_PATH__',
|
2010-01-11 15:32:06 -06:00
|
|
|
'app/NONE/NONE' => '@__VIA_LIBRARY_PATH__',
|
2008-03-18 06:56:41 -05:00
|
|
|
'shl/URELIB/URELIB' => '@loader_path',
|
2011-10-21 10:18:13 -05:00
|
|
|
'shl/OOO/URELIB' => '@loader_path/../ure-link/lib',
|
2008-03-18 06:56:41 -05:00
|
|
|
'shl/OOO/OOO' => '@loader_path',
|
2011-03-01 08:04:30 -06:00
|
|
|
'shl/LOADER/LOADER' => '@loader_path',
|
2009-12-18 08:56:13 -06:00
|
|
|
'shl/OXT/URELIB' => '@executable_path/urelibs',
|
|
|
|
'shl/NONE/URELIB' => '@__VIA_LIBRARY_PATH__',
|
2010-11-03 04:17:39 -05:00
|
|
|
'shl/OOO/NONE' => '@__VIA_LIBRARY_PATH__',
|
2010-01-11 23:56:05 -06:00
|
|
|
'shl/NONE/OOO' => '@__VIA_LIBRARY_PATH__',
|
2009-12-18 08:56:13 -06:00
|
|
|
'shl/NONE/NONE' => '@__VIA_LIBRARY_PATH__');
|
2008-03-18 06:56:41 -05:00
|
|
|
my ($type, $loc1, $loc2) = @_;
|
|
|
|
my $act = $action{"$type/$loc1/$loc2"};
|
2009-12-18 08:56:13 -06:00
|
|
|
die "illegal combination $type/$loc1/$loc2" unless defined $act;
|
2008-03-18 06:56:41 -05:00
|
|
|
return $act;
|
|
|
|
}
|
|
|
|
|
2009-02-19 05:42:47 -06:00
|
|
|
@ARGV == 3 || @ARGV >= 2 && $ARGV[0] eq "extshl" or die
|
2011-10-24 15:56:33 -05:00
|
|
|
'Usage: app|shl|extshl UREBIN|URELIB|OOO|SDK|OXT|NONE|LOADER <filepath>*';
|
2008-03-18 06:56:41 -05:00
|
|
|
$type = shift @ARGV;
|
|
|
|
$loc = shift @ARGV;
|
2011-01-13 11:55:57 -06:00
|
|
|
if ($type eq "SharedLibrary")
|
|
|
|
{
|
|
|
|
$type = "shl";
|
|
|
|
}
|
|
|
|
if ($type eq "Executable")
|
|
|
|
{
|
|
|
|
$type = "app"
|
|
|
|
}
|
2011-01-18 08:04:46 -06:00
|
|
|
if ($type eq "Library")
|
|
|
|
{
|
|
|
|
$type = "shl"
|
|
|
|
}
|
2008-03-18 06:56:41 -05:00
|
|
|
if ($type eq "extshl")
|
|
|
|
{
|
|
|
|
$type = "shl";
|
|
|
|
my $change = "";
|
2009-08-26 03:22:01 -05:00
|
|
|
my %inames;
|
2008-03-18 06:56:41 -05:00
|
|
|
foreach $file (@ARGV)
|
|
|
|
{
|
2009-08-26 03:22:01 -05:00
|
|
|
my $iname = otoolD($file);
|
|
|
|
(defined $iname ? $iname : $file . "\n") =~ m'^(.*?([^/]+))\n$' or
|
2008-03-18 06:56:41 -05:00
|
|
|
die "unexpected otool -D output";
|
|
|
|
$change .= " -change $1 " . action($type, $loc, $loc) . "/$2";
|
2009-08-26 03:22:01 -05:00
|
|
|
$inames{$file} = $2;
|
2008-03-18 06:56:41 -05:00
|
|
|
}
|
2011-03-01 08:04:30 -06:00
|
|
|
if( $loc eq "LOADER" )
|
2008-03-18 06:56:41 -05:00
|
|
|
{
|
2011-03-01 08:04:30 -06:00
|
|
|
foreach $file (@ARGV)
|
|
|
|
{
|
|
|
|
my $call = "install_name_tool$change -id \@loader_path/$inames{$file} $file";
|
|
|
|
system($call) == 0 or die "cannot $call";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
foreach $file (@ARGV)
|
|
|
|
{
|
|
|
|
my $call = "install_name_tool$change -id \@__________________________________________________$loc/$inames{$file} $file";
|
|
|
|
system($call) == 0 or die "cannot $call";
|
|
|
|
}
|
2008-03-18 06:56:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
foreach $file (@ARGV)
|
|
|
|
{
|
|
|
|
my $call = "otool -L $file";
|
|
|
|
open(IN, "-|", $call) or die "cannot $call";
|
|
|
|
my $change = "";
|
|
|
|
while (<IN>)
|
|
|
|
{
|
|
|
|
$change .= " -change $1 " . action($type, $loc, $2) . "$3"
|
|
|
|
if m'^\s*(@_{50}([^/]+)(/.+)) \(compatibility version \d+\.\d+\.\d+, current version \d+\.\d+\.\d+\)\n$';
|
2011-06-11 09:48:06 -05:00
|
|
|
$change .= ' -change '.$1.' @loader_path/'.$2
|
|
|
|
if m'^\s*(/python-inst/(OOoPython.framework/Versions/[^/]+/OOoPython))';
|
2008-03-18 06:56:41 -05:00
|
|
|
}
|
|
|
|
close(IN);
|
|
|
|
if ($change ne "")
|
|
|
|
{
|
|
|
|
$call = "install_name_tool$change $file";
|
|
|
|
system($call) == 0 or die "cannot $call";
|
|
|
|
}
|
|
|
|
}
|