From 51b57cec06af74748f38ebcdc786a024c5066a1f Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Wed, 8 Oct 2008 21:38:01 +0000 Subject: * first try at making sure that the required Perl-headers exist before we try to use one of them git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@2275 95ad53e4-c205-0410-b2fa-d234c58c8868 --- Makefile | 12 +++++++++++- lib/OpenSLX/Syscall.pm | 11 +++++++++-- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 883ea290..9f662a94 100644 --- a/Makefile +++ b/Makefile @@ -244,7 +244,17 @@ supported."; \ @ # set default db-type: @DEFAULT_DB_TYPE=$$(cat DEFAULT-DB-TYPE); \ rm DEFAULT-DB-TYPE; \ - echo -n ' '; slxsettings set db-type="$${DEFAULT_DB_TYPE}"; + echo -n ' '; slxsettings set db-type="$${DEFAULT_DB_TYPE}"; \ + + @ # create required Perl headers that may be missing + @if ! test -e ${SLX_BASE_PATH}/lib/ph/asm; then \ + echo "Converting kernel C-headers into Perl-headers ..."; \ + mkdir -p ${SLX_BASE_PATH}/lib/ph; \ + pushd /usr/include >/dev/null; \ + h2ph -rQ -d ${SLX_BASE_PATH}/lib/ph asm-x86; \ + popd >/dev/null; \ + mv ${SLX_BASE_PATH}/lib/ph/asm-x86 ${SLX_BASE_PATH}/lib/ph/asm; \ + fi; vmware_install: @# we should read the config file here or better have a separate diff --git a/lib/OpenSLX/Syscall.pm b/lib/OpenSLX/Syscall.pm index a46d9ac6..faf223f8 100644 --- a/lib/OpenSLX/Syscall.pm +++ b/lib/OpenSLX/Syscall.pm @@ -30,6 +30,8 @@ before trying to invoke the respective syscall. =cut +use File::Path; + use OpenSLX::Basics; =head1 PUBLIC FUNCTIONS @@ -58,14 +60,19 @@ sub _loadPerlHeader { my @phFiles = @_; + my $phLibDir = "$openslxConfig{'base-path'}/lib/ph"; + mkpath($phLibDir) unless -e $phLibDir; + + local @INC = @INC; + push @INC, $phLibDir; + for my $phFile (@phFiles) { if (!eval { require $phFile }) { # perl-header has not been provided by host-OS, so we create it # manually from C-header (via h2ph): (my $hFile = $phFile) =~ s{\.ph$}{.h}; if (-e "/usr/include/$hFile") { - my $libDir = "$openslxConfig{'base-path'}/lib"; - slxsystem("cd /usr/include && h2ph -d $libDir $hFile") == 0 + slxsystem("cd /usr/include && h2ph -d $phLibDir $hFile") == 0 or die _tr('unable to create %s! (%s)', $phFile, $!); } } -- cgit v1.2.3-55-g7522