cap5: Load libCap5.so from lib/perl/<perl-version>/<perl-archname>

This allows the same version of Base to be used from both RHEL5 and RHEL6
for example; they use different Perl versions which are not compatible at
the ABI level.
This commit is contained in:
Andrew Johnson
2011-12-10 23:11:33 -06:00
parent e289af684f
commit 4a5b8a37df
3 changed files with 35 additions and 9 deletions
+16
View File
@@ -13,6 +13,22 @@
<!-- Insert new items immediately below here ... -->
<h4>Path for Cap5 loadable library changed</h4>
<p>The perl CA module makes use of a loadable library, which used to be loaded
from the base/lib/&lt;host-arch&gt; directory. However different versions of
Perl require different loadable library binaries as the Perl ABI can change.
Now the library will be installed into and loaded from the directory
base/lib/perl/&lt;version&gt;/&lt;archname&gt; where both &lt;version&gt; and
&lt;archname&gt; are taken from the Perl configuration. This makes it possible
for the same Perl script to be run on both RHEL5 and RHEL6 workstations say, even
though they use different versions of Perl.</p>
<p>To achieve that, first build EPICS Base using the older OS version. Then
on a machine running the newer version, go into the base/src/cap5 directory and
run a <tt>make rebuild</tt> command. This will rebuild the libCap5.so file and
install it into the location appropriate for its Perl version and architecture.</p>
<h4>Build configurations updated for Apple iOS targets</h4>
<p>The build process can now construct universal binaries containing both ARMv6
+6 -4
View File
@@ -6,9 +6,6 @@ use warnings;
my $version = '0.4';
exists $ENV{EPICS_HOST_ARCH}
or die "EPICS_HOST_ARCH environment variable not set";
package CA;
@@ -26,12 +23,17 @@ package Cap5;
our $VERSION = $version;
our @ISA = qw(DynaLoader);
# Library is specific to the Perl version and archname
use Config;
my $perl_version = $Config::Config{version};
my $perl_archname = $Config::Config{archname};
require DynaLoader;
# Add our lib/<arch> directory to the shared library search path
use File::Basename;
my $Lib = dirname(__FILE__);
push @DynaLoader::dl_library_path, "$Lib/../$ENV{EPICS_HOST_ARCH}";
push @DynaLoader::dl_library_path, "$Lib/$perl_version/$perl_archname";
bootstrap Cap5 $VERSION;
+13 -5
View File
@@ -22,6 +22,11 @@ ifneq ($(findstring darwin,$(T_A)),)
LOADABLE_SHRLIB_SUFFIX = .bundle
endif
PERL_VERSION = $(shell $(PERL) ../perlConfig.pl version)
PERL_ARCHNAME = $(shell $(PERL) ../perlConfig.pl archname)
PERL_ARCHPATH = $(PERL_VERSION)/$(PERL_ARCHNAME)
ifeq ($(findstring Host,$(VALID_BUILDS)),Host)
ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),)
# Doesn't build on WIN32
LOADABLE_LIBRARY_HOST = Cap5
@@ -33,12 +38,11 @@ ifeq ($(findstring $(OS_CLASS),WIN32 cygwin32),)
PERL_SCRIPTS += camonitor.pl
PERL_MODULES += CA.pm
PERL_MODULES += $(PERL_ARCHPATH)/$(LOADABLE_SHRLIB_PREFIX)Cap5$(LOADABLE_SHRLIB_SUFFIX)
ifeq ($(findstring Host,$(VALID_BUILDS)),Host)
# Can only create docs in Host build
HTMLS_DIR = .
HTMLS = CA.html
endif
HTMLS_DIR = .
HTMLS = CA.html
endif
endif
Cap5_SRCS = Cap5.xs
@@ -59,6 +63,10 @@ ifdef T_A
$(RM) $@
podchecker $< && pod2html --infile=$< --outfile=$@
$(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH)/%: %
$(ECHO) "Installing loadable shared library $@"
@$(INSTALL_LIBRARY) -d -m $(LIB_PERMISSIONS) $< $(INSTALL_PERL_MODULES)/$(PERL_ARCHPATH)
clean::
$(RM) Cap5.c
endif