Skip to content

Instantly share code, notes, and snippets.

@extrowerk
Created November 6, 2016 12:05
Show Gist options
  • Save extrowerk/f066db4421fd958dfc07989992130cc0 to your computer and use it in GitHub Desktop.
Save extrowerk/f066db4421fd958dfc07989992130cc0 to your computer and use it in GitHub Desktop.
From 077e374304a56221935f74c36da2f34c2e7b03b0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sun, 6 Nov 2016 12:26:59 +0100
Subject: [PATCH] Updated patchset
Applied Haiku patchset
Added missing files
---
MANIFEST | 1 +
cpan/CPAN/lib/CPAN/FirstTime.pm | 6 ++
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm | 3 +-
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm | 80 ++++++++++++++++++++++++
cpan/File-Temp/lib/File/Temp.pm | 3 +-
cpan/File-Temp/t/lock.t | 3 +-
ext/Errno/Errno_pm.PL | 2 +-
hints/haiku.sh | 45 +------------
installperl | 5 ++
sitecustomize.pl | 36 +++++++++++
t/run/exit.t | 16 ++---
11 files changed, 144 insertions(+), 56 deletions(-)
create mode 100644 cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm
create mode 100644 sitecustomize.pl
diff --git a/MANIFEST b/MANIFEST
index c847f60..90af422 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1071,6 +1071,7 @@ cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_BeOS.pm MakeMaker methods for BeOS
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Cygwin.pm MakeMaker methods for Cygwin
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Darwin.pm MakeMaker methods for Darwin
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_DOS.pm MakeMaker methods for DOS
+cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm MakeMaker methods for Haiku
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_MacOS.pm MakeMaker methods for MacOS
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_NW5.pm MakeMaker methods for NetWare
cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_OS2.pm MakeMaker methods for OS/2
diff --git a/cpan/CPAN/lib/CPAN/FirstTime.pm b/cpan/CPAN/lib/CPAN/FirstTime.pm
index 918e009..1ac44b9 100644
--- a/cpan/CPAN/lib/CPAN/FirstTime.pm
+++ b/cpan/CPAN/lib/CPAN/FirstTime.pm
@@ -2058,6 +2058,12 @@ sub _print_urllist {
}
sub _can_write_to_libdirs {
+ if ($^O eq 'haiku') {
+ # on Haiku, the other dirs are never writable, as they are
+ # being populated by packagefs
+ return -w $Config{installsitelib}
+ && -w $Config{installsitearch}
+ }
return -w $Config{installprivlib}
&& -w $Config{installarchlib}
&& -w $Config{installsitelib}
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm
index fa5f72c..044c4a4 100644
--- a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM.pm
@@ -59,7 +59,8 @@ if( $^O eq 'MSWin32' ) {
$Is{UWIN} = $^O =~ /^uwin(-nt)?$/;
$Is{Cygwin} = $^O eq 'cygwin';
$Is{NW5} = $Config{osname} eq 'NetWare'; # intentional
-$Is{BeOS} = ($^O =~ /beos/i or $^O eq 'haiku');
+$Is{BeOS} = $^O =~ /beos/i;
+$Is{Haiku} = $^O eq 'haiku';
$Is{DOS} = $^O eq 'dos';
if( $Is{NW5} ) {
$^O = 'NetWare';
diff --git a/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm
new file mode 100644
index 0000000..8a04ead
--- /dev/null
+++ b/cpan/ExtUtils-MakeMaker/lib/ExtUtils/MM_Haiku.pm
@@ -0,0 +1,80 @@
+package ExtUtils::MM_Haiku;
+
+use strict;
+
+=head1 NAME
+
+ExtUtils::MM_Haiku - methods to override UN*X behaviour in ExtUtils::MakeMaker
+
+=head1 SYNOPSIS
+
+ use ExtUtils::MM_Haiku; # Done internally by ExtUtils::MakeMaker if needed
+
+=head1 DESCRIPTION
+
+See ExtUtils::MM_Unix for a documentation of the methods provided
+there. This package overrides the implementation of these methods, not
+the semantics.
+
+=over 4
+
+=cut
+
+use ExtUtils::MakeMaker::Config;
+use File::Spec;
+require ExtUtils::MM_Any;
+require ExtUtils::MM_Unix;
+
+our @ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix );
+our $VERSION = '6.66';
+
+
+sub os_flavor {
+ return('Haiku');
+}
+
+sub init_main {
+ my $self = shift;
+
+ # switch to vendor directories if requested.
+ if ($ENV{'HAIKU_USE_VENDOR_DIRECTORIES'}) {
+ $self->{INSTALLDIRS} ||= 'vendor';
+ }
+
+ $self->SUPER::init_main();
+}
+
+sub init_INSTALL_from_PREFIX {
+ my $self = shift;
+
+ # If a prefix has been given from outside, the default implementation
+ # will set PERLPREFIX, SITEPREFIX and VENDORPREFIX to identical values,
+ # but due to the way how Haiku's package management works, PERLPREFIX
+ # and VENDORPREFIX are not writable at all (as they're being populated
+ # from installed packages via package-fs). SITEPREFIX, however needs to
+ # be set to a path which can be written to (since site packages are
+ # expected to be installed "manually") - so we make sure it points
+ # to a 'non-packaged'-folder:
+ my $prefixGiven = $self->{PREFIX};
+ $self->SUPER::init_INSTALL_from_PREFIX();
+ if ($prefixGiven) {
+ $self->{SITEPREFIX} = '$(PREFIX)/non-packaged';
+ }
+}
+
+sub init_others {
+ my $self = shift;
+
+ $self->SUPER::init_others();
+
+ # Don't use run-time paths for libraries required by dynamic
+ # modules on Haiku, as that wouldn't work should a library be moved
+ # (for instance because the package has been activated somewhere else).
+ $self->{LD_RUN_PATH} = "";
+
+ return;
+}
+
+1;
+__END__
+
diff --git a/cpan/File-Temp/lib/File/Temp.pm b/cpan/File-Temp/lib/File/Temp.pm
index 817c6d9..c3298a6 100644
--- a/cpan/File-Temp/lib/File/Temp.pm
+++ b/cpan/File-Temp/lib/File/Temp.pm
@@ -1425,7 +1425,8 @@ sub unlink0 {
# On NFS the link count may still be 1 but we can't know that
# we are on NFS. Since we can't be sure, we'll defer it
- return 1 if $fh[3] == 0 || $^O eq 'cygwin';
+ # On haiku, the link count seems to be always 1 (at least for BFS)
+ return 1 if $fh[3] == 0 || $^O eq 'cygwin' || $^O eq 'haiku';
}
# fall-through if we can't unlink now
_deferred_unlink($fh, $path, 0);
diff --git a/cpan/File-Temp/t/lock.t b/cpan/File-Temp/t/lock.t
index ff8c7f9..4364bf6 100644
--- a/cpan/File-Temp/t/lock.t
+++ b/cpan/File-Temp/t/lock.t
@@ -8,7 +8,8 @@ use Fcntl;
BEGIN {
# see if we have O_EXLOCK
eval { &Fcntl::O_EXLOCK; };
- if ($@) {
+ if ($@ || $^O eq 'haiku') {
+ # haiku doesn't implement O_EXLOCK yet (but it defines the value)
plan skip_all => 'Do not seem to have O_EXLOCK';
} else {
plan tests => 4;
diff --git a/ext/Errno/Errno_pm.PL b/ext/Errno/Errno_pm.PL
index 6251a3c..77bd0cd 100644
--- a/ext/Errno/Errno_pm.PL
+++ b/ext/Errno/Errno_pm.PL
@@ -139,7 +139,7 @@ sub get_files {
$file{$linux_errno_h} = 1;
} elsif ($^O eq 'haiku') {
# hidden in a special place
- $file{'/boot/develop/headers/posix/errno.h'} = 1;
+ $file{'/boot/system/develop/headers/posix/errno.h'} = 1;
} elsif ($^O eq 'vos') {
# avoid problem where cpp returns non-POSIX pathnames
diff --git a/hints/haiku.sh b/hints/haiku.sh
index fa8ebe5..0f09f53 100644
--- a/hints/haiku.sh
+++ b/hints/haiku.sh
@@ -1,44 +1 @@
-# Haiku hints file
-# $Id$
-
-case "$prefix" in
-'') prefix="/boot/common" ;;
-*) ;; # pass the user supplied value through
-esac
-
-libpth='/boot/home/config/lib /boot/common/lib /system/lib'
-usrinc='/boot/develop/headers/posix'
-locinc='/boot/home/config/include /boot/common/include /boot/develop/headers'
-
-libc='/system/lib/libroot.so'
-libs='-lnetwork'
-
-# Use Haiku's malloc() by default.
-case "$usemymalloc" in
-'') usemymalloc='n' ;;
-esac
-
-# Haiku generally supports hard links, but the default file system (BFS)
-# doesn't. So better avoid using hard links.
-d_link='undef'
-dont_use_nlink='define'
-
-# The array syserrlst[] is useless for the most part.
-# Large negative numbers really kind of suck in arrays.
-d_syserrlst='undef'
-
-# Haiku uses gcc.
-cc="gcc"
-ld='gcc'
-
-# The runtime loader library path variable is LIBRARY_PATH.
-case "$ldlibpthname" in
-'') ldlibpthname=LIBRARY_PATH ;;
-esac
-
-# as of alpha 4.1 (at the latest) some symbols are versioned,
-# confusing the nm lookup
-case "$usenm" in
-'') usenm='undef' ;;
-esac
-
+# haiku sets all its specifics via Configure
diff --git a/installperl b/installperl
index f4d850b..9fa96aa 100755
--- a/installperl
+++ b/installperl
@@ -381,6 +381,11 @@ elsif ($Is_Cygwin) { # On Cygwin symlink it to CORE to make Makefile happy
# AIX needs perl.exp installed as well.
push(@corefiles,'perl.exp') if $^O eq 'aix';
+ if ($^O eq 'haiku') {
+ # Haiku needs haikuish.h installed as well.
+ mkpath("$installarchlib/CORE/haiku", $opts{verbose}, 0777);
+ push(@corefiles,'haiku/haikuish.h');
+ }
}
diff --git a/sitecustomize.pl b/sitecustomize.pl
new file mode 100644
index 0000000..a321e51
--- /dev/null
+++ b/sitecustomize.pl
@@ -0,0 +1,36 @@
+#! perl
+
+use Config;
+
+# Remove all compiled-in paths referring to Perl's installation dir
+# and replace them with a static set of paths that implement the intended
+# searching order:
+my @ourINC = (
+ "/boot/home/config/lib/perl5/$Config{version}/$Config{archname}",
+ "/boot/home/config/lib/perl5/$Config{version}",
+ "/boot/home/config/non-packaged/lib/perl5/site_perl/$Config{version}/$Config{archname}",
+ "/boot/home/config/non-packaged/lib/perl5/site_perl/$Config{version}",
+ "/boot/home/config/lib/perl5/vendor_perl/$Config{version}/$Config{archname}",
+ "/boot/home/config/lib/perl5/vendor_perl/$Config{version}",
+ "/boot/home/config/lib/perl5/vendor_perl",
+ "/boot/system/lib/perl5/$Config{version}/$Config{archname}",
+ "/boot/system/lib/perl5/$Config{version}",
+ "/boot/system/non-packaged/lib/perl5/site_perl/$Config{version}/$Config{archname}",
+ "/boot/system/non-packaged/lib/perl5/site_perl/$Config{version}",
+ "/boot/system/lib/perl5/vendor_perl/$Config{version}/$Config{archname}",
+ "/boot/system/lib/perl5/vendor_perl/$Config{version}",
+ "/boot/system/lib/perl5/vendor_perl",
+);
+my @newINC;
+my $removedPerlPaths;
+foreach my $inc (@INC) {
+ if ($inc =~ m[^/packages/perl-$Config{version}-\d+/.self/]o) {
+ if (! $removedPerlPaths) {
+ push @newINC, @ourINC;
+ $removedPerlPaths = 1;
+ }
+ next;
+ }
+ push @newINC, $inc;
+}
+@INC = @newINC;
diff --git a/t/run/exit.t b/t/run/exit.t
index ce3270e..cab9a79 100644
--- a/t/run/exit.t
+++ b/t/run/exit.t
@@ -55,18 +55,18 @@ is( ${^CHILD_ERROR_NATIVE}, $native_success, 'Normal exit ${^CHILD_ERROR_NATIVE
if (!$vms_exit_mode) {
my $posix_ok = eval { require POSIX; };
my $wait_macros_ok = defined &POSIX::WIFEXITED;
- eval { POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}) };
+ eval { POSIX::WIFEXITED($?) };
$wait_macros_ok = 0 if $@;
$exit = run('exit 42');
is( $exit >> 8, 42, 'Non-zero exit' );
is( $exit, $?, 'Non-zero exit $?' );
- isnt( !${^CHILD_ERROR_NATIVE}, 0, 'Non-zero exit ${^CHILD_ERROR_NATIVE}' );
+ isnt( ${^CHILD_ERROR_NATIVE}, 0, 'Non-zero exit ${^CHILD_ERROR_NATIVE}' );
SKIP: {
skip("No POSIX", 3) unless $posix_ok;
skip("No POSIX wait macros", 3) unless $wait_macros_ok;
- ok(POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}), "WIFEXITED");
- ok(!POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE}), "WIFSIGNALED");
- is(POSIX::WEXITSTATUS(${^CHILD_ERROR_NATIVE}), 42, "WEXITSTATUS");
+ ok(POSIX::WIFEXITED($?), "WIFEXITED");
+ ok(!POSIX::WIFSIGNALED($?), "WIFSIGNALED");
+ is(POSIX::WEXITSTATUS($?), 42, "WEXITSTATUS");
}
SKIP: {
@@ -85,9 +85,9 @@ if (!$vms_exit_mode) {
SKIP: {
skip("No POSIX", 3) unless $posix_ok;
skip("No POSIX wait macros", 3) unless $wait_macros_ok;
- ok(!POSIX::WIFEXITED(${^CHILD_ERROR_NATIVE}), "WIFEXITED");
- ok(POSIX::WIFSIGNALED(${^CHILD_ERROR_NATIVE}), "WIFSIGNALED");
- is(POSIX::WTERMSIG(${^CHILD_ERROR_NATIVE}), 15, "WTERMSIG");
+ ok(!POSIX::WIFEXITED($?), "WIFEXITED");
+ ok(POSIX::WIFSIGNALED($?), "WIFSIGNALED");
+ is(POSIX::WTERMSIG($?), 15, "WTERMSIG");
}
}
--
2.10.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment