[PATCH 5/5] Fix issues w.r.t. MacPorts' libiberty to have Python bindings work.

* configure.ac (DARWIN): New conditional. * src/libiberty-fix.c: New. * src/Makefile.am (libdyn_la_SOURCES) [DARWIN]: Add libiberty-fix.c. --- dynamic-use-of-static-c++/ChangeLog | 9 +++++ dynamic-use-of-static-c++/configure.ac | 4 ++ dynamic-use-of-static-c++/src/Makefile.am | 7 ++++ dynamic-use-of-static-c++/src/libiberty-fix.c | 46 +++++++++++++++++++++++++ 4 files changed, 66 insertions(+), 0 deletions(-) create mode 100644 dynamic-use-of-static-c++/src/libiberty-fix.c diff --git a/dynamic-use-of-static-c++/ChangeLog b/dynamic-use-of-static-c++/ChangeLog index fef105e..ce53b40 100644 --- a/dynamic-use-of-static-c++/ChangeLog +++ b/dynamic-use-of-static-c++/ChangeLog @@ -1,5 +1,14 @@ 2009-10-29 Roland Levillain <roland@lrde.epita.fr> + Fix issues w.r.t. MacPorts' libiberty to have Python bindings work. + + * configure.ac (DARWIN): New conditional. + * src/libiberty-fix.c: New. + * src/Makefile.am (libdyn_la_SOURCES) [DARWIN]: Add + libiberty-fix.c. + +2009-10-29 Roland Levillain <roland@lrde.epita.fr> + Provide some Python bindings over dyn using SWIG. * Makefile.am (SUBDIRS): Add swig. diff --git a/dynamic-use-of-static-c++/configure.ac b/dynamic-use-of-static-c++/configure.ac index 2bbb19c..e6ff54b 100644 --- a/dynamic-use-of-static-c++/configure.ac +++ b/dynamic-use-of-static-c++/configure.ac @@ -95,6 +95,10 @@ AC_SUBST(LIBLTDL) DYN_LIBIBERTY +# Are we running on Darwin (Mac OS X)? If so, we'll have to deal with +# MacPorts' libiberty's issues w.r.t `environ'. +AM_CONDITIONAL([DARWIN], [echo "$host_os" | grep '^darwin']) + ## ------ ## ## Boost. ## ## ------ ## diff --git a/dynamic-use-of-static-c++/src/Makefile.am b/dynamic-use-of-static-c++/src/Makefile.am index da9a4cf..ea01751 100644 --- a/dynamic-use-of-static-c++/src/Makefile.am +++ b/dynamic-use-of-static-c++/src/Makefile.am @@ -61,6 +61,13 @@ libdyn_la_SOURCES = \ ruby_stream.hh ruby_stream.cc \ ansidecl.h demangle.h config.hh +# Provide a dummy `environ' symbol expected by libiberty (from the +# MacPorts), but missing on Mac OS X. This is just a workaround. We +# should file a problem report to the MacPorts about this. +if DARWIN + libdyn_la_SOURCES += libiberty-fix.c +endif DARWIN + libdyn_la_LIBADD = @RUBY_LIBRUBYARG_SHARED@ $(LIBLTDL) \ $(top_builddir)/libmd5/libmd5.la $(BOOST_FILESYSTEM_LIBS) libdyn_la_DEPENDENCIES = $(LTDLDEPS) diff --git a/dynamic-use-of-static-c++/src/libiberty-fix.c b/dynamic-use-of-static-c++/src/libiberty-fix.c new file mode 100644 index 0000000..6010944 --- /dev/null +++ b/dynamic-use-of-static-c++/src/libiberty-fix.c @@ -0,0 +1,46 @@ +/* Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE) + + This file is part of Olena. + + Olena is free software: you can redistribute it and/or modify it under + the terms of the GNU General Public License as published by the Free + Software Foundation, version 2 of the License. + + Olena is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Olena. If not, see <http://www.gnu.org/licenses/>. + + As a special exception, you may use this file as part of a free + software project without restriction. Specifically, if other files + instantiate templates or use macros or inline functions from this + file, or you compile this file and link it with other files to produce + an executable, this file does not by itself cause the resulting + executable to be covered by the GNU General Public License. This + exception does not however invalidate any other reasons why the + executable file might be covered by the GNU General Public License. */ + + +/** \file + \brief An ugly workaround to have libiberty (glued into libdyn) + find the \c environ symbol. + + Everything should run well as long as we do not use it, nor any + function depending on it. + + The recommended solution (see + http://www.gnu.org/software/gnulib/manual/gnulib.html#environ) is + to patch the guilty source by prepending these lines: + + \code + #include <crt_externs.h> + #define environ (*_NSGetEnviron()) + \endcode + + Alas, we depend on a <em>compiled</em> libiberty, so we cheat by + providing a dummy \c environ. */ + +char** environ = 0; -- 1.6.5
participants (1)
-
Roland Levillain