[pygobject] Support PEP 3149 (ABI version tagged .so files)



commit 6c22fea63fa6978c2a717ff12ff84d3aff776b5e
Author: Christoph Reiter <reiter christoph gmail com>
Date:   Tue Mar 26 16:03:59 2013 +0100

    Support PEP 3149 (ABI version tagged .so files)
    
    Add a ABI suffix to the shared library retrieved from distutils.sysconfig
    instead of hardcoding it. This should also make things more robust on Windows.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=696646

 configure.ac            |    3 +++
 gi/Makefile.am          |   14 +++++++-------
 gi/_glib/Makefile.am    |   14 +++++++-------
 gi/_gobject/Makefile.am |   14 +++++++-------
 4 files changed, 24 insertions(+), 21 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index f706814..bdd11b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -111,6 +111,9 @@ if test $build_py3k = true ; then
                          [AC_MSG_ERROR(too old)])
 fi
 
+PYTHON_SO=`$PYTHON -c "import distutils.sysconfig, sys; 
sys.stdout.write(distutils.sysconfig.get_config_var('SO'));"`
+AC_SUBST(PYTHON_SO)
+
 AM_CHECK_PYTHON_HEADERS(, AC_MSG_ERROR([Python headers not found]))
 if test "x$os_win32" = "xyes"; then
   AM_CHECK_PYTHON_LIBS(, AC_MSG_ERROR([Python libs not found. Windows requires Python modules to be 
explicitly linked to libpython.]))
diff --git a/gi/Makefile.am b/gi/Makefile.am
index 4d93133..c687d31 100644
--- a/gi/Makefile.am
+++ b/gi/Makefile.am
@@ -10,7 +10,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -20,8 +21,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 pygidir = $(pyexecdir)/gi
@@ -114,7 +114,7 @@ _gi_cairo_la_LDFLAGS = \
 # This is to ensure we have a symlink to the .so in the
 # build directory, which the Python interpreter can load
 # directly without having to know how to parse .la files.
-.la.so:
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
 
 # if we build in a separate tree, we need to symlink the *.py files from the
@@ -125,8 +125,8 @@ build_pylinks:
            [ -e $(builddir)/$$f ] || $(LN_S) $(srcdir)/$$f $(builddir)/$$f; \
        done
 
-all-local: $(LTLIBRARIES:.la=.so) build_pylinks
+all-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 
-check-local: $(LTLIBRARIES:.la=.so) build_pylinks
+check-local: $(LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(LTLIBRARIES:.la=.so)
+       rm -f $(LTLIBRARIES:.la=$(PYTHON_SO))
diff --git a/gi/_glib/Makefile.am b/gi/_glib/Makefile.am
index 9d802c5..774b7e1 100644
--- a/gi/_glib/Makefile.am
+++ b/gi/_glib/Makefile.am
@@ -6,7 +6,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -16,8 +17,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 
@@ -83,9 +83,9 @@ build_pylinks:
        done
 
 
-all: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pyglib_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pyglib_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pyglib_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@
diff --git a/gi/_gobject/Makefile.am b/gi/_gobject/Makefile.am
index d8613a9..5059ea7 100644
--- a/gi/_gobject/Makefile.am
+++ b/gi/_gobject/Makefile.am
@@ -10,7 +10,8 @@ extension_cppflags = \
 
 extension_ldflags = \
        -module \
-       -avoid-version
+       -avoid-version \
+       -shrext $(PYTHON_SO)
 
 if OS_WIN32
 # Windows requires Python modules to be explicitly linked to libpython.
@@ -20,8 +21,7 @@ extension_libadd = \
        $(PYTHON_LIBS)
 
 extension_ldflags += \
-       -no-undefined \
-       -shrext ".pyd"
+       -no-undefined
 endif
 
 pygobjectdir = $(pyexecdir)/gi/_gobject
@@ -79,9 +79,9 @@ build_pylinks:
        done
 
 
-all: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
-check-local: $(pygobject_LTLIBRARIES:.la=.so) build_pylinks
+all: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
+check-local: $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO)) build_pylinks
 clean-local:
-       rm -f $(pygobject_LTLIBRARIES:.la=.so)
-.la.so:
+       rm -f $(pygobject_LTLIBRARIES:.la=$(PYTHON_SO))
+%$(PYTHON_SO): %.la
        $(LN_S) -f .libs/$@ $@


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