[perl-Cairo] Fix libpthread-related building issues on OpenBSD



commit 4f6bef79cef42b4c0ff5626da2cc79c829cd0407
Author: Torsten Schönfeld <kaffeetisch gmx de>
Date:   Sun Nov 2 18:12:35 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 |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.PL b/Makefile.PL
index 1e374ad..eeeeae3 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -571,6 +571,20 @@ $dep->install (qw(cairo-perl.h
                   build/cairo-perl-auto.typemap));
 $dep->save_config ('build/IFiles.pm');
 
+# 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          => 'Cairo',
     #AUTHOR, LICENSE are now part of %meta_merge
@@ -582,6 +596,7 @@ WriteMakefile (
     DL_FUNCS      => { Cairo=> [] },
     META_MERGE    => \%meta_merge,
     $dep->get_makefile_vars,
+    @openbsd_compat_flags,
 );
 
 sub MY::postamble


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]