[libglib-perl] 03/11: Fix libpthread-related building issues on OpenBSD

Intrigeri intrigeri at moszumanska.debian.org
Thu Mar 19 13:29:28 UTC 2015


This is an automated email from the git hooks/post-receive script.

intrigeri pushed a commit to branch experimental
in repository libglib-perl.

commit 5f57bcd0da25c0ed537d9ddbef0d7e8451c0e3bd
Author: Torsten Schönfeld <kaffeetisch at gmx.de>
Date:   Sun Nov 2 16:53:12 2014 +0100

    Fix libpthread-related building issues on OpenBSD
    
    On OpenBSD, any program that directly or indirectly wants to load libpthread.so
    must do so from the start.  But when perl is built without ithreads, it will
    also most likely not be compiled with "-pthread".  When libglib/libgobject then
    go and try to load libpthread.so, the loader will error out.
    
    Fix by setting LD_PRELOAD=libpthread.so at the relevant points in the build and
    test process.
---
 Makefile.PL            | 17 ++++++++++++++++-
 lib/Glib/MakeHelper.pm | 12 ++++++------
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index a59cc8c..6a3936d 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -192,6 +192,20 @@ $glib->save_config ('build/IFiles.pm');
 our @exports;
 require 'Glib.exports';
 
+# On OpenBSD, any program that directly or indirectly wants to load
+# libpthread.so must do so from the start.  But when perl is built without
+# ithreads, it will also most likely not be compiled with "-pthread".  When
+# libglib/libgobject then go and try to load libpthread.so, the loader will
+# error out.
+my @openbsd_compat_flags = ();
+if ($^O eq 'openbsd' && $Config::Config{ldflags} !~ m/-pthread\b/) {
+  warn " ***\n *** on OpenBSD, we either need perl linked with '-pthread',\n",
+       " ***   or we need to set LD_PRELOAD=libpthread.so; doing the latter now...\n ***\n";
+  @openbsd_compat_flags = (
+    macro => {FULLPERLRUN => 'LD_PRELOAD=libpthread.so $(FULLPERL)'},
+  );
+}
+
 WriteMakefile(
     NAME		=> 'Glib',
     VERSION_FROM	=> 'lib/Glib.pm', # finds $VERSION
@@ -203,6 +217,7 @@ WriteMakefile(
     DL_FUNCS		=> { Glib => [] },
     META_MERGE		=> \%meta_merge,
     $glib ? $glib->get_makefile_vars : (),
+    @openbsd_compat_flags,
 );
 
 =unstable
@@ -250,7 +265,7 @@ build/podindex :: \$(INST_LIB)/Glib/GenPod.pm
 
 \$(INST_LIB)/\$(FULLEXT)/xsapi.pod :: build/doc.pl apidoc.pl xsapi.pod.head xsapi.pod.foot
 	\$(NOECHO) \$(ECHO) Creating XS API documentation...
-	\$(NOECHO) $^X apidoc.pl xsapi.pod.head xsapi.pod.foot build/doc.pl > \$@
+	\$(NOECHO) \$(FULLPERLRUN) apidoc.pl xsapi.pod.head xsapi.pod.foot build/doc.pl > \$@
 
 "
 	     . Glib::MakeHelper->postamble_precompiled_headers (qw/gperl.h/)
diff --git a/lib/Glib/MakeHelper.pm b/lib/Glib/MakeHelper.pm
index f79ed19..1083d71 100644
--- a/lib/Glib/MakeHelper.pm
+++ b/lib/Glib/MakeHelper.pm
@@ -422,7 +422,7 @@ build/blib_done_ :: build/blib_done_dynamic
 
 build/doc.pl :: Makefile @xs_files
 	\$(NOECHO) \$(ECHO) Parsing XS files...
-	\$(NOECHO) $^X -I \$(INST_LIB) -I \$(INST_ARCHLIB) -MGlib::ParseXSDoc \\
+	\$(NOECHO) \$(FULLPERLRUN) -I \$(INST_LIB) -I \$(INST_ARCHLIB) -MGlib::ParseXSDoc \\
 		-e "xsdocparse (qw(@xs_files))" > \$@
 
 # passing all of these files through the single podindex file, which is 
@@ -432,18 +432,18 @@ build/doc.pl :: Makefile @xs_files
 
 build/podindex :: \$(BLIB_DONE) Makefile build/doc.pl \$(POD_DEPENDS)
 	\$(NOECHO) \$(ECHO) Generating POD...
-	\$(NOECHO) $^X -I \$(INST_LIB) -I \$(INST_ARCHLIB) -MGlib::GenPod -M\$(NAME) \\
+	\$(NOECHO) \$(FULLPERLRUN) -I \$(INST_LIB) -I \$(INST_ARCHLIB) -MGlib::GenPod -M\$(NAME) \\
 		-e "$docgen_code"
 
 \$(INST_LIB)/\$(FULLEXT)/:
-	$^X -MExtUtils::Command -e mkpath \$@
+	\$(FULLPERLRUN) -MExtUtils::Command -e mkpath \$@
 
 \$(INST_LIB)/\$(FULLEXT)/index.pod :: \$(INST_LIB)/\$(FULLEXT)/ build/podindex
 	\$(NOECHO) \$(ECHO) Creating POD index...
-	\$(NOECHO) $^X -e "print qq(\\n=head1 NAME\\n\\n\$(NAME) - API Reference Pod Index\\n\\n=head1 PAGES\\n\\n=over\\n\\n)" \\
+	\$(NOECHO) \$(FULLPERLRUN) -e "print qq(\\n=head1 NAME\\n\\n\$(NAME) - API Reference Pod Index\\n\\n=head1 PAGES\\n\\n=over\\n\\n)" \\
 		> \$(INST_LIB)/\$(FULLEXT)/index.pod
-	\$(NOECHO) $^X -ne "print q(=item L<) . (split q( ))[1] . qq(>\\n\\n);" < build/podindex >> \$(INST_LIB)/\$(FULLEXT)/index.pod
-	\$(NOECHO) $^X -e "print qq(=back\\n\\n);" >> \$(INST_LIB)/\$(FULLEXT)/index.pod
+	\$(NOECHO) \$(FULLPERLRUN) -ne "print q(=item L<) . (split q( ))[1] . qq(>\\n\\n);" < build/podindex >> \$(INST_LIB)/\$(FULLEXT)/index.pod
+	\$(NOECHO) \$(FULLPERLRUN) -e "print qq(=back\\n\\n);" >> \$(INST_LIB)/\$(FULLEXT)/index.pod
 __EOM__
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libglib-perl.git



More information about the Pkg-perl-cvs-commits mailing list