alpy/Makefile |
| 1 | # |
| 2 | # Copyright (C) 2012 David Kuehling <dvdkhlng TA gmx TOD de> |
| 3 | # |
| 4 | # License GPLv2 or later. NO WARRANTY. |
| 5 | # |
| 6 | # OpenWRT package for Alpy: Allegro Game Library bindings for Python |
| 7 | |
| 8 | include $(TOPDIR)/rules.mk |
| 9 | |
| 10 | PKG_NAME:=alpy |
| 11 | PKG_VERSION:=0.1.5 |
| 12 | PKG_RELEASE:=1 |
| 13 | PKG_SOURCE:=Alpy-$(PKG_VERSION).tar.gz |
| 14 | PKG_SOURCE_URL:=@SF/project/pyallegro/alpy/alpy-$(PKG_VERSION) |
| 15 | PKG_MD5SUM:=862925d97931fc81d1e4c3b9159fe2b1 |
| 16 | PKG_BUILD_DIR:=$(BUILD_DIR)/Alpy-$(PKG_VERSION) |
| 17 | PKG_INSTALL:=1 |
| 18 | |
| 19 | include $(INCLUDE_DIR)/package.mk |
| 20 | $(call include_mk, python-package.mk) |
| 21 | |
| 22 | define Package/alpy/Default |
| 23 | SECTION:=libs |
| 24 | CATEGORY:=Languages |
| 25 | TITLE:=Alpy (Allegro bindings for Python) |
| 26 | URL:=https://sourceforge.net/projects/forth-alpy/ |
| 27 | DEPENDS:=+python-mini +liballegro |
| 28 | endef |
| 29 | |
| 30 | define Package/alpy/Default/description |
| 31 | Python bindings for the Allegro Game and Graphics Library |
| 32 | endef |
| 33 | |
| 34 | define Package/alpy |
| 35 | $(call Package/alpy/Default) |
| 36 | endef |
| 37 | |
| 38 | define Package/alpy/description |
| 39 | $(call Package/alpy/Default/description) |
| 40 | endef |
| 41 | |
| 42 | CONFIGURE_ARGS += |
| 43 | |
| 44 | define Build/Compile |
| 45 | $(call Build/Compile/PyMod,,build) |
| 46 | endef |
| 47 | # --prefix="$(PKG_INSTALL_DIR)/usr" , \ |
| 48 | # LOCALBASE="$(STAGING_DIR)/usr" \ |
| 49 | # NO_SCRAP=1 \ |
| 50 | # ) |
| 51 | |
| 52 | # define Build/Configure |
| 53 | # # $(call Build/Configure/Default) |
| 54 | # endef |
| 55 | |
| 56 | # define Build/Compile |
| 57 | # CC="$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_CPPFLAGS) $(EXTRA_CFLAGS) $(TARGET_LDFLAGS)" \ |
| 58 | # $(PKG_BUILD_DIR)/setup.py build |
| 59 | # endef |
| 60 | |
| 61 | TARGET_LDFLAGS += -lalleg -lm -lpthread |
| 62 | |
| 63 | define Build/Install |
| 64 | $(call Build/Compile/PyMod,, \ |
| 65 | install --root $(PKG_INSTALL_DIR) --prefix=/usr) |
| 66 | endef |
| 67 | |
| 68 | # define Package/alpy/install |
| 69 | # $(INSTALL_DIR) $(1)/usr |
| 70 | # $(CP) $(PKG_INSTALL_DIR)/usr/* $(1)/usr/ |
| 71 | # endef |
| 72 | |
| 73 | define PyPackage/alpy/filespec |
| 74 | +|$(PYTHON_PKG_DIR)/alpy.py |
| 75 | +|$(PYTHON_PKG_DIR)/_alpy.so |
| 76 | endef |
| 77 | |
| 78 | $(eval $(call PyPackage,alpy)) |
| 79 | $(eval $(call BuildPackage,alpy)) |
| 80 | |
| 81 | # The following comments configure the Emacs editor. Just ignore them. |
| 82 | # Local Variables: |
| 83 | # compile-command: "make -C ~/h/src/qi/openwrt-xburst package/alpy/compile -j2 V=99" |
| 84 | # End: |
alpy/patches/005-dl.patch |
| 1 | Index: Alpy-0.1.5/alpy.py |
| 2 | =================================================================== |
| 3 | --- Alpy-0.1.5.orig/alpy.py 2012-03-28 03:07:42.682184386 +0200 |
| 4 | @@ -32,18 +32,18 @@ |
| 5 | if not _ALLEGRO_USE_MODULES: |
| 6 | return __import__('_alpy') |
| 7 | _major, _minor = sys.version_info[:2] |
| 8 | - try: import dl |
| 9 | + try: import DLFCN |
| 10 | except ImportError: |
| 11 | - 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" |
| 12 | + 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" |
| 13 | print >> sys.stderr, "Warning: %s\n" % msg |
| 14 | return __import__('_alpy') |
| 15 | if _major > 2 or (_major == 2 and _minor >= 2): |
| 16 | - sys.setdlopenflags(dl.RTLD_NOW|dl.RTLD_GLOBAL) |
| 17 | + sys.setdlopenflags(DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) |
| 18 | return __import__('_alpy') |
| 19 | else: |
| 20 | file, path, desc = imp.find_module('_alpy') |
| 21 | try: |
| 22 | - handle = dl.open(path, dl.RTLD_NOW|dl.RTLD_GLOBAL) |
| 23 | + handle = DLFCN.open(path, DLFCN.RTLD_NOW|DLFCN.RTLD_GLOBAL) |
| 24 | m = __import__('_alpy') |
| 25 | handle.close() |
| 26 | return m |