diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2012-02-29 18:34:42 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2012-02-29 18:46:38 +0100 |
commit | 7c4f2ec8a795534164ee1923093b7d5be0126c55 (patch) | |
tree | 08971f4c7375629393b6d9cdeb713006778334bf /solenv | |
parent | 8c9823d311fdf8092cc75873e4565325d204a658 (diff) |
Simplify install name handling for external libraries on Mac OS X
...by allowing our special @___... tokens anywhere within an install name,
so that external modules can configure --prefix=/@___... etc. This removes
the need for the special extshl and EXTRPATH=LOADER. Also, a new
OUT2BIN_NONE can be used for external modules where the generated libraries
need the default EXTRPATH=OOO, but generated executables are only used
during the build and such need RPATH=NONE.
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/macosx-change-install-names.pl | 76 | ||||
-rw-r--r-- | solenv/inc/tg_ext.mk | 25 |
2 files changed, 51 insertions, 50 deletions
diff --git a/solenv/bin/macosx-change-install-names.pl b/solenv/bin/macosx-change-install-names.pl index 290a488342b1..91bea7e165c1 100644 --- a/solenv/bin/macosx-change-install-names.pl +++ b/solenv/bin/macosx-change-install-names.pl @@ -25,8 +25,27 @@ # #************************************************************************* -use lib ("$ENV{SOLARENV}/bin/modules"); -use macosxotoolhelper; +# The install names of our dynamic libraries contain a special segment token +# that denotes where the dynamic library is located in the installation set. +# The segment token consists of "@", optionally followed by ".", followed by 50 +# "_", followed by a location token (one of "URELIB", "OOO", "OXT", or "NONE"). +# +# Typically, the segment token is the first segment of a relative install name. +# But the segment token may also appear within an absolute install name. That +# is useful when tunnelling the segment token into the external build process +# via a --prefix configure switch, for example. +# +# When another dynamic library or an executable links against such a dynamic +# library, the path recorded in the former to locate the latter is rewritten +# according to the below %action table. The result path consists of the prefix +# from the action table followed by the suffix of the dynamic library's install +# name. If the special segment token does not contain the optional "." after +# the "@", the suffix consists of all segments after the special token segment. +# If the special token segment does contain the optional ".", then the suffix +# consists of just the last segment of the original install name. +# +# That latter case is useful for libraries from external modules, where the +# external build process locates them in some sub-directory. sub action($$$) { @@ -41,8 +60,6 @@ sub action($$$) 'shl/URELIB/URELIB' => '@loader_path', 'shl/OOO/URELIB' => '@loader_path/../ure-link/lib', 'shl/OOO/OOO' => '@loader_path', - 'shl/LOADER/LOADER' => '@loader_path', - 'shl/LOADER/URELIB' => '@loader_path/../ure-link/lib', 'shl/OXT/URELIB' => '@executable_path/urelibs', 'shl/NONE/URELIB' => '@__VIA_LIBRARY_PATH__', 'shl/OOO/NONE' => '@__VIA_LIBRARY_PATH__', @@ -54,52 +71,17 @@ sub action($$$) return $act; } -@ARGV == 3 || @ARGV >= 2 && $ARGV[0] eq "extshl" or die - 'Usage: app|shl|extshl UREBIN|URELIB|OOO|SDK|OXT|NONE|LOADER <filepath>*'; +@ARGV >= 2 or die 'Usage: app|shl UREBIN|URELIB|OOO|SDK|OXT|NONE <filepath>*'; $type = shift @ARGV; $loc = shift @ARGV; -if ($type eq "SharedLibrary") -{ - $type = "shl"; -} if ($type eq "Executable") { $type = "app" } -if ($type eq "Library") +elsif ($type eq "Library" || $type eq "SharedLibrary") { $type = "shl" } -if ($type eq "extshl") -{ - $type = "shl"; - my $change = ""; - my %inames; - foreach $file (@ARGV) - { - my $iname = otoolD($file); - (defined $iname ? $iname : $file . "\n") =~ m'^(.*?([^/]+))\n$' or - die "unexpected otool -D output"; - $change .= " -change $1 " . action($type, $loc, $loc) . "/$2"; - $inames{$file} = $2; - } - if( $loc eq "LOADER" ) - { - 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"; - } - } -} foreach $file (@ARGV) { my $call = "otool -L $file"; @@ -107,10 +89,14 @@ foreach $file (@ARGV) 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$'; - $change .= ' -change '.$1.' @loader_path/'.$2 - if m'^\s*(/python-inst/(OOoPython.framework/Versions/[^/]+/OOoPython))'; + if (m'^\s*(((/.*)?/)?@_{50}([^/]+)(/.+)) \(compatibility version \d+\.\d+\.\d+, current version \d+\.\d+\.\d+\)\n$') + { + $change .= " -change $1 " . action($type, $loc, $4) . $5; + } + elsif (m'^\s*(((/.*)?/)?@\._{50}([^/]+)(/.+)?(/[^/]+)) \(compatibility version \d+\.\d+\.\d+, current version \d+\.\d+\.\d+\)\n$') + { + $change .= " -change $1 " . action($type, $loc, $4) . $6; + } } close(IN); if ($change ne "") diff --git a/solenv/inc/tg_ext.mk b/solenv/inc/tg_ext.mk index 0adec0c96683..b74c79fc954d 100644 --- a/solenv/inc/tg_ext.mk +++ b/solenv/inc/tg_ext.mk @@ -47,8 +47,8 @@ PATH!:=.$(PATH_SEPERATOR)$(SOLARBINDIR)$(PATH_SEPERATOR)$(PATH) .EXPORT : PATH #override -PACKAGE_DIR=$(MISC)/build -ABS_PACKAGE_DIR:=$(MAKEDIR)/$(MISC)/build +PACKAGE_DIR*=$(MISC)/build +ABS_PACKAGE_DIR:=$(MAKEDIR)/$(PACKAGE_DIR) #MUST match with PACKAGE_DIR BACK_PATH=../../../ @@ -252,7 +252,7 @@ $(PACKAGE_DIR)/$(PREDELIVER_FLAG_FILE) : $(PACKAGE_DIR)/$(INSTALL_FLAG_FILE) .IF "$(OUT2LIB)"!="" $(COMMAND_ECHO)$(COPY) $(foreach,i,$(OUT2LIB) $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$i) $(LB) .IF "$(OS)"=="MACOSX" - $(COMMAND_ECHO)$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl extshl \ + $(COMMAND_ECHO)$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl shl \ $(EXTRPATH) \ $(shell ls $(foreach,j,$(OUT2LIB) $(LB)/$(j:f)) | \ (grep -v '\.a$$' || test $$? = 1)) @@ -271,16 +271,31 @@ $(PACKAGE_DIR)/$(PREDELIVER_FLAG_FILE) : $(PACKAGE_DIR)/$(INSTALL_FLAG_FILE) .ENDIF # "$(OUTDIR2INC)"!="" .IF "$(OUT2BIN)"!="" $(COMMAND_ECHO)$(COPY) $(foreach,i,$(OUT2BIN) $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$i) $(BIN) -.IF "$(GUI)$(COM)$(COMEX)"=="WNTMSC12" +.IF "$(OS)"=="MACOSX" + $(COMMAND_ECHO)$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl app \ + $(EXTRPATH) $(shell ls $(foreach,j,$(OUT2BIN) $(BIN)/$(j:f))) +.ELIF "$(GUI)$(COM)$(COMEX)"=="WNTMSC12" @noop $(foreach,j,$(foreach,k,$(OUT2BIN) \ $(shell -ls -1 $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$k | $(GREP) .dll)) \ $(shell @$(IFEXIST) $(j).manifest $(THEN) mt.exe \ -manifest $(j).manifest -outputresource:$(BIN)/$(j:f)$(EMQ);2 $(FI))) .ENDIF # "$(GUI)$(COM)$(COMEX)"=="WNTMSC12" .ENDIF # "$(OUT2BIN)"!="" +.IF "$(OUT2BIN_NONE)"!="" + $(COMMAND_ECHO)$(COPY) $(foreach,i,$(OUT2BIN_NONE) $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$i) $(BIN) +.IF "$(OS)"=="MACOSX" + $(COMMAND_ECHO)$(PERL) $(SOLARENV)/bin/macosx-change-install-names.pl app \ + NONE $(shell ls $(foreach,j,$(OUT2BIN_NONE) $(BIN)/$(j:f))) +.ELIF "$(GUI)$(COM)$(COMEX)"=="WNTMSC12" + @noop $(foreach,j,$(foreach,k,$(OUT2BIN_NONE) \ + $(shell -ls -1 $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$k | $(GREP) .dll)) \ + $(shell @$(IFEXIST) $(j).manifest $(THEN) mt.exe \ + -manifest $(j).manifest -outputresource:$(BIN)/$(j:f)$(EMQ);2 $(FI))) +.END +.ENDIF # "$(OUT2BIN_NONE)"!="" .IF "$(OUT2CLASS)"!="" $(COMMAND_ECHO)$(COPY) $(foreach,i,$(OUT2CLASS) $(PACKAGE_DIR)/$(TARFILE_ROOTDIR)/$i) $(CLASSDIR) -.ENDIF # "$(OUT2BIN)"!="" +.ENDIF # "$(OUT2CLASS)"!="" $(COMMAND_ECHO)$(TOUCH) $(PACKAGE_DIR)/$(PREDELIVER_FLAG_FILE) $(MISC)/$(TARFILE_ROOTDIR).done : $(MISC)/$(TARFILE_MD5)-$(TARFILE_NAME).unpack $(PATCH_FILES) |