summaryrefslogtreecommitdiff
path: root/solenv/bin/macosx-change-install-names.pl
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2008-03-18 11:56:41 +0000
committerVladimir Glazounov <vg@openoffice.org>2008-03-18 11:56:41 +0000
commited7681ba1e7f8f53552be3294f7be6e863c0947a (patch)
treec4b5733d7030ddd15be3bfe6c309f877c1fbd767 /solenv/bin/macosx-change-install-names.pl
parentc23b9746947d3c6d757af45cc653f7553b3f0aee (diff)
INTEGRATION: CWS sb83 (1.1.2); FILE ADDED
2008/02/25 15:44:32 sb 1.1.2.6: #i84200# fixed parsing of otool -D output 2008/02/01 11:02:16 sb 1.1.2.5: #i84200# added SHLnRPATH=OXT for libraries within extensions (that only link against URE libs) 2008/01/25 16:05:11 sb 1.1.2.4: #i84200# do normal shl processing for extshl as well 2008/01/18 09:57:44 sb 1.1.2.3: #i84200# untabified 2008/01/18 09:54:51 sb 1.1.2.2: #i84200# added extshl support 2008/01/09 09:43:01 sb 1.1.2.1: #i84200# use APP|SHLnRPATH (-> LINKFLAGSRUNPATH_xxx) to control the install_name on unxmacx, use new macosx-change-install-names to adapt recorded install_names of linked-against libraries to correct paths in the target environment
Diffstat (limited to 'solenv/bin/macosx-change-install-names.pl')
-rw-r--r--solenv/bin/macosx-change-install-names.pl92
1 files changed, 92 insertions, 0 deletions
diff --git a/solenv/bin/macosx-change-install-names.pl b/solenv/bin/macosx-change-install-names.pl
new file mode 100644
index 000000000000..840d2d42a940
--- /dev/null
+++ b/solenv/bin/macosx-change-install-names.pl
@@ -0,0 +1,92 @@
+#*************************************************************************
+#
+# $RCSfile: macosx-change-install-names.pl,v $
+#
+# $Revision: 1.2 $
+#
+# last change: $Author: vg $ $Date: 2008-03-18 12:56:41 $
+#
+# The Contents of this file are made available subject to
+# the terms of GNU Lesser General Public License Version 2.1.
+#
+#
+# GNU Lesser General Public License Version 2.1
+# =============================================
+# Copyright 2008 by Sun Microsystems, Inc.
+# 901 San Antonio Road, Palo Alto, CA 94303, USA
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License version 2.1, as published by the Free Software Foundation.
+#
+# This library 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 for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+# MA 02111-1307 USA
+#
+#*************************************************************************
+
+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',
+ 'app/OOO/OOO' => '@executable_path',
+ 'app/BRAND/URELIB' => '@executable_path/../basis-link/ure-link/lib',
+ 'app/BRAND/OOO' => '@executable_path/../basis-link/program',
+ 'shl/URELIB/URELIB' => '@loader_path',
+ 'shl/OOO/URELIB' => '@loader_path/../ure-link/lib',
+ 'shl/OOO/OOO' => '@loader_path',
+ 'shl/OXT/URELIB' => '@executable_path/urelibs');
+ my ($type, $loc1, $loc2) = @_;
+ my $act = $action{"$type/$loc1/$loc2"};
+ die "illegal combination $type/$loc/$2" unless defined $act;
+ return $act;
+}
+
+@ARGV == 3 || @ARGV >= 3 && $ARGV[0] eq "extshl" or
+ die "Usage: app|shl|extshl UREBIN|URELIB|OOO|BRAND|OXT <filepath>+";
+$type = shift @ARGV;
+$loc = shift @ARGV;
+if ($type eq "extshl")
+{
+ $type = "shl";
+ my $change = "";
+ foreach $file (@ARGV)
+ {
+ otoolD($file) =~ m'^(.*?([^/]+))\n$' or
+ die "unexpected otool -D output";
+ $change .= " -change $1 " . action($type, $loc, $loc) . "/$2";
+ $iname{$file} = $2;
+ }
+ foreach $file (@ARGV)
+ {
+ my $call = "install_name_tool$change -id \@__________________________________________________$loc/$iname{$file} $file";
+ system($call) == 0 or die "cannot $call";
+ }
+}
+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$';
+ }
+ close(IN);
+ if ($change ne "")
+ {
+ $call = "install_name_tool$change $file";
+ system($call) == 0 or die "cannot $call";
+ }
+}