From 6f8c21fa7422855ef46377a32205309a82dfd53f Mon Sep 17 00:00:00 2001 From: Nicholas Clark Date: Sun, 23 Oct 2011 18:39:04 +0100 Subject: bisect-runner.pl now builds test_prep on OpenBSD back to 5.002 The historical OpenBSD hints file needs tweaking for compiler and linker flags, and needs to be provided for revisions before it was added to the source tree. perl.h and pp_sys.c need patching with the current (i.e. post 1996) #ifdef forest for [gs]etpgrp() variants. perl.h needs to include on OpenBSD, else POSIX.xs won't build. OpenBSD also requires all the parallel Makefile fixes, as its make builds targets in reverse lexical order, which reveals a lot of assumptions about build order. (Such as Cwd nearly always being built in time, because it sorts lexically far ahead of other XS modules dependant on it.) --- Porting/bisect-runner.pl | 309 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 309 insertions(+) diff --git a/Porting/bisect-runner.pl b/Porting/bisect-runner.pl index 0caa64edb6..bcd8e07243 100755 --- a/Porting/bisect-runner.pl +++ b/Porting/bisect-runner.pl @@ -939,6 +939,292 @@ index 2a6cbcd..eab2de1 100644 EOPATCH } } +} elsif ($^O eq 'openbsd') { + if (!-f 'hints/openbsd.sh') { + system 'git show 43051805d53a3e4c:hints/openbsd.sh > hints/openbsd.sh' + and die; + } + + if ($major < 8) { + my $which = extract_from_file('hints/openbsd.sh', + qr/# from (2\.8|3\.1) onwards/, + ''); + if ($which eq '') { + my $was = extract_from_file('hints/openbsd.sh', + qr/(lddlflags="(?:-Bforcearchive )?-Bshareable)/); + # This is commit 154d43cbcf57271c and parts of 5c75dbfa77b0949c + # and 29b5585702e5e025 + apply_patch(sprintf <<'EOPATCH', $was); +diff --git a/hints/openbsd.sh b/hints/openbsd.sh +index a7d8bf2..5b79709 100644 +--- a/hints/openbsd.sh ++++ b/hints/openbsd.sh +@@ -37,7 +37,25 @@ OpenBSD.alpha|OpenBSD.mips|OpenBSD.powerpc|OpenBSD.vax) + # we use -fPIC here because -fpic is *NOT* enough for some of the + # extensions like Tk on some OpenBSD platforms (ie: sparc) + cccdlflags="-DPIC -fPIC $cccdlflags" +- %s $lddlflags" ++ case "$osvers" in ++ [01].*|2.[0-7]|2.[0-7].*) ++ lddlflags="-Bshareable $lddlflags" ++ ;; ++ 2.[8-9]|3.0) ++ ld=${cc:-cc} ++ lddlflags="-shared -fPIC $lddlflags" ++ ;; ++ *) # from 3.1 onwards ++ ld=${cc:-cc} ++ lddlflags="-shared -fPIC $lddlflags" ++ libswanted=`echo $libswanted | sed 's/ dl / /'` ++ ;; ++ esac ++ ++ # We need to force ld to export symbols on ELF platforms. ++ # Without this, dlopen() is crippled. ++ ELF=`${cc:-cc} -dM -E - = 0 ); ++#ifdef BSD_SETPGRP ++ SETi( BSD_SETPGRP(pid, pgrp) >= 0 ); + #else + if ((pgrp != 0) || (pid != 0)) { + DIE("POSIX setpgrp can't take an argument"); +EOPATCH + } } if ($major < 10) { @@ -1215,6 +1501,29 @@ index 03c4d48..3c814a2 100644 EOPATCH } +if ($major < 8 && $^O eq 'openbsd' + && !extract_from_file('perl.h', qr/include /)) { + # This is part of commit 3f270f98f9305540, applied at a slightly different + # location in perl.h, where the context is stable back to 5.000 + apply_patch(<<'EOPATCH'); +diff --git a/perl.h b/perl.h +index 9418b52..b8b1a7c 100644 +--- a/perl.h ++++ b/perl.h +@@ -496,6 +496,10 @@ register struct op *Perl_op asm(stringify(OP_IN_REGISTER)); + # include + #endif + ++/* If this causes problems, set i_unistd=undef in the hint file. */ ++#ifdef I_UNISTD ++# include ++#endif + + /* Use all the "standard" definitions? */ + #if defined(STANDARD_C) && defined(I_STDLIB) +EOPATCH +} + if ($major < 10 and -f 'ext/IPC/SysV/SysV.xs') { edit_file('ext/IPC/SysV/SysV.xs', sub { my $xs = shift; -- cgit v1.2.1