Index: perlio.h =================================================================== --- perlio.h (.../vendor/perl/current) (revision 21) +++ perlio.h (.../trunk) (revision 21) @@ -64,7 +64,7 @@ */ #include -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) int fseeko(FILE *stream, off_t offset, int whence); off_t ftello(FILE *stream); #endif Index: haiku/haikuish.h =================================================================== --- haiku/haikuish.h (.../vendor/perl/current) (revision 0) +++ haiku/haikuish.h (.../trunk) (revision 21) @@ -0,0 +1,11 @@ +#ifndef PERL_HAIKU_HAIKUISH_H +#define PERL_HAIKU_HAIKUISH_H + +#include "../unixish.h" + +/* We need or else the W* macros aren't defined in perl.h. */ + +#include + +#endif + Index: perl.c =================================================================== --- perl.c (.../vendor/perl/current) (revision 21) +++ perl.c (.../trunk) (revision 21) @@ -107,7 +107,7 @@ #endif -#ifdef __BEOS__ +#if defined(__BEOS__) && !defined(__HAIKU__) # define HZ 1000000 #endif @@ -381,7 +381,7 @@ * BeOS has those, but returns the wrong value. * The HZ if not originally defined has been by now * been defined as CLK_TCK, if available. */ -#if defined(HAS_SYSCONF) && defined(_SC_CLK_TCK) && !defined(__BEOS__) +#if defined(HAS_SYSCONF) && defined(_SC_CLK_TCK) && (!defined(__BEOS__) || defined(__HAIKU__)) PL_clocktick = sysconf(_SC_CLK_TCK); if (PL_clocktick <= 0) #endif Index: perl.h =================================================================== --- perl.h (.../vendor/perl/current) (revision 21) +++ perl.h (.../trunk) (revision 21) @@ -2551,7 +2551,10 @@ # define ISHISH "macos classic" #endif -#if defined(__BEOS__) +#if defined(__HAIKU__) +# include "haiku/haikuish.h" +# define ISHISH "haiku" +#elif defined(__BEOS__) # include "beos/beosish.h" # define ISHISH "beos" #endif @@ -5609,9 +5612,10 @@ #if O_TEXT != O_BINARY /* If you have different O_TEXT and O_BINARY and you are a CLRF shop, * that is, you are somehow DOSish. */ -# if defined(__BEOS__) || defined(__VOS__) || defined(__CYGWIN__) - /* BeOS has O_TEXT != O_BINARY but O_TEXT and O_BINARY have no effect; - * BeOS is always UNIXoid (LF), not DOSish (CRLF). */ +# if defined(__BEOS__) || defined(__HAIKU__) || defined(__VOS__) || \ + defined(__CYGWIN__) + /* BeOS/Haiku has O_TEXT != O_BINARY but O_TEXT and O_BINARY have no effect; + * BeOS/Haiku is always UNIXoid (LF), not DOSish (CRLF). */ /* VOS has O_TEXT != O_BINARY, and they have effect, * but VOS always uses LF, never CRLF. */ /* If you have O_TEXT different from your O_BINARY but you still are Index: lib/CPANPLUS/Internals/Constants/Report.pm =================================================================== --- lib/CPANPLUS/Internals/Constants/Report.pm (.../vendor/perl/current) (revision 21) +++ lib/CPANPLUS/Internals/Constants/Report.pm (.../trunk) (revision 21) @@ -29,6 +29,7 @@ Cygwin => 'cygwin', Darwin => 'darwin', EBCDIC => 'os390|os400|posix-bc|vmesa', + Haiku => 'haiku', HPUX => 'hpux', Linux => 'linux', MSDOS => 'dos|os2|MSWin32|cygwin', Index: lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t =================================================================== --- lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t (.../vendor/perl/current) (revision 21) +++ lib/CPANPLUS/t/20_CPANPLUS-Dist-MM.t (.../trunk) (revision 21) @@ -45,7 +45,13 @@ $conf->set_conf( cpantest => 0 ); ### Redirect errors to file ### -*STDERR = output_handle() unless $Verbose; +### The code in IPC::Cmd::_open3_run() uses a pipe to get the child's stderr +### output and IPC::Open3::_open3() will not dup the child's error end to the +### original STDERR FD. Instead it will assign the pipe's write end FD, which +### will be CLOEXEC. On exec() this FD will be closed and the select()+read() +### loop in IPC::Cmd::_open3_run() will become very busy, since select() +### will always return immediately due to the half-closed pipe. +#*STDERR = output_handle() unless $Verbose; ### dont uncomment this, it screws up where STDOUT goes and makes ### test::harness create test counter mismatches Index: lib/Module/Build.pm =================================================================== --- lib/Module/Build.pm (.../vendor/perl/current) (revision 21) +++ lib/Module/Build.pm (.../trunk) (revision 21) @@ -30,6 +30,7 @@ dynixptx Unix freebsd Unix linux Unix + haiku Unix hpux Unix irix Unix darwin Unix Index: lib/Term/ReadLine.pm =================================================================== --- lib/Term/ReadLine.pm (.../vendor/perl/current) (revision 21) +++ lib/Term/ReadLine.pm (.../trunk) (revision 21) @@ -222,7 +222,8 @@ $console = "sys\$command"; } - if (($^O eq 'amigaos') || ($^O eq 'beos') || ($^O eq 'epoc')) { + if (($^O eq 'amigaos') || ($^O eq 'beos') || ($^O eq 'epoc') || + ($^O eq 'haiku')) { $console = undef; } elsif ($^O eq 'os2') { Index: lib/ExtUtils/MM.pm =================================================================== --- lib/ExtUtils/MM.pm (.../vendor/perl/current) (revision 21) +++ lib/ExtUtils/MM.pm (.../trunk) (revision 21) @@ -69,6 +69,7 @@ $Is{VOS} = $^O eq 'vos'; $Is{QNX} = $^O eq 'qnx'; $Is{AIX} = $^O eq 'aix'; +$Is{Haiku} = $^O eq 'haiku'; $Is{Unix} = !grep { $_ } values %Is; Index: lib/ExtUtils/MM_Haiku.pm =================================================================== --- lib/ExtUtils/MM_Haiku.pm (.../vendor/perl/current) (revision 0) +++ lib/ExtUtils/MM_Haiku.pm (.../trunk) (revision 21) @@ -0,0 +1,62 @@ +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; + +use vars qw(@ISA $VERSION); +@ISA = qw( ExtUtils::MM_Any ExtUtils::MM_Unix ); +$VERSION = '6.42'; + + +=item os_flavor + +Haiku is Haiku. + +=cut + +sub os_flavor { + return('Haiku'); +} + +=item init_linker + +libperl.a equivalent to be linked to dynamic extensions. + +=cut + +sub init_linker { + my($self) = shift; + + $self->{PERL_ARCHIVE} ||= + File::Spec->catdir('$(PERL_INC)',$Config{libperl}); + $self->{PERL_ARCHIVE_AFTER} ||= ''; + $self->{EXPORT_LIST} ||= ''; +} + +=back + +1; +__END__ + Index: t/io/fs.t =================================================================== --- t/io/fs.t (.../vendor/perl/current) (revision 21) +++ t/io/fs.t (.../trunk) (revision 21) @@ -275,7 +275,7 @@ is( $atime, 500000001, 'atime' ); is( $mtime, 500000000 + $delta, 'mtime' ); } - elsif ($^O eq 'beos') { + elsif ($^O eq 'beos' || $^O eq 'haiku') { SKIP: { skip "atime not updated", 1; } Index: hints/haiku.sh =================================================================== --- hints/haiku.sh (.../vendor/perl/current) (revision 0) +++ hints/haiku.sh (.../trunk) (revision 21) @@ -0,0 +1,56 @@ +# Haiku hints file +# $Id$ + +prefix="/boot/home/config" + +libpth='/boot/home/config/lib /boot/common/lib /boot/beos/system/lib' +usrinc='/boot/develop/headers/posix' +locinc='/boot/home/config/include /boot/common/include /boot/develop/headers' + +libc='/boot/beos/system/lib/libroot.so' +libs=' ' + +#d_bcmp='define' +#d_bcopy='define' +#d_bzero='define' +#d_index='define' +#d_htonl='define' # It exists, but much hackery would be required to support. +# a bunch of extra includes would have to be added, and it's only used at +# one place in the non-socket perl code. + +#these are all in libdll.a, which my version of nm doesn't know how to parse. +#if I can get it to both do that, and scan multiple library files, perhaps +#these can be gotten rid of. + +case "$usemymalloc" in +'') usemymalloc='n' ;; +esac +# Hopefully, Be's malloc knows better than perl's. + +d_link='undef' +dont_use_nlink='define' +# no posix (aka hard) links for us! + +d_syserrlst='undef' +# the array syserrlst[] is useless for the most part. +# large negative numbers really kind of suck in arrays. + +# Sockets didn't use to be real sockets but BONE changes this. +#if [ ! -f /boot/develop/headers/be/bone/sys/socket.h ]; then +# d_socket='undef' +# d_gethbyaddr='undef' +# d_gethbyname='undef' +# d_getsbyname='undef' +# +# libs='-lnet' +#fi + + +cc="gcc" +ld='gcc' + +export PATH="$PATH:$PWD/haiku" + +case "$ldlibpthname" in +'') ldlibpthname=LIBRARY_PATH ;; +esac Index: ext/Errno/Errno_pm.PL =================================================================== --- ext/Errno/Errno_pm.PL (.../vendor/perl/current) (revision 21) +++ ext/Errno/Errno_pm.PL (.../trunk) (revision 21) @@ -155,7 +155,7 @@ # we might miss out on compiler-specific ones $file{"$ENV{GUSI}include:sys:errno.h"} = 1; - } elsif ($^O eq 'beos') { + } elsif ($^O eq 'beos' || $^O eq 'haiku') { # hidden in a special place $file{'/boot/develop/headers/posix/errno.h'} = 1; @@ -250,7 +250,8 @@ close(CPPI); - unless ($^O eq 'MacOS' || $^O eq 'beos') { # trust what we have / get later + unless ($^O eq 'MacOS' || $^O eq 'beos' || $^O eq 'haiku') { + # trust what we have / get later # invoke CPP and read the output if ($^O eq 'VMS') { @@ -293,12 +294,12 @@ # Many of the E constants (including ENOENT, which is being # used in the Perl test suite a lot), are available only as - # enums in BeOS, so compiling and executing some code is about + # enums in BeOS/Haiku, so compiling and executing some code is about # only way to find out what the numeric Evalues are. In fact above, we # didn't even bother to get the values of the ones that have numeric # values, since we can get all of them here, anyway. - if ($^O eq 'beos') { + if ($^O eq 'beos' || $^O eq 'haiku') { if (open(C, ">errno.c")) { my @allerrs = keys %err; print C < 'Haiku', + VERSION_FROM => 'Haiku.pm', +# LIBS => \@libs, + INSTALLDIRS => ($] >= 5.008004 ? 'perl' : 'site'), + NO_META => 1, + + AUTHOR => 'Ingo Weinhold ', + ABSTRACT_FROM => 'Haiku.pm', +); Index: ext/Haiku/Haiku.xs =================================================================== --- ext/Haiku/Haiku.xs (.../vendor/perl/current) (revision 0) +++ ext/Haiku/Haiku.xs (.../trunk) (revision 21) @@ -0,0 +1,141 @@ +#define PERL_NO_GET_CONTEXT +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#include + +#include + +static void +haiku_do_debugger(const char* format,...) +{ + char buffer[1024]; + va_list args; + va_start(args, format); + my_vsnprintf(buffer, sizeof(buffer), format, args); + va_end(args); + + debugger(buffer); +} + +static void +haiku_do_debug_printf(pTHX_ register SV *sv, + void (*printfFunc)(const char*,...)) +{ + dVAR; + + if (!sv) + return; + if (SvTYPE(sv) == SVt_IV && SvIOK(sv)) { + assert(!SvGMAGICAL(sv)); + if (SvIsUV(sv)) + (*printfFunc)("%"UVuf, (UV)SvUVX(sv)); + else + (*printfFunc)("%"IVdf, (IV)SvIVX(sv)); + return; + } + else { + STRLEN len; + /* Do this first to trigger any overloading. */ + const char *tmps = SvPV_const(sv, len); + U8 *tmpbuf = NULL; +#undef strnlen +if (strnlen(tmps, len) != len) +haiku_do_debugger("haiku_do_debug_printf(): len: %lu, acually: %lu", +len, strnlen(tmps, len)); + + if (!SvUTF8(sv)) { + /* We don't modify the original scalar. */ + tmpbuf = bytes_to_utf8((const U8*) tmps, &len); + tmps = (char *) tmpbuf; + } + + if (len) + (*printfFunc)("%.*s", (int)len, tmps); + Safefree(tmpbuf); + } +} + +XS(haiku_debug_printf) +{ + dVAR; + dXSARGS; + dORIGMARK; + SV *sv; + + if (items < 1) + Perl_croak(aTHX_ "usage: Haiku::debug_printf($format,...)"); + + sv = newSV(0); + + if (SvTAINTED(MARK[1])) + TAINT_PROPER("debug_printf"); + do_sprintf(sv, SP - MARK, MARK + 1); + + haiku_do_debug_printf(sv, &debug_printf); + + SvREFCNT_dec(sv); + SP = ORIGMARK; + PUSHs(&PL_sv_yes); +} + +XS(haiku_ktrace_printf) +{ + dVAR; + dXSARGS; + dORIGMARK; + SV *sv; + + if (items < 1) + Perl_croak(aTHX_ "usage: Haiku::debug_printf($format,...)"); + + sv = newSV(0); + + if (SvTAINTED(MARK[1])) + TAINT_PROPER("ktrace_printf"); + do_sprintf(sv, SP - MARK, MARK + 1); + + haiku_do_debug_printf(sv, &ktrace_printf); + + SvREFCNT_dec(sv); + SP = ORIGMARK; + PUSHs(&PL_sv_yes); +} + +XS(haiku_debugger) +{ + dVAR; + dXSARGS; + dORIGMARK; + SV *sv; + + if (items < 1) + Perl_croak(aTHX_ "usage: Haiku::debugger($format,...)"); + + sv = newSV(0); + + if (SvTAINTED(MARK[1])) + TAINT_PROPER("debugger"); + do_sprintf(sv, SP - MARK, MARK + 1); + + haiku_do_debug_printf(sv, &haiku_do_debugger); + + SvREFCNT_dec(sv); + SP = ORIGMARK; + PUSHs(&PL_sv_yes); +} + +MODULE = Haiku PACKAGE = Haiku + +PROTOTYPES: DISABLE + +BOOT: +{ + char *file = __FILE__; + + newXS("Haiku::debug_printf", haiku_debug_printf, file); + newXS("Haiku::ktrace_printf", haiku_ktrace_printf, file); + newXS("Haiku::debugger", haiku_debugger, file); + XSRETURN_YES; +} Index: ext/Haiku/Haiku.pm =================================================================== --- ext/Haiku/Haiku.pm (.../vendor/perl/current) (revision 0) +++ ext/Haiku/Haiku.pm (.../trunk) (revision 21) @@ -0,0 +1,54 @@ +package Haiku; + +BEGIN { + use strict; + use vars qw|$VERSION $XS_VERSION @ISA @EXPORT @EXPORT_OK|; + + require Exporter; + require DynaLoader; + + @ISA = qw|Exporter DynaLoader|; + $VERSION = '0.34'; + $XS_VERSION = $VERSION; + $VERSION = eval $VERSION; + + @EXPORT = qw( + ); + @EXPORT_OK = qw( + ); +} + +bootstrap Haiku; + +1; + +__END__ + +=head1 NAME + +Haiku - Interfaces to some Haiku API Functions + +=head1 DESCRIPTION + +The Haiku module contains functions to access Haiku APIs. + +=head2 Alphabetical Listing of Haiku Functions + +=over + +=item Haiku::debug_printf(FORMAT,...) + +Similar to printf, but prints to system debug output. + +=item Haiku::debugger(FORMAT,...) + +Drops the program into the debugger. The printf like arguments define the +debugger message. + +=item Haiku::ktrace_printf(FORMAT,...) + +Similar to printf, but prints to a kernel tracing entry. + +=back + +=cut Index: Configure =================================================================== --- Configure (.../vendor/perl/current) (revision 21) +++ Configure (.../trunk) (revision 21) @@ -7864,6 +7864,7 @@ case "$lddlflags" in '') case "$osname" in beos) dflt='-nostart' ;; + haiku) dflt='-nostart' ;; hpux) dflt='-b'; case "$gccversion" in '') dflt="$dflt +vnocompatwarnings" ;; @@ -7946,7 +7947,7 @@ ;; *) case "$useshrplib" in '') case "$osname" in - svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*) + svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*|haiku) dflt=y also='Building a shared libperl is required for dynamic loading to work on your system.' ;; @@ -8109,6 +8110,9 @@ beos) # beos doesn't like the default, either. ;; + haiku) + # Haiku doesn't like the default, either. + ;; hpux*) # hpux doesn't like the default, either. tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""