Hi Devs,

as current PHP5 package maintainer I would like to share some thoughts
with you requesting your feedback and suggestions.

Currently, there are some PECl extensions for PHP which are patched
into the PHP core and then build as modules. This wasn't my initial idea
but the situation (e.g. APC module) when I took over maintainership. Yes, 
it works and I used it for several additional modules too (dio, http...).
But I think we could do it better: so I would like to split such PECL
extensions into their own Openwrt package.

So my questions are the following:
- What do you think about this?
- I didn't dared to commit outside the packages/lang/php5 directory.
  I don't know whether it is currently technically possible for me. But I
  would like to prior ask you for permission to do so for creating such
  new pecl packages.

I attach an initial version as example so that you could get a feeling,
what I'm planning to do.
It would be nice if you could drop me some feedback :-)

Thanks,
Michael

---

Index: lang/php5-pecl-apc/Makefile
===================================================================
--- lang/php5-pecl-apc/Makefile (revision 0)
+++ lang/php5-pecl-apc/Makefile (revision 0)
@@ -0,0 +1,34 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PECL_NAME:=APC
+PECL_LONGNAME:=Alternative PHP Cache
+
+PKG_VERSION:=3.1.9
+PKG_RELEASE:=1
+PKG_MD5SUM:=a2cf7fbf6f3a87f190d897a53260ddaa
+
+PKG_NAME:=php5-pecl-apc
+PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
+PKG_SOURCE_URL:=http://pecl.php.net/get/
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PECL_NAME)-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+include ../php5/pecl.mk
+
+CONFIGURE_ARGS+= \
+       --enable-apc=shared \
+       --disable-apc-mmap \
+       --disable-apc-pthreadmutex \
+
+$(eval $(call PECLPackage,apc,$(PECL_LONGNAME)))
+$(eval $(call BuildPackage,$(PKG_NAME)))
Index: lang/php5/pecl.mk
===================================================================
--- lang/php5/pecl.mk   (revision 0)
+++ lang/php5/pecl.mk   (revision 0)
@@ -0,0 +1,40 @@
+#
+# Copyright (C) 2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/php5-pecl/Default
+  SUBMENU:=PHP
+  SECTION:=lang
+  CATEGORY:=Languages
+  URL:=http://pecl.php.net/
+  MAINTAINER:=Michael Heimpold <m...@heimpold.de>
+  DEPENDS:=php5
+endef
+
+define Build/Configure
+       ( cd $(PKG_BUILD_DIR); $(STAGING_DIR_HOST)/usr/bin/phpize )
+       $(Build/Configure/Default)
+endef
+
+define PECLPackage
+
+  define Package/php5-pecl-$(1)
+    $(call Package/php5-pecl/Default)
+    TITLE:=$(2)
+
+    ifneq ($(3),)
+      DEPENDS+=$(3)
+    endif
+  endef
+
+  define Package/php5-pecl-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/php
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/modules/$(subst -,_,$(1)).so 
$$(1)/usr/lib/php/
+       $(INSTALL_DIR) $$(1)/etc/php5
+       echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php5/$(subst 
-,_,$(1)).ini
+  endef
+
+endef
Index: lang/php5/Makefile
===================================================================
--- lang/php5/Makefile  (revision 28510)
+++ lang/php5/Makefile  (working copy)
@@ -462,6 +462,14 @@
        $(INSTALL_BIN) ./files/php.init $(1)/etc/init.d/php
 endef
 
+define Build/InstallDev
+       make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/php-dev
+       rm $(PKG_BUILD_DIR)/php-dev/usr/bin/php
+       $(CP) $(PKG_BUILD_DIR)/php-dev/* $(STAGING_DIR_HOST)
+       sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR_HOST)/usr'#" 
$(STAGING_DIR_HOST)/usr/bin/phpize
+       sed -i -e "s#exec_prefix=\"\`eval echo 
/usr\`\"#exec_prefix='$(STAGING_DIR_HOST)/usr'#" 
$(STAGING_DIR_HOST)/usr/bin/phpize
+endef
+
 define BuildModule
 
 define Package/php5-mod-$(1)

_______________________________________________
openwrt-devel mailing list
openwrt-devel@lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel

Reply via email to