ASR_BASE

Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/external/subpack/lang/php7/Makefile b/external/subpack/lang/php7/Makefile
new file mode 100644
index 0000000..4415b51
--- /dev/null
+++ b/external/subpack/lang/php7/Makefile
@@ -0,0 +1,663 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=php
+PKG_VERSION:=7.4.32
+PKG_RELEASE:=1
+
+PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
+PKG_LICENSE:=PHP-3.01
+PKG_LICENSE_FILES:=LICENSE
+PKG_CPE_ID:=cpe:/a:php:php
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://www.php.net/distributions/
+PKG_HASH:=323332c991e8ef30b1d219cb10f5e30f11b5f319ce4c6642a5470d75ade7864a
+
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+
+PHP7_MODULES= \
+	bcmath \
+	calendar ctype curl \
+	dom \
+	exif \
+	fileinfo filter ftp \
+	gettext gd gmp \
+	iconv imap intl \
+	json \
+	ldap \
+	mbstring mysqli mysqlnd \
+	opcache openssl \
+	pcntl pdo pdo-mysql pdo-pgsql pdo-sqlite pgsql phar \
+	session shmop simplexml snmp soap sockets sqlite3 sysvmsg sysvsem sysvshm \
+	tokenizer \
+	xml xmlreader xmlwriter \
+	zip
+
+PKG_CONFIG_DEPENDS:= \
+	$(patsubst %,CONFIG_PACKAGE_php7-mod-%,$(PHP7_MODULES)) \
+	CONFIG_PHP7_LIBXML CONFIG_PHP7_SYSTEMTZDATA
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/php7/Default
+  SUBMENU:=PHP7
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=PHP7 Hypertext preprocessor
+  URL:=http://www.php.net/
+  DEPENDS:=php7
+endef
+
+define Package/php7/Default/description
+  PHP is a widely-used general-purpose scripting language that is especially
+  suited for Web development and can be embedded into HTML.
+endef
+
+define Package/php7/config
+	config PHP7_LIBXML
+		bool "PHP7 LIBXML support"
+		depends on PACKAGE_php7-cli || PACKAGE_php7-cgi
+
+	config PHP7_SYSTEMTZDATA
+		bool "Use system timezone data instead of php's built-in database"
+		depends on PACKAGE_php7-cli || PACKAGE_php7-cgi
+		default y
+		help
+			Enabling this feature automatically selects the zoneinfo-core package
+			which contains data for UTC timezone. To use other timezones you have
+			to install the corresponding zoneinfo-... package(s).
+endef
+
+define Package/php7
+  $(call Package/php7/Default)
+
+  DEPENDS:=+libpcre2 +zlib \
+           +PHP7_LIBXML:libxml2 \
+           +PHP7_SYSTEMTZDATA:zoneinfo-core
+endef
+
+define Package/php7/description
+  $(call Package/php7/Default/description)
+  This package contains only the PHP config file. You must actually choose
+  your PHP flavour (cli, cgi or fastcgi).
+
+  Please note, that installing php5 and php7 in parallel on the same target
+  is not supported in OpenWrt/LEDE.
+endef
+
+define Package/php7-cli
+  $(call Package/php7/Default)
+  DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp
+  TITLE+= (CLI)
+endef
+
+define Package/php7-cli/description
+  $(call Package/php7/Default/description)
+  This package contains the CLI version of the PHP7 interpreter.
+endef
+
+define Package/php7-cgi
+  $(call Package/php7/Default)
+  DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp
+  TITLE+= (CGI & FastCGI)
+endef
+
+define Package/php7-cgi/description
+  $(call Package/php7/Default/description)
+  This package contains the CGI version of the PHP7 interpreter.
+endef
+
+define Package/php7-fastcgi
+  $(call Package/php7/Default)
+  DEPENDS+= +php7-cgi
+  TITLE:=FastCGI startup script
+endef
+
+define Package/php7-fastcgi/description
+  As FastCGI support is now a core feature the php7-fastcgi package now depends
+  on the php7-cgi package, containing just the startup script.
+endef
+
+define Package/php7-fpm
+  $(call Package/php7/Default)
+  DEPENDS+= +PACKAGE_php7-mod-intl:libstdcpp
+  TITLE+= (FPM)
+endef
+
+define Package/php7-fpm/description
+  $(call Package/php7/Default/description)
+  This package contains the FastCGI Process Manager of the PHP7 interpreter.
+endef
+
+define Package/php7-mod-intl/config
+  config PHP7_FULLICUDATA
+	bool "Add dependency to full ICU Data"
+	depends on PACKAGE_php7-mod-intl
+	default n
+endef
+
+define Package/php7-mod-intl/description
+  Note that this package depends in ICU library which is built without data
+  by default. This is to satisfy programs build and run dependencies but to
+  keep the installed footprint small on the target system(s).
+  However, the data is required to make the ICU library useful - and thus
+  directly affects PHPs ICU extension, too - so consider to also
+  select/install package 'icu-full-data'.
+endef
+
+# not everything groks --disable-nls
+DISABLE_NLS:=
+
+CONFIGURE_ARGS+= \
+	--enable-cli \
+	--enable-cgi \
+	--enable-fpm \
+	--enable-shared \
+	--disable-static \
+	--with-pic \
+	--disable-rpath \
+	--disable-debug \
+	--disable-phpdbg \
+	--without-pear \
+	\
+	--with-config-file-path=/etc \
+	--with-config-file-scan-dir=/etc/php7 \
+	--disable-short-tags \
+	\
+	--without-valgrind \
+	--with-external-pcre \
+	--with-zlib="$(STAGING_DIR)/usr"
+
+ifeq ($(CONFIG_LIBC_USE_GLIBC),y)
+TARGET_LDFLAGS += -ldl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-bcmath),)
+  CONFIGURE_ARGS+= --enable-bcmath=shared
+else
+  CONFIGURE_ARGS+= --disable-bcmath
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-calendar),)
+  CONFIGURE_ARGS+= --enable-calendar=shared
+else
+  CONFIGURE_ARGS+= --disable-calendar
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ctype),)
+  CONFIGURE_ARGS+= --enable-ctype=shared
+else
+  CONFIGURE_ARGS+= --disable-ctype
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-curl),)
+  CONFIGURE_ARGS+= --with-curl=shared
+else
+  CONFIGURE_ARGS+= --without-curl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-dom),)
+  CONFIGURE_ARGS+= --enable-dom=shared
+else
+  CONFIGURE_ARGS+= --disable-dom
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-exif),)
+  CONFIGURE_ARGS+= --enable-exif=shared
+else
+  CONFIGURE_ARGS+= --disable-exif
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-fileinfo),)
+  CONFIGURE_ARGS+= --enable-fileinfo=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-fileinfo
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-filter),)
+  CONFIGURE_ARGS+= --enable-filter=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-filter
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ftp),)
+  CONFIGURE_ARGS+= --enable-ftp=shared
+else
+  CONFIGURE_ARGS+= --disable-ftp
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gd),)
+  CONFIGURE_ARGS+= \
+	--enable-gd=shared,"$(STAGING_DIR)/usr" \
+	--with-external-gd
+else
+  CONFIGURE_ARGS+= --disable-gd
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gettext),)
+  CONFIGURE_ARGS+= --with-gettext=shared,"$(STAGING_DIR)/usr/lib/libintl-full"
+else
+  CONFIGURE_ARGS+= --without-gettext
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-gmp),)
+  CONFIGURE_ARGS+= --with-gmp=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-gmp
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-iconv),)
+  CONFIGURE_ARGS+= --with-iconv=shared,"$(ICONV_PREFIX)"
+else
+  CONFIGURE_ARGS+= --without-iconv
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-imap),)
+  CONFIGURE_ARGS+= \
+	--with-imap=shared,"$(STAGING_DIR)/usr" \
+	--with-kerberos=no \
+	--with-imap-ssl="$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-imap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-intl),)
+  CONFIGURE_ARGS+= --enable-intl=shared
+  TARGET_CXXFLAGS+= -std=c++0x
+else
+  CONFIGURE_ARGS+= --disable-intl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-json),)
+  CONFIGURE_ARGS+= --enable-json=shared
+else
+  CONFIGURE_ARGS+= --disable-json
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-ldap),)
+  CONFIGURE_ARGS+= \
+	--with-ldap=shared,"$(STAGING_DIR)/usr" \
+	--with-ldap-sasl
+else
+  CONFIGURE_ARGS+= --without-ldap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mbstring),)
+  CONFIGURE_ARGS+= \
+	--enable-mbstring=shared \
+	--enable-mbregex
+else
+  CONFIGURE_ARGS+= --disable-mbstring
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mysqli),)
+  CONFIGURE_ARGS+= --with-mysqli=shared
+else
+  CONFIGURE_ARGS+= --without-mysqli
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-mysqlnd),)
+  CONFIGURE_ARGS+= --enable-mysqlnd=shared
+else
+  CONFIGURE_ARGS+= --disable-mysqlnd
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-opcache),)
+  CONFIGURE_ARGS+= --enable-opcache=shared
+else
+  CONFIGURE_ARGS+= --disable-opcache
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-openssl)$(CONFIG_PACKAGE_php7-mod-ftp)$(CONFIG_PACKAGE_php7-mod-imap)$(CONFIG_PACKAGE_php7-mod-snmp),)
+  CONFIGURE_ARGS+= \
+	--with-openssl=shared \
+	--with-kerberos=no \
+	--with-openssl-dir="$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-openssl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pcntl),)
+  CONFIGURE_ARGS+= --enable-pcntl=shared
+else
+  CONFIGURE_ARGS+= --disable-pcntl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo),)
+  CONFIGURE_ARGS+= --enable-pdo=shared
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-mysql),)
+    CONFIGURE_ARGS+= --with-pdo-mysql=shared
+  else
+    CONFIGURE_ARGS+= --without-pdo-mysql
+  endif
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-pgsql),)
+    CONFIGURE_ARGS+= --with-pdo-pgsql=shared,"$(STAGING_DIR)/usr"
+  else
+    CONFIGURE_ARGS+= --without-pdo-pgsql
+  endif
+  ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pdo-sqlite),)
+    CONFIGURE_ARGS+= --with-pdo-sqlite=shared
+  else
+    CONFIGURE_ARGS+= --without-pdo-sqlite
+  endif
+else
+  CONFIGURE_ARGS+= --disable-pdo
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-pgsql),)
+  CONFIGURE_ARGS+= --with-pgsql=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-pgsql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-phar),)
+  CONFIGURE_ARGS+= --enable-phar=shared
+else
+  CONFIGURE_ARGS+= --disable-phar
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-session),)
+  CONFIGURE_ARGS+= --enable-session=shared
+else
+  CONFIGURE_ARGS+= --disable-session
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-shmop),)
+  CONFIGURE_ARGS+= --enable-shmop=shared
+else
+  CONFIGURE_ARGS+= --disable-shmop
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-simplexml),)
+  CONFIGURE_ARGS+= --enable-simplexml=shared
+else
+  CONFIGURE_ARGS+= --disable-simplexml
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-snmp),)
+  CONFIGURE_ARGS+= --with-snmp=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-snmp
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-soap),)
+  CONFIGURE_ARGS+= --enable-soap=shared
+else
+  CONFIGURE_ARGS+= --disable-soap
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sockets),)
+  CONFIGURE_ARGS+= --enable-sockets=shared
+else
+  CONFIGURE_ARGS+= --disable-sockets
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sqlite3),)
+  CONFIGURE_ARGS+= --with-sqlite3=shared
+else
+  CONFIGURE_ARGS+= --without-sqlite3
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvmsg),)
+  CONFIGURE_ARGS+= --enable-sysvmsg=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvmsg
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvsem),)
+  CONFIGURE_ARGS+= --enable-sysvsem=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvsem
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-sysvshm),)
+  CONFIGURE_ARGS+= --enable-sysvshm=shared
+else
+  CONFIGURE_ARGS+= --disable-sysvshm
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-tokenizer),)
+  CONFIGURE_ARGS+= --enable-tokenizer=shared
+else
+  CONFIGURE_ARGS+= --disable-tokenizer
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xml),)
+  CONFIGURE_ARGS+= --enable-xml=shared,"$(STAGING_DIR)/usr"
+  ifneq ($(CONFIG_PHP7_LIBXML),y)
+    CONFIGURE_ARGS+= --with-expat
+  endif
+else
+  CONFIGURE_ARGS+= --disable-xml
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlreader),)
+  CONFIGURE_ARGS+= --enable-xmlreader=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-xmlreader
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_php7-mod-xmlwriter),)
+  CONFIGURE_ARGS+= --enable-xmlwriter=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --disable-xmlwriter
+endif
+
+ifneq ($(CONFIG_PACKAGE_php7-mod-zip),)
+  CONFIGURE_ARGS+= --with-zip=shared,"$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= --without-zip
+endif
+
+ifneq ($(SDK)$(CONFIG_PHP7_LIBXML),)
+  CONFIGURE_ARGS+= --with-libxml
+else
+  CONFIGURE_ARGS+= --without-libxml
+endif
+
+ifneq ($(CONFIG_PHP7_SYSTEMTZDATA),)
+  CONFIGURE_ARGS+= --with-system-tzdata
+else
+  CONFIGURE_ARGS+= --without-system-tzdata
+endif
+
+CONFIGURE_VARS+= \
+	ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no) \
+	php_cv_cc_rpath="no" \
+	iconv_impl_name="gnu_libiconv" \
+	ac_cv_php_xml2_config_path="$(STAGING_DIR)/host/bin/xml2-config" \
+	ac_cv_u8t_decompose=yes \
+	ac_cv_have_pcre2_jit=no
+
+define Package/php7/conffiles
+/etc/php.ini
+/etc/php7/
+endef
+
+define Package/php7/install
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_DATA) ./files/php.ini $(1)/etc/
+endef
+
+define Package/php7-cli/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(CP) $(PKG_BUILD_DIR)/sapi/cli/php $(1)/usr/bin/php-cli
+endef
+
+define Package/php7-cgi/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(CP) $(PKG_BUILD_DIR)/sapi/cgi/php-cgi $(1)/usr/bin/php-cgi
+	ln -sf php-cgi $(1)/usr/bin/php-fcgi
+endef
+
+define Package/php7-fastcgi/install
+	$(INSTALL_DIR) $(1)/etc/config
+	$(INSTALL_DATA) ./files/php7-fastcgi.config $(1)/etc/config/php7-fastcgi
+
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/php7-fastcgi.init $(1)/etc/init.d/php7-fastcgi
+endef
+
+define Package/php7-fastcgi/conffiles
+/etc/config/php7-fastcgi
+endef
+
+define Package/php7-fpm/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/sapi/fpm/php-fpm $(1)/usr/bin/php-fpm
+
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_DATA) ./files/php7-fpm.conf $(1)/etc/php7-fpm.conf
+
+	$(INSTALL_DIR) $(1)/etc/config
+	$(INSTALL_DATA) ./files/php7-fpm.config $(1)/etc/config/php7-fpm
+
+	$(INSTALL_DIR) $(1)/etc/php7-fpm.d
+	$(INSTALL_DATA) ./files/php7-fpm-www.conf $(1)/etc/php7-fpm.d/www.conf
+
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/php7-fpm.init $(1)/etc/init.d/php7-fpm
+endef
+
+define Package/php7-fpm/conffiles
+/etc/php7-fpm.conf
+/etc/php7-fpm.d/
+/etc/config/php7-fpm
+endef
+
+define Package/php7-mod-openssl/postinst
+#!/bin/sh
+[ -n "$$IPKG_INSTROOT" ] || {
+	if [ -e "/etc/php7/20_openssl.ini" ] && [ -e "/etc/php7/15_openssl.ini" ]; then
+		echo "Renaming PHP ini file '/etc/php7/20_openssl.ini' -> '/etc/php7/15_openssl.ini'"
+		mv /etc/php7/20_openssl.ini /etc/php7/15_openssl.ini
+	fi
+}
+endef
+
+define Package/php7-mod-mysqli/postinst
+#!/bin/sh
+[ -n "$$IPKG_INSTROOT" ] || {
+	if [ -e "/etc/php7/20_mysqli.ini" ] && [ -e "/etc/php7/30_mysqli.ini" ]; then
+		echo "Renaming PHP ini file '/etc/php7/20_mysqli.ini' -> '/etc/php7/30_mysqli.ini'"
+		mv /etc/php7/20_mysqli.ini /etc/php7/30_mysqli.ini
+	fi
+}
+endef
+
+define Build/Prepare
+	$(call Build/Prepare/Default)
+	$(if $(QUILT),,( cd $(PKG_BUILD_DIR); touch configure.ac; ./buildconf --force ))
+endef
+
+define Build/Configure
+	$(if $(QUILT),( cd $(PKG_BUILD_DIR); touch configure.ac; ./buildconf --force ))
+	$(call Build/Configure/Default)
+endef
+
+define Build/InstallDev
+	rm -rf $(PKG_BUILD_DIR)/staging
+	make -C $(PKG_BUILD_DIR) install INSTALL_ROOT=$(PKG_BUILD_DIR)/staging
+	rm -rf $(PKG_BUILD_DIR)/staging/usr/{share,man,sbin}
+	rm -f $(PKG_BUILD_DIR)/staging/usr/bin/{php,php-cgi,php-cli}
+	mv $(PKG_BUILD_DIR)/staging/usr/bin/phpize $(PKG_BUILD_DIR)/staging/usr/bin/phpize7
+	mv $(PKG_BUILD_DIR)/staging/usr/bin/php-config $(PKG_BUILD_DIR)/staging/usr/bin/php7-config
+	mv $(PKG_BUILD_DIR)/staging/usr/include/php $(PKG_BUILD_DIR)/staging/usr/include/php7
+	mv $(PKG_BUILD_DIR)/staging/usr/lib/php $(PKG_BUILD_DIR)/staging/usr/lib/php7
+
+	$(CP) $(PKG_BUILD_DIR)/staging/usr $(STAGING_DIR)/
+
+	sed -i -e "s#prefix='/usr'#prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7
+	sed -i -e "s#exec_prefix=\"\`eval echo /usr\`\"#exec_prefix='$(STAGING_DIR)/usr'#" $(STAGING_DIR)/usr/bin/phpize7
+	sed -i -e "s#/include\`/php\"#/include\`/php7\"#" $(STAGING_DIR)/usr/bin/phpize7
+	sed -i -e "s#/lib/php\`/build\"#/lib/php7\`/build\"#" $(STAGING_DIR)/usr/bin/phpize7
+
+	sed -i -e "s#prefix=\"/usr\"#prefix=\"$(STAGING_DIR)/usr\"#" $(STAGING_DIR)/usr/bin/php7-config
+	sed -i -e "s#/include/php\"#/include/php7\"#" $(STAGING_DIR)/usr/bin/php7-config
+endef
+
+define BuildModule
+
+  define Package/php7-mod-$(1)
+    $(call Package/php7/Default)
+
+    ifneq ($(3),)
+      DEPENDS+=$(3)
+    endif
+
+    TITLE:=$(2) shared module
+  endef
+
+  define Package/php7-mod-$(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/php7
+      ifeq ($(5),zend)
+	echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini
+      else
+	echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini
+    endif
+  endef
+
+  $$(eval $$(call BuildPackage,php7-mod-$(1)))
+
+endef
+
+$(eval $(call BuildPackage,php7))
+$(eval $(call BuildPackage,php7-cgi))
+$(eval $(call BuildPackage,php7-cli))
+$(eval $(call BuildPackage,php7-fastcgi))
+$(eval $(call BuildPackage,php7-fpm))
+
+#$(eval $(call BuildModule,NAME,TITLE[,PKG DEPENDS]))
+$(eval $(call BuildModule,bcmath,Bcmath))
+$(eval $(call BuildModule,calendar,Calendar))
+$(eval $(call BuildModule,ctype,Ctype))
+$(eval $(call BuildModule,curl,cURL,+PACKAGE_php7-mod-curl:libcurl))
+$(eval $(call BuildModule,dom,DOM,+@PHP7_LIBXML +PACKAGE_php7-mod-dom:libxml2))
+$(eval $(call BuildModule,exif,EXIF))
+$(eval $(call BuildModule,fileinfo,Fileinfo))
+$(eval $(call BuildModule,filter,Filter))
+$(eval $(call BuildModule,ftp,FTP,+PACKAGE_php7-mod-ftp:libopenssl))
+$(eval $(call BuildModule,gd,GD graphics,+PACKAGE_php7-mod-gd:libgd-full))
+$(eval $(call BuildModule,gettext,Gettext,+PACKAGE_php7-mod-gettext:libintl-full))
+$(eval $(call BuildModule,gmp,GMP,+PACKAGE_php7-mod-gmp:libgmp))
+$(eval $(call BuildModule,iconv,iConv,$(ICONV_DEPENDS)))
+$(eval $(call BuildModule,imap,IMAP,+PACKAGE_php7-mod-imap:libopenssl +PACKAGE_libpam:libpam +PACKAGE_php7-mod-imap:uw-imap))
+$(eval $(call BuildModule,intl,Internationalization Functions,+PACKAGE_php7-mod-intl:icu +PHP7_FULLICUDATA:icu-full-data))
+$(eval $(call BuildModule,json,JSON))
+$(eval $(call BuildModule,ldap,LDAP,+PACKAGE_php7-mod-ldap:libopenldap +PACKAGE_php7-mod-ldap:libsasl2))
+$(eval $(call BuildModule,mbstring,MBString,+PACKAGE_php7-mod-mbstring:oniguruma))
+$(eval $(call BuildModule,mysqli,MySQL Improved Extension,+PACKAGE_php7-mod-mysqli:php7-mod-mysqlnd,30))
+$(eval $(call BuildModule,mysqlnd,MySQL Native Driver,+PACKAGE_php7-mod-openssl:php7-mod-openssl))
+$(eval $(call BuildModule,opcache,OPcache,,,zend))
+$(eval $(call BuildModule,openssl,OpenSSL,+PACKAGE_php7-mod-openssl:libopenssl,15))
+$(eval $(call BuildModule,pcntl,PCNTL))
+$(eval $(call BuildModule,pdo,PHP Data Objects))
+$(eval $(call BuildModule,pdo-mysql,PDO driver for MySQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-mysql:php7-mod-mysqlnd))
+$(eval $(call BuildModule,pdo-pgsql,PDO driver for PostgreSQL,+php7-mod-pdo +PACKAGE_php7-mod-pdo-pgsql:libpq))
+$(eval $(call BuildModule,pdo-sqlite,PDO driver for SQLite 3.x,+php7-mod-pdo +PACKAGE_php7-mod-pdo-sqlite:libsqlite3 +PACKAGE_php7-mod-pdo-sqlite:librt))
+$(eval $(call BuildModule,pgsql,PostgreSQL,+PACKAGE_php7-mod-pgsql:libpq))
+$(eval $(call BuildModule,phar,Phar Archives))
+$(eval $(call BuildModule,session,Session))
+$(eval $(call BuildModule,shmop,Shared Memory))
+$(eval $(call BuildModule,simplexml,SimpleXML,+@PHP7_LIBXML +PACKAGE_php7-mod-simplexml:libxml2))
+$(eval $(call BuildModule,snmp,SNMP,+PACKAGE_php7-mod-snmp:libnetsnmp +PACKAGE_php7-mod-snmp:libopenssl))
+$(eval $(call BuildModule,soap,SOAP,+@PHP7_LIBXML +PACKAGE_php7-mod-soap:libxml2))
+$(eval $(call BuildModule,sockets,Sockets))
+$(eval $(call BuildModule,sqlite3,SQLite3,+PACKAGE_php7-mod-sqlite3:libsqlite3))
+$(eval $(call BuildModule,sysvmsg,System V messages))
+$(eval $(call BuildModule,sysvsem,System V shared memory))
+$(eval $(call BuildModule,sysvshm,System V semaphore))
+$(eval $(call BuildModule,tokenizer,Tokenizer))
+$(eval $(call BuildModule,xml,XML,+PHP7_LIBXML:libxml2 +!PHP7_LIBXML:libexpat))
+$(eval $(call BuildModule,xmlreader,XMLReader,+@PHP7_LIBXML +PACKAGE_php7-mod-dom:php7-mod-dom +PACKAGE_php7-mod-xmlreader:libxml2))
+$(eval $(call BuildModule,xmlwriter,XMLWriter,+@PHP7_LIBXML +PACKAGE_php7-mod-xmlwriter:libxml2))
+$(eval $(call BuildModule,zip,ZIP,+PACKAGE_php7-mod-zip:libzip))
diff --git a/external/subpack/lang/php7/files/php.ini b/external/subpack/lang/php7/files/php.ini
new file mode 100644
index 0000000..b387c62
--- /dev/null
+++ b/external/subpack/lang/php7/files/php.ini
@@ -0,0 +1,134 @@
+[PHP]
+
+;;;;;;;;;;;;;;;;;;;;
+; Language Options ;
+;;;;;;;;;;;;;;;;;;;;
+
+engine = On
+;short_open_tag = Off
+precision = 12
+output_buffering = Off
+;output_handler =
+zlib.output_compression = Off
+;zlib.output_compression_level = -1
+;zlib.output_handler =
+implicit_flush = Off
+unserialize_callback_func =
+;unserialize_max_depth = 4096
+serialize_precision = 100
+;open_basedir =
+disable_functions =
+disable_classes =
+;highlight.string = #DD0000
+;highlight.comment = #FF9900
+;highlight.keyword = #007700
+;highlight.bg = #FFFFFF
+;highlight.default = #0000BB
+;highlight.html = #000000
+;ignore_user_abort = On
+;realpath_cache_size = 16k
+;realpath_cache_ttl = 120
+;zend.enable_gc = On
+;zend.multibyte = Off
+;zend.script_encoding =
+;zend.exception_ignore_args = On
+
+;;;;;;;;;;;;;;;;;
+; Miscellaneous ;
+;;;;;;;;;;;;;;;;;
+
+expose_php = On
+
+;;;;;;;;;;;;;;;;;;;
+; Resource Limits ;
+;;;;;;;;;;;;;;;;;;;
+
+max_execution_time = 30
+max_input_time = 60
+;max_input_nesting_level = 64
+;max_input_vars = 1000
+memory_limit = 8M
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+; Error handling and logging ;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED & ~E_STRICT
+display_errors = On
+display_startup_errors = Off
+log_errors = Off
+log_errors_max_len = 1024
+ignore_repeated_errors = Off
+ignore_repeated_source = Off
+report_memleaks = On
+;report_zend_debug = 0
+track_errors = Off
+;html_errors = Off
+;docref_root = "/phpmanual/"
+;docref_ext = .html
+;error_prepend_string = "<span style='color: #ff0000'>"
+;error_append_string = "</span>"
+;error_log = syslog
+;syslog.ident = php
+;syslog.facility = user
+;syslog.filter = ascii
+
+;;;;;;;;;;;;;;;;;
+; Data Handling ;
+;;;;;;;;;;;;;;;;;
+
+;arg_separator.output = "&amp;"
+;arg_separator.input = ";&"
+variables_order = "EGPCS"
+request_order = "GP"
+register_argc_argv = On
+auto_globals_jit = On
+;enable_post_data_reading = Off
+post_max_size = 8M
+auto_prepend_file =
+auto_append_file =
+default_mimetype = "text/html"
+;default_charset = "UTF-8"
+;internal_encoding =
+;input_encoding =
+;output_encoding =
+
+;;;;;;;;;;;;;;;;;;;;;;;;;
+; Paths and Directories ;
+;;;;;;;;;;;;;;;;;;;;;;;;;
+
+;include_path = ".:/php/includes"
+doc_root = "/www"
+user_dir =
+extension_dir = "/usr/lib/php"
+;sys_temp_dir = "/tmp"
+enable_dl = On
+;cgi.force_redirect = 1
+;cgi.nph = 1
+;cgi.redirect_status_env =
+cgi.fix_pathinfo = 1
+;cgi.discard_path = 1
+;fastcgi.impersonate = 1
+;fastcgi.logging = 0
+;cgi.rfc2616_headers = 0
+;cgi.check_shebang_line = 1
+
+;;;;;;;;;;;;;;;;
+; File Uploads ;
+;;;;;;;;;;;;;;;;
+
+file_uploads = On
+upload_tmp_dir = "/tmp"
+upload_max_filesize = 2M
+max_file_uploads = 20
+
+;;;;;;;;;;;;;;;;;;
+; Fopen wrappers ;
+;;;;;;;;;;;;;;;;;;
+
+allow_url_fopen = On
+allow_url_include = Off
+;from = "john@doe.com"
+;user_agent = "PHP"
+default_socket_timeout = 60
+;auto_detect_line_endings = Off
diff --git a/external/subpack/lang/php7/files/php7-fastcgi.config b/external/subpack/lang/php7/files/php7-fastcgi.config
new file mode 100644
index 0000000..22e9998
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fastcgi.config
@@ -0,0 +1,3 @@
+config php7-fastcgi
+	option enabled 1
+	option port '1026'
diff --git a/external/subpack/lang/php7/files/php7-fastcgi.init b/external/subpack/lang/php7/files/php7-fastcgi.init
new file mode 100644
index 0000000..6106b4f
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fastcgi.init
@@ -0,0 +1,29 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+start_instance() {
+	local section="$1"
+	local enabled
+	local port
+
+	config_get_bool enabled "$section" 'enabled' 0
+	config_get port "$section" 'port'
+
+	[ $enabled -gt 0 ] || return 1
+
+	PHP_FCGI_CHILDREN='' \
+	service_start /usr/bin/php-fcgi ${port:+-b $port}
+}
+
+start() {
+	config_load 'php7-fastcgi'
+	config_foreach start_instance 'php7-fastcgi'
+}
+
+stop() {
+	service_stop /usr/bin/php-fcgi
+}
diff --git a/external/subpack/lang/php7/files/php7-fpm-www.conf b/external/subpack/lang/php7/files/php7-fpm-www.conf
new file mode 100644
index 0000000..d3a3222
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fpm-www.conf
@@ -0,0 +1,392 @@
+; Start a new pool named 'www'.
+; the variable $pool can we used in any directive and will be replaced by the
+; pool name ('www' here)
+[www]
+
+; Per pool prefix
+; It only applies on the following directives:
+; - 'slowlog'
+; - 'listen' (unixsocket)
+; - 'chroot'
+; - 'chdir'
+; - 'php_values'
+; - 'php_admin_values'
+; When not set, the global prefix (or /usr) applies instead.
+; Note: This directive can also be relative to the global prefix.
+; Default Value: none
+;prefix = /path/to/pools/$pool
+
+; Unix user/group of processes
+; Note: The user is mandatory. If the group is not set, the default user's group
+;       will be used.
+user = nobody
+;group =
+
+; The address on which to accept FastCGI requests.
+; Valid syntaxes are:
+;   'ip.add.re.ss:port'    - to listen on a TCP socket to a specific address on
+;                            a specific port;
+;   'port'                 - to listen on a TCP socket to all addresses on a
+;                            specific port;
+;   '/path/to/unix/socket' - to listen on a unix socket.
+; Note: This value is mandatory.
+listen = /var/run/php7-fpm.sock
+
+; Set listen(2) backlog.
+; Default Value: 128 (-1 on FreeBSD and OpenBSD)
+;listen.backlog = 128
+
+; Set permissions for unix socket, if one is used. In Linux, read/write
+; permissions must be set in order to allow connections from a web server. Many
+; BSD-derived systems allow connections regardless of permissions. 
+; Default Values: user and group are set as the running user
+;                 mode is set to 0666
+;listen.owner = www-data
+;listen.group = www-data
+;listen.mode = 0666
+
+; List of ipv4 addresses of FastCGI clients which are allowed to connect.
+; Equivalent to the FCGI_WEB_SERVER_ADDRS environment variable in the original
+; PHP FCGI (5.2.2+). Makes sense only with a tcp listening socket. Each address
+; must be separated by a comma. If this value is left blank, connections will be
+; accepted from any ip address.
+; Default Value: any
+;listen.allowed_clients = 127.0.0.1
+
+; Specify the nice(2) priority to apply to the pool processes (only if set)
+; The value can vary from -19 (highest priority) to 20 (lower priority)
+; Note: - It will only work if the FPM master process is launched as root
+;       - The pool processes will inherit the master process priority
+;         unless it specified otherwise
+; Default Value: no set
+; priority = -19
+
+; Choose how the process manager will control the number of child processes.
+; Possible Values:
+;   static  - a fixed number (pm.max_children) of child processes;
+;   dynamic - the number of child processes are set dynamically based on the
+;             following directives. With this process management, there will be
+;             always at least 1 children.
+;             pm.max_children      - the maximum number of children that can
+;                                    be alive at the same time.
+;             pm.start_servers     - the number of children created on startup.
+;             pm.min_spare_servers - the minimum number of children in 'idle'
+;                                    state (waiting to process). If the number
+;                                    of 'idle' processes is less than this
+;                                    number then some children will be created.
+;             pm.max_spare_servers - the maximum number of children in 'idle'
+;                                    state (waiting to process). If the number
+;                                    of 'idle' processes is greater than this
+;                                    number then some children will be killed.
+;  ondemand - no children are created at startup. Children will be forked when
+;             new requests will connect. The following parameter are used:
+;             pm.max_children           - the maximum number of children that
+;                                         can be alive at the same time.
+;             pm.process_idle_timeout   - The number of seconds after which
+;                                         an idle process will be killed.
+; Note: This value is mandatory.
+pm = dynamic
+
+; The number of child processes to be created when pm is set to 'static' and the
+; maximum number of child processes when pm is set to 'dynamic' or 'ondemand'.
+; This value sets the limit on the number of simultaneous requests that will be
+; served. Equivalent to the ApacheMaxClients directive with mpm_prefork.
+; Equivalent to the PHP_FCGI_CHILDREN environment variable in the original PHP
+; CGI. The below defaults are based on a server without much resources. Don't
+; forget to tweak pm.* to fit your needs.
+; Note: Used when pm is set to 'static', 'dynamic' or 'ondemand'
+; Note: This value is mandatory.
+pm.max_children = 5
+
+; The number of child processes created on startup.
+; Note: Used only when pm is set to 'dynamic'
+; Default Value: min_spare_servers + (max_spare_servers - min_spare_servers) / 2
+pm.start_servers = 2
+
+; The desired minimum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.min_spare_servers = 1
+
+; The desired maximum number of idle server processes.
+; Note: Used only when pm is set to 'dynamic'
+; Note: Mandatory when pm is set to 'dynamic'
+pm.max_spare_servers = 3
+
+; The number of seconds after which an idle process will be killed.
+; Note: Used only when pm is set to 'ondemand'
+; Default Value: 10s
+;pm.process_idle_timeout = 10s;
+
+; The number of requests each child process should execute before respawning.
+; This can be useful to work around memory leaks in 3rd party libraries. For
+; endless request processing specify '0'. Equivalent to PHP_FCGI_MAX_REQUESTS.
+; Default Value: 0
+;pm.max_requests = 500
+
+; The URI to view the FPM status page. If this value is not set, no URI will be
+; recognized as a status page. It shows the following informations:
+;   pool                 - the name of the pool;
+;   process manager      - static, dynamic or ondemand;
+;   start time           - the date and time FPM has started;
+;   start since          - number of seconds since FPM has started;
+;   accepted conn        - the number of request accepted by the pool;
+;   listen queue         - the number of request in the queue of pending
+;                          connections (see backlog in listen(2));
+;   max listen queue     - the maximum number of requests in the queue
+;                          of pending connections since FPM has started;
+;   listen queue len     - the size of the socket queue of pending connections;
+;   idle processes       - the number of idle processes;
+;   active processes     - the number of active processes;
+;   total processes      - the number of idle + active processes;
+;   max active processes - the maximum number of active processes since FPM
+;                          has started;
+;   max children reached - number of times, the process limit has been reached,
+;                          when pm tries to start more children (works only for
+;                          pm 'dynamic' and 'ondemand');
+; Value are updated in real time.
+; Example output:
+;   pool:                 www
+;   process manager:      static
+;   start time:           01/Jul/2011:17:53:49 +0200
+;   start since:          62636
+;   accepted conn:        190460
+;   listen queue:         0
+;   max listen queue:     1
+;   listen queue len:     42
+;   idle processes:       4
+;   active processes:     11
+;   total processes:      15
+;   max active processes: 12
+;   max children reached: 0
+;
+; By default the status page output is formatted as text/plain. Passing either
+; 'html', 'xml' or 'json' in the query string will return the corresponding
+; output syntax. Example:
+;   http://www.foo.bar/status
+;   http://www.foo.bar/status?json
+;   http://www.foo.bar/status?html
+;   http://www.foo.bar/status?xml
+;
+; By default the status page only outputs short status. Passing 'full' in the
+; query string will also return status for each pool process.
+; Example: 
+;   http://www.foo.bar/status?full
+;   http://www.foo.bar/status?json&full
+;   http://www.foo.bar/status?html&full
+;   http://www.foo.bar/status?xml&full
+; The Full status returns for each process:
+;   pid                  - the PID of the process;
+;   state                - the state of the process (Idle, Running, ...);
+;   start time           - the date and time the process has started;
+;   start since          - the number of seconds since the process has started;
+;   requests             - the number of requests the process has served;
+;   request duration     - the duration in µs of the requests;
+;   request method       - the request method (GET, POST, ...);
+;   request URI          - the request URI with the query string;
+;   content length       - the content length of the request (only with POST);
+;   user                 - the user (PHP_AUTH_USER) (or '-' if not set);
+;   script               - the main script called (or '-' if not set);
+;   last request cpu     - the %cpu the last request consumed
+;                          it's always 0 if the process is not in Idle state
+;                          because CPU calculation is done when the request
+;                          processing has terminated;
+;   last request memory  - the max amount of memory the last request consumed
+;                          it's always 0 if the process is not in Idle state
+;                          because memory calculation is done when the request
+;                          processing has terminated;
+; If the process is in Idle state, then informations are related to the
+; last request the process has served. Otherwise informations are related to
+; the current request being served.
+; Example output:
+;   ************************
+;   pid:                  31330
+;   state:                Running
+;   start time:           01/Jul/2011:17:53:49 +0200
+;   start since:          63087
+;   requests:             12808
+;   request duration:     1250261
+;   request method:       GET
+;   request URI:          /test_mem.php?N=10000
+;   content length:       0
+;   user:                 -
+;   script:               /home/fat/web/docs/php/test_mem.php
+;   last request cpu:     0.00
+;   last request memory:  0
+;
+; Note: There is a real-time FPM status monitoring sample web page available
+;       It's available in: ${prefix}/share/fpm/status.html
+;
+; Note: The value must start with a leading slash (/). The value can be
+;       anything, but it may not be a good idea to use the .php extension or it
+;       may conflict with a real PHP file.
+; Default Value: not set 
+;pm.status_path = /status
+
+; The ping URI to call the monitoring page of FPM. If this value is not set, no
+; URI will be recognized as a ping page. This could be used to test from outside
+; that FPM is alive and responding, or to
+; - create a graph of FPM availability (rrd or such);
+; - remove a server from a group if it is not responding (load balancing);
+; - trigger alerts for the operating team (24/7).
+; Note: The value must start with a leading slash (/). The value can be
+;       anything, but it may not be a good idea to use the .php extension or it
+;       may conflict with a real PHP file.
+; Default Value: not set
+;ping.path = /ping
+
+; This directive may be used to customize the response of a ping request. The
+; response is formatted as text/plain with a 200 response code.
+; Default Value: pong
+;ping.response = pong
+
+; The access log file
+; Default: not set
+;access.log = log/$pool.access.log
+
+; The access log format.
+; The following syntax is allowed
+;  %%: the '%' character
+;  %C: %CPU used by the request
+;      it can accept the following format:
+;      - %{user}C for user CPU only
+;      - %{system}C for system CPU only
+;      - %{total}C  for user + system CPU (default)
+;  %d: time taken to serve the request
+;      it can accept the following format:
+;      - %{seconds}d (default)
+;      - %{miliseconds}d
+;      - %{mili}d
+;      - %{microseconds}d
+;      - %{micro}d
+;  %e: an environment variable (same as $_ENV or $_SERVER)
+;      it must be associated with embraces to specify the name of the env
+;      variable. Some exemples:
+;      - server specifics like: %{REQUEST_METHOD}e or %{SERVER_PROTOCOL}e
+;      - HTTP headers like: %{HTTP_HOST}e or %{HTTP_USER_AGENT}e
+;  %f: script filename
+;  %l: content-length of the request (for POST request only)
+;  %m: request method
+;  %M: peak of memory allocated by PHP
+;      it can accept the following format:
+;      - %{bytes}M (default)
+;      - %{kilobytes}M
+;      - %{kilo}M
+;      - %{megabytes}M
+;      - %{mega}M
+;  %n: pool name
+;  %o: ouput header
+;      it must be associated with embraces to specify the name of the header:
+;      - %{Content-Type}o
+;      - %{X-Powered-By}o
+;      - %{Transfert-Encoding}o
+;      - ....
+;  %p: PID of the child that serviced the request
+;  %P: PID of the parent of the child that serviced the request
+;  %q: the query string 
+;  %Q: the '?' character if query string exists
+;  %r: the request URI (without the query string, see %q and %Q)
+;  %R: remote IP address
+;  %s: status (response code)
+;  %t: server time the request was received
+;      it can accept a strftime(3) format:
+;      %d/%b/%Y:%H:%M:%S %z (default)
+;  %T: time the log has been written (the request has finished)
+;      it can accept a strftime(3) format:
+;      %d/%b/%Y:%H:%M:%S %z (default)
+;  %u: remote user
+;
+; Default: "%R - %u %t \"%m %r\" %s"
+;access.format = "%R - %u %t \"%m %r%Q%q\" %s %f %{mili}d %{kilo}M %C%%"
+
+; The log file for slow requests
+; Default Value: not set
+; Note: slowlog is mandatory if request_slowlog_timeout is set
+;slowlog = log/$pool.log.slow
+
+; The timeout for serving a single request after which a PHP backtrace will be
+; dumped to the 'slowlog' file. A value of '0s' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_slowlog_timeout = 0
+
+; The timeout for serving a single request after which the worker process will
+; be killed. This option should be used when the 'max_execution_time' ini option
+; does not stop script execution for some reason. A value of '0' means 'off'.
+; Available units: s(econds)(default), m(inutes), h(ours), or d(ays)
+; Default Value: 0
+;request_terminate_timeout = 0
+
+; Set open file descriptor rlimit.
+; Default Value: system defined value
+;rlimit_files = 1024
+
+; Set max core size rlimit.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+
+; Chroot to this directory at the start. This value must be defined as an
+; absolute path. When this value is not set, chroot is not used.
+; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
+; of its subdirectories. If the pool prefix is not set, the global prefix
+; will be used instead.
+; Note: chrooting is a great security feature and should be used whenever
+;       possible. However, all PHP paths will be relative to the chroot
+;       (error_log, sessions.save_path, ...).
+; Default Value: not set
+;chroot =
+
+; Chdir to this directory at the start.
+; Note: relative path can be used.
+; Default Value: current directory or / when chroot
+chdir = /
+
+; Redirect worker stdout and stderr into main error log. If not set, stdout and
+; stderr will be redirected to /dev/null according to FastCGI specs.
+; Note: on highloaded environement, this can cause some delay in the page
+; process time (several ms).
+; Default Value: no
+;catch_workers_output = yes
+
+; Limits the extensions of the main script FPM will allow to parse. This can
+; prevent configuration mistakes on the web server side. You should only limit
+; FPM to .php extensions to prevent malicious users to use other extensions to
+; exectute php code.
+; Note: set an empty value to allow all extensions.
+; Default Value: .php
+;security.limit_extensions = .php .php3 .php4 .php5
+
+; Pass environment variables like LD_LIBRARY_PATH. All $VARIABLEs are taken from
+; the current environment.
+; Default Value: clean env
+;env[HOSTNAME] = $HOSTNAME
+;env[PATH] = /usr/local/bin:/usr/bin:/bin
+;env[TMP] = /tmp
+;env[TMPDIR] = /tmp
+;env[TEMP] = /tmp
+
+; Additional php.ini defines, specific to this pool of workers. These settings
+; overwrite the values previously defined in the php.ini. The directives are the
+; same as the PHP SAPI:
+;   php_value/php_flag             - you can set classic ini defines which can
+;                                    be overwritten from PHP call 'ini_set'. 
+;   php_admin_value/php_admin_flag - these directives won't be overwritten by
+;                                     PHP call 'ini_set'
+; For php_*flag, valid values are on, off, 1, 0, true, false, yes or no.
+
+; Defining 'extension' will load the corresponding shared extension from
+; extension_dir. Defining 'disable_functions' or 'disable_classes' will not
+; overwrite previously defined php.ini values, but will append the new value
+; instead.
+
+; Note: path INI options can be relative and will be expanded with the prefix
+; (pool, global or /usr)
+
+; Default Value: nothing is defined by default except the values in php.ini and
+;                specified at startup with the -d argument
+;php_admin_value[sendmail_path] = /usr/sbin/sendmail -t -i -f www@my.domain.com
+;php_flag[display_errors] = off
+;php_admin_value[error_log] = /var/log/fpm-php.www.log
+;php_admin_flag[log_errors] = on
+;php_admin_value[memory_limit] = 32M
diff --git a/external/subpack/lang/php7/files/php7-fpm.conf b/external/subpack/lang/php7/files/php7-fpm.conf
new file mode 100644
index 0000000..c980b21
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fpm.conf
@@ -0,0 +1,121 @@
+;;;;;;;;;;;;;;;;;;;;;
+; FPM Configuration ;
+;;;;;;;;;;;;;;;;;;;;;
+
+; All relative paths in this configuration file are relative to PHP's install
+; prefix (/usr). This prefix can be dynamically changed by using the
+; '-p' argument from the command line.
+
+; Include one or more files. If glob(3) exists, it is used to include a bunch of
+; files from a glob(3) pattern. This directive can be used everywhere in the
+; file.
+; Relative path can also be used. They will be prefixed by:
+;  - the global prefix if it's been set (-p argument)
+;  - /usr otherwise
+;include=/etc/php7/fpm/*.conf
+
+;;;;;;;;;;;;;;;;;;
+; Global Options ;
+;;;;;;;;;;;;;;;;;;
+
+[global]
+; Pid file
+; Note: the default prefix is /var
+; Default Value: none
+pid = /var/run/php7-fpm.pid
+
+; Error log file
+; If it's set to "syslog", log is sent to syslogd instead of being written
+; in a local file.
+; Note: the default prefix is /var
+; Default Value: log/php-fpm.log
+error_log = /var/log/php7-fpm.log
+
+; syslog_facility is used to specify what type of program is logging the
+; message. This lets syslogd specify that messages from different facilities
+; will be handled differently.
+; See syslog(3) for possible values (ex daemon equiv LOG_DAEMON)
+; Default Value: daemon
+;syslog.facility = daemon
+
+; syslog_ident is prepended to every message. If you have multiple FPM
+; instances running on the same server, you can change the default value
+; which must suit common needs.
+; Default Value: php-fpm
+;syslog.ident = php-fpm
+
+; Log level
+; Possible Values: alert, error, warning, notice, debug
+; Default Value: notice
+;log_level = notice
+
+; If this number of child processes exit with SIGSEGV or SIGBUS within the time
+; interval set by emergency_restart_interval then FPM will restart. A value
+; of '0' means 'Off'.
+; Default Value: 0
+;emergency_restart_threshold = 0
+
+; Interval of time used by emergency_restart_interval to determine when 
+; a graceful restart will be initiated.  This can be useful to work around
+; accidental corruptions in an accelerator's shared memory.
+; Available Units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;emergency_restart_interval = 0
+
+; Time limit for child processes to wait for a reaction on signals from master.
+; Available units: s(econds), m(inutes), h(ours), or d(ays)
+; Default Unit: seconds
+; Default Value: 0
+;process_control_timeout = 0
+
+; The maximum number of processes FPM will fork. This has been design to control
+; the global number of processes when using dynamic PM within a lot of pools.
+; Use it with caution.
+; Note: A value of 0 indicates no limit
+; Default Value: 0
+; process.max = 128
+
+; Specify the nice(2) priority to apply to the master process (only if set)
+; The value can vary from -19 (highest priority) to 20 (lower priority)
+; Note: - It will only work if the FPM master process is launched as root
+;       - The pool process will inherit the master process priority
+;         unless it specified otherwise
+; Default Value: no set
+; process.priority = -19
+
+; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
+; Default Value: yes
+;daemonize = yes
+
+; Set open file descriptor rlimit for the master process.
+; Default Value: system defined value
+;rlimit_files = 1024
+
+; Set max core size rlimit for the master process.
+; Possible Values: 'unlimited' or an integer greater or equal to 0
+; Default Value: system defined value
+;rlimit_core = 0
+
+; Specify the event mechanism FPM will use. The following is available:
+; - select     (any POSIX os)
+; - poll       (any POSIX os)
+; - epoll      (linux >= 2.5.44)
+; - kqueue     (FreeBSD >= 4.1, OpenBSD >= 2.9, NetBSD >= 2.0)
+; - /dev/poll  (Solaris >= 7)
+; - port       (Solaris >= 10)
+; Default Value: not set (auto detection)
+; events.mechanism = epoll
+
+;;;;;;;;;;;;;;;;;;;;
+; Pool Definitions ;
+;;;;;;;;;;;;;;;;;;;;
+
+; Multiple pools of child processes may be started with different listening
+; ports and different management options.  The name of the pool will be
+; used in logs and stats. There is no limitation on the number of pools which
+; FPM can handle. Your system will tell you anyway :)
+
+; To configure the pools it is recommended to have one .conf file per
+; pool in the following directory:
+include=/etc/php7-fpm.d/*.conf
diff --git a/external/subpack/lang/php7/files/php7-fpm.config b/external/subpack/lang/php7/files/php7-fpm.config
new file mode 100644
index 0000000..3a893c6
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fpm.config
@@ -0,0 +1,2 @@
+config php7-fpm
+	option enabled 1
diff --git a/external/subpack/lang/php7/files/php7-fpm.init b/external/subpack/lang/php7/files/php7-fpm.init
new file mode 100644
index 0000000..c913a2b
--- /dev/null
+++ b/external/subpack/lang/php7/files/php7-fpm.init
@@ -0,0 +1,28 @@
+#!/bin/sh /etc/rc.common
+
+START=50
+
+PROG=/usr/bin/php-fpm
+CONFIG=/etc/php7-fpm.conf
+
+SERVICE_PID_FILE=/var/run/php7-fpm.pid
+
+start_instance() {
+	local section="$1"
+	local enabled
+
+	config_get_bool enabled "$section" 'enabled' 0
+
+	[ $enabled -gt 0 ] || return 1
+
+	service_start $PROG -y $CONFIG -g $SERVICE_PID_FILE
+}
+
+start() {
+	config_load 'php7-fpm'
+	config_foreach start_instance 'php7-fpm'
+}
+
+stop() {
+	service_stop $PROG
+}
diff --git a/external/subpack/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch b/external/subpack/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch
new file mode 100644
index 0000000..f9ef5e4
--- /dev/null
+++ b/external/subpack/lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch
@@ -0,0 +1,665 @@
+From: Debian PHP Maintainers <team+pkg-php@tracker.debian.org>
+Date: Thu, 7 Mar 2019 19:42:35 +0000
+Subject: Add-support-for-use-of-the-system-timezone-database
+
+# License: MIT
+# http://opensource.org/licenses/MIT
+
+# License: MIT
+# http://opensource.org/licenses/MIT
+
+Add support for use of the system timezone database, rather
+than embedding a copy.  Discussed upstream but was not desired.
+
+History:
+r18: adapt for autotool change in 7.3.3RC1
+r17: adapt for timelib 2018.01 (in 7.3.2RC1)
+r16: adapt for timelib 2017.06 (in 7.2.3RC1)
+r15: adapt for timelib 2017.05beta7 (in 7.2.0RC1)
+r14: improve check for valid tz file
+r13: adapt for upstream changes to use PHP allocator
+r12: adapt for upstream changes for new zic
+r11: use canonical names to avoid more case sensitivity issues
+     round lat/long from zone.tab towards zero per builtin db
+r10: make timezone case insensitive
+r9: fix another compile error without --with-system-tzdata configured (Michael Heimpold)
+r8: fix compile error without --with-system-tzdata configured
+r7: improve check for valid timezone id to exclude directories
+r6: fix fd leak in r5, fix country code/BC flag use in
+    timezone_identifiers_list() using system db,
+    fix use of PECL timezonedb to override system db,
+r5: reverts addition of "System/Localtime" fake tzname.
+    updated for 5.3.0, parses zone.tab to pick up mapping between
+    timezone name, country code and long/lat coords
+r4: added "System/Localtime" tzname which uses /etc/localtime
+r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert)
+r2: add filesystem trawl to set up name alias index
+r1: initial revision
+---
+ ext/date/config0.m4     |  13 ++
+ ext/date/lib/parse_tz.c | 535 +++++++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 545 insertions(+), 3 deletions(-)
+
+--- a/ext/date/config0.m4
++++ b/ext/date/config0.m4
+@@ -4,6 +4,19 @@ AC_CHECK_HEADERS([io.h])
+ dnl Check for strtoll, atoll
+ AC_CHECK_FUNCS(strtoll atoll)
+ 
++PHP_ARG_WITH(system-tzdata, for use of system timezone data,
++[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
++no, no)
++
++if test "$PHP_SYSTEM_TZDATA" != "no"; then
++   AC_DEFINE(HAVE_SYSTEM_TZDATA, 1, [Define if system timezone data is used])
++
++   if test "$PHP_SYSTEM_TZDATA" != "yes"; then
++      AC_DEFINE_UNQUOTED(HAVE_SYSTEM_TZDATA_PREFIX, "$PHP_SYSTEM_TZDATA",
++                         [Define for location of system timezone data])
++   fi
++fi
++
+ PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1"
+ timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c
+                  lib/timelib.c lib/tm2unixtime.c lib/unixtime2tm.c lib/parse_iso_intervals.c lib/interval.c"
+--- a/ext/date/lib/parse_tz.c
++++ b/ext/date/lib/parse_tz.c
+@@ -26,8 +26,21 @@
+ #include "timelib.h"
+ #include "timelib_private.h"
+ 
++#ifdef HAVE_SYSTEM_TZDATA
++#include <sys/mman.h>
++#include <sys/stat.h>
++#include <limits.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#include "php_scandir.h"
++
++#else
+ #define TIMELIB_SUPPORTS_V2DATA
+ #include "timezonedb.h"
++#endif
++
++#include <ctype.h>
+ 
+ #if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+ # if defined(__LITTLE_ENDIAN__)
+@@ -88,6 +101,11 @@ static int read_php_preamble(const unsig
+ {
+ 	uint32_t version;
+ 
++	if (memcmp(*tzf, "TZif", 4) == 0) {
++		*tzf += 20;
++		return 0;
++	}
++
+ 	/* read ID */
+ 	version = (*tzf)[3] - '0';
+ 	*tzf += 4;
+@@ -412,7 +430,429 @@ void timelib_dump_tzinfo(timelib_tzinfo
+ 	}
+ }
+ 
+-static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
++#ifdef HAVE_SYSTEM_TZDATA
++
++#ifdef HAVE_SYSTEM_TZDATA_PREFIX
++#define ZONEINFO_PREFIX HAVE_SYSTEM_TZDATA_PREFIX
++#else
++#define ZONEINFO_PREFIX "/usr/share/zoneinfo"
++#endif
++
++/* System timezone database pointer. */
++static const timelib_tzdb *timezonedb_system;
++
++/* Hash table entry for the cache of the zone.tab mapping table. */
++struct location_info {
++        char code[2];
++        double latitude, longitude;
++        char name[64];
++        char *comment;
++        struct location_info *next;
++};
++
++/* Cache of zone.tab. */
++static struct location_info **system_location_table;
++
++/* Size of the zone.tab hash table; a random-ish prime big enough to
++ * prevent too many collisions. */
++#define LOCINFO_HASH_SIZE (1021)
++
++/* Compute a case insensitive hash of str */
++static uint32_t tz_hash(const char *str)
++{
++    const unsigned char *p = (const unsigned char *)str;
++    uint32_t hash = 5381;
++    int c;
++
++    while ((c = tolower(*p++)) != '\0') {
++        hash = (hash << 5) ^ hash ^ c;
++    }
++
++    return hash % LOCINFO_HASH_SIZE;
++}
++
++/* Parse an ISO-6709 date as used in zone.tab. Returns end of the
++ * parsed string on success, or NULL on parse error.  On success,
++ * writes the parsed number to *result. */
++static char *parse_iso6709(char *p, double *result)
++{
++    double v, sign;
++    char *pend;
++    size_t len;
++
++    if (*p == '+')
++        sign = 1.0;
++    else if (*p == '-')
++        sign = -1.0;
++    else
++        return NULL;
++
++    p++;
++    for (pend = p; *pend >= '0' && *pend <= '9'; pend++)
++        ;;
++
++    /* Annoying encoding used by zone.tab has no decimal point, so use
++     * the length to determine the format:
++     * 
++     * 4 = DDMM
++     * 5 = DDDMM
++     * 6 = DDMMSS
++     * 7 = DDDMMSS
++     */
++    len = pend - p;
++    if (len < 4 || len > 7) {
++        return NULL;
++    }
++
++    /* p => [D]DD */
++    v = (p[0] - '0') * 10.0 + (p[1] - '0');
++    p += 2;
++    if (len == 5 || len == 7)
++        v = v * 10.0 + (*p++ - '0');
++    /* p => MM[SS] */
++    v += (10.0 * (p[0] - '0')
++          + p[1] - '0') / 60.0;
++    p += 2;
++    /* p => [SS] */
++    if (len > 5) {
++        v += (10.0 * (p[0] - '0')
++              + p[1] - '0') / 3600.0;
++        p += 2;
++    }
++
++    /* Round to five decimal place, not because it's a good idea,
++     * but, because the builtin data uses rounded data, so, match
++     * that. */
++    *result = trunc(v * sign * 100000.0) / 100000.0;
++
++    return p;
++}
++
++/* This function parses the zone.tab file to build up the mapping of
++ * timezone to country code and geographic location, and returns a
++ * hash table.  The hash table is indexed by the function:
++ *
++ *   tz_hash(timezone-name)
++ */
++static struct location_info **create_location_table(void)
++{
++    struct location_info **li, *i;
++    char zone_tab[PATH_MAX];
++    char line[512];
++    FILE *fp;
++
++    strncpy(zone_tab, ZONEINFO_PREFIX "/zone.tab", sizeof zone_tab);
++
++    fp = fopen(zone_tab, "r");
++    if (!fp) {
++        return NULL;
++    }
++
++    li = calloc(LOCINFO_HASH_SIZE, sizeof *li);
++
++    while (fgets(line, sizeof line, fp)) {
++        char *p = line, *code, *name, *comment;
++        uint32_t hash;
++        double latitude, longitude;
++
++        while (isspace(*p))
++            p++;
++
++        if (*p == '#' || *p == '\0' || *p == '\n')
++            continue;
++        
++        if (!isalpha(p[0]) || !isalpha(p[1]) || p[2] != '\t')
++            continue;
++        
++        /* code => AA */
++        code = p;
++        p[2] = 0;
++        p += 3;
++
++        /* coords => [+-][D]DDMM[SS][+-][D]DDMM[SS] */
++        p = parse_iso6709(p, &latitude);
++        if (!p) {
++            continue;
++        }
++        p = parse_iso6709(p, &longitude);
++        if (!p) {
++            continue;
++        }
++
++        if (!p || *p != '\t') {
++            continue;
++        }
++
++        /* name = string */
++        name = ++p;
++        while (*p != '\t' && *p && *p != '\n')
++            p++;
++
++        *p++ = '\0';
++
++        /* comment = string */
++        comment = p;
++        while (*p != '\t' && *p && *p != '\n')
++            p++;
++
++        if (*p == '\n' || *p == '\t')
++            *p = '\0';
++        
++        hash = tz_hash(name);
++        i = malloc(sizeof *i);
++        memcpy(i->code, code, 2);
++        strncpy(i->name, name, sizeof i->name);
++        i->comment = strdup(comment);
++        i->longitude = longitude;
++        i->latitude = latitude;
++        i->next = li[hash];
++        li[hash] = i;
++        /* printf("%s [%u, %f, %f]\n", name, hash, latitude, longitude); */
++    }
++
++    fclose(fp);
++
++    return li;
++}
++
++/* Return location info from hash table, using given timezone name.
++ * Returns NULL if the name could not be found. */
++const struct location_info *find_zone_info(struct location_info **li, 
++                                           const char *name)
++{
++    uint32_t hash = tz_hash(name);
++    const struct location_info *l;
++
++    if (!li) {
++        return NULL;
++    }
++
++    for (l = li[hash]; l; l = l->next) {
++        if (timelib_strcasecmp(l->name, name) == 0)
++            return l;
++    }
++
++    return NULL;
++}    
++
++/* Filter out some non-tzdata files and the posix/right databases, if
++ * present. */
++static int index_filter(const struct dirent *ent)
++{
++	return strcmp(ent->d_name, ".") != 0
++		&& strcmp(ent->d_name, "..") != 0
++		&& strcmp(ent->d_name, "posix") != 0
++		&& strcmp(ent->d_name, "posixrules") != 0
++		&& strcmp(ent->d_name, "right") != 0
++		&& strstr(ent->d_name, ".list") == NULL
++		&& strstr(ent->d_name, ".tab") == NULL;
++}
++
++static int sysdbcmp(const void *first, const void *second)
++{
++        const timelib_tzdb_index_entry *alpha = first, *beta = second;
++
++        return timelib_strcasecmp(alpha->id, beta->id);
++}
++
++
++/* Create the zone identifier index by trawling the filesystem. */
++static void create_zone_index(timelib_tzdb *db)
++{
++	size_t dirstack_size,  dirstack_top;
++	size_t index_size, index_next;
++	timelib_tzdb_index_entry *db_index;
++	char **dirstack;
++
++	/* LIFO stack to hold directory entries to scan; each slot is a
++	 * directory name relative to the zoneinfo prefix. */
++	dirstack_size = 32;
++	dirstack = malloc(dirstack_size * sizeof *dirstack);
++	dirstack_top = 1;
++	dirstack[0] = strdup("");
++	
++	/* Index array. */
++	index_size = 64;
++	db_index = malloc(index_size * sizeof *db_index);
++	index_next = 0;
++
++	do {
++		struct dirent **ents;
++		char name[PATH_MAX], *top;
++		int count;
++
++		/* Pop the top stack entry, and iterate through its contents. */
++		top = dirstack[--dirstack_top];
++		snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s", top);
++
++		count = php_scandir(name, &ents, index_filter, php_alphasort);
++
++		while (count > 0) {
++			struct stat st;
++			const char *leaf = ents[count - 1]->d_name;
++
++			snprintf(name, sizeof name, ZONEINFO_PREFIX "/%s/%s", 
++				 top, leaf);
++			
++			if (strlen(name) && stat(name, &st) == 0) {
++				/* Name, relative to the zoneinfo prefix. */
++				const char *root = top;
++
++				if (root[0] == '/') root++;
++
++				snprintf(name, sizeof name, "%s%s%s", root, 
++					 *root ? "/": "", leaf);
++
++				if (S_ISDIR(st.st_mode)) {
++					if (dirstack_top == dirstack_size) {
++						dirstack_size *= 2;
++						dirstack = realloc(dirstack, 
++								   dirstack_size * sizeof *dirstack);
++					}
++					dirstack[dirstack_top++] = strdup(name);
++				}
++				else {
++					if (index_next == index_size) {
++						index_size *= 2;
++						db_index = realloc(db_index,
++								   index_size * sizeof *db_index);
++					}
++
++					db_index[index_next++].id = strdup(name);
++				}
++			}
++
++			free(ents[--count]);
++		}
++		
++		if (count != -1) free(ents);
++		free(top);
++	} while (dirstack_top);
++
++        qsort(db_index, index_next, sizeof *db_index, sysdbcmp);
++
++	db->index = db_index;
++	db->index_size = index_next;
++
++	free(dirstack);
++}
++
++#define FAKE_HEADER "1234\0??\1??"
++#define FAKE_UTC_POS (7 - 4)
++
++/* Create a fake data segment for database 'sysdb'. */
++static void fake_data_segment(timelib_tzdb *sysdb,
++                              struct location_info **info)
++{
++        size_t n;
++        char *data, *p;
++        
++        data = malloc(3 * sysdb->index_size + 7);
++
++        p = mempcpy(data, FAKE_HEADER, sizeof(FAKE_HEADER) - 1);
++
++        for (n = 0; n < sysdb->index_size; n++) {
++                const struct location_info *li;
++                timelib_tzdb_index_entry *ent;
++
++                ent = (timelib_tzdb_index_entry *)&sysdb->index[n];
++
++                /* Lookup the timezone name in the hash table. */
++                if (strcmp(ent->id, "UTC") == 0) {
++                        ent->pos = FAKE_UTC_POS;
++                        continue;
++                }
++
++                li = find_zone_info(info, ent->id);
++                if (li) {
++                        /* If found, append the BC byte and the
++                         * country code; set the position for this
++                         * section of timezone data.  */
++                        ent->pos = (p - data) - 4;
++                        *p++ = '\1';
++                        *p++ = li->code[0];
++                        *p++ = li->code[1];
++                }
++                else {
++                        /* If not found, the timezone data can
++                         * point at the header. */
++                        ent->pos = 0;
++                }
++        }
++        
++        sysdb->data = (unsigned char *)data;
++}
++
++/* Returns true if the passed-in stat structure describes a
++ * probably-valid timezone file. */
++static int is_valid_tzfile(const struct stat *st, int fd)
++{
++	if (fd) {
++		char buf[20];
++		if (read(fd, buf, 20)!=20) {
++			return 0;
++		}
++		lseek(fd, SEEK_SET, 0);
++		if (memcmp(buf, "TZif", 4)) {
++			return 0;
++		}
++	}
++	return S_ISREG(st->st_mode) && st->st_size > 20;
++}
++
++/* To allow timezone names to be used case-insensitively, find the
++ * canonical name for this timezone, if possible. */
++static const char *canonical_tzname(const char *timezone)
++{
++    if (timezonedb_system) {
++        timelib_tzdb_index_entry *ent, lookup;
++
++        lookup.id = (char *)timezone;
++
++        ent = bsearch(&lookup, timezonedb_system->index,
++                      timezonedb_system->index_size, sizeof lookup,
++                      sysdbcmp);
++        if (ent) {
++            return ent->id;
++        }
++    }
++
++    return timezone;
++}
++
++/* Return the mmap()ed tzfile if found, else NULL.  On success, the
++ * length of the mapped data is placed in *length. */
++static char *map_tzfile(const char *timezone, size_t *length)
++{
++	char fname[PATH_MAX];
++	struct stat st;
++	char *p;
++	int fd;
++	
++	if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
++		return NULL;
++	}
++
++	snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
++
++	fd = open(fname, O_RDONLY);
++	if (fd == -1) {
++		return NULL;
++	} else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) {
++		close(fd);
++		return NULL;
++	}
++
++	*length = st.st_size;
++	p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED, fd, 0);
++	close(fd);
++	
++	return p != MAP_FAILED ? p : NULL;
++}
++
++#endif
++
++static int inmem_seek_to_tz_position(const unsigned char **tzf, char *timezone, const timelib_tzdb *tzdb)
+ {
+ 	int left = 0, right = tzdb->index_size - 1;
+ 
+@@ -438,9 +878,48 @@ static int seek_to_tz_position(const uns
+ 	return 0;
+ }
+ 
++static int seek_to_tz_position(const unsigned char **tzf, char *timezone,
++			       char **map, size_t *maplen,
++			       const timelib_tzdb *tzdb)
++{
++#ifdef HAVE_SYSTEM_TZDATA
++	if (tzdb == timezonedb_system) {
++		char *orig;
++
++		orig = map_tzfile(timezone, maplen);
++		if (orig == NULL) {
++			return 0;
++		}
++
++		(*tzf) = (unsigned char *)orig;
++		*map = orig;
++        return 1;
++	}
++	else
++#endif
++	{
++		return inmem_seek_to_tz_position(tzf, timezone, tzdb);
++	}
++}
++
+ const timelib_tzdb *timelib_builtin_db(void)
+ {
++#ifdef HAVE_SYSTEM_TZDATA
++	if (timezonedb_system == NULL) {
++		timelib_tzdb *tmp = malloc(sizeof *tmp);
++
++		tmp->version = "0.system";
++		tmp->data = NULL;
++		create_zone_index(tmp);
++		system_location_table = create_location_table();
++		fake_data_segment(tmp, system_location_table);
++		timezonedb_system = tmp;
++	}
++
++	return timezonedb_system;
++#else
+ 	return &timezonedb_builtin;
++#endif
+ }
+ 
+ const timelib_tzdb_index_entry *timelib_timezone_identifiers_list(const timelib_tzdb *tzdb, int *count)
+@@ -452,7 +931,30 @@ const timelib_tzdb_index_entry *timelib_
+ int timelib_timezone_id_is_valid(char *timezone, const timelib_tzdb *tzdb)
+ {
+ 	const unsigned char *tzf;
+-	return (seek_to_tz_position(&tzf, timezone, tzdb));
++
++#ifdef HAVE_SYSTEM_TZDATA
++	if (tzdb == timezonedb_system) {
++		char fname[PATH_MAX];
++		struct stat st;
++
++		if (timezone[0] == '\0' || strstr(timezone, "..") != NULL) {
++			return 0;
++		}
++
++		if (system_location_table) {
++			if (find_zone_info(system_location_table, timezone) != NULL) {
++				/* found in cache */
++				return 1;
++			}
++		}
++
++		snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
++
++		return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0);
++	}
++#endif
++
++	return (inmem_seek_to_tz_position(&tzf, timezone, tzdb));
+ }
+ 
+ static int skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
+@@ -494,12 +996,14 @@ static timelib_tzinfo* timelib_tzinfo_ct
+ timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb, int *error_code)
+ {
+ 	const unsigned char *tzf;
++	char *memmap = NULL;
++	size_t maplen;
+ 	timelib_tzinfo *tmp;
+ 	int version;
+ 	int transitions_result, types_result;
+ 	unsigned int type; /* TIMELIB_TZINFO_PHP or TIMELIB_TZINFO_ZONEINFO */
+ 
+-	if (seek_to_tz_position(&tzf, timezone, tzdb)) {
++	if (seek_to_tz_position(&tzf, timezone, &memmap, &maplen, tzdb)) {
+ 		tmp = timelib_tzinfo_ctor(timezone);
+ 
+ 		version = read_preamble(&tzf, tmp, &type);
+@@ -534,11 +1038,36 @@ timelib_tzinfo *timelib_parse_tzfile(cha
+ 		}
+ 		skip_posix_string(&tzf, tmp);
+ 
++#ifdef HAVE_SYSTEM_TZDATA
++		if (memmap) {
++			const struct location_info *li;
++
++			/* TZif-style - grok the location info from the system database,
++			 * if possible. */
++
++			if ((li = find_zone_info(system_location_table, timezone)) != NULL) {
++				tmp->location.comments = timelib_strdup(li->comment);
++				strncpy(tmp->location.country_code, li->code, 2);
++				tmp->location.longitude = li->longitude;
++				tmp->location.latitude = li->latitude;
++				tmp->bc = 1;
++			}
++			else {
++				set_default_location_and_comments(&tzf, tmp);
++			}
++
++			/* Now done with the mmap segment - discard it. */
++			munmap(memmap, maplen);
++		} else {
++#endif
+ 		if (type == TIMELIB_TZINFO_PHP) {
+ 			read_location(&tzf, tmp);
+ 		} else {
+ 			set_default_location_and_comments(&tzf, tmp);
+ 		}
++#ifdef HAVE_SYSTEM_TZDATA
++		}
++#endif
+ 	} else {
+ 		*error_code = TIMELIB_ERROR_NO_SUCH_TIMEZONE;
+ 		tmp = NULL;
diff --git a/external/subpack/lang/php7/patches/0032-Use-system-timezone.patch b/external/subpack/lang/php7/patches/0032-Use-system-timezone.patch
new file mode 100644
index 0000000..5886902
--- /dev/null
+++ b/external/subpack/lang/php7/patches/0032-Use-system-timezone.patch
@@ -0,0 +1,41 @@
+From: Debian PHP Maintainers <pkg-php-maint@lists.alioth.debian.org>
+Date: Sat, 2 May 2015 10:26:56 +0200
+Subject: Use system timezone
+
+Upstream don't want this patch. See
+http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=730771 for a summary.
+
+This delta is recovered from previous versions of the system timezone patch in
+Debian, and appears to have inadvertently been dropped. Author unknown.
+
+To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezonedb_fixes.patch.
+---
+ ext/date/php_date.c | 17 +++++++++++++++++
+ 1 file changed, 17 insertions(+)
+
+--- a/ext/date/php_date.c
++++ b/ext/date/php_date.c
+@@ -1039,6 +1039,23 @@ static char* guess_timezone(const timeli
+ 		DATEG(timezone_valid) = 1;
+ 		return DATEG(default_timezone);
+ 	}
++	/* Try to guess timezone from system information */
++	{
++		struct tm *ta, tmbuf;
++		time_t     the_time;
++		char      *tzid = NULL;
++
++		the_time = time(NULL);
++		ta = php_localtime_r(&the_time, &tmbuf);
++		if (ta) {
++			tzid = timelib_timezone_id_from_abbr(ta->tm_zone, ta->tm_gmtoff, ta->tm_isdst);
++		}
++		if (! tzid) {
++			tzid = "UTC";
++		}
++
++		return tzid;
++	}
+ 	/* Fallback to UTC */
+ 	return "UTC";
+ }
diff --git a/external/subpack/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch b/external/subpack/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch
new file mode 100644
index 0000000..d39042a
--- /dev/null
+++ b/external/subpack/lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch
@@ -0,0 +1,102 @@
+From: Thijs Kinkhorst <thijs@debian.org>
+Date: Mon, 2 Dec 2019 22:18:43 +0100
+Subject: Add patch to remove build timestamps from generated binaries.
+
+---
+ ext/standard/info.c           |  1 -
+ sapi/apache2handler/config.m4 | 15 +++------------
+ sapi/cgi/cgi_main.c           |  4 ++--
+ sapi/cli/php_cli.c            |  4 ++--
+ sapi/fpm/fpm/fpm_main.c       |  4 ++--
+ sapi/phpdbg/phpdbg.c          |  4 +---
+ 6 files changed, 10 insertions(+), 22 deletions(-)
+
+--- a/ext/standard/info.c
++++ b/ext/standard/info.c
+@@ -803,7 +803,6 @@ PHPAPI ZEND_COLD void php_print_info(int
+ 		php_info_print_box_end();
+ 		php_info_print_table_start();
+ 		php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
+-		php_info_print_table_row(2, "Build Date", __DATE__ " " __TIME__);
+ #ifdef COMPILER
+ 		php_info_print_table_row(2, "Compiler", COMPILER);
+ #endif
+--- a/sapi/apache2handler/config.m4
++++ b/sapi/apache2handler/config.m4
+@@ -64,18 +64,9 @@ if test "$PHP_APXS2" != "no"; then
+   fi
+ 
+   APXS_LIBEXECDIR='$(INSTALL_ROOT)'`$APXS -q LIBEXECDIR`
+-  if test -z `$APXS -q SYSCONFDIR`; then
+-    INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
+-                 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+-                       -i -n php7"
+-  else
+-    APXS_SYSCONFDIR='$(INSTALL_ROOT)'`$APXS -q SYSCONFDIR`
+-    INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
+-                \$(mkinstalldirs) '$APXS_SYSCONFDIR' && \
+-                 $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
+-                       -S SYSCONFDIR='$APXS_SYSCONFDIR' \
+-                       -i -a -n php7"
+-  fi
++  INSTALL_IT="\$(mkinstalldirs) '$APXS_LIBEXECDIR' && \
++               $APXS -S LIBEXECDIR='$APXS_LIBEXECDIR' \
++                     -i -n php7"
+ 
+   case $host_alias in
+   *aix*)
+--- a/sapi/cgi/cgi_main.c
++++ b/sapi/cgi/cgi_main.c
+@@ -2401,9 +2401,9 @@ parent_loop_end:
+ 							SG(headers_sent) = 1;
+ 							SG(request_info).no_headers = 1;
+ #if ZEND_DEBUG
+-							php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++							php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name,  get_zend_version());
+ #else
+-							php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++							php_printf("PHP %s (%s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+ #endif
+ 							php_request_shutdown((void *) 0);
+ 							fcgi_shutdown();
+--- a/sapi/cli/php_cli.c
++++ b/sapi/cli/php_cli.c
+@@ -648,8 +648,8 @@ static int do_cli(int argc, char **argv)
+ 				goto out;
+ 
+ 			case 'v': /* show php version & quit */
+-				php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) The PHP Group\n%s",
+-					PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
++				php_printf("PHP %s (%s) ( %s)\nCopyright (c) The PHP Group\n%s",
++					PHP_VERSION, cli_sapi_module.name,
+ #if ZTS
+ 					"ZTS "
+ #else
+--- a/sapi/fpm/fpm/fpm_main.c
++++ b/sapi/fpm/fpm/fpm_main.c
+@@ -1718,9 +1718,9 @@ int main(int argc, char *argv[])
+ 				SG(request_info).no_headers = 1;
+ 
+ #if ZEND_DEBUG
+-				php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__,        __TIME__, get_zend_version());
++				php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+ #else
+-				php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__,      get_zend_version());
++				php_printf("PHP %s (%s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+ #endif
+ 				php_request_shutdown((void *) 0);
+ 				fcgi_shutdown();
+--- a/sapi/phpdbg/phpdbg.c
++++ b/sapi/phpdbg/phpdbg.c
+@@ -1697,10 +1697,8 @@ phpdbg_main:
+ 				phpdbg_do_help_cmd(exec);
+ 			} else if (show_version) {
+ 				phpdbg_out(
+-					"phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) The PHP Group\n%s",
++					"phpdbg %s\nPHP %s, Copyright (c) The PHP Group\n%s",
+ 					PHPDBG_VERSION,
+-					__DATE__,
+-					__TIME__,
+ 					PHP_VERSION,
+ 					get_zend_version()
+ 				);
diff --git a/external/subpack/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch b/external/subpack/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch
new file mode 100644
index 0000000..ed22169
--- /dev/null
+++ b/external/subpack/lang/php7/patches/0042-Remove-W3C-validation-icon-to-not-expose-the-reader-.patch
@@ -0,0 +1,23 @@
+From: =?utf-8?q?Ond=C5=99ej_Sur=C3=BD?= <ondrej@sury.org>
+Date: Wed, 29 Jul 2015 14:37:55 +0200
+Subject: Remove W3C validation icon to not expose the reader's IP address to
+ potential tracking.
+
+---
+ sapi/fpm/status.html.in | 5 -----
+ 1 file changed, 5 deletions(-)
+
+--- a/sapi/fpm/status.html.in
++++ b/sapi/fpm/status.html.in
+@@ -70,11 +70,6 @@
+ 				<tr class="h"><th>PID&darr;</th><th>Start Time</th><th>Start Since</th><th>Requests Served</th><th>Request Duration</th><th>Request method</th><th>Request URI</th><th>Content Length</th><th>User</th><th>Script</th><th>Last Request %CPU</th><th>Last Request Memory</th></tr>
+ 			</table>
+ 		</div>
+-		<p>
+-			<a href="http://validator.w3.org/check?uri=referer">
+-				<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Transitional" height="31" width="88" />
+-			</a>
+-		 </p>
+ 		<script type="text/javascript">
+ <!--
+ 			var xhr_object = null;
diff --git a/external/subpack/lang/php7/patches/0050-remove-build-timestamps.patch b/external/subpack/lang/php7/patches/0050-remove-build-timestamps.patch
new file mode 100644
index 0000000..ec7bb36
--- /dev/null
+++ b/external/subpack/lang/php7/patches/0050-remove-build-timestamps.patch
@@ -0,0 +1,28 @@
+--- a/ext/opcache/ZendAccelerator.c
++++ b/ext/opcache/ZendAccelerator.c
+@@ -2670,11 +2670,6 @@ static void accel_gen_system_id(void)
+ 	PHP_MD5Update(&context, PHP_VERSION, sizeof(PHP_VERSION)-1);
+ 	PHP_MD5Update(&context, ZEND_EXTENSION_BUILD_ID, sizeof(ZEND_EXTENSION_BUILD_ID)-1);
+ 	PHP_MD5Update(&context, ZEND_BIN_ID, sizeof(ZEND_BIN_ID)-1);
+-	if (strstr(PHP_VERSION, "-dev") != 0) {
+-		/* Development versions may be changed from build to build */
+-		PHP_MD5Update(&context, __DATE__, sizeof(__DATE__)-1);
+-		PHP_MD5Update(&context, __TIME__, sizeof(__TIME__)-1);
+-	}
+ 	/* Modules may have changed after restart which can cause dangling pointers from
+      * custom opcode handlers in the second-level cache files
+      */
+--- a/sapi/litespeed/lsapi_main.c
++++ b/sapi/litespeed/lsapi_main.c
+@@ -1288,9 +1288,9 @@ static int cli_main( int argc, char * ar
+             case 'v':
+                 if (php_request_startup() != FAILURE) {
+ #if ZEND_DEBUG
+-                    php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++                    php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+ #else
+-                    php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++                    php_printf("PHP %s (%s)\nCopyright (c) The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+ #endif
+ #ifdef PHP_OUTPUT_NEWAPI
+                     php_output_end_all();
diff --git a/external/subpack/lang/php7/patches/1001-ext-opcache-fix-detection-of-shm-mmap.patch b/external/subpack/lang/php7/patches/1001-ext-opcache-fix-detection-of-shm-mmap.patch
new file mode 100644
index 0000000..40506f7
--- /dev/null
+++ b/external/subpack/lang/php7/patches/1001-ext-opcache-fix-detection-of-shm-mmap.patch
@@ -0,0 +1,46 @@
+From dd6ee0fb6715881b204fb4cb124db9134c1a6c7d Mon Sep 17 00:00:00 2001
+From: Michael Heimpold <mhei@heimpold.de>
+Date: Mon, 2 Dec 2019 22:42:28 +0100
+Subject: [PATCH] ext/opcache: fix detection of shm/mmap
+
+The detection of sysvipc and mmap doesn't work well when cross-compiling,
+so I decided to only check for the availability of the functions involved.
+This is not a clean solution, but works for now(tm) :-)
+
+It should be discussed with upstream to find a better solution.
+
+This solves the issue reported at
+https://github.com/openwrt/packages/issues/1010
+and makes opcache usable on OpenWrt.
+
+Signed-off-by: Michael Heimpold <mhei@heimpold.de>
+---
+ ext/opcache/config.m4 | 10 ++++++++--
+ 1 file changed, 8 insertions(+), 2 deletions(-)
+
+--- a/ext/opcache/config.m4
++++ b/ext/opcache/config.m4
+@@ -89,7 +89,10 @@ int main() {
+ }
+ ]])],[dnl
+     AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
+-    msg=yes],[msg=no],[msg=no])
++    msg=yes],[msg=no],[dnl
++    AC_CHECK_FUNC(shmget,[dnl
++        AC_DEFINE(HAVE_SHM_IPC, 1, [Define if you have SysV IPC SHM support])
++        msg=yes],[msg=no])])
+   AC_MSG_RESULT([$msg])
+ 
+   AC_MSG_CHECKING(for mmap() using MAP_ANON shared memory support)
+@@ -141,7 +144,10 @@ int main() {
+ }
+ ]])],[dnl
+     AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
+-    msg=yes],[msg=no],[msg=no])
++    msg=yes],[msg=no],[dnl
++    AC_CHECK_FUNC(mmap,[dnl
++        AC_DEFINE(HAVE_SHM_MMAP_ANON, 1, [Define if you have mmap(MAP_ANON) SHM support])
++        msg=yes],[msg=no])])
+   AC_MSG_RESULT([$msg])
+ 
+   PHP_CHECK_FUNC_LIB(shm_open, rt)
diff --git a/external/subpack/lang/php7/patches/1004-disable-phar-command.patch b/external/subpack/lang/php7/patches/1004-disable-phar-command.patch
new file mode 100644
index 0000000..6ac9524
--- /dev/null
+++ b/external/subpack/lang/php7/patches/1004-disable-phar-command.patch
@@ -0,0 +1,32 @@
+--- a/ext/phar/config.m4
++++ b/ext/phar/config.m4
+@@ -19,7 +19,7 @@ if test "$PHP_PHAR" != "no"; then
+   fi
+   PHP_ADD_EXTENSION_DEP(phar, hash, true)
+   PHP_ADD_EXTENSION_DEP(phar, spl, true)
+-  PHP_ADD_MAKEFILE_FRAGMENT
++  #PHP_ADD_MAKEFILE_FRAGMENT
+ 
+   PHP_INSTALL_HEADERS([ext/phar], [php_phar.h])
+ 
+--- a/configure.ac
++++ b/configure.ac
+@@ -1454,13 +1454,13 @@ CFLAGS="\$(CFLAGS_CLEAN) $standard_libto
+ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
+ CXXFLAGS="$CXXFLAGS $standard_libtool_flag \$(PROF_FLAGS)"
+ 
+-if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
+-  pharcmd=pharcmd
+-  pharcmd_install=install-pharcmd
+-else
++#if test "$PHP_PHAR" != "no" && test "$PHP_CLI" != "no"; then
++#  pharcmd=pharcmd
++#  pharcmd_install=install-pharcmd
++#else
+   pharcmd=
+   pharcmd_install=
+-fi;
++#fi;
+ 
+ all_targets="$lcov_target \$(OVERALL_TARGET) \$(PHP_MODULES) \$(PHP_ZEND_EX) \$(PHP_BINARIES) $pharcmd"
+ install_targets="$install_sapi $install_modules $install_binaries install-build install-headers install-programs $install_pear $pharcmd_install"
diff --git a/external/subpack/lang/php7/pecl.mk b/external/subpack/lang/php7/pecl.mk
new file mode 100644
index 0000000..faa8b09
--- /dev/null
+++ b/external/subpack/lang/php7/pecl.mk
@@ -0,0 +1,52 @@
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Package/php7-pecl/Default
+  SUBMENU:=PHP7
+  SECTION:=lang
+  CATEGORY:=Languages
+  URL:=http://pecl.php.net/
+  DEPENDS:=php7
+endef
+
+define Build/Prepare
+	$(Build/Prepare/Default)
+	$(if $(QUILT),,( cd $(PKG_BUILD_DIR); $(STAGING_DIR)/usr/bin/phpize7 ))
+endef
+
+define Build/Configure
+	$(if $(QUILT),( cd $(PKG_BUILD_DIR); $(STAGING_DIR)/usr/bin/phpize7 ))
+	$(Build/Configure/Default)
+endef
+
+CONFIGURE_VARS+= \
+	ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no)
+
+CONFIGURE_ARGS+= \
+	--with-php-config=$(STAGING_DIR)/usr/bin/php7-config
+
+define PHP7PECLPackage
+
+  define Package/php7-pecl-$(1)
+    $(call Package/php7-pecl/Default)
+    TITLE:=$(2)
+
+    ifneq ($(3),)
+      DEPENDS+=$(3)
+    endif
+  endef
+
+  define Package/php7-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/php7
+    ifeq ($(5),zend)
+	echo "zend_extension=/usr/lib/php/$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini
+    else
+	echo "extension=$(subst -,_,$(1)).so" > $$(1)/etc/php7/$(if $(4),$(4),20)_$(subst -,_,$(1)).ini
+    endif
+  endef
+
+endef
diff --git a/external/subpack/lang/php7/test.sh b/external/subpack/lang/php7/test.sh
new file mode 100644
index 0000000..273afc7
--- /dev/null
+++ b/external/subpack/lang/php7/test.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+case "$1" in
+	php7-cgi)
+		php-cgi -v | grep "$2"
+		;;
+	php7-cli)
+		php-cli -v | grep "$2"
+		;;
+	php7-fpm)
+		php-fpm -v | grep "$2"
+		;;
+	php7-mod-*)
+		PHP_MOD="${1#php7-mod-}"
+		PHP_MOD="${PHP_MOD//-/_}"
+
+		opkg install php7-cli
+
+		php-cli -m | grep -i "$PHP_MOD"
+		;;
+	*)
+		;;
+esac