diff options
author | Nicholas Clark <nick@ccl4.org> | 2011-10-12 10:43:55 +0200 |
---|---|---|
committer | Nicholas Clark <nick@ccl4.org> | 2011-10-12 10:43:55 +0200 |
commit | 915f531bebf29a3e56e60e075eaac0f66cb59d44 (patch) | |
tree | be99f6af3eab36a74a1d44f48a387d64f7dc5c9a | |
parent | 5b36e9450efc47317616775e6c3eb0daba56035c (diff) | |
download | perl-915f531bebf29a3e56e60e075eaac0f66cb59d44.tar.gz |
bisect-runner.pl now builds test_prep on OS X back to 5.001n
bisect.pl is now suitable for general use on (at least) Linux, FreeBSD and
OS X. [Tested on Snow Leopard on a case-sensitive file system. The latter is
a requirement for some older intermediate revisions of perl]
bisect-runner.pl now sets $ENV{$Config{ldlibpthname}} before running the
supplied test case, which is necessary when perl is built with
useshrplib='true'
The historical Darwin hints require some tweaking for cflags and ldflags.
Adding the Darwin hints and dl_dyld.xs with minimal patching is sufficient
to build perl and all extensions back to 5.001n, allowing Darwin systems to
be used for general bisecting, not just Darwin specific issues.
-rwxr-xr-x | Porting/bisect-runner.pl | 129 |
1 files changed, 129 insertions, 0 deletions
diff --git a/Porting/bisect-runner.pl b/Porting/bisect-runner.pl index 965d932646..8aedf192d4 100755 --- a/Porting/bisect-runner.pl +++ b/Porting/bisect-runner.pl @@ -726,6 +726,123 @@ if ($^O eq 'freebsd') { ;; EOPATCH } +} elsif ($^O eq 'darwin') { + if ($major < 8) { + my $faking_it; + # We can't build on darwin without some of the data in the hints file. + foreach ('ext/DynaLoader/dl_dyld.xs', 'hints/darwin.sh') { + next if -f $_; + ++$faking_it; + # Probably less surprising to use the earliest version of + # hints/darwin.sh and then edit in place just below, than use + # blead's version, as that would create a discontinuity at + # f556e5b971932902 - before it, hints bugs would be "fixed", after + # it they'd resurface. This way, we should give the illusion of + # monotonic bug fixing. + system "git show f556e5b971932902:$_ >$_" + and die "while attempting to extract $_"; + } + if ($faking_it) { + apply_patch(<<'EOPATCH'); +diff -u a/ext/DynaLoader/dl_dyld.xs~ a/ext/DynaLoader/dl_dyld.xs +--- a/ext/DynaLoader/dl_dyld.xs~ 2011-10-11 21:41:27.000000000 +0100 ++++ b/ext/DynaLoader/dl_dyld.xs 2011-10-11 21:42:20.000000000 +0100 +@@ -41,6 +41,35 @@ + #include "perl.h" + #include "XSUB.h" + ++#ifndef pTHX ++# define pTHX void ++# define pTHX_ ++#endif ++#ifndef aTHX ++# define aTHX ++# define aTHX_ ++#endif ++#ifndef dTHX ++# define dTHXa(a) extern int Perl___notused(void) ++# define dTHX extern int Perl___notused(void) ++#endif ++ ++#ifndef Perl_form_nocontext ++# define Perl_form_nocontext form ++#endif ++ ++#ifndef Perl_warn_nocontext ++# define Perl_warn_nocontext warn ++#endif ++ ++#ifndef PTR2IV ++# define PTR2IV(p) (IV)(p) ++#endif ++ ++#ifndef get_av ++# define get_av perl_get_av ++#endif ++ + #define DL_LOADONCEONLY + + #include "dlutils.c" /* SaveError() etc */ +@@ -185,7 +191,7 @@ + CODE: + DLDEBUG(1,PerlIO_printf(Perl_debug_log, "dl_load_file(%s,%x):\n", filename,flags)); + if (flags & 0x01) +- Perl_warn(aTHX_ "Can't make loaded symbols global on this platform while loading %s",filename); ++ Perl_warn_nocontext("Can't make loaded symbols global on this platform while loading %s",filename); + RETVAL = dlopen(filename, mode) ; + DLDEBUG(2,PerlIO_printf(Perl_debug_log, " libref=%x\n", RETVAL)); + ST(0) = sv_newmortal() ; +EOPATCH + if ($major < 4 && !extract_from_file('util.c', qr/^form/m)) { + apply_patch(<<'EOPATCH'); +diff -u a/ext/DynaLoader/dl_dyld.xs~ a/ext/DynaLoader/dl_dyld.xs +--- a/ext/DynaLoader/dl_dyld.xs~ 2011-10-11 21:56:25.000000000 +0100 ++++ b/ext/DynaLoader/dl_dyld.xs 2011-10-11 22:00:00.000000000 +0100 +@@ -60,6 +60,18 @@ + # define get_av perl_get_av + #endif + ++static char * ++form(char *pat, ...) ++{ ++ char *retval; ++ va_list args; ++ va_start(args, pat); ++ vasprintf(&retval, pat, &args); ++ va_end(args); ++ SAVEFREEPV(retval); ++ return retval; ++} ++ + #define DL_LOADONCEONLY + + #include "dlutils.c" /* SaveError() etc */ +EOPATCH + } + } + + edit_file('hints/darwin.sh', sub { + my $code = shift; + # Part of commit 8f4f83badb7d1ba9, which mostly undoes + # commit 0511a818910f476c. + $code =~ s/^cppflags='-traditional-cpp';$/cppflags="\${cppflags} -no-cpp-precomp"/m; + # commit 14c11978e9b52e08/803bb6cc74d36a3f + # Without this, code in libperl.bundle links against op.o + # in preference to opmini.o on the linker command line, + # and hence miniperl tries to use File::Glob instead of + # csh + $code =~ s/^(lddlflags=)/ldflags="\${ldflags} -flat_namespace"\n$1/m; + # f556e5b971932902 also patches Makefile.SH with some + # special case code to deal with useshrplib for darwin. + # Given that post 5.8.0 the darwin hints default was + # changed to false, and it would be very complex to splice + # in that code in various versions of Makefile.SH back + # to 5.002, lets just turn it off. + $code =~ s/^useshrplib='true'/useshrplib='false'/m + if $faking_it; + return $code; + }); + } } if ($major < 10) { @@ -1074,6 +1191,18 @@ if (defined $options{'one-liner'}) { } # This is what we came here to run: + +if (exists $Config{ldlibpthname}) { + require Cwd; + my $varname = $Config{ldlibpthname}; + my $cwd = Cwd::getcwd(); + if (defined $ENV{$varname}) { + $ENV{$varname} = $cwd . $Config{path_sep} . $ENV{$varname}; + } else { + $ENV{$varname} = $cwd; + } +} + my $ret = system @ARGV; report_and_exit($ret, 'zero exit from', 'non-zero exit from', "@ARGV"); |