pygoocanvas r229 - trunk



Author: arminb
Date: Fri Nov 14 22:31:35 2008
New Revision: 229
URL: http://svn.gnome.org/viewvc/pygoocanvas?rev=229&view=rev

Log:
2008-11-14  Armin Burgmeier  <armin arbur net>

	* acinclude.m4: Obtain flags for linking against python. This is
	required on Windows, since shared libraries are not allowed to contain
	undefined references.

	* Makefile.am: Added the -no-undefined flag to ldflags to create a
	shared library on Windows, and rename the resulting file to .pyd,
	since python modules must end on .pyd on Windows (even though they are
	actually DLL files).


Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/acinclude.m4

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Fri Nov 14 22:31:35 2008
@@ -13,9 +13,9 @@
 
 # goocanvas module
 pyexec_LTLIBRARIES = goocanvasmodule.la
-goocanvasmodule_la_LDFLAGS = -module -avoid-version -export-symbols-regex initgoocanvas
+goocanvasmodule_la_LDFLAGS = -module -avoid-version -no-undefined -export-symbols-regex initgoocanvas
 goocanvasmodule_la_CFLAGS = $(PYGOOCANVAS_CFLAGS)
-goocanvasmodule_la_LIBADD = $(PYGOOCANVAS_LIBS)
+goocanvasmodule_la_LIBADD = $(PYGOOCANVAS_LIBS) $(PYTHON_LDFLAGS)
 goocanvasmodule_la_SOURCES = goocanvasmodule.c 
 nodist_goocanvasmodule_la_SOURCES = goocanvas.c
 goocanvas.c: goocanvas.defs goocanvas.override arg-types.py
@@ -38,3 +38,10 @@
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = pygoocanvas.pc
 EXTRA_DIST += pygoocanvas.pc
+
+if PLATFORM_WIN32
+# Python .pyd modules are simply DLLs, but they have to be called .pyd for
+# python to find them, and libtool only creates .dll.
+install-exec-hook:
+	mv $(pyexecdir)/goocanvasmodule.dll $(pyexecdir)/goocanvas.pyd
+endif

Modified: trunk/acinclude.m4
==============================================================================
--- trunk/acinclude.m4	(original)
+++ trunk/acinclude.m4	Fri Nov 14 22:31:35 2008
@@ -59,6 +59,40 @@
 [AC_MSG_RESULT(not found)
 $2])
 CPPFLAGS="$save_CPPFLAGS"
+
+	# This bit is copied from Planner. murrayc.
+	# Check for Python library path
+        AC_MSG_CHECKING([for Python library path])
+
+	# Win32 has libpython25.a instead of libpython2.5.a, so we look
+	# for both. TODO: Only look for libpython25.a on Windows, and for
+	# libpython2.5.a on unix.
+	WIN32_PYTHON_VERSION=`echo $PYTHON_VERSION | sed "s,\.,,"`
+
+        python_path=`dirname $PYTHON | sed "s,/bin.*$,,"`
+        for i in "$python_path/lib/python$PYTHON_VERSION/config/" "$python_path/lib/python$PYTHON_VERSION/" "$python_path/lib/python/config/" "$python_path/lib/python/" "$python_path/" ; do
+		if test -e "$i"; then
+	                python_path=`find $i -type f -name libpython$PYTHON_VERSION.* -print | sed "1q"`
+        	        if test -n "$python_path" ; then
+				python_lib="python$PYTHON_VERSION"
+                	        break
+	                fi
+
+			# Additionally test WIN32_PYTHON_VERSION
+	                python_path=`find $i -type f -name libpython$WIN32_PYTHON_VERSION.* -print | sed "1q"`
+        	        if test -n "$python_path" ; then
+				python_lib="python$WIN32_PYTHON_VERSION"
+                	        break
+	                fi
+		fi
+        done
+
+        python_path=`echo $python_path | sed "s,/libpython.*$,,"`
+        AC_MSG_RESULT([$python_path])
+        if test -z "$python_path" ; then
+                AC_MSG_ERROR([cannot find Python library path])
+        fi
+        AC_SUBST([PYTHON_LDFLAGS],["-L$python_path -l$python_lib"])
 ])
 
 dnl



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