From b2d16d9654e071417e838174431fcb1fe60ae3a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20K=C3=BChling?= Date: Wed, 28 Mar 2012 03:22:54 +0200 Subject: [PATCH] new package: alpy: python bindings for allegro game library (currently crashes on allegro_init(), dlopen unresolved symbol issue?) --- alpy/Makefile | 84 +++++++++++++++++++++++++++++++++++++++ alpy/patches/005-dl.patch | 27 +++++++++++++ 2 files changed, 111 insertions(+) create mode 100644 alpy/Makefile create mode 100644 alpy/patches/005-dl.patch diff --git a/alpy/Makefile b/alpy/Makefile new file mode 100644 index 0000000..da0833e --- /dev/null +++ b/alpy/Makefile @@ -0,0 +1,84 @@ +# +# Copyright (C) 2012 David Kuehling +# +# License GPLv2 or later. NO WARRANTY. +# +# OpenWRT package for Alpy: Allegro Game Library bindings for Python + +include $(TOPDIR)/rules.mk + +PKG_NAME:=alpy +PKG_VERSION:=0.1.5 +PKG_RELEASE:=1 +PKG_SOURCE:=Alpy-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=@SF/project/pyallegro/alpy/alpy-$(PKG_VERSION) +PKG_MD5SUM:=862925d97931fc81d1e4c3b9159fe2b1 +PKG_BUILD_DIR:=$(BUILD_DIR)/Alpy-$(PKG_VERSION) +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk +$(call include_mk, python-package.mk) + +define Package/alpy/Default + SECTION:=libs + CATEGORY:=Languages + TITLE:=Alpy (Allegro bindings for Python) + URL:=https://sourceforge.net/projects/forth-alpy/ + DEPENDS:=+python-mini +liballegro +endef + +define Package/alpy/Default/description +Python bindings for the Allegro Game and Graphics Library +endef + +define Package/alpy +$(call Package/alpy/Default) +endef + +define Package/alpy/description +$(call Package/alpy/Default/description) +endef + +CONFIGURE_ARGS += + +define Build/Compile + $(call Build/Compile/PyMod,,build) +endef +# --prefix="$(PKG_INSTALL_DIR)/usr" , \ +# LOCALBASE="$(STAGING_DIR)/usr" \ +# NO_SCRAP=1 \ +# ) + +# define Build/Configure +# # $(call Build/Configure/Default) +# endef + +# define Build/Compile +# CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CFLAGS) $(TARGET_LDFLAGS)" \ +# $(PKG_BUILD_DIR)/setup.py build +# endef + +TARGET_LDFLAGS += -lalleg -lm -lpthread + +define Build/Install + $(call Build/Compile/PyMod,, \ + install --root $(PKG_INSTALL_DIR) --prefix=/usr) +endef + +# define Package/alpy/install +# $(INSTALL_DIR) $(1)/usr +# $(CP) $(PKG_INSTALL_DIR)/usr/* $(1)/usr/ +# endef + +define PyPackage/alpy/filespec ++|$(PYTHON_PKG_DIR)/alpy.py ++|$(PYTHON_PKG_DIR)/_alpy.so +endef + +$(eval $(call PyPackage,alpy)) +$(eval $(call BuildPackage,alpy)) + +# The following comments configure the Emacs editor. Just ignore them. +# Local Variables: +# compile-command: "make -C ~/h/src/qi/openwrt-xburst package/alpy/compile -j2 V=99" +# End: diff --git a/alpy/patches/005-dl.patch b/alpy/patches/005-dl.patch new file mode 100644 index 0000000..58d1181 --- /dev/null +++ b/alpy/patches/005-dl.patch @@ -0,0 +1,27 @@ +Index: Alpy-0.1.5/alpy.py +=================================================================== +--- Alpy-0.1.5.orig/alpy.py 2012-03-28 03:07:42.682184386 +0200 ++++ Alpy-0.1.5/alpy.py 2012-03-28 03:08:24.794378142 +0200 +@@ -32,18 +32,18 @@ + if not _ALLEGRO_USE_MODULES: + return __import__('_alpy') + _major, _minor = sys.version_info[:2] +- try: import dl ++ try: import DLFCN + except ImportError: +- msg = "Sorry, to be able to use Allegro loadable modules you need to install the 'dl' module: you can still use Alpy, but some features will not be available" ++ msg = "Sorry, to be able to use Allegro loadable modules you need to install the 'DLFCN' module: you can still use Alpy, but some features will not be available" + print >> sys.stderr, "Warning: %s\n" % msg + return __import__('_alpy') + if _major > 2 or (_major == 2 and _minor >= 2): +- sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL) ++ sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) + return __import__('_alpy') + else: + file, path, desc = imp.find_module('_alpy') + try: +- handle = dl.open(path, dl.RTLD_NOW|dl.RTLD_GLOBAL) ++ handle = DLFCN.open(path, DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) + m = __import__('_alpy') + handle.close() + return m