Browse Source

Fresh pull from upstream

RISCi_ATOM 6 years ago
parent
commit
f116137591
100 changed files with 2158 additions and 6054 deletions
  1. 0 114
      CONTRIBUTING.md
  2. 2 2
      admin/debootstrap/Makefile
  3. 119 0
      admin/openwisp-config/Makefile
  4. 2 2
      admin/sudo/Makefile
  5. 76 0
      admin/syslog-ng/Makefile
  6. 37 0
      admin/syslog-ng/files/syslog-ng.conf
  7. 19 0
      admin/syslog-ng/files/syslog-ng.init
  8. 0 51
      kernel/exfat-nofuse/Makefile
  9. 3 4
      lang/lua-bencode/Makefile
  10. 2 2
      lang/lualanes/Makefile
  11. 6 2
      lang/luarocks/Makefile
  12. 37 0
      lang/luarocks/patches/02_allow_configure_uname_siteconfig_adjustment.patch
  13. 1 1
      lang/node/Makefile
  14. 8 4
      lang/perl-cgi/Makefile
  15. 49 0
      lang/perl-www-curl/Makefile
  16. 74 0
      lang/perl-www-curl/patches/100-perl-www-curl_disable_curl-config_hack.patch
  17. 34 0
      lang/perl-www-curl/patches/101-skip-preprocessor-symbol.path
  18. 11 0
      lang/perl-www-curl/patches/200-fix_default_lflags.patch
  19. 2 2
      lang/perl-xml-parser/Makefile
  20. 11 0
      lang/perl/Config.in
  21. 4 3
      lang/perl/Makefile
  22. 10 6
      lang/perl/perlmod.mk
  23. 3 3
      lang/php7-pecl-dio/Makefile
  24. 0 3110
      lang/php7-pecl-dio/patches/0000-unify-line-endings.patch
  25. 0 32
      lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch
  26. 0 39
      lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch
  27. 0 39
      lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch
  28. 0 42
      lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch
  29. 0 91
      lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch
  30. 0 117
      lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch
  31. 0 66
      lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch
  32. 0 34
      lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch
  33. 0 125
      lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch
  34. 0 240
      lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch
  35. 0 89
      lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch
  36. 0 829
      lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch
  37. 0 69
      lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch
  38. 0 54
      lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch
  39. 0 48
      lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch
  40. 0 44
      lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch
  41. 16 5
      lang/php7-pecl-http/Makefile
  42. 0 0
      lang/php7-pecl-http/patches.old/100_config9-m4.patch
  43. 11 0
      lang/php7-pecl-http/patches/100_php_http_etag_bigendian_check.patch
  44. 3 2
      lang/php7/Makefile
  45. 27 16
      lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch
  46. 2 2
      lang/php7/patches/0032-Use-system-timezone.patch
  47. 24 41
      lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch
  48. 29 0
      lang/php7/patches/1005-fix-asm-constraints-in-aarch64-multiply-macro.patch
  49. 3 0
      lang/php7/pecl.mk
  50. 1 1
      lang/python-cffi/Makefile
  51. 0 44
      lang/python-gmpy/Makefile
  52. 2 2
      lang/python-packages/Makefile
  53. 1 1
      lang/python-pip/Makefile
  54. 1 1
      lang/python-ply/Makefile
  55. 1 1
      lang/python-pycparser/Makefile
  56. 1 1
      lang/python-setuptools/Makefile
  57. 24 13
      lang/python/Makefile
  58. 7 6
      lang/python/files/python-host.mk
  59. 1 1
      lang/python/files/python-package-dev.mk
  60. 19 16
      lang/python/files/python-package.mk
  61. 1 1
      lang/python/files/python-version.mk
  62. 0 31
      lang/python/patches/005-fix-libffi-x86-64-configure.patch
  63. 0 15
      lang/python/patches/011-do-not-prefer-ncursesw.patch
  64. 12 0
      lang/python/patches/011-remove-setupterm-definition.patch
  65. 31 8
      lang/python3/Makefile
  66. 90 0
      lang/python3/files/python3-host.mk
  67. 3 1
      lang/python3/files/python3-package-dev.mk
  68. 2 0
      lang/python3/files/python3-package-lib2to3.mk
  69. 41 32
      lang/python3/files/python3-package.mk
  70. 13 0
      lang/python3/files/python3-version.mk
  71. 24 0
      lang/python3/patches/011-fix-ncursesw-definition-colisions.patch
  72. 72 0
      lang/python3/patches/016-adjust-config-paths.patch
  73. 226 223
      lang/ruby/Makefile
  74. 0 152
      lang/ruby/patches/001-acinclude.m4_rename_aclocal.m4.patch
  75. 2 2
      lang/ruby/ruby_find_pkgsdeps
  76. 1 1
      lang/ruby/ruby_missingfiles
  77. 13 11
      libs/boost/Makefile
  78. 5 4
      libs/boost/patches/01_fiber_fix.patch
  79. 74 0
      libs/dtc/Makefile
  80. 44 0
      libs/eventlog/Makefile
  81. 4 4
      libs/expat/Makefile
  82. 2 2
      libs/fftw3/Makefile
  83. 8 8
      libs/fftw3/patches/001-makefile.patch
  84. 8 6
      libs/glib2/Makefile
  85. 4 2
      libs/gnutls/Makefile
  86. 41 28
      libs/icu/Makefile
  87. 1 1
      libs/icu/patches/000-dont-cpy-files-from-topdirs.patch
  88. 26 0
      libs/icu/patches/001-disable-strtod_l.patch
  89. 176 0
      libs/icu/patches/CVE-2017-7867_CVE-2017-7868.patch
  90. 71 0
      libs/libcanfestival/Makefile
  91. 11 0
      libs/libcanfestival/patches/001-sigval-ref-fix.patch
  92. 33 0
      libs/libcanfestival/patches/002-makefile-gcc-linker.patch
  93. 20 0
      libs/libcanfestival/patches/003-makefile-skip-examples.patch
  94. 64 0
      libs/libcoap/Makefile
  95. 0 51
      libs/libevhtp/Makefile
  96. 0 49
      libs/libevhtp/patches/010-strcmp-endianness-fix.patch
  97. 1 0
      libs/libexif/Makefile
  98. 3 4
      libs/libextractor/Makefile
  99. 347 0
      libs/libextractor/patches/002-ffmpeg2.9_api_backport.patch
  100. 1 1
      libs/libgd/Makefile

+ 0 - 114
CONTRIBUTING.md

@@ -1,114 +0,0 @@
-# Contributing Guidelines  
-(See <http://wiki.openwrt.org/doc/devel/packages> for overall format and construction)
-
-
-### Basic guidelines
-
-All packages you commit or submit by pull-request should follow these simple guidelines:
-* Package a version which is still maintained by the upstream author.
-* Will be updated regularly to maintained and supported versions.
-* Have no dependencies outside the OpenWrt core packages or this repository feed.
-* Have been tested to compile with the correct includes and dependencies. Please also test with "Compile with full language support" found under "General Build Settings" set if language support is relevant to your package.
-* Do NOT use a rolling source file (e.g. foo-latest.tar.gz) or the head of a branch as source for the package since that would create unpredictable builds which change over time.
-* Best of all -- it works as expected!
-
-#### Makefile contents should contain:
-
-* An up-to-date copyright notice. Use OpenWrt if no other present or supply your own.
-* A (PKG_)MAINTAINER definition listing either yourself or another person in the field.
-    (E.g.: PKG_MAINTAINER:= Joe D. Hacker `<jdh@jdhs-email-provider.org`>)
-* A PKG_LICENSE tag declaring the main license of the package.
-    (E.g.: PKG_LICENSE:=GPL-2.0+) Please use SPDX identifiers if possible (see list at the bottom).
-* An optional PKG_LICENSE_FILES tag including the filenames of the license-files in the source-package.
-    (E.g.: PKG_LICENSE_FILES:=COPYING)
-* PKG_RELEASE should be initially set to 1 or reset to 1 if the software version is changed. You should increment it if the package itself has changed. For example, modifying a support script, changing configure options like --disable* or --enable* switches, or if you changed something in the package which causes the resulting binaries to be different. Changes like correcting md5sums, changing mirror URLs, adding a maintainer field or updating a comment or copyright year in a Makefile do not require a change to PKG_RELEASE.
-
-#### Commits in your pull-requests should:
-
-* Have a useful description prefixed with the package name
-    (E.g.: "foopkg: Add libzot dependency")
-* Include Signed-off-by in the comment
-    (See <https://dev.openwrt.org/wiki/SubmittingPatches#a10.Signyourwork>)
-
-### Advice on pull requests:
-
-Pull requests are the easiest way to contribute changes to git repos at Github. They are the preferred contribution method, as they offer a nice way for commenting and amending the proposed changes.
-
-* You need a local "fork" of the Github repo.
-* Use a "feature branch" for your changes. That separates the changes in the pull request from your other changes and makes it easy to edit/amend commits in the pull request. Workflow using "feature_x" as the example:
-  - Update your local git fork to the tip (of the master, usually)
-  - Create the feature branch with `git checkout -b feature_x`
-  - Edit changes and commit them locally
-  - Push them to your Github fork by `git push -u origin feature_x`. That creates the "feature_x" branch at your Github fork and sets it as the remote of this branch
-  - When you now visit Github, you should see a proposal to create a pull request
-
-* If you later need to add new commits to the pull request, you can simply commit the changes to the local branch and then use `git push` to automatically update the pull request.
-
-* If you need to change something in the existing pull request (e.g. to add a missing signed-off-by line to the commit message), you can use `git push -f` to overwrite the original commits. That is easy and safe when using a feature branch. Example workflow:
-  - Checkout the feature branch by `git checkout feature_x`
-  - Edit changes and commit them locally. If you are just updating the commit message in the last commit, you can use `git commit --amend` to do that
-  - If you added several new commits or made other changes that require cleaning up, you can use `git rebase -i HEAD~X` (X = number of commits to edit) to possibly squash some commits
-  - Push the changed commits to Github with `git push -f` to overwrite the original commits in the "feature_x" branch with the new ones. The pull request gets automatically updated
-
-### If you have commit access:
-
-* Do NOT use git push --force.
-* Do NOT commit to other maintainer's packages without their consent.
-* Use Pull Requests if you are unsure and to suggest changes to other maintainers.
-
-#### Gaining commit access:
-
-* We will gladly grant commit access to responsible contributors who have made
-  useful pull requests and / or feedback or patches to this repository or
-  OpenWrt in general. Please include your request for commit access in your
-  next pull request or ticket.
-
-### Release Branches:
-
-* Branches named "for-XX.YY" (e.g. for-14.07) are release branches.
-* These branches are built with the respective OpenWrt release and are created
-  during the release stabilisation phase.
-* Please ONLY cherry-pick or commit security and bug-fixes to these branches.
-* Do NOT add new packages and do NOT do major upgrades of packages here.
-* If you are unsure if your change is suitable, please use a pull request.
-
-### Common LICENSE tags (short list)  
-(Complete list can be found at: <http://spdx.org/licenses>)
-
-| Full Name | Identifier  |
-|---|:---|
-|Apache License 1.0|Apache-1.0|
-|Apache License 1.1|Apache-1.1|
-|Apache License 2.0|Apache-2.0|
-|Artistic License 1.0|Artistic-1.0|
-|Artistic License 1.0 (Perl)|Artistic-1.0-Perl|
-|Artistic License 1.0 w/clause 8|Artistic-1.0-cl8|
-|Artistic License 2.0|Artistic-2.0|
-|BSD 2-clause "Simplified" License|BSD-2-Clause|
-|BSD 2-clause FreeBSD License|BSD-2-Clause-FreeBSD|
-|BSD 2-clause NetBSD License|BSD-2-Clause-NetBSD|
-|BSD 3-clause "New" or "Revised" License|BSD-3-Clause|
-|BSD 3-clause Clear License|BSD-3-Clause-Clear|
-|BSD 4-clause "Original" or "Old" License|BSD-4-Clause|
-|BSD Protection License|BSD-Protection|
-|BSD with attribution|BSD-3-Clause-Attribution|
-|BSD-4-Clause (University of California-Specific)|BSD-4-Clause-UC|
-|GNU General Public License v1.0 only|GPL-1.0|
-|GNU General Public License v1.0 or later|GPL-1.0+|
-|GNU General Public License v2.0 only|GPL-2.0|
-|GNU General Public License v2.0 or later|GPL-2.0+|
-|GNU General Public License v3.0 only|GPL-3.0|
-|GNU General Public License v3.0 or later|GPL-3.0+|
-|GNU Lesser General Public License v2.1 only|LGPL-2.1|
-|GNU Lesser General Public License v2.1 or later|LGPL-2.1+|
-|GNU Lesser General Public License v3.0 only|LGPL-3.0|
-|GNU Lesser General Public License v3.0 or later|LGPL-3.0+|
-|GNU Library General Public License v2 only|LGPL-2.0|
-|GNU Library General Public License v2 or later|LGPL-2.0+|
-|Fair License|Fair|
-|ISC License|ISC|
-|MIT License|MIT|
-|No Limit Public License|NLPL|
-|OpenSSL License|OpenSSL|
-|X11 License|X11|
-|zlib License|Zlib|

+ 2 - 2
admin/debootstrap/Makefile

@@ -9,13 +9,13 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=debootstrap
 PKG_NAME:=debootstrap
-PKG_VERSION:=1.0.83
+PKG_VERSION:=1.0.87
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
 
 
 PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb
 PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb
 PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap
 PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap
-PKG_MD5SUM:=877fe5281a0e424bd6c71d121cbb725b8f56694e66558cd47c20c3aa87ceff72
+PKG_MD5SUM:=784f5754f3287ae80715d9100a4ed04e7895be5f7b81b7b2295d335dd69d79fb
 PKG_LICENSE:=Unique
 PKG_LICENSE:=Unique
 PKG_LICENSE_FILES:=debian/copyright
 PKG_LICENSE_FILES:=debian/copyright
 
 

+ 119 - 0
admin/openwisp-config/Makefile

@@ -0,0 +1,119 @@
+# openwisp.org
+#
+# This is free software, licensed under the GNU General Public License v3.
+# See /LICENSE for more information.
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=openwisp-config
+PKG_VERSION:=0.4.5
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://github.com/openwisp/openwisp-config.git
+PKG_SOURCE_VERSION:=0.4.5
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_SOURCE_VERSION)
+PKG_MIRROR_HASH:=017a8ed35ebfda2805426e7da02559d5cc2845ee9ded60fdae8e848d377424fb
+PKG_LICENSE:=GPL-3.0
+PKGARCH:=all
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/openwisp-config/default
+	TITLE:=Remote configuration management agent ($(2) variant)
+	CATEGORY:=Administration
+	SECTION:=admin
+	SUBMENU:=openwisp
+	DEPENDS:=+curl +lua +libuci-lua +luafilesystem $(3)
+	VARIANT:=$(1)
+	MAINTAINER:=Federico Capoano <f.capoano@cineca.it>
+	URL:=http://openwisp.org
+endef
+
+Package/openwisp-config-openssl=$(call Package/openwisp-config/default,openssl,OpenSSL,+ca-certificates +libopenssl)
+Package/openwisp-config-mbedtls=$(call Package/openwisp-config/default,mbedtls,mbedTLS,+ca-certificates +libmbedtls)
+Package/openwisp-config-cyassl=$(call Package/openwisp-config/default,cyassl,CyaSSL,+ca-certificates +libcyassl)
+# deprecated on recent versions of OpenWRT (>= Designated Driver) and LEDE (>= 17.01)
+Package/openwisp-config-polarssl=$(call Package/openwisp-config/default,polarssl,PolarSSL,+ca-certificates +libpolarssl)
+Package/openwisp-config-nossl=$(call Package/openwisp-config/default,nossl,No SSL)
+
+define Build/Compile
+endef
+
+define Package/openwisp-config-$(BUILD_VARIANT)/conffiles
+/etc/config/openwisp
+endef
+
+ifeq ($(BUILD_VARIANT),openssl)
+CONFIG_OPENWISP_UCI:=ssl
+endif
+ifeq ($(BUILD_VARIANT),mbedtls)
+CONFIG_OPENWISP_UCI:=ssl
+endif
+ifeq ($(BUILD_VARIANT),cyassl)
+CONFIG_OPENWISP_UCI:=ssl
+endif
+ifeq ($(BUILD_VARIANT),polarssl)
+CONFIG_OPENWISP_UCI:=ssl
+endif
+ifeq ($(BUILD_VARIANT),nossl)
+CONFIG_OPENWISP_UCI:=nossl
+endif
+
+
+define Package/openwisp-config-$(BUILD_VARIANT)/install
+	$(INSTALL_DIR) \
+		$(1)/usr/sbin \
+		$(1)/etc/init.d \
+		$(1)/etc/config \
+		$(1)/etc/openwisp \
+		$(1)/usr/lib/lua/openwisp
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/openwisp.agent \
+		$(1)/usr/sbin/openwisp_config
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/openwisp.init \
+		$(1)/etc/init.d/openwisp_config
+
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/openwisp-config/files/openwisp-$(CONFIG_OPENWISP_UCI).config \
+		$(1)/etc/config/openwisp
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-reload-config \
+		$(1)/usr/sbin/openwisp-reload-config
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/lib/openwisp/utils.lua \
+		$(1)/usr/lib/lua/openwisp/utils.lua
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-store-unmanaged.lua \
+		$(1)/usr/sbin/openwisp-store-unmanaged
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-restore-unmanaged.lua \
+		$(1)/usr/sbin/openwisp-restore-unmanaged
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-remove-default-wifi.lua \
+		$(1)/usr/sbin/openwisp-remove-default-wifi
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-uci-autoname.lua \
+		$(1)/usr/sbin/openwisp-uci-autoname
+
+	$(INSTALL_BIN) \
+		$(PKG_BUILD_DIR)/openwisp-config/files/sbin/openwisp-update-config.lua \
+		$(1)/usr/sbin/openwisp-update-config
+
+	$(CP) $(PKG_BUILD_DIR)/VERSION $(1)/etc/openwisp/
+endef
+
+$(eval $(call BuildPackage,openwisp-config-openssl))
+$(eval $(call BuildPackage,openwisp-config-mbedtls))
+$(eval $(call BuildPackage,openwisp-config-cyassl))
+$(eval $(call BuildPackage,openwisp-config-polarssl))
+$(eval $(call BuildPackage,openwisp-config-nossl))

+ 2 - 2
admin/sudo/Makefile

@@ -64,8 +64,8 @@ define Host/Compile
 endef
 endef
 
 
 define Host/Install
 define Host/Install
-	$(INSTALL_DIR) $(HOST_BUILD_PREFIX)/bin
-	$(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(HOST_BUILD_PREFIX)/bin/
+	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin
+	$(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(STAGING_DIR_HOSTPKG)/bin/
 endef
 endef
 
 
 $(eval $(call HostBuild))
 $(eval $(call HostBuild))

+ 76 - 0
admin/syslog-ng/Makefile

@@ -0,0 +1,76 @@
+include  $(TOPDIR)/rules.mk
+
+PKG_NAME:=syslog-ng
+PKG_VERSION:=3.8.1
+PKG_RELEASE:=3
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/balabit/syslog-ng/releases/download/$(PKG_NAME)-$(PKG_VERSION)/
+PKG_MD5SUM:=acf14563cf5ce435db8db35486ce66af
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/syslog-ng
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+libpcre +glib2 +libeventlog +libopenssl +libuuid +libcurl
+  TITLE:=A powerful syslog daemon
+  URL:=http://www.balabit.com/network-security/syslog-ng/opensource-logging-system/
+endef
+
+define Package/syslog-ng/description
+  syslog-ng reads and logs messages to the system console, log
+  files, other machines and/or users as specified by its
+  configuration file.
+endef
+
+define Package/syslog-ng/conffiles
+  /etc/syslog-ng.conf
+endef
+
+define Build/Configure
+	$(SED) 's,-I/usr/include,,' $(PKG_BUILD_DIR)/configure
+	$(Build/Configure/Default)
+endef
+
+CONFIGURE_ARGS += \
+  $(call autoconf_bool,CONFIG_IPV6,ipv6) \
+         --disable-dependency-tracking \
+         --disable-ampq \
+         --disable-tcp-wrapper \
+         --disable-glibtest \
+         --disable-mongodb \
+         --disable-java \
+         --disable-json \
+         --disable-python \
+         --disable-spoof-source \
+         --disable-sql \
+         --disable-linux-caps \
+	 --disable-smtp \
+	 --disable-redis \
+         --enable-prce \
+
+TARGET_CPPFLAGS += \
+  -I$(STAGING_DIR)/usr/include/eventlog
+
+CONFIGURE_VARS += \
+  LIBDBI_CFLAGS="-I$(STAGING_DIR)/usr/include"
+
+define Package/syslog-ng/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		install-sbinPROGRAMS install-libLTLIBRARIES \
+		install-moduleLTLIBRARIES DESTDIR="$(1)"
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/syslog-ng.init $(1)/etc/init.d/syslog-ng
+	$(INSTALL_DIR) $(1)/etc
+	$(INSTALL_DATA) ./files/syslog-ng.conf $(1)/etc
+	$(call libtool_remove_files,$(1))
+endef
+
+$(eval $(call BuildPackage,syslog-ng))

+ 37 - 0
admin/syslog-ng/files/syslog-ng.conf

@@ -0,0 +1,37 @@
+@version:3.8
+
+options {
+	chain_hostnames(no);
+	create_dirs(yes);
+	flush_lines(0);
+	keep_hostname(yes);
+	log_fifo_size(256);
+	log_msg_size(1024);
+	stats_freq(0);
+	flush_lines(0);
+	use_fqdn(no);
+};
+
+source src {
+	internal();
+	unix-stream("/dev/log");
+};
+
+source net {
+	udp(ip(0.0.0.0) port(514));
+};
+
+source kernel {
+        file("/proc/kmsg" program_override("kernel"));
+};
+
+destination messages {
+	file("/var/log/messages");
+};
+
+log {
+	source(src);
+	source(net);
+        source(kernel);
+	destination(messages);
+};

+ 19 - 0
admin/syslog-ng/files/syslog-ng.init

@@ -0,0 +1,19 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2016 OpenWrt.org
+
+START=20
+
+SERVICE_USE_PID=1
+
+start() {
+	[ -f /etc/syslog-ng.conf ] || return 1
+	service_start /usr/sbin/syslog-ng
+}
+
+stop() {
+	service_stop /usr/sbin/syslog-ng
+}
+
+reload() {
+	service_reload /usr/sbin/syslog-ng
+}

+ 0 - 51
kernel/exfat-nofuse/Makefile

@@ -1,51 +0,0 @@
-#
-# Copyright (C) 2014 Bruno Randolf <br1@einfach.org>
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-include $(INCLUDE_DIR)/kernel.mk
-
-PKG_NAME:=exfat-nofuse
-PKG_VERSION=2016-09-26-$(PKG_SOURCE_VERSION)
-PKG_RELEASE:=1
-
-PKG_SOURCE=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://github.com/dorimanx/exfat-nofuse.git
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_SUBDIR=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=051167ceccbe75d9d77fc4f5356f5a39a01779e8
-
-PKG_MAINTAINER:=Bruno Randolf <br1@einfach.org>
-PKG_LICENSE:=GPL-2.0
-PKG_LICENSE_FILES:=LICENSE
-
-include $(INCLUDE_DIR)/package.mk
-
-define KernelPackage/fs-exfat
-	SUBMENU:=Filesystems
-	TITLE:=ExFAT Kernel driver
-	FILES:=$(PKG_BUILD_DIR)/exfat.ko
-	AUTOLOAD:=$(call AutoLoad,30,exfat,1)
-	DEPENDS:=+kmod-nls-base @BUILD_PATENTED
-endef
-
-define KernelPackage/fs-exfat/description
-	Kernel module for ExFAT Filesytems
-endef
-
-MAKE_OPTS:= \
-	ARCH="$(LINUX_KARCH)" \
-	CROSS_COMPILE="$(TARGET_CROSS)" \
-	M="$(PKG_BUILD_DIR)"
-
-define Build/Compile
-	$(MAKE) -C "$(LINUX_DIR)" \
-		$(MAKE_OPTS) \
-		CONFIG_EXFAT_FS=m \
-		modules
-endef
-
-$(eval $(call KernelPackage,fs-exfat))

+ 3 - 4
lang/lua-bencode/Makefile

@@ -11,11 +11,10 @@ PKG_NAME:=lua-bencode
 PKG_VERSION:=2.1.0
 PKG_VERSION:=2.1.0
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_URL:=https://bitbucket.org/wilhelmy/lua-bencode
-PKG_SOURCE_PROTO:=hg
-PKG_SOURCE_VERSION:=500243383cb6acbddd3cf12aee6e4667aab53324
+PKG_SOURCE_URL:=https://bitbucket.org/wilhelmy/lua-bencode/downloads/
+PKG_HASH:=4624f33ff026bc62990a323ee4953e42d68430c38a1a4726c9cfd77c085b1422
 PKG_LICENSE:=MIT
 PKG_LICENSE:=MIT
 
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/package.mk

+ 2 - 2
lang/lualanes/Makefile

@@ -42,8 +42,8 @@ endef
 define Build/Compile
 define Build/Compile
 	$(MAKE) -C $(PKG_BUILD_DIR) all \
 	$(MAKE) -C $(PKG_BUILD_DIR) all \
         CC="$(TARGET_CC)" \
         CC="$(TARGET_CC)" \
-        LUA="$(STAGING_DIR)/host/bin/lua" \
-        LUAC="$(STAGING_DIR)/host/bin/luac" \
+        LUA="$(STAGING_DIR_HOSTPKG)/bin/lua" \
+        LUAC="$(STAGING_DIR_HOSTPKG)/bin/luac" \
         OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield"
         OPT_FLAGS="$(TARGET_CFLAGS) --std=c99 -Dpthread_yield=sched_yield"
 endef
 endef
 
 

+ 6 - 2
lang/luarocks/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=luarocks
 PKG_NAME:=luarocks
 PKG_VERSION:=2.2.2
 PKG_VERSION:=2.2.2
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_PROTO:=git
 PKG_SOURCE_PROTO:=git
@@ -41,7 +41,11 @@ endef
 CONFIGURE_ARGS = \
 CONFIGURE_ARGS = \
     --prefix=$(CONFIGURE_PREFIX) \
     --prefix=$(CONFIGURE_PREFIX) \
     --sysconfdir=/etc \
     --sysconfdir=/etc \
-    --with-lua=$(STAGING_DIR)/host
+    --with-lua=$(STAGING_DIR_HOSTPKG)
+
+CONFIGURE_VARS = \
+	LUAROCKS_UNAME_S="Linux" \
+	LUAROCKS_UNAME_M="$(ARCH)"
 
 
 define Build/Compile
 define Build/Compile
 	$(call Build/Compile/Default,build)
 	$(call Build/Compile/Default,build)

+ 37 - 0
lang/luarocks/patches/02_allow_configure_uname_siteconfig_adjustment.patch

@@ -0,0 +1,37 @@
+Index: luarocks-2.2.2/configure
+===================================================================
+--- luarocks-2.2.2.orig/configure
++++ luarocks-2.2.2/configure
+@@ -388,18 +388,22 @@ then
+ fi
+ 
+ echo_n "Configuring for system... "
+-if uname -s
+-then
+-   LUAROCKS_UNAME_S=`uname -s`
+-else
+-   die "Could not determine operating system. 'uname -s' failed."
++if [ -z "$LUAROCKS_UNAME_S" ]; then
++    if uname -s
++    then
++        LUAROCKS_UNAME_S=`uname -s`
++    else
++        die "Could not determine operating system. 'uname -s' failed."
++    fi
+ fi
+ echo_n "Configuring for architecture... "
+-if uname -m
+-then
+-   LUAROCKS_UNAME_M=`uname -m`
+-else
+-   die "Could not determine processor architecture. 'uname -m' failed."
++if [ -z "$LUAROCKS_UNAME_M" ]; then
++    if uname -m
++    then
++        LUAROCKS_UNAME_M=`uname -m`
++    else
++        die "Could not determine processor architecture. 'uname -m' failed."
++    fi
+ fi
+ 
+ for v in 5.1 5.2 5.3; do

+ 1 - 1
lang/node/Makefile

@@ -72,7 +72,7 @@ HOST_CONFIGURE_VARS:=
 HOST_CONFIGURE_ARGS:= \
 HOST_CONFIGURE_ARGS:= \
 	--dest-os=linux \
 	--dest-os=linux \
 	--without-snapshot \
 	--without-snapshot \
-	--prefix=$(HOST_BUILD_PREFIX)
+	--prefix=$(STAGING_DIR_HOSTPKG)
 
 
 HOST_CONFIGURE_CMD:=python ./configure
 HOST_CONFIGURE_CMD:=python ./configure
 
 

+ 8 - 4
lang/perl-cgi/Makefile

@@ -8,18 +8,22 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=perl-cgi
 PKG_NAME:=perl-cgi
-PKG_VERSION:=4.28
-PKG_RELEASE:=1
+PKG_VERSION:=4.35
+PKG_RELEASE:=2
 
 
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEEJO
 PKG_SOURCE_URL:=http://www.cpan.org/authors/id/L/LE/LEEJO
 PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz
 PKG_SOURCE:=CGI-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=28efb391377f6e98c19c23292d5fcc8c
+PKG_MD5SUM:=15e63942c02354426b25f056f2a4467c
 
 
 PKG_LICENSE:=GPL Artistic-2.0
 PKG_LICENSE:=GPL Artistic-2.0
-PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>, \
+		Philip Prindeville <philipp@redfish-solutions.com>
 
 
 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/CGI-$(PKG_VERSION)
 
 
+# don't strip comments because that will mangle this module
+PKG_LEAVE_COMMENTS:=1
+
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/package.mk
 include ../perl/perlmod.mk
 include ../perl/perlmod.mk
 
 

+ 49 - 0
lang/perl-www-curl/Makefile

@@ -0,0 +1,49 @@
+#
+# Copyright (C) 2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=perl-www-curl
+PKG_VERSION:=4.17
+PKG_RELEASE:=4
+
+PKG_SOURCE_URL:=http://www.cpan.org/authors/id/S/SZ/SZBALINT/
+PKG_SOURCE:=WWW-Curl-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=997ac81cd6b03b30b36f7cd930474845
+
+PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/perl/WWW-Curl-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include ../perl/perlmod.mk
+
+define Package/perl-www-curl
+  SUBMENU:=Perl
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Perl bindings to libcurl
+  URL:=http://search.cpan.org/dist/WWW-Curl/
+  DEPENDS:=perl +libcurl +perlbase-essential +perlbase-xsloader
+endef
+
+define Build/Configure
+	$(call perlmod/Configure,$(STAGING_DIR)/usr/include,)
+endef
+
+define Build/Compile
+	$(call perlmod/Compile,,)
+endef
+
+define Package/perl-www-curl/install
+	$(call perlmod/Install,$(1),WWW/Curl WWW/Curl.pm auto/WWW/Curl)
+endef
+
+
+$(eval $(call BuildPackage,perl-www-curl))

+ 74 - 0
lang/perl-www-curl/patches/100-perl-www-curl_disable_curl-config_hack.patch

@@ -0,0 +1,74 @@
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -12,31 +12,31 @@ no_index		directory => 'template';
+ repository		'http://github.com/szbalint/WWW--Curl';
+ # This is a hack. If you have libcurl installed, just specify curl.h below
+ # and comment out this line.
+-if ($^O ne 'MSWin32') {
+-    if (!$ENV{CURL_CONFIG}) {
+-	    requires_external_bin	'curl-config';
+-    }
+-} else {
+-	print	"Sorry, no automated install is available on Windows,\n".
+-		"please see the README.Win32 file on instructions for a manual install.\n";
+-	exit(0);
+-}
+-
+-my $curl_config = $ENV{CURL_CONFIG} || 'curl-config';
+-
+-my $vernum = `${curl_config} --vernum`; chomp $vernum;
+-my $version = `${curl_config} --version`; chomp $version; 
+-
+-my $minimum_ver = hex("070a08");
+-
+-if ($vernum && hex($vernum) <= $minimum_ver) {
+-	print	"Your currently installed libcurl version - $version - is too old.\n".
+-		"This module doesn't seek compatibility with versions older than 7.10.8\n".
+-		"Proceed manually if you know what you're doing.\n";
+-	exit(0);
+-}
+-
+-print "The version is $version\n";
++#if ($^O ne 'MSWin32') {
++#    if (!$ENV{CURL_CONFIG}) {
++#	    requires_external_bin	'curl-config';
++#    }
++#} else {
++#	print	"Sorry, no automated install is available on Windows,\n".
++#		"please see the README.Win32 file on instructions for a manual install.\n";
++#	exit(0);
++#}
++#
++#my $curl_config = $ENV{CURL_CONFIG} || 'curl-config';
++#
++#my $vernum = `${curl_config} --vernum`; chomp $vernum;
++#my $version = `${curl_config} --version`; chomp $version; 
++#
++#my $minimum_ver = hex("070a08");
++#
++#if ($vernum && hex($vernum) <= $minimum_ver) {
++#	print	"Your currently installed libcurl version - $version - is too old.\n".
++#		"This module doesn't seek compatibility with versions older than 7.10.8\n".
++#		"Proceed manually if you know what you're doing.\n";
++#	exit(0);
++#}
++#
++#print "The version is $version\n";
+ 
+ my @includes = qw();
+ my ($cflags,$lflags, $ldflags) = ('','','');
+@@ -58,10 +58,10 @@ if ($^O ne 'MSWin32') {
+ # Get curl to tell us where it is, if we can.
+ #
+ 
+-if ($^O ne 'MSWin32') {
+-	$cflags = `${curl_config} --cflags`;
+-	$lflags = `${curl_config} --libs`;
+-}
++#if ($^O ne 'MSWin32') {
++#	$cflags = `${curl_config} --cflags`;
++#	$lflags = `${curl_config} --libs`;
++#}
+ 
+ # can't find link flags, make some guesses
+ if (!defined($lflags)) {

+ 34 - 0
lang/perl-www-curl/patches/101-skip-preprocessor-symbol.path

@@ -0,0 +1,34 @@
+From 0be0223422e6e5f4091c6e4e058d213623eed105 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
+Date: Mon, 12 Sep 2016 14:40:44 +0200
+Subject: [PATCH] Skip preprocessor symbol only CURL_STRICTER
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+CURL_STRICTER leaked into curl-constants.c when building against
+curl-7.50.2. This is a preprocessor only macro without a value.
+
+CPAN RT#117793
+
+Signed-off-by: Petr Písař <ppisar@redhat.com>
+---
+ Makefile.PL | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Makefile.PL b/Makefile.PL
+index f9170bb..ad2bd3d 100644
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -127,7 +127,7 @@ if (!defined($curl_h)) {
+     close H;
+ 
+     for my $e (sort @syms) {
+-       if($e =~ /(OBSOLETE|^CURL_EXTERN|_LAST\z|_LASTENTRY\z)/) {
++       if($e =~ /(OBSOLETE|^CURL_EXTERN|^CURL_STRICTER\z|_LAST\z|_LASTENTRY\z)/) {
+           next;
+        }
+        my ($group) = $e =~ m/^([^_]+_)/;
+-- 
+2.7.4
+

+ 11 - 0
lang/perl-www-curl/patches/200-fix_default_lflags.patch

@@ -0,0 +1,11 @@
+--- a/Makefile.PL
++++ b/Makefile.PL
+@@ -39,7 +39,7 @@ repository		'http://github.com/szbalint/
+ #print "The version is $version\n";
+ 
+ my @includes = qw();
+-my ($cflags,$lflags, $ldflags) = ('','','');
++my ($cflags,$lflags, $ldflags) = ('','-lcurl','');
+ 
+ # You may need to specify where to find curl.h on your platform
+ # These are guesses only, in case curl-config is not telling us.

+ 2 - 2
lang/perl-xml-parser/Makefile

@@ -25,8 +25,8 @@ HOST_BUILD_DEPENDS:=perl/host expat/host
 
 
 EXPAT_LIBPATH:=$(STAGING_DIR)/usr/lib
 EXPAT_LIBPATH:=$(STAGING_DIR)/usr/lib
 EXPAT_INCPATH=$(STAGING_DIR)/usr/include
 EXPAT_INCPATH=$(STAGING_DIR)/usr/include
-HOST_EXPAT_LIBPATH:=$(STAGING_DIR)/host/lib
-HOST_EXPAT_INCPATH=$(STAGING_DIR)/host/include
+HOST_EXPAT_LIBPATH:=$(STAGING_DIR_HOSTPKG)/lib
+HOST_EXPAT_INCPATH=$(STAGING_DIR_HOSTPKG)/include
 
 
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/host-build.mk

+ 11 - 0
lang/perl/Config.in

@@ -17,4 +17,15 @@ config PERL_TESTS
 		Test support is still in development. Some tests will fail,
 		Test support is still in development. Some tests will fail,
 		others are just missing completely.
 		others are just missing completely.
 
 
+config PERL_NOCOMMENT
+	bool "Strip comments and pod sections from modules"
+	default y
+	help
+		Remove comments and pod sections for all perl packages.
+
+		This will descrease the size of perl libraries moderately.
+
+		Stripping occasionally gets confused and mangles valid code,
+		so disable this option if you're not pressed for space.
+
 endmenu
 endmenu

+ 4 - 3
lang/perl/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=perl
 PKG_NAME:=perl
 PKG_VERSION:=5.22.1
 PKG_VERSION:=5.22.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 
 PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
 PKG_SOURCE_URL:=ftp://ftp.cpan.org/pub/CPAN/src/5.0 \
 		http://www.cpan.org/src/5.0 \
 		http://www.cpan.org/src/5.0 \
@@ -24,7 +24,8 @@ PKG_MD5SUM:=19295bbb775a3c36123161b9bf4892f1
 
 
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_LICENSE:=GPL-1.0+ Artistic-1.0-Perl
 PKG_LICENSE_FILES:=Copying Artistic README
 PKG_LICENSE_FILES:=Copying Artistic README
-PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>
+PKG_MAINTAINER:=Marcel Denia <naoir@gmx.net>, \
+		Philip Prindeville <philipp@redfish-solutions.com>
 
 
 # Build settings
 # Build settings
 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/perl/$(PKG_NAME)-$(PKG_VERSION)
@@ -35,7 +36,7 @@ PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 
 
 # Variables used during configuration/build
 # Variables used during configuration/build
-HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr
+HOST_PERL_PREFIX:=$(STAGING_DIR_HOSTPKG)/usr
 
 
 # Filter -g3, it will break Compress-Raw-Zlib
 # Filter -g3, it will break Compress-Raw-Zlib
 TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))
 TARGET_CFLAGS_PERL:=$(patsubst -g3,-g,$(TARGET_CFLAGS))

+ 10 - 6
lang/perl/perlmod.mk

@@ -4,12 +4,12 @@
 PERL_VERSION:=5.22
 PERL_VERSION:=5.22
 
 
 # Build environment
 # Build environment
-HOST_PERL_PREFIX:=$(STAGING_DIR)/host/usr
+HOST_PERL_PREFIX:=$(STAGING_DIR_HOSTPKG)/usr
 ifneq ($(CONFIG_USE_GLIBC),)
 ifneq ($(CONFIG_USE_GLIBC),)
 	EXTRA_LIBS:=bsd
 	EXTRA_LIBS:=bsd
 	EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
 	EXTRA_LIBDIRS:=$(STAGING_DIR)/lib
 endif
 endif
-PERL_CMD:=$(STAGING_DIR)/host/usr/bin/perl$(PERL_VERSION).0
+PERL_CMD:=$(STAGING_DIR_HOSTPKG)/usr/bin/perl$(PERL_VERSION).0
 
 
 MOD_CFLAGS_PERL:=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(TARGET_CFLAGS) $(TARGET_CPPFLAGS)
 MOD_CFLAGS_PERL:=-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 $(TARGET_CFLAGS) $(TARGET_CPPFLAGS)
 ifdef CONFIG_PERL_THREADS
 ifdef CONFIG_PERL_THREADS
@@ -26,7 +26,7 @@ define perlmod/host/relink
 	rm -f $(1)/Makefile.aperl
 	rm -f $(1)/Makefile.aperl
 	$(MAKE) -C $(1) perl
 	$(MAKE) -C $(1) perl
 	$(CP) $(1)/perl $(PERL_CMD)
 	$(CP) $(1)/perl $(PERL_CMD)
-	$(CP) $(1)/perl $(STAGING_DIR)/host/usr/bin/perl
+	$(CP) $(1)/perl $(STAGING_DIR_HOSTPKG)/usr/bin/perl
 endef
 endef
 
 
 define perlmod/host/Configure
 define perlmod/host/Configure
@@ -129,9 +129,7 @@ define perlmod/Install/NoStrip
 endef
 endef
 
 
 
 
-define perlmod/Install
-	$(call perlmod/Install/NoStrip,$(1),$(2),$(3))
-
+define perlmod/_DoStrip
 	@echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
 	@echo "---> Stripping modules in: $(strip $(1))$(PERL_SITELIB)"
 	find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
 	find $(strip $(1))$(PERL_SITELIB) -name \*.pm -or -name \*.pl | \
 	xargs -r sed -i \
 	xargs -r sed -i \
@@ -141,6 +139,12 @@ define perlmod/Install
 		-e '/^#[^!"'"'"']/d'
 		-e '/^#[^!"'"'"']/d'
 endef
 endef
 
 
+define perlmod/Install
+	$(call perlmod/Install/NoStrip,$(1),$(2),$(3))
+
+	$(if $(CONFIG_PERL_NOCOMMENT),$(if $(PKG_LEAVE_COMMENTS),,$(call perlmod/_DoStrip,$(1),$(2),$(3))))
+endef
+
 # You probably don't want to use this directly. Look at perlmod/InstallTests
 # You probably don't want to use this directly. Look at perlmod/InstallTests
 define perlmod/_InstallTests
 define perlmod/_InstallTests
 	$(INSTALL_DIR) $(strip $(1))
 	$(INSTALL_DIR) $(strip $(1))

+ 3 - 3
lang/php7-pecl-dio/Makefile

@@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk
 PECL_NAME:=dio
 PECL_NAME:=dio
 PECL_LONGNAME:=Direct I/O functions
 PECL_LONGNAME:=Direct I/O functions
 
 
-PKG_VERSION:=0.0.7
-PKG_RELEASE:=2
-PKG_MD5SUM:=a1a4df428a17dbe1ab4277b492dfa052
+PKG_VERSION:=0.0.9
+PKG_RELEASE:=1
+PKG_MD5SUM:=2c80b63fbbbaead856cb468955c14dc328d1262621b0c704b122d902053c8156
 
 
 PKG_NAME:=php7-pecl-$(PECL_NAME)
 PKG_NAME:=php7-pecl-$(PECL_NAME)
 PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz

+ 0 - 3110
lang/php7-pecl-dio/patches/0000-unify-line-endings.patch

@@ -1,3110 +0,0 @@
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -1,659 +1,659 @@
--/*
--   +----------------------------------------------------------------------+
--   | PHP Version 5                                                        |
--   +----------------------------------------------------------------------+
--   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
--   +----------------------------------------------------------------------+
--   | This source file is subject to version 3.0 of the PHP license,       |
--   | that is bundled with this package in the file LICENSE, and is        |
--   | available through the world-wide-web at the following url:           |
--   | http://www.php.net/license/3_0.txt.                                  |
--   | If you did not receive a copy of the PHP license and are unable to   |
--   | obtain it through the world-wide-web, please send a note to          |
--   | license@php.net so we can mail you a copy immediately.               |
--   +----------------------------------------------------------------------+
--   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
--   +----------------------------------------------------------------------+
-- */
--
--#ifdef HAVE_CONFIG_H
--#include "config.h"
--#endif
--
--#include "php.h"
--
--#include "php_dio_common.h"
--
--/* {{{ dio_stream_mode_to_flags
-- * Convert an fopen() mode string to open() flags
-- */
--static int dio_stream_mode_to_flags(const char *mode) {
--	int  flags = 0, ch = 0, bin = 1;
--
--	switch(mode[ch++]) {
--		case 'r':
--			flags = 0;
--			break;
--		case 'w':
--			flags = O_TRUNC | O_CREAT;
--			break;
--		case 'a':
--			flags = O_APPEND | O_CREAT;
--			break;
--		case 'x':
--			flags = O_EXCL | O_CREAT;
--			break;
--	}
--
--	if (mode[ch] != '+') {
--		bin = (mode[ch++] == 'b');
--	}
--
--	if (mode[ch] == '+') {
--		flags |= O_RDWR;
--	} else if (flags) {
--		flags |= O_WRONLY;
--	} else {
--		flags |= O_RDONLY;
--	}
--
--#if defined(_O_TEXT) && defined(O_BINARY)
--	if (bin) {
--		flags |= O_BINARY;
--	} else {
--		flags |= _O_TEXT;
--	}
--#endif
--
--	return flags;
--}
--/* }}} */
--
--/* {{{ dio_data_rate_to_define
-- * Converts a numeric data rate to a termios define
-- */
--static int dio_data_rate_to_define(long rate, speed_t *def) {
--	speed_t val;
--
--	switch (rate) {
--		case 0:
--			val = 0;
--			break;
--		case 50:
--			val = B50;
--			break;
--		case 75:
--			val = B75;
--			break;
--		case 110:
--			val = B110;
--			break;
--		case 134:
--			val = B134;
--			break;
--		case 150:
--			val = B150;
--			break;
--		case 200:
--			val = B200;
--			break;
--		case 300:
--			val = B300;
--			break;
--		case 600:
--			val = B600;
--			break;
--		case 1200:
--			val = B1200;
--			break;
--		case 1800:
--			val = B1800;
--			break;
--		case 2400:
--			val = B2400;
--			break;
--		case 4800:
--			val = B4800;
--			break;
--		case 9600:
--			val = B9600;
--			break;
--		case 19200:
--			val = B19200;
--			break;
--		case 38400:
--			val = B38400;
--			break;
--#ifdef B57600
--		case 57600:
--			val = B57600;
--			break;
--#endif
--#ifdef B115200
--		case 115200:
--			val = B115200;
--			break;
--#endif
--#ifdef B230400
--		case 230400:
--			val = B230400;
--			break;
--#endif
--#ifdef B460800
--		case 460800:
--			val = B460800;
--			break;
--#endif
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--
--/* {{{ dio_data_bits_to_define
-- * Converts a number of data bits to a termios define
-- */
--static int dio_data_bits_to_define(int data_bits, int *def) {
--	int val;
--
--	switch (data_bits) {
--		case 8:
--			val = CS8;
--			break;
--		case 7:
--			val = CS7;
--			break;
--		case 6:
--			val = CS6;
--			break;
--		case 5:
--			val = CS5;
--			break;
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_stop_bits_to_define
-- * Converts a number of stop bits to a termios define
-- */
--static int dio_stop_bits_to_define(int stop_bits, int *def) {
--	int val;
--
--	switch (stop_bits) {
--		case 1:
--			val = 0;
--			break;
--		case 2:
--			val = CSTOPB;
--			break;
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_parity_to_define
-- * Converts a parity type to a termios define
-- */
--static int dio_parity_to_define(int parity, int *def) {
--	int val;
--
--	switch (parity) {
--		case 0:
--			val = 0;
--			break;
--		case 1:
--			val = PARENB | PARODD;
--			break;
--		case 2:
--			val = PARENB;
--			break;
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_create_stream_data
-- * Creates an initialised stream data structure.  Free with efree().
-- */
--php_dio_stream_data * dio_create_stream_data(void) {
--	php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data));
--	dio_init_stream_data(&(data->common));
--	data->fd = -1;
--	data->flags = 0;
--
--	return (php_dio_stream_data *)data;
--}
--/* }}} */
--
--/* {{{ dio_common_write
-- * Writes count chars from the buffer to the stream described by the stream data.
-- */
--size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
--	size_t ret;
--
--	/* Blocking writes can be interrupted by signals etc. If
--	 * interrupted try again. Not sure about non-blocking
--	 * writes but it doesn't hurt to check. */
--	do {
--		ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count);
--		if (ret > 0) {
--			return ret;
--		}
--	} while (errno == EINTR);
--	return 0;
--}
--/* }}} */
--
--#ifdef DIO_NONBLOCK
--/* {{{ dio_timeval_subtract
-- * Calculates the difference between two timevals returning the result in the
-- * structure pointed to by diffptr.  Returns -1 as error if late time is
-- * earlier than early time.
-- */
--static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) {
--	struct timeval *tmp;
--
--	/* Handle negatives */
--	if (late->tv_sec < early->tv_sec) {
--		return 0;
--	}
--
--	if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) {
--		return 0;
--	}
--
--	/* Handle any carry.  If later usec is smaller than earlier usec simple
--	 * subtraction will result in negative value.  Since usec has a maximum
--	 * of one second by adding another second before the subtraction the
--	 * result will always be positive. */
--	if (late->tv_usec < early->tv_usec) {
--		late->tv_usec  += 1000000;
--		late->tv_sec--;
--	}
--
--	/* Once adjusted can just subtract values. */
--	diff->tv_sec  = late->tv_sec  - early->tv_sec;
--	diff->tv_usec = late->tv_usec - early->tv_usec;
--
--	return 1;
--}
--#endif
--
--/* {{{ dio_common_read
-- * Reads count chars to the buffer to the stream described by the stream data.
-- */
--size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
--	int fd = ((php_dio_posix_stream_data*)data)->fd;
--	size_t ret, total = 0;
--	char *ptr = (char*)buf;
--
--	struct timeval timeout, timeouttmp, before, after, diff;
--	fd_set rfds;
--
--	if (!data->has_timeout) {
--		/* Blocking reads can be interrupted by signals etc. If
--		 * interrupted try again. Not sure about non-blocking
--		 * reads but it doesn't hurt to check. */
--		do {
--			ret = read(fd, (char*)ptr, count);
--			if (ret > 0) {
--				return ret;
--			} else if (!ret) {
--				data->end_of_file = 1;
--			}
--		} while ((errno == EINTR) && !data->end_of_file);
--		return 0;
--	}
--#ifdef DIO_NONBLOCK
--	else {
--		/* Clear timed out flag */
--		data->timed_out = 0;
--
--		/* The initial timeout value */
--		timeout.tv_sec  = data->timeout_sec;
--		timeout.tv_usec = data->timeout_usec;
--
--		do {
--			/* The semantics of select() are that you cannot guarantee
--			 * that the timeval structure passed in has not been changed by
--			 * the select call.  So you keep a copy. */
--			timeouttmp = timeout;
--
--			/* The time before we wait for data. */
--			(void) gettimeofday(&before, NULL);
--
--			/* Wait for an event on our file descriptor. */
--			FD_ZERO(&rfds);
--			FD_SET(fd, &rfds);
--
--			ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp);
--			/* An error. */
--			if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
--				return 0;
--			}
--
--			/* We have data to read. */
--			if ((ret > 0) && FD_ISSET(fd, &rfds)) {
--				ret = read(fd, ptr, count);
--				/* Another error */
--				if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
--					return 0;
--				}
--
--				if (ret > 0) {
--					/* Got data, add it to the buffer. */
--					ptr   += ret;
--					total += ret;
--					count -= ret;
--				} else if (!ret) {
--					/* This should never happen since how can we have
--					 * data to read at an end of file, but still
--					 * just in case! */
--					data->end_of_file = 1;
--					break;
--				}
--			}
--
--			/* If not timed out and not end of file and not all data read
--			 * calculate how long it took us and loop if we still have time
--			 * out time left. */
--			if (count) {
--				(void) gettimeofday(&after, NULL);
--
--				/* Diff the timevals */
--				(void) dio_timeval_subtract(&after, &before, &diff);
--
--				/* Now adjust the timeout. */
--				if (!dio_timeval_subtract(&timeout, &diff, &timeout)) {
--					/* If it errors we've run out of time. */
--					data->timed_out = 1;
--					break;
--				} else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) {
--					/* Check for rounding issues (millisecond accuracy) */
--					data->timed_out = 1;
--					break;
--				}
--			}
--		} while (count); /* Until time out or end of file or all data read. */
--
--		return total;
--	}
--#endif
--}
--/* }}} */
--
--/* {{{ php_dio_stream_data
-- * Closes the php_stream.
-- */
--int dio_common_close(php_dio_stream_data *data) {
--	if (close(((php_dio_posix_stream_data*)data)->fd) < 0) {
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_common_set_option
-- * Sets/gets stream options
-- */
--int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) {
--	int fd = ((php_dio_posix_stream_data*)data)->fd;
--	int old_is_blocking;
--	int flags;
--
--	switch (option) {
--#ifdef DIO_NONBLOCK
--		case PHP_STREAM_OPTION_READ_TIMEOUT:
--			if (ptrparam) {
--				struct timeval *tv = (struct timeval*)ptrparam;
--
--				flags = fcntl(fd, F_GETFL, 0);
--
--				/* A timeout of zero seconds and zero microseconds disables
--				   any existing timeout. */
--				if (tv->tv_sec || tv->tv_usec) {
--					data->timeout_sec = tv->tv_sec;
--					data->timeout_usec = tv->tv_usec;
--					data->has_timeout = -1;
--					(void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK);
--				} else {
--					data->timeout_sec = 0;
--					data->timeout_usec = 0;
--					data->has_timeout = 0;
--					data->timed_out = 0;
--					(void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK);
--				}
--
--				return PHP_STREAM_OPTION_RETURN_OK;
--			} else {
--				return PHP_STREAM_OPTION_RETURN_ERR;
--			}
--
--		case PHP_STREAM_OPTION_BLOCKING:
--			flags = fcntl(fd, F_GETFL, 0);
--			if (value) {
--				flags &= ~DIO_NONBLOCK;
--			} else {
--				flags |= DIO_NONBLOCK;
--			}
--			(void) fcntl(fd, F_SETFL, flags);
--
--			old_is_blocking = data->is_blocking;
--			data->is_blocking = value;
--			return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
--#endif /* O_NONBLOCK */
--
--		default:
--			break;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_raw_open_stream
-- * Opens the underlying stream.
-- */
--int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
--	pdata->flags = dio_stream_mode_to_flags(mode);
--
--#ifdef DIO_NONBLOCK
--	if (!data->is_blocking || data->has_timeout) {
--		pdata->flags |= DIO_NONBLOCK;
--	}
--#endif
--
--	/* Open the file and handle any errors. */
--#ifdef DIO_HAS_FILEPERMS
--	if (data->has_perms) {
--		pdata->fd = open(filename, pdata->flags, (mode_t)data->perms);
--	} else {
--		pdata->fd = open(filename, pdata->flags);
--	}
--#else
--	pdata->fd = open(filename, pdata->flags);
--#endif
--
--	if (pdata->fd < 0) {
--		switch (errno) {
--			case EEXIST:
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
--				return 0;
--			default:
--				return 0;
--		}
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_init
-- * Initialises the serial settings storing the original settings before hand.
-- */
--static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
--	int ret = 0, data_bits_def, stop_bits_def, parity_def;
--	struct termios tio;
--	speed_t rate_def;
--
--	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
--		return 0;
--	}
--
--	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
--		return 0;
--	}
--
--	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
--		return 0;
--	}
--
--	if (!dio_parity_to_define(data->parity, &parity_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
--		return 0;
--	}
--
--	ret = tcgetattr(pdata->fd, &(pdata->oldtio));
--	if (ret < 0) {
--		if ((errno == ENOTTY) || (errno == ENODEV)) {
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!");
--		}
--		return 0;
--	}
--
--	ret = tcgetattr(pdata->fd, &tio);
--	if (ret < 0) {
--		return 0;
--	}
--
--	if (data->canonical) {
--		tio.c_iflag = IGNPAR | ICRNL;
--		tio.c_oflag = 0;
--		tio.c_lflag = ICANON;
--	} else {
--		cfmakeraw(&tio);
--	}
--
--	cfsetispeed(&tio, rate_def);
--	cfsetospeed(&tio, rate_def);
--
--	tio.c_cflag &= ~CSIZE;
--	tio.c_cflag |= data_bits_def;
--	tio.c_cflag &= ~CSTOPB;
--	tio.c_cflag |= stop_bits_def;
--	tio.c_cflag &= ~(PARENB|PARODD);
--	tio.c_cflag |= parity_def;
--
--#ifdef CRTSCTS
--	tio.c_cflag &= ~(CLOCAL | CRTSCTS);
--#else
--	tio.c_cflag &= ~CLOCAL;
--#endif
--	if (!data->flow_control) {
--		tio.c_cflag |= CLOCAL;
--#ifdef CRTSCTS
--	} else {
--		tio.c_cflag |= CRTSCTS;
--#endif
--	}
--
--	ret = tcsetattr(pdata->fd, TCSANOW, &tio);
--	if (ret < 0) {
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_uninit
-- * Restores the serial settings back to their original state.
-- */
--int dio_serial_uninit(php_dio_stream_data *data) {
--	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
--	int ret;
--
--	do {
--		ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio));
--	} while ((ret < 0) && (errno == EINTR));
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_flush
-- * Purges the serial buffers of data.
-- */
--int dio_serial_purge(php_dio_stream_data *data) {
--	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
--	int ret;
--
--	if ((pdata->flags & O_RDWR) == O_RDWR) {
--		ret = tcflush(pdata->fd, TCIOFLUSH);
--	} else if ((pdata->flags & O_WRONLY) == O_WRONLY) {
--		ret = tcflush(pdata->fd, TCOFLUSH);
--	} else if ((pdata->flags & O_RDONLY) == O_RDONLY) {
--		ret = tcflush(pdata->fd, TCIFLUSH);
--	}
--
--	if (ret < 0) {
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_open_stream
-- * Opens the underlying stream.
-- */
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
--
--#ifdef O_NOCTTY
--	/* We don't want a controlling TTY */
--	pdata->flags |= O_NOCTTY;
--#endif
--
--	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
--		return 0;
--	}
--
--	if (!dio_serial_init(data TSRMLS_CC)) {
--		close(pdata->fd);
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/*
-- * Local variables:
-- * c-basic-offset: 4
-- * tab-width: 4
-- * End:
-- * vim600: fdm=marker
-- * vim: sw=4 ts=4 noet
-- */
-+/*
-+   +----------------------------------------------------------------------+
-+   | PHP Version 5                                                        |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 3.0 of the PHP license,       |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available through the world-wide-web at the following url:           |
-+   | http://www.php.net/license/3_0.txt.                                  |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license@php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include "php.h"
-+
-+#include "php_dio_common.h"
-+
-+/* {{{ dio_stream_mode_to_flags
-+ * Convert an fopen() mode string to open() flags
-+ */
-+static int dio_stream_mode_to_flags(const char *mode) {
-+	int  flags = 0, ch = 0, bin = 1;
-+
-+	switch(mode[ch++]) {
-+		case 'r':
-+			flags = 0;
-+			break;
-+		case 'w':
-+			flags = O_TRUNC | O_CREAT;
-+			break;
-+		case 'a':
-+			flags = O_APPEND | O_CREAT;
-+			break;
-+		case 'x':
-+			flags = O_EXCL | O_CREAT;
-+			break;
-+	}
-+
-+	if (mode[ch] != '+') {
-+		bin = (mode[ch++] == 'b');
-+	}
-+
-+	if (mode[ch] == '+') {
-+		flags |= O_RDWR;
-+	} else if (flags) {
-+		flags |= O_WRONLY;
-+	} else {
-+		flags |= O_RDONLY;
-+	}
-+
-+#if defined(_O_TEXT) && defined(O_BINARY)
-+	if (bin) {
-+		flags |= O_BINARY;
-+	} else {
-+		flags |= _O_TEXT;
-+	}
-+#endif
-+
-+	return flags;
-+}
-+/* }}} */
-+
-+/* {{{ dio_data_rate_to_define
-+ * Converts a numeric data rate to a termios define
-+ */
-+static int dio_data_rate_to_define(long rate, speed_t *def) {
-+	speed_t val;
-+
-+	switch (rate) {
-+		case 0:
-+			val = 0;
-+			break;
-+		case 50:
-+			val = B50;
-+			break;
-+		case 75:
-+			val = B75;
-+			break;
-+		case 110:
-+			val = B110;
-+			break;
-+		case 134:
-+			val = B134;
-+			break;
-+		case 150:
-+			val = B150;
-+			break;
-+		case 200:
-+			val = B200;
-+			break;
-+		case 300:
-+			val = B300;
-+			break;
-+		case 600:
-+			val = B600;
-+			break;
-+		case 1200:
-+			val = B1200;
-+			break;
-+		case 1800:
-+			val = B1800;
-+			break;
-+		case 2400:
-+			val = B2400;
-+			break;
-+		case 4800:
-+			val = B4800;
-+			break;
-+		case 9600:
-+			val = B9600;
-+			break;
-+		case 19200:
-+			val = B19200;
-+			break;
-+		case 38400:
-+			val = B38400;
-+			break;
-+#ifdef B57600
-+		case 57600:
-+			val = B57600;
-+			break;
-+#endif
-+#ifdef B115200
-+		case 115200:
-+			val = B115200;
-+			break;
-+#endif
-+#ifdef B230400
-+		case 230400:
-+			val = B230400;
-+			break;
-+#endif
-+#ifdef B460800
-+		case 460800:
-+			val = B460800;
-+			break;
-+#endif
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+
-+/* {{{ dio_data_bits_to_define
-+ * Converts a number of data bits to a termios define
-+ */
-+static int dio_data_bits_to_define(int data_bits, int *def) {
-+	int val;
-+
-+	switch (data_bits) {
-+		case 8:
-+			val = CS8;
-+			break;
-+		case 7:
-+			val = CS7;
-+			break;
-+		case 6:
-+			val = CS6;
-+			break;
-+		case 5:
-+			val = CS5;
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_stop_bits_to_define
-+ * Converts a number of stop bits to a termios define
-+ */
-+static int dio_stop_bits_to_define(int stop_bits, int *def) {
-+	int val;
-+
-+	switch (stop_bits) {
-+		case 1:
-+			val = 0;
-+			break;
-+		case 2:
-+			val = CSTOPB;
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_parity_to_define
-+ * Converts a parity type to a termios define
-+ */
-+static int dio_parity_to_define(int parity, int *def) {
-+	int val;
-+
-+	switch (parity) {
-+		case 0:
-+			val = 0;
-+			break;
-+		case 1:
-+			val = PARENB | PARODD;
-+			break;
-+		case 2:
-+			val = PARENB;
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_create_stream_data
-+ * Creates an initialised stream data structure.  Free with efree().
-+ */
-+php_dio_stream_data * dio_create_stream_data(void) {
-+	php_dio_posix_stream_data * data = emalloc(sizeof(php_dio_posix_stream_data));
-+	dio_init_stream_data(&(data->common));
-+	data->fd = -1;
-+	data->flags = 0;
-+
-+	return (php_dio_stream_data *)data;
-+}
-+/* }}} */
-+
-+/* {{{ dio_common_write
-+ * Writes count chars from the buffer to the stream described by the stream data.
-+ */
-+size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
-+	size_t ret;
-+
-+	/* Blocking writes can be interrupted by signals etc. If
-+	 * interrupted try again. Not sure about non-blocking
-+	 * writes but it doesn't hurt to check. */
-+	do {
-+		ret = write(((php_dio_posix_stream_data*)data)->fd, buf, count);
-+		if (ret > 0) {
-+			return ret;
-+		}
-+	} while (errno == EINTR);
-+	return 0;
-+}
-+/* }}} */
-+
-+#ifdef DIO_NONBLOCK
-+/* {{{ dio_timeval_subtract
-+ * Calculates the difference between two timevals returning the result in the
-+ * structure pointed to by diffptr.  Returns -1 as error if late time is
-+ * earlier than early time.
-+ */
-+static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) {
-+	struct timeval *tmp;
-+
-+	/* Handle negatives */
-+	if (late->tv_sec < early->tv_sec) {
-+		return 0;
-+	}
-+
-+	if ((late->tv_sec == early->tv_sec) && (late->tv_usec < early->tv_usec)) {
-+		return 0;
-+	}
-+
-+	/* Handle any carry.  If later usec is smaller than earlier usec simple
-+	 * subtraction will result in negative value.  Since usec has a maximum
-+	 * of one second by adding another second before the subtraction the
-+	 * result will always be positive. */
-+	if (late->tv_usec < early->tv_usec) {
-+		late->tv_usec  += 1000000;
-+		late->tv_sec--;
-+	}
-+
-+	/* Once adjusted can just subtract values. */
-+	diff->tv_sec  = late->tv_sec  - early->tv_sec;
-+	diff->tv_usec = late->tv_usec - early->tv_usec;
-+
-+	return 1;
-+}
-+#endif
-+
-+/* {{{ dio_common_read
-+ * Reads count chars to the buffer to the stream described by the stream data.
-+ */
-+size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-+	int fd = ((php_dio_posix_stream_data*)data)->fd;
-+	size_t ret, total = 0;
-+	char *ptr = (char*)buf;
-+
-+	struct timeval timeout, timeouttmp, before, after, diff;
-+	fd_set rfds;
-+
-+	if (!data->has_timeout) {
-+		/* Blocking reads can be interrupted by signals etc. If
-+		 * interrupted try again. Not sure about non-blocking
-+		 * reads but it doesn't hurt to check. */
-+		do {
-+			ret = read(fd, (char*)ptr, count);
-+			if (ret > 0) {
-+				return ret;
-+			} else if (!ret) {
-+				data->end_of_file = 1;
-+			}
-+		} while ((errno == EINTR) && !data->end_of_file);
-+		return 0;
-+	}
-+#ifdef DIO_NONBLOCK
-+	else {
-+		/* Clear timed out flag */
-+		data->timed_out = 0;
-+
-+		/* The initial timeout value */
-+		timeout.tv_sec  = data->timeout_sec;
-+		timeout.tv_usec = data->timeout_usec;
-+
-+		do {
-+			/* The semantics of select() are that you cannot guarantee
-+			 * that the timeval structure passed in has not been changed by
-+			 * the select call.  So you keep a copy. */
-+			timeouttmp = timeout;
-+
-+			/* The time before we wait for data. */
-+			(void) gettimeofday(&before, NULL);
-+
-+			/* Wait for an event on our file descriptor. */
-+			FD_ZERO(&rfds);
-+			FD_SET(fd, &rfds);
-+
-+			ret = select(fd + 1, &rfds, NULL, NULL, &timeouttmp);
-+			/* An error. */
-+			if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
-+				return 0;
-+			}
-+
-+			/* We have data to read. */
-+			if ((ret > 0) && FD_ISSET(fd, &rfds)) {
-+				ret = read(fd, ptr, count);
-+				/* Another error */
-+				if ((ret < 0) && (errno != EINTR) && (errno != EAGAIN)) {
-+					return 0;
-+				}
-+
-+				if (ret > 0) {
-+					/* Got data, add it to the buffer. */
-+					ptr   += ret;
-+					total += ret;
-+					count -= ret;
-+				} else if (!ret) {
-+					/* This should never happen since how can we have
-+					 * data to read at an end of file, but still
-+					 * just in case! */
-+					data->end_of_file = 1;
-+					break;
-+				}
-+			}
-+
-+			/* If not timed out and not end of file and not all data read
-+			 * calculate how long it took us and loop if we still have time
-+			 * out time left. */
-+			if (count) {
-+				(void) gettimeofday(&after, NULL);
-+
-+				/* Diff the timevals */
-+				(void) dio_timeval_subtract(&after, &before, &diff);
-+
-+				/* Now adjust the timeout. */
-+				if (!dio_timeval_subtract(&timeout, &diff, &timeout)) {
-+					/* If it errors we've run out of time. */
-+					data->timed_out = 1;
-+					break;
-+				} else if (!timeout.tv_sec && !(timeout.tv_usec / 1000)) {
-+					/* Check for rounding issues (millisecond accuracy) */
-+					data->timed_out = 1;
-+					break;
-+				}
-+			}
-+		} while (count); /* Until time out or end of file or all data read. */
-+
-+		return total;
-+	}
-+#endif
-+}
-+/* }}} */
-+
-+/* {{{ php_dio_stream_data
-+ * Closes the php_stream.
-+ */
-+int dio_common_close(php_dio_stream_data *data) {
-+	if (close(((php_dio_posix_stream_data*)data)->fd) < 0) {
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_common_set_option
-+ * Sets/gets stream options
-+ */
-+int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) {
-+	int fd = ((php_dio_posix_stream_data*)data)->fd;
-+	int old_is_blocking;
-+	int flags;
-+
-+	switch (option) {
-+#ifdef DIO_NONBLOCK
-+		case PHP_STREAM_OPTION_READ_TIMEOUT:
-+			if (ptrparam) {
-+				struct timeval *tv = (struct timeval*)ptrparam;
-+
-+				flags = fcntl(fd, F_GETFL, 0);
-+
-+				/* A timeout of zero seconds and zero microseconds disables
-+				   any existing timeout. */
-+				if (tv->tv_sec || tv->tv_usec) {
-+					data->timeout_sec = tv->tv_sec;
-+					data->timeout_usec = tv->tv_usec;
-+					data->has_timeout = -1;
-+					(void) fcntl(fd, F_SETFL, flags & ~DIO_NONBLOCK);
-+				} else {
-+					data->timeout_sec = 0;
-+					data->timeout_usec = 0;
-+					data->has_timeout = 0;
-+					data->timed_out = 0;
-+					(void) fcntl(fd, F_SETFL, flags | DIO_NONBLOCK);
-+				}
-+
-+				return PHP_STREAM_OPTION_RETURN_OK;
-+			} else {
-+				return PHP_STREAM_OPTION_RETURN_ERR;
-+			}
-+
-+		case PHP_STREAM_OPTION_BLOCKING:
-+			flags = fcntl(fd, F_GETFL, 0);
-+			if (value) {
-+				flags &= ~DIO_NONBLOCK;
-+			} else {
-+				flags |= DIO_NONBLOCK;
-+			}
-+			(void) fcntl(fd, F_SETFL, flags);
-+
-+			old_is_blocking = data->is_blocking;
-+			data->is_blocking = value;
-+			return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
-+#endif /* O_NONBLOCK */
-+
-+		default:
-+			break;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_raw_open_stream
-+ * Opens the underlying stream.
-+ */
-+int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
-+	pdata->flags = dio_stream_mode_to_flags(mode);
-+
-+#ifdef DIO_NONBLOCK
-+	if (!data->is_blocking || data->has_timeout) {
-+		pdata->flags |= DIO_NONBLOCK;
-+	}
-+#endif
-+
-+	/* Open the file and handle any errors. */
-+#ifdef DIO_HAS_FILEPERMS
-+	if (data->has_perms) {
-+		pdata->fd = open(filename, pdata->flags, (mode_t)data->perms);
-+	} else {
-+		pdata->fd = open(filename, pdata->flags);
-+	}
-+#else
-+	pdata->fd = open(filename, pdata->flags);
-+#endif
-+
-+	if (pdata->fd < 0) {
-+		switch (errno) {
-+			case EEXIST:
-+				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
-+				return 0;
-+			default:
-+				return 0;
-+		}
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_init
-+ * Initialises the serial settings storing the original settings before hand.
-+ */
-+static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
-+	int ret = 0, data_bits_def, stop_bits_def, parity_def;
-+	struct termios tio;
-+	speed_t rate_def;
-+
-+	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
-+		return 0;
-+	}
-+
-+	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
-+		return 0;
-+	}
-+
-+	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
-+		return 0;
-+	}
-+
-+	if (!dio_parity_to_define(data->parity, &parity_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
-+		return 0;
-+	}
-+
-+	ret = tcgetattr(pdata->fd, &(pdata->oldtio));
-+	if (ret < 0) {
-+		if ((errno == ENOTTY) || (errno == ENODEV)) {
-+			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!");
-+		}
-+		return 0;
-+	}
-+
-+	ret = tcgetattr(pdata->fd, &tio);
-+	if (ret < 0) {
-+		return 0;
-+	}
-+
-+	if (data->canonical) {
-+		tio.c_iflag = IGNPAR | ICRNL;
-+		tio.c_oflag = 0;
-+		tio.c_lflag = ICANON;
-+	} else {
-+		cfmakeraw(&tio);
-+	}
-+
-+	cfsetispeed(&tio, rate_def);
-+	cfsetospeed(&tio, rate_def);
-+
-+	tio.c_cflag &= ~CSIZE;
-+	tio.c_cflag |= data_bits_def;
-+	tio.c_cflag &= ~CSTOPB;
-+	tio.c_cflag |= stop_bits_def;
-+	tio.c_cflag &= ~(PARENB|PARODD);
-+	tio.c_cflag |= parity_def;
-+
-+#ifdef CRTSCTS
-+	tio.c_cflag &= ~(CLOCAL | CRTSCTS);
-+#else
-+	tio.c_cflag &= ~CLOCAL;
-+#endif
-+	if (!data->flow_control) {
-+		tio.c_cflag |= CLOCAL;
-+#ifdef CRTSCTS
-+	} else {
-+		tio.c_cflag |= CRTSCTS;
-+#endif
-+	}
-+
-+	ret = tcsetattr(pdata->fd, TCSANOW, &tio);
-+	if (ret < 0) {
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_uninit
-+ * Restores the serial settings back to their original state.
-+ */
-+int dio_serial_uninit(php_dio_stream_data *data) {
-+	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
-+	int ret;
-+
-+	do {
-+		ret = tcsetattr(pdata->fd, TCSANOW, &(pdata->oldtio));
-+	} while ((ret < 0) && (errno == EINTR));
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_flush
-+ * Purges the serial buffers of data.
-+ */
-+int dio_serial_purge(php_dio_stream_data *data) {
-+	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
-+	int ret;
-+
-+	if ((pdata->flags & O_RDWR) == O_RDWR) {
-+		ret = tcflush(pdata->fd, TCIOFLUSH);
-+	} else if ((pdata->flags & O_WRONLY) == O_WRONLY) {
-+		ret = tcflush(pdata->fd, TCOFLUSH);
-+	} else if ((pdata->flags & O_RDONLY) == O_RDONLY) {
-+		ret = tcflush(pdata->fd, TCIFLUSH);
-+	}
-+
-+	if (ret < 0) {
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_open_stream
-+ * Opens the underlying stream.
-+ */
-+int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
-+
-+#ifdef O_NOCTTY
-+	/* We don't want a controlling TTY */
-+	pdata->flags |= O_NOCTTY;
-+#endif
-+
-+	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+		return 0;
-+	}
-+
-+	if (!dio_serial_init(data TSRMLS_CC)) {
-+		close(pdata->fd);
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/*
-+ * Local variables:
-+ * c-basic-offset: 4
-+ * tab-width: 4
-+ * End:
-+ * vim600: fdm=marker
-+ * vim: sw=4 ts=4 noet
-+ */
---- a/dio_win32.c
-+++ b/dio_win32.c
-@@ -1,759 +1,759 @@
--/*
--   +----------------------------------------------------------------------+
--   | PHP Version 5                                                        |
--   +----------------------------------------------------------------------+
--   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
--   +----------------------------------------------------------------------+
--   | This source file is subject to version 3.0 of the PHP license,       |
--   | that is bundled with this package in the file LICENSE, and is        |
--   | available through the world-wide-web at the following url:           |
--   | http://www.php.net/license/3_0.txt.                                  |
--   | If you did not receive a copy of the PHP license and are unable to   |
--   | obtain it through the world-wide-web, please send a note to          |
--   | license@php.net so we can mail you a copy immediately.               |
--   +----------------------------------------------------------------------+
--   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
--   +----------------------------------------------------------------------+
-- */
--
--#ifdef HAVE_CONFIG_H
--#include "config.h"
--#endif
--
--#include "php.h"
--#include "php_dio_common.h"
--
--#ifndef ZEND_WIN32
--#error ZEND_WIN32 not defined!
--#endif
--
--/* {{{ dio_last_error_php_error
-- * Generates a PHP error message based upon the last Windows error.
-- */
--static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
--	LPVOID msgbuf;
--	DWORD  msgbuflen;
--	char * errmsg;
--	DWORD  err;
--
--#ifdef UNICODE
--	DWORD  errmsglen;
--#endif
--
--	err = GetLastError();
--	msgbuflen = FormatMessage(
--		FORMAT_MESSAGE_ALLOCATE_BUFFER|
--		FORMAT_MESSAGE_FROM_SYSTEM|
--		FORMAT_MESSAGE_IGNORE_INSERTS,
--		NULL,
--		err,
--		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
--		(LPTSTR)&msgbuf,
--		0,
--		NULL);
--
--#ifdef UNICODE
--
--	/* Get the length of the converted message */
--	errmsglen = WideCharToMultibyte(
--		CP_ACP,
--		0
--		(LPCWSTR)msgbuf,
--		-1,
--		(LPSTR)errmsg,
--		0,
--		NULL,
--		NULL);
--
--	/* Allocate a buffer */
--	errmsg = emalloc(errmsglen);
--	if (!errmsg) {
--		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!");
--		LocalFree(msgbuf);
--		return;
--	}
--
--	/* Convert the message */
--	errmsglen = WideCharToMultibyte(
--		CP_ACP,
--		0
--		(LPCWSTR)msgbuf,
--		-1,
--		(LPSTR)errmsg,
--		errmsglen,
--		NULL,
--		NULL);
--
--#else
--	errmsg = (char *)msgbuf;
--#endif
--
--	php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
--
--	LocalFree(msgbuf);
--#ifdef UNICODE
--	efree(errmsg);
--#endif
--}
--
--/* {{{ dio_data_rate_to_define
-- * Converts a numeric data rate to a termios define
-- */
--static int dio_data_rate_to_define(long rate, DWORD *def) {
--	switch (rate) {
--		case 75:
--		case 110:
--		case 134:
--		case 150:
--		case 300:
--		case 600:
--		case 1200:
--		case 1800:
--		case 2400:
--		case 4800:
--		case 7200:
--		case 9600:
--		case 14400:
--		case 19200:
--		case 38400:
--		case 57600:
--		case 115200:
--		case 56000:
--		case 128000:
--		case 256000:
--			break;
--		default:
--			return 0;
--	}
--
--	*def = (DWORD)rate;
--	return 1;
--}
--/* }}} */
--
--
--/* {{{ dio_data_bits_to_define
-- * Converts a number of data bits to a termios define
-- */
--static int dio_data_bits_to_define(int data_bits, DWORD *def) {
--	switch (data_bits) {
--		case 8:
--		case 7:
--		case 6:
--		case 5:
--		case 4:
--			break;
--		default:
--			return 0;
--	}
--
--	*def = (DWORD)data_bits;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_stop_bits_to_define
-- * Converts a number of stop bits to a termios define
-- */
--static int dio_stop_bits_to_define(int stop_bits, DWORD *def) {
--	DWORD val;
--
--	switch (stop_bits) {
--		case 1:
--			val = ONESTOPBIT;
--			break;
--		case 2:
--			val = TWOSTOPBITS;
--			break;
--		case 3:
--			val = ONE5STOPBITS;
--			break;
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_parity_to_define
-- * Converts a parity type to a termios define
-- */
--static int dio_parity_to_define(int parity, DWORD *def) {
--	DWORD val;
--
--	switch (parity) {
--		case 0:
--			val = NOPARITY;
--			break;
--		case 1:
--			val = ODDPARITY;
--			break;
--		case 2:
--			val = EVENPARITY;
--			break;
--		default:
--			return 0;
--	}
--
--	*def = val;
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_create_stream_data
-- * Creates an initialised stream data structure.  Free with efree().
-- */
--php_dio_stream_data * dio_create_stream_data(void) {
--	php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data));
--	memset(data, 0, sizeof(php_dio_win32_stream_data));
--	dio_init_stream_data(&(data->common));
--	data->handle = INVALID_HANDLE_VALUE;
--	data->desired_access = 0;
--	data->creation_disposition = 0;
--	data->olddcb.DCBlength = sizeof(DCB);
--
--	return (php_dio_stream_data *)data;
--}
--/* }}} */
--
--/* {{{ dio_common_write
-- * Writes count chars from the buffer to the stream described by the stream data.
-- */
--size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	DWORD total = 0;
--
--	if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) {
--		return (size_t)total;
--	}
--
--	return 0;
--}
--/* }}} */
--
--/* {{{ dio_buffer_read
-- * Reads any available chars from the canonical buffer.
-- */
--static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
--	php_dio_win32_canon_data *canon_data = wdata->canon_data;
--	size_t total = 0;
--
--	/* Read always follows write.  I.e. if read ptr > write ptr buffer has
--	   wrapped and so we need to copy two blocks of data. */
--	if (canon_data->read_pos > canon_data->write_pos) {
--
--		/* Check we actually need to copy both blocks */
--		if ((canon_data->size - canon_data->read_pos) > count) {
--
--			/* No we don't.  Just copy as much as we were asked for. */
--			memcpy((char*)buf, 
--				   &(canon_data->buf[canon_data->read_pos]), 
--				   count);
--			/* Update the read pointer. */
--			canon_data->read_pos += count;
--
--			/* Return the amount read. */
--			return count;
--		} else {
--
--			/* We need to copy both blocks so copy data up to the end of 
--			   the buffer. */
--			total = canon_data->size - canon_data->read_pos;
--			memcpy((char*)buf, 
--				   &(canon_data->buf[canon_data->read_pos]), 
--				   total);
--			canon_data->read_pos = 0;
--			count -= total;
--
--			/* Now copy the data from the start of the buffer either up
--			   count or the number of bytes in the buffer. */
--
--			if (canon_data->write_pos > count) {
--				memcpy((char*)buf, canon_data->buf, count);
--				canon_data->read_pos = count;
--				total += count;
--
--				return total;
--			} else {
--				memcpy((char*)buf, canon_data->buf, canon_data->write_pos);
--				canon_data->read_pos = canon_data->write_pos;
--				total += canon_data->write_pos;
--
--				return total;
--			}
--		}
--
--	/* Else if write follows read.  This is a simpler case.  We just copy 
--	   either all the data buffered or count, which ever is smaller. */
--	} else if (canon_data->write_pos > canon_data->read_pos) {
--		if ((canon_data->write_pos - canon_data->read_pos) > count) {
--			memcpy((char*)buf, 
--				   &(canon_data->buf[canon_data->read_pos]), 
--				   count);
--			canon_data->read_pos += count;
--
--			return count;
--		} else {
--			total = canon_data->write_pos - canon_data->read_pos;
--			memcpy((char*)buf, 
--				   &(canon_data->buf[canon_data->read_pos]), 
--				   total);
--			canon_data->read_pos += total;
--
--			return total;
--		}
--	}
--
--	/* Else we need to read more data from the data port. */
--	return 0;
--}
--
--/* {{{ dio_com_read
-- * Read chars from the data port.
-- */
--static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	DWORD err, total = 0;
--
--	if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) {
--
--		if (total) {
--			return (size_t)total;
--		}
--
--		data->end_of_file = 1;
--	}
--
--	if (!data->end_of_file) {
--		err = GetLastError();
--
--		if (ERROR_HANDLE_EOF == err) {
--			data->end_of_file = 1;
--		}
--	}
--
--	return 0;
--}
--
--/* {{{ dio_canonical_read
-- * Reads chars from the input stream until the internal buffer is full or a new
-- * line is reached.
-- */
--static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
--	php_dio_win32_canon_data *canon_data = wdata->canon_data;
--	size_t total = 0;
--	char ch;
--
--	/* See if there's any buffered data and copy it. */
--	total = dio_buffer_read(wdata, buf, count);
--	if (total) {
--		return total;
--	}
--
--	/* Need to read more data from the data port.  Buffer should be empty(er)
--	   by now. */
--	do {
--		/* Is the buffer full? */
--		if (((canon_data->write_pos + 1) % canon_data->size) == 
--			canon_data->read_pos) {
--			break;
--		}
--
--		/* Read a byte from the input checking for EOF. */
--		if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) {
--			break;
--		}
--
--		/* Translate CR to newlines (same as ICRNL in POSIX) */
--		ch = (ch != '\r') ? ch : '\n';
--
--		/* We read a character!  So buffer it. */
--		canon_data->buf[canon_data->write_pos++] = ch;
--		if (canon_data->write_pos >= canon_data->size) {
--			canon_data->write_pos = 0;
--		}
--
--		/* End of line/input (^D)? */
--	} while ((ch != '\n') && (ch != 0x04));
--
--	return dio_buffer_read(wdata, buf, count);
--}
--/* }}} */
--
--/* {{{ dio_common_read
-- * Reads count chars to the buffer to the stream described by the stream data.
-- */
--size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
--
--	/* You ask for no bytes you'll get none :-) */
--	if (!count) {
--		return 0;
--	}
--
--	if (data->canonical) {
--		return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count);
--	} else {
--		return dio_com_read(data, buf, count);
--	}
--}
--/* }}} */
--
--/* {{{ php_dio_stream_data
-- * Closes the php_stream.
-- */
--int dio_common_close(php_dio_stream_data *data) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--
--	if (data->canonical) {
--		efree(wdata->canon_data);
--	}
--
--	if (!CloseHandle(wdata->handle)) {
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_common_set_option
-- * Sets/gets stream options
-- */
--int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) {
--	COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
--	int old_is_blocking = 0;
--
--	/* Can't do timeouts or non blocking with raw windows streams :-( */
--	if (DIO_STREAM_TYPE_SERIAL == data->stream_type) {
--		switch (option) {
--			case PHP_STREAM_OPTION_BLOCKING:
--				old_is_blocking   = data->is_blocking;
--				data->is_blocking = value ? 1 : 0;
--
--				/* Only change values if we need to change them. */
--				if (data->is_blocking != old_is_blocking) {
--					/* If we're not blocking but don't have a timeout
--					   set to return immediately */
--					if (!data->is_blocking && !data->has_timeout) {
--						cto.ReadIntervalTimeout = MAXDWORD;
--					}
--
--					/* If we have a timeout ignore the blocking and set
--					   the total time in which to read the data */
--					if (data->has_timeout) {
--						cto.ReadIntervalTimeout = MAXDWORD;
--						cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
--						cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) +
--							(data->timeout_sec * 1000);
--					}
--
--					if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) {
--						return PHP_STREAM_OPTION_RETURN_ERR;
--					}
--				}
--				return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
--
--			case PHP_STREAM_OPTION_READ_TIMEOUT:
--				if (ptrparam) {
--					/* struct timeval is supported with PHP_WIN32 defined. */
--					struct timeval *tv = (struct timeval*)ptrparam;
--
--					/* A timeout of zero seconds and zero microseconds disables
--					   any existing timeout. */
--					if (tv->tv_sec || tv->tv_usec) {
--						data->timeout_sec = tv->tv_sec;
--						data->timeout_usec = tv->tv_usec;
--						data->has_timeout = -1;
--
--						cto.ReadIntervalTimeout = MAXDWORD;
--						cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
--						cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) +
--							(data->timeout_sec * 1000);
--					} else {
--						data->timeout_sec = 0;
--						data->timeout_usec = 0;
--						data->has_timeout = 0;
--						data->timed_out = 0;
--
--						/* If we're not blocking but don't have a timeout
--						   set to return immediately */
--						if (!data->is_blocking) {
--							cto.ReadIntervalTimeout = MAXDWORD;
--						}
--					}
--
--					if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) {
--						return PHP_STREAM_OPTION_RETURN_ERR;
--					} else {
--						return PHP_STREAM_OPTION_RETURN_OK;
--					}
--				} else {
--					return PHP_STREAM_OPTION_RETURN_ERR;
--				}
--
--			default:
--				break;
--		}
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_raw_open_stream
-- * Opens the underlying stream.
-- */
--int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	DWORD err;
--
--	switch(*mode) {
--		case 'r':
--			wdata->creation_disposition = OPEN_EXISTING;
--			break;
--		case 'w':
--			wdata->creation_disposition = TRUNCATE_EXISTING;
--			break;
--		case 'a':
--			wdata->creation_disposition = OPEN_ALWAYS;
--			break;
--		case 'x':
--			wdata->creation_disposition = CREATE_NEW;
--			break;
--	}
--	mode ++;
--
--	if (*mode && (*mode != '+')) {
--		mode++;
--	}
--
--	if (*mode && (*mode == '+')) {
--		wdata->desired_access = GENERIC_READ | GENERIC_WRITE;
--	} else if (OPEN_EXISTING == wdata->creation_disposition) {
--		wdata->desired_access = GENERIC_READ;
--	} else {
--		wdata->desired_access = GENERIC_WRITE;
--	}
--
--	wdata->handle = CreateFile(filename, wdata->desired_access, 0,
--			NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL);
--	if (INVALID_HANDLE_VALUE == wdata->handle) {
--		err = GetLastError();
--		switch (err) {
--			case ERROR_FILE_EXISTS:
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
--				return 0;
--
--			case ERROR_FILE_NOT_FOUND:
--				/* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that
--				 * the file doesn't exist so now try to create it. */
--				if (TRUNCATE_EXISTING == wdata->creation_disposition) {
--					php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!");
--
--					wdata->handle = CreateFile(filename, wdata->desired_access, 0,
--								NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
--					if (INVALID_HANDLE_VALUE == wdata->handle) {
--						dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
--						return 0;
--					}
--				} else {
--					php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!");
--					return 0;
--				}
--				break;
--
--			default:
--				dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
--				return 0;
--		}
--	}
--
--	/* If canonical allocate the canonical buffer. */
--	if (data->canonical) {
--		wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data));
--		memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data));
--		wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_init
-- * Initialises the serial port
-- */
--static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	DWORD rate_def, data_bits_def, stop_bits_def, parity_def;
--	DCB dcb;
--
--	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
--		return 0;
--	}
--
--	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
--		return 0;
--	}
--
--	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
--		return 0;
--	}
--
--	if (!dio_parity_to_define(data->parity, &parity_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
--		return 0;
--	}
--
--	if (!GetCommState(wdata->handle, &(wdata->olddcb))) {
--		dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC);
--		return 0;
--	}
--
--	/* Init the DCB structure */
--	memset(&dcb, 0, sizeof(DCB));
--	dcb.DCBlength = sizeof(DCB);
--
--	/* Set the communication parameters */
--	dcb.fBinary  = 1;
--	dcb.BaudRate = rate_def;
--	dcb.ByteSize = (BYTE)data_bits_def;
--	dcb.StopBits = (BYTE)stop_bits_def;
--	dcb.Parity   = (BYTE)parity_def;
--
--	/* Set the control line parameters */
--	dcb.fDtrControl       = DTR_CONTROL_DISABLE;
--	dcb.fDsrSensitivity   = FALSE;
--	dcb.fOutxDsrFlow      = FALSE;
--	dcb.fTXContinueOnXoff = FALSE;
--	dcb.fOutX             = FALSE;
--	dcb.fInX              = FALSE;
--	dcb.fErrorChar        = FALSE;
--	dcb.fNull             = FALSE;
--	dcb.fAbortOnError     = FALSE;
--
--	/* Hardware flow control */
--	if (data->flow_control) {
--		dcb.fOutxCtsFlow = TRUE;
--		dcb.fRtsControl  = RTS_CONTROL_HANDSHAKE;
--	} else {
--		dcb.fOutxCtsFlow = FALSE;
--		dcb.fRtsControl  = RTS_CONTROL_DISABLE;
--	}
--
--	if (!SetCommState(wdata->handle, &dcb)) {
--		dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC);
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--
--/* {{{ dio_serial_uninit
-- * Restores the serial settings back to their original state.
-- */
--int dio_serial_uninit(php_dio_stream_data *data) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--
--	if (!SetCommState(wdata->handle, &(wdata->olddcb))) {
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/* {{{ dio_serial_flush
-- * Purges the serial buffers of data.
-- */
--int dio_serial_purge(php_dio_stream_data *data) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	BOOL ret;
--
--	/* Purge the canonical buffer if required */
--	if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) {
--		wdata->canon_data->read_pos  = 0;
--		wdata->canon_data->write_pos = 0;
--	}
--
--	/* Purge the com port */
--	if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) {
--		ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR);
--	} else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) {
--		ret = PurgeComm(wdata->handle, PURGE_TXCLEAR);
--	} else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) {
--		ret = PurgeComm(wdata->handle, PURGE_RXCLEAR);
--	}
--
--	return ret;
--}
--/* }}} */
--
--/* {{{ dio_serial_open_stream
-- * Opens the underlying stream.
-- */
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
--	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
--	COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
--
--	php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
--
--	if (*mode != 'r') {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!");
--		return 0;
--	}
--
--	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
--		return 0;
--	}
--
--	if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) {
--		dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC);
--		CloseHandle(wdata->handle);
--		return 0;
--	}
--
--	/* If we're not blocking but don't have a timeout
--	   set to return immediately */
--	if (!data->is_blocking && !data->has_timeout) {
--		cto.ReadIntervalTimeout = MAXDWORD;
--	}
--	
--	/* If we have a timeout ignore the blocking and set
--	   the total time in which to read the data */
--	if (data->has_timeout) {
--		cto.ReadIntervalTimeout = MAXDWORD;
--		cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
--		cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + 
--			(data->timeout_sec * 1000);
--	}
--
--	if (!SetCommTimeouts(wdata->handle, &cto)) {
--		dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC);
--		CloseHandle(wdata->handle);
--		return 0;
--	}
--
--	if (!dio_serial_init(data TSRMLS_CC)) {
--		CloseHandle(wdata->handle);
--		return 0;
--	}
--
--	return 1;
--}
--/* }}} */
--
--/*
-- * Local variables:
-- * c-basic-offset: 4
-- * tab-width: 4
-- * End:
-- * vim600: fdm=marker
-- * vim: sw=4 ts=4 noet
-- */
-+/*
-+   +----------------------------------------------------------------------+
-+   | PHP Version 5                                                        |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 3.0 of the PHP license,       |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available through the world-wide-web at the following url:           |
-+   | http://www.php.net/license/3_0.txt.                                  |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license@php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifdef HAVE_CONFIG_H
-+#include "config.h"
-+#endif
-+
-+#include "php.h"
-+#include "php_dio_common.h"
-+
-+#ifndef ZEND_WIN32
-+#error ZEND_WIN32 not defined!
-+#endif
-+
-+/* {{{ dio_last_error_php_error
-+ * Generates a PHP error message based upon the last Windows error.
-+ */
-+static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
-+	LPVOID msgbuf;
-+	DWORD  msgbuflen;
-+	char * errmsg;
-+	DWORD  err;
-+
-+#ifdef UNICODE
-+	DWORD  errmsglen;
-+#endif
-+
-+	err = GetLastError();
-+	msgbuflen = FormatMessage(
-+		FORMAT_MESSAGE_ALLOCATE_BUFFER|
-+		FORMAT_MESSAGE_FROM_SYSTEM|
-+		FORMAT_MESSAGE_IGNORE_INSERTS,
-+		NULL,
-+		err,
-+		MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
-+		(LPTSTR)&msgbuf,
-+		0,
-+		NULL);
-+
-+#ifdef UNICODE
-+
-+	/* Get the length of the converted message */
-+	errmsglen = WideCharToMultibyte(
-+		CP_ACP,
-+		0
-+		(LPCWSTR)msgbuf,
-+		-1,
-+		(LPSTR)errmsg,
-+		0,
-+		NULL,
-+		NULL);
-+
-+	/* Allocate a buffer */
-+	errmsg = emalloc(errmsglen);
-+	if (!errmsg) {
-+		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!");
-+		LocalFree(msgbuf);
-+		return;
-+	}
-+
-+	/* Convert the message */
-+	errmsglen = WideCharToMultibyte(
-+		CP_ACP,
-+		0
-+		(LPCWSTR)msgbuf,
-+		-1,
-+		(LPSTR)errmsg,
-+		errmsglen,
-+		NULL,
-+		NULL);
-+
-+#else
-+	errmsg = (char *)msgbuf;
-+#endif
-+
-+	php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
-+
-+	LocalFree(msgbuf);
-+#ifdef UNICODE
-+	efree(errmsg);
-+#endif
-+}
-+
-+/* {{{ dio_data_rate_to_define
-+ * Converts a numeric data rate to a termios define
-+ */
-+static int dio_data_rate_to_define(long rate, DWORD *def) {
-+	switch (rate) {
-+		case 75:
-+		case 110:
-+		case 134:
-+		case 150:
-+		case 300:
-+		case 600:
-+		case 1200:
-+		case 1800:
-+		case 2400:
-+		case 4800:
-+		case 7200:
-+		case 9600:
-+		case 14400:
-+		case 19200:
-+		case 38400:
-+		case 57600:
-+		case 115200:
-+		case 56000:
-+		case 128000:
-+		case 256000:
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = (DWORD)rate;
-+	return 1;
-+}
-+/* }}} */
-+
-+
-+/* {{{ dio_data_bits_to_define
-+ * Converts a number of data bits to a termios define
-+ */
-+static int dio_data_bits_to_define(int data_bits, DWORD *def) {
-+	switch (data_bits) {
-+		case 8:
-+		case 7:
-+		case 6:
-+		case 5:
-+		case 4:
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = (DWORD)data_bits;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_stop_bits_to_define
-+ * Converts a number of stop bits to a termios define
-+ */
-+static int dio_stop_bits_to_define(int stop_bits, DWORD *def) {
-+	DWORD val;
-+
-+	switch (stop_bits) {
-+		case 1:
-+			val = ONESTOPBIT;
-+			break;
-+		case 2:
-+			val = TWOSTOPBITS;
-+			break;
-+		case 3:
-+			val = ONE5STOPBITS;
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_parity_to_define
-+ * Converts a parity type to a termios define
-+ */
-+static int dio_parity_to_define(int parity, DWORD *def) {
-+	DWORD val;
-+
-+	switch (parity) {
-+		case 0:
-+			val = NOPARITY;
-+			break;
-+		case 1:
-+			val = ODDPARITY;
-+			break;
-+		case 2:
-+			val = EVENPARITY;
-+			break;
-+		default:
-+			return 0;
-+	}
-+
-+	*def = val;
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_create_stream_data
-+ * Creates an initialised stream data structure.  Free with efree().
-+ */
-+php_dio_stream_data * dio_create_stream_data(void) {
-+	php_dio_win32_stream_data * data = emalloc(sizeof(php_dio_win32_stream_data));
-+	memset(data, 0, sizeof(php_dio_win32_stream_data));
-+	dio_init_stream_data(&(data->common));
-+	data->handle = INVALID_HANDLE_VALUE;
-+	data->desired_access = 0;
-+	data->creation_disposition = 0;
-+	data->olddcb.DCBlength = sizeof(DCB);
-+
-+	return (php_dio_stream_data *)data;
-+}
-+/* }}} */
-+
-+/* {{{ dio_common_write
-+ * Writes count chars from the buffer to the stream described by the stream data.
-+ */
-+size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	DWORD total = 0;
-+
-+	if (WriteFile(wdata->handle, buf, (DWORD)count, &total, NULL)) {
-+		return (size_t)total;
-+	}
-+
-+	return 0;
-+}
-+/* }}} */
-+
-+/* {{{ dio_buffer_read
-+ * Reads any available chars from the canonical buffer.
-+ */
-+static size_t dio_buffer_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
-+	php_dio_win32_canon_data *canon_data = wdata->canon_data;
-+	size_t total = 0;
-+
-+	/* Read always follows write.  I.e. if read ptr > write ptr buffer has
-+	   wrapped and so we need to copy two blocks of data. */
-+	if (canon_data->read_pos > canon_data->write_pos) {
-+
-+		/* Check we actually need to copy both blocks */
-+		if ((canon_data->size - canon_data->read_pos) > count) {
-+
-+			/* No we don't.  Just copy as much as we were asked for. */
-+			memcpy((char*)buf, 
-+				   &(canon_data->buf[canon_data->read_pos]), 
-+				   count);
-+			/* Update the read pointer. */
-+			canon_data->read_pos += count;
-+
-+			/* Return the amount read. */
-+			return count;
-+		} else {
-+
-+			/* We need to copy both blocks so copy data up to the end of 
-+			   the buffer. */
-+			total = canon_data->size - canon_data->read_pos;
-+			memcpy((char*)buf, 
-+				   &(canon_data->buf[canon_data->read_pos]), 
-+				   total);
-+			canon_data->read_pos = 0;
-+			count -= total;
-+
-+			/* Now copy the data from the start of the buffer either up
-+			   count or the number of bytes in the buffer. */
-+
-+			if (canon_data->write_pos > count) {
-+				memcpy((char*)buf, canon_data->buf, count);
-+				canon_data->read_pos = count;
-+				total += count;
-+
-+				return total;
-+			} else {
-+				memcpy((char*)buf, canon_data->buf, canon_data->write_pos);
-+				canon_data->read_pos = canon_data->write_pos;
-+				total += canon_data->write_pos;
-+
-+				return total;
-+			}
-+		}
-+
-+	/* Else if write follows read.  This is a simpler case.  We just copy 
-+	   either all the data buffered or count, which ever is smaller. */
-+	} else if (canon_data->write_pos > canon_data->read_pos) {
-+		if ((canon_data->write_pos - canon_data->read_pos) > count) {
-+			memcpy((char*)buf, 
-+				   &(canon_data->buf[canon_data->read_pos]), 
-+				   count);
-+			canon_data->read_pos += count;
-+
-+			return count;
-+		} else {
-+			total = canon_data->write_pos - canon_data->read_pos;
-+			memcpy((char*)buf, 
-+				   &(canon_data->buf[canon_data->read_pos]), 
-+				   total);
-+			canon_data->read_pos += total;
-+
-+			return total;
-+		}
-+	}
-+
-+	/* Else we need to read more data from the data port. */
-+	return 0;
-+}
-+
-+/* {{{ dio_com_read
-+ * Read chars from the data port.
-+ */
-+static size_t dio_com_read(php_dio_stream_data *data, const char *buf, size_t count) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	DWORD err, total = 0;
-+
-+	if (ReadFile(wdata->handle, (void*)buf, (DWORD)count, &total, NULL)) {
-+
-+		if (total) {
-+			return (size_t)total;
-+		}
-+
-+		data->end_of_file = 1;
-+	}
-+
-+	if (!data->end_of_file) {
-+		err = GetLastError();
-+
-+		if (ERROR_HANDLE_EOF == err) {
-+			data->end_of_file = 1;
-+		}
-+	}
-+
-+	return 0;
-+}
-+
-+/* {{{ dio_canonical_read
-+ * Reads chars from the input stream until the internal buffer is full or a new
-+ * line is reached.
-+ */
-+static size_t dio_canonical_read(php_dio_win32_stream_data *wdata, const char *buf, size_t count) {
-+	php_dio_win32_canon_data *canon_data = wdata->canon_data;
-+	size_t total = 0;
-+	char ch;
-+
-+	/* See if there's any buffered data and copy it. */
-+	total = dio_buffer_read(wdata, buf, count);
-+	if (total) {
-+		return total;
-+	}
-+
-+	/* Need to read more data from the data port.  Buffer should be empty(er)
-+	   by now. */
-+	do {
-+		/* Is the buffer full? */
-+		if (((canon_data->write_pos + 1) % canon_data->size) == 
-+			canon_data->read_pos) {
-+			break;
-+		}
-+
-+		/* Read a byte from the input checking for EOF. */
-+		if (!dio_com_read((php_dio_stream_data*)wdata, &ch, 1)) {
-+			break;
-+		}
-+
-+		/* Translate CR to newlines (same as ICRNL in POSIX) */
-+		ch = (ch != '\r') ? ch : '\n';
-+
-+		/* We read a character!  So buffer it. */
-+		canon_data->buf[canon_data->write_pos++] = ch;
-+		if (canon_data->write_pos >= canon_data->size) {
-+			canon_data->write_pos = 0;
-+		}
-+
-+		/* End of line/input (^D)? */
-+	} while ((ch != '\n') && (ch != 0x04));
-+
-+	return dio_buffer_read(wdata, buf, count);
-+}
-+/* }}} */
-+
-+/* {{{ dio_common_read
-+ * Reads count chars to the buffer to the stream described by the stream data.
-+ */
-+size_t dio_common_read(php_dio_stream_data *data, const char *buf, size_t count) {
-+
-+	/* You ask for no bytes you'll get none :-) */
-+	if (!count) {
-+		return 0;
-+	}
-+
-+	if (data->canonical) {
-+		return dio_canonical_read((php_dio_win32_stream_data*)data, buf, count);
-+	} else {
-+		return dio_com_read(data, buf, count);
-+	}
-+}
-+/* }}} */
-+
-+/* {{{ php_dio_stream_data
-+ * Closes the php_stream.
-+ */
-+int dio_common_close(php_dio_stream_data *data) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+
-+	if (data->canonical) {
-+		efree(wdata->canon_data);
-+	}
-+
-+	if (!CloseHandle(wdata->handle)) {
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_common_set_option
-+ * Sets/gets stream options
-+ */
-+int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam) {
-+	COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
-+	int old_is_blocking = 0;
-+
-+	/* Can't do timeouts or non blocking with raw windows streams :-( */
-+	if (DIO_STREAM_TYPE_SERIAL == data->stream_type) {
-+		switch (option) {
-+			case PHP_STREAM_OPTION_BLOCKING:
-+				old_is_blocking   = data->is_blocking;
-+				data->is_blocking = value ? 1 : 0;
-+
-+				/* Only change values if we need to change them. */
-+				if (data->is_blocking != old_is_blocking) {
-+					/* If we're not blocking but don't have a timeout
-+					   set to return immediately */
-+					if (!data->is_blocking && !data->has_timeout) {
-+						cto.ReadIntervalTimeout = MAXDWORD;
-+					}
-+
-+					/* If we have a timeout ignore the blocking and set
-+					   the total time in which to read the data */
-+					if (data->has_timeout) {
-+						cto.ReadIntervalTimeout = MAXDWORD;
-+						cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
-+						cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) +
-+							(data->timeout_sec * 1000);
-+					}
-+
-+					if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) {
-+						return PHP_STREAM_OPTION_RETURN_ERR;
-+					}
-+				}
-+				return old_is_blocking ? PHP_STREAM_OPTION_RETURN_OK : PHP_STREAM_OPTION_RETURN_ERR;
-+
-+			case PHP_STREAM_OPTION_READ_TIMEOUT:
-+				if (ptrparam) {
-+					/* struct timeval is supported with PHP_WIN32 defined. */
-+					struct timeval *tv = (struct timeval*)ptrparam;
-+
-+					/* A timeout of zero seconds and zero microseconds disables
-+					   any existing timeout. */
-+					if (tv->tv_sec || tv->tv_usec) {
-+						data->timeout_sec = tv->tv_sec;
-+						data->timeout_usec = tv->tv_usec;
-+						data->has_timeout = -1;
-+
-+						cto.ReadIntervalTimeout = MAXDWORD;
-+						cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
-+						cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) +
-+							(data->timeout_sec * 1000);
-+					} else {
-+						data->timeout_sec = 0;
-+						data->timeout_usec = 0;
-+						data->has_timeout = 0;
-+						data->timed_out = 0;
-+
-+						/* If we're not blocking but don't have a timeout
-+						   set to return immediately */
-+						if (!data->is_blocking) {
-+							cto.ReadIntervalTimeout = MAXDWORD;
-+						}
-+					}
-+
-+					if (!SetCommTimeouts(((php_dio_win32_stream_data*)data)->handle, &cto)) {
-+						return PHP_STREAM_OPTION_RETURN_ERR;
-+					} else {
-+						return PHP_STREAM_OPTION_RETURN_OK;
-+					}
-+				} else {
-+					return PHP_STREAM_OPTION_RETURN_ERR;
-+				}
-+
-+			default:
-+				break;
-+		}
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_raw_open_stream
-+ * Opens the underlying stream.
-+ */
-+int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	DWORD err;
-+
-+	switch(*mode) {
-+		case 'r':
-+			wdata->creation_disposition = OPEN_EXISTING;
-+			break;
-+		case 'w':
-+			wdata->creation_disposition = TRUNCATE_EXISTING;
-+			break;
-+		case 'a':
-+			wdata->creation_disposition = OPEN_ALWAYS;
-+			break;
-+		case 'x':
-+			wdata->creation_disposition = CREATE_NEW;
-+			break;
-+	}
-+	mode ++;
-+
-+	if (*mode && (*mode != '+')) {
-+		mode++;
-+	}
-+
-+	if (*mode && (*mode == '+')) {
-+		wdata->desired_access = GENERIC_READ | GENERIC_WRITE;
-+	} else if (OPEN_EXISTING == wdata->creation_disposition) {
-+		wdata->desired_access = GENERIC_READ;
-+	} else {
-+		wdata->desired_access = GENERIC_WRITE;
-+	}
-+
-+	wdata->handle = CreateFile(filename, wdata->desired_access, 0,
-+			NULL, wdata->creation_disposition, FILE_ATTRIBUTE_NORMAL, NULL);
-+	if (INVALID_HANDLE_VALUE == wdata->handle) {
-+		err = GetLastError();
-+		switch (err) {
-+			case ERROR_FILE_EXISTS:
-+				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
-+				return 0;
-+
-+			case ERROR_FILE_NOT_FOUND:
-+				/* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that
-+				 * the file doesn't exist so now try to create it. */
-+				if (TRUNCATE_EXISTING == wdata->creation_disposition) {
-+					php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!");
-+
-+					wdata->handle = CreateFile(filename, wdata->desired_access, 0,
-+								NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
-+					if (INVALID_HANDLE_VALUE == wdata->handle) {
-+						dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
-+						return 0;
-+					}
-+				} else {
-+					php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!");
-+					return 0;
-+				}
-+				break;
-+
-+			default:
-+				dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
-+				return 0;
-+		}
-+	}
-+
-+	/* If canonical allocate the canonical buffer. */
-+	if (data->canonical) {
-+		wdata->canon_data = emalloc(sizeof(php_dio_win32_canon_data));
-+		memset(wdata->canon_data, 0, sizeof(php_dio_win32_canon_data));
-+		wdata->canon_data->size = DIO_WIN32_CANON_BUF_SIZE;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_init
-+ * Initialises the serial port
-+ */
-+static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	DWORD rate_def, data_bits_def, stop_bits_def, parity_def;
-+	DCB dcb;
-+
-+	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
-+		return 0;
-+	}
-+
-+	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
-+		return 0;
-+	}
-+
-+	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
-+		return 0;
-+	}
-+
-+	if (!dio_parity_to_define(data->parity, &parity_def)) {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
-+		return 0;
-+	}
-+
-+	if (!GetCommState(wdata->handle, &(wdata->olddcb))) {
-+		dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC);
-+		return 0;
-+	}
-+
-+	/* Init the DCB structure */
-+	memset(&dcb, 0, sizeof(DCB));
-+	dcb.DCBlength = sizeof(DCB);
-+
-+	/* Set the communication parameters */
-+	dcb.fBinary  = 1;
-+	dcb.BaudRate = rate_def;
-+	dcb.ByteSize = (BYTE)data_bits_def;
-+	dcb.StopBits = (BYTE)stop_bits_def;
-+	dcb.Parity   = (BYTE)parity_def;
-+
-+	/* Set the control line parameters */
-+	dcb.fDtrControl       = DTR_CONTROL_DISABLE;
-+	dcb.fDsrSensitivity   = FALSE;
-+	dcb.fOutxDsrFlow      = FALSE;
-+	dcb.fTXContinueOnXoff = FALSE;
-+	dcb.fOutX             = FALSE;
-+	dcb.fInX              = FALSE;
-+	dcb.fErrorChar        = FALSE;
-+	dcb.fNull             = FALSE;
-+	dcb.fAbortOnError     = FALSE;
-+
-+	/* Hardware flow control */
-+	if (data->flow_control) {
-+		dcb.fOutxCtsFlow = TRUE;
-+		dcb.fRtsControl  = RTS_CONTROL_HANDSHAKE;
-+	} else {
-+		dcb.fOutxCtsFlow = FALSE;
-+		dcb.fRtsControl  = RTS_CONTROL_DISABLE;
-+	}
-+
-+	if (!SetCommState(wdata->handle, &dcb)) {
-+		dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC);
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+
-+/* {{{ dio_serial_uninit
-+ * Restores the serial settings back to their original state.
-+ */
-+int dio_serial_uninit(php_dio_stream_data *data) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+
-+	if (!SetCommState(wdata->handle, &(wdata->olddcb))) {
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_flush
-+ * Purges the serial buffers of data.
-+ */
-+int dio_serial_purge(php_dio_stream_data *data) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	BOOL ret;
-+
-+	/* Purge the canonical buffer if required */
-+	if (data->canonical && ((wdata->desired_access & GENERIC_READ) == GENERIC_READ)) {
-+		wdata->canon_data->read_pos  = 0;
-+		wdata->canon_data->write_pos = 0;
-+	}
-+
-+	/* Purge the com port */
-+	if ((wdata->desired_access & (GENERIC_READ|GENERIC_WRITE)) == (GENERIC_READ|GENERIC_WRITE)) {
-+		ret = PurgeComm(wdata->handle, PURGE_RXCLEAR|PURGE_TXCLEAR);
-+	} else if ((wdata->desired_access & GENERIC_WRITE) == GENERIC_WRITE) {
-+		ret = PurgeComm(wdata->handle, PURGE_TXCLEAR);
-+	} else if ((wdata->desired_access & GENERIC_READ) == GENERIC_READ) {
-+		ret = PurgeComm(wdata->handle, PURGE_RXCLEAR);
-+	}
-+
-+	return ret;
-+}
-+/* }}} */
-+
-+/* {{{ dio_serial_open_stream
-+ * Opens the underlying stream.
-+ */
-+int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
-+	COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
-+
-+	php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
-+
-+	if (*mode != 'r') {
-+		php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!");
-+		return 0;
-+	}
-+
-+	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+		return 0;
-+	}
-+
-+	if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) {
-+		dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC);
-+		CloseHandle(wdata->handle);
-+		return 0;
-+	}
-+
-+	/* If we're not blocking but don't have a timeout
-+	   set to return immediately */
-+	if (!data->is_blocking && !data->has_timeout) {
-+		cto.ReadIntervalTimeout = MAXDWORD;
-+	}
-+	
-+	/* If we have a timeout ignore the blocking and set
-+	   the total time in which to read the data */
-+	if (data->has_timeout) {
-+		cto.ReadIntervalTimeout = MAXDWORD;
-+		cto.ReadTotalTimeoutMultiplier  = MAXDWORD;
-+		cto.ReadTotalTimeoutConstant = (data->timeout_usec / 1000) + 
-+			(data->timeout_sec * 1000);
-+	}
-+
-+	if (!SetCommTimeouts(wdata->handle, &cto)) {
-+		dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC);
-+		CloseHandle(wdata->handle);
-+		return 0;
-+	}
-+
-+	if (!dio_serial_init(data TSRMLS_CC)) {
-+		CloseHandle(wdata->handle);
-+		return 0;
-+	}
-+
-+	return 1;
-+}
-+/* }}} */
-+
-+/*
-+ * Local variables:
-+ * c-basic-offset: 4
-+ * tab-width: 4
-+ * End:
-+ * vim600: fdm=marker
-+ * vim: sw=4 ts=4 noet
-+ */
---- a/php_dio_posix.h
-+++ b/php_dio_posix.h
-@@ -1,70 +1,70 @@
--/*
--   +----------------------------------------------------------------------+
--   | PHP Version 5                                                        |
--   +----------------------------------------------------------------------+
--   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
--   +----------------------------------------------------------------------+
--   | This source file is subject to version 3.0 of the PHP license,       |
--   | that is bundled with this package in the file LICENSE, and is        |
--   | available through the world-wide-web at the following url:           |
--   | http://www.php.net/license/3_0.txt.                                  |
--   | If you did not receive a copy of the PHP license and are unable to   |
--   | obtain it through the world-wide-web, please send a note to          |
--   | license@php.net so we can mail you a copy immediately.               |
--   +----------------------------------------------------------------------+
--   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
--   +----------------------------------------------------------------------+
-- */
--
--#ifndef PHP_DIO_POSIX_H_
--#define PHP_DIO_POSIX_H_
--
--#include <sys/stat.h>
--#include <sys/types.h>
--#include <sys/select.h>
--#include <sys/time.h>
--
--#ifdef HAVE_UNISTD_H
--#include <unistd.h>
--#endif
--
--#include <fcntl.h>
--#include <termios.h>
--
--
--/**
-+/*
-+   +----------------------------------------------------------------------+
-+   | PHP Version 5                                                        |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 3.0 of the PHP license,       |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available through the world-wide-web at the following url:           |
-+   | http://www.php.net/license/3_0.txt.                                  |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license@php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifndef PHP_DIO_POSIX_H_
-+#define PHP_DIO_POSIX_H_
-+
-+#include <sys/stat.h>
-+#include <sys/types.h>
-+#include <sys/select.h>
-+#include <sys/time.h>
-+
-+#ifdef HAVE_UNISTD_H
-+#include <unistd.h>
-+#endif
-+
-+#include <fcntl.h>
-+#include <termios.h>
-+
-+
-+/**
-  * Detect if we can support non blocking IO.
-- */
--#ifdef O_NONBLOCK
--#define DIO_NONBLOCK O_NONBLOCK
--#else
--#ifdef O_NDELAY
--#define DIO_NONBLOCK O_NDELAY
--#endif
--#endif
--
--/**
-+ */
-+#ifdef O_NONBLOCK
-+#define DIO_NONBLOCK O_NONBLOCK
-+#else
-+#ifdef O_NDELAY
-+#define DIO_NONBLOCK O_NDELAY
-+#endif
-+#endif
-+
-+/**
-  * POSIXy platforms have file permissions
-- */
--#define DIO_HAS_FILEPERMS
--
--#include "php_dio_common_data.h"
--
--typedef struct _php_dio_posix_stream_data {
--	php_dio_stream_data common;
--	int fd;
--	int flags;
--	/* Serial options */
--	struct termios oldtio;
--} php_dio_posix_stream_data ;
--
--#endif /* PHP_DIO_POSIX_H_ */
--
--/*
-- * Local variables:
-- * c-basic-offset: 4
-- * tab-width: 4
-- * End:
-- * vim600: fdm=marker
-- * vim: sw=4 ts=4 noet
-- */
-+ */
-+#define DIO_HAS_FILEPERMS
-+
-+#include "php_dio_common_data.h"
-+
-+typedef struct _php_dio_posix_stream_data {
-+	php_dio_stream_data common;
-+	int fd;
-+	int flags;
-+	/* Serial options */
-+	struct termios oldtio;
-+} php_dio_posix_stream_data ;
-+
-+#endif /* PHP_DIO_POSIX_H_ */
-+
-+/*
-+ * Local variables:
-+ * c-basic-offset: 4
-+ * tab-width: 4
-+ * End:
-+ * vim600: fdm=marker
-+ * vim: sw=4 ts=4 noet
-+ */
---- a/php_dio_win32.h
-+++ b/php_dio_win32.h
-@@ -1,62 +1,62 @@
--/*
--   +----------------------------------------------------------------------+
--   | PHP Version 5                                                        |
--   +----------------------------------------------------------------------+
--   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
--   +----------------------------------------------------------------------+
--   | This source file is subject to version 3.0 of the PHP license,       |
--   | that is bundled with this package in the file LICENSE, and is        |
--   | available through the world-wide-web at the following url:           |
--   | http://www.php.net/license/3_0.txt.                                  |
--   | If you did not receive a copy of the PHP license and are unable to   |
--   | obtain it through the world-wide-web, please send a note to          |
--   | license@php.net so we can mail you a copy immediately.               |
--   +----------------------------------------------------------------------+
--   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
--   +----------------------------------------------------------------------+
-- */
--
--#ifndef PHP_DIO_WIN32_H_
--#define PHP_DIO_WIN32_H_
--
--#include <windows.h>
--
--/* Windows platform can do non blocking. */
--#define DIO_NONBLOCK
--
--#include "php_dio_common_data.h"
--
--#define DIO_WIN32_CANON_BUF_SIZE 8192
--
--/* This is the buffer information when reading in canonical mode.  Data is 
--   read right up to either buffer being full or a newline being read.  Excess
--   data will be retained in the buffer until the next read. */
--typedef struct _php_dio_win32_canon_data {
--	size_t size;
--	size_t read_pos;
--	size_t write_pos;
--	char buf[DIO_WIN32_CANON_BUF_SIZE];
--
--} php_dio_win32_canon_data;
--
--typedef struct _php_dio_win32_stream_data {
--	php_dio_stream_data common;
--	HANDLE handle;
--	DWORD desired_access;
--	DWORD creation_disposition;
--	DCB olddcb;
--	COMMTIMEOUTS oldcto;
--	php_dio_win32_canon_data *canon_data;
--
--} php_dio_win32_stream_data ;
--
--#endif /* PHP_DIO_WIN32_H_ */
--
--/*
-- * Local variables:
-- * c-basic-offset: 4
-- * tab-width: 4
-- * End:
-- * vim600: fdm=marker
-- * vim: sw=4 ts=4 noet
-- */
-+/*
-+   +----------------------------------------------------------------------+
-+   | PHP Version 5                                                        |
-+   +----------------------------------------------------------------------+
-+   | Copyright (c) 2009 Melanie Rhianna Lewis                             |
-+   +----------------------------------------------------------------------+
-+   | This source file is subject to version 3.0 of the PHP license,       |
-+   | that is bundled with this package in the file LICENSE, and is        |
-+   | available through the world-wide-web at the following url:           |
-+   | http://www.php.net/license/3_0.txt.                                  |
-+   | If you did not receive a copy of the PHP license and are unable to   |
-+   | obtain it through the world-wide-web, please send a note to          |
-+   | license@php.net so we can mail you a copy immediately.               |
-+   +----------------------------------------------------------------------+
-+   | Author: Melanie Rhianna Lewis <cyberspice@php.net>                   |
-+   +----------------------------------------------------------------------+
-+ */
-+
-+#ifndef PHP_DIO_WIN32_H_
-+#define PHP_DIO_WIN32_H_
-+
-+#include <windows.h>
-+
-+/* Windows platform can do non blocking. */
-+#define DIO_NONBLOCK
-+
-+#include "php_dio_common_data.h"
-+
-+#define DIO_WIN32_CANON_BUF_SIZE 8192
-+
-+/* This is the buffer information when reading in canonical mode.  Data is 
-+   read right up to either buffer being full or a newline being read.  Excess
-+   data will be retained in the buffer until the next read. */
-+typedef struct _php_dio_win32_canon_data {
-+	size_t size;
-+	size_t read_pos;
-+	size_t write_pos;
-+	char buf[DIO_WIN32_CANON_BUF_SIZE];
-+
-+} php_dio_win32_canon_data;
-+
-+typedef struct _php_dio_win32_stream_data {
-+	php_dio_stream_data common;
-+	HANDLE handle;
-+	DWORD desired_access;
-+	DWORD creation_disposition;
-+	DCB olddcb;
-+	COMMTIMEOUTS oldcto;
-+	php_dio_win32_canon_data *canon_data;
-+
-+} php_dio_win32_stream_data ;
-+
-+#endif /* PHP_DIO_WIN32_H_ */
-+
-+/*
-+ * Local variables:
-+ * c-basic-offset: 4
-+ * tab-width: 4
-+ * End:
-+ * vim600: fdm=marker
-+ * vim: sw=4 ts=4 noet
-+ */

+ 0 - 32
lang/php7-pecl-dio/patches/0001-fix-svn-prop.patch

@@ -1,32 +0,0 @@
-From 46d3a1ff2c6e316cf0928a9fd403cb5284bfe863 Mon Sep 17 00:00:00 2001
-From: remi <remi@c90b9560-bf6c-de11-be94-00142212c4b1>
-Date: Wed, 9 Oct 2013 12:04:16 +0000
-Subject: [PATCH 01/16] fix svn prop
-
-git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331748 c90b9560-bf6c-de11-be94-00142212c4b1
----
- dio_posix.c     | 0
- dio_win32.c     | 0
- php_dio_posix.h | 0
- php_dio_win32.h | 0
- 4 files changed, 0 insertions(+), 0 deletions(-)
- mode change 100755 => 100644 dio_posix.c
- mode change 100755 => 100644 dio_win32.c
- mode change 100755 => 100644 php_dio_posix.h
- mode change 100755 => 100644 php_dio_win32.h
-
-diff --git a/dio_posix.c b/dio_posix.c
-old mode 100755
-new mode 100644
-diff --git a/dio_win32.c b/dio_win32.c
-old mode 100755
-new mode 100644
-diff --git a/php_dio_posix.h b/php_dio_posix.h
-old mode 100755
-new mode 100644
-diff --git a/php_dio_win32.h b/php_dio_win32.h
-old mode 100755
-new mode 100644
--- 
-2.5.0
-

+ 0 - 39
lang/php7-pecl-dio/patches/0002-fix-Wunused-variable.patch

@@ -1,39 +0,0 @@
-From e9261081d447492e7eff3a22601b1de4f1ae550f Mon Sep 17 00:00:00 2001
-From: remi <remi@c90b9560-bf6c-de11-be94-00142212c4b1>
-Date: Wed, 9 Oct 2013 12:15:51 +0000
-Subject: [PATCH 02/16] fix [-Wunused-variable]
-
-git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331749 c90b9560-bf6c-de11-be94-00142212c4b1
----
- dio.c       | 2 +-
- dio_posix.c | 1 -
- 2 files changed, 1 insertion(+), 2 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index e400cf0..408a171 100644
---- a/dio.c
-+++ b/dio.c
-@@ -775,7 +775,7 @@ ZEND_BEGIN_ARG_INFO_EX(dio_serial_args, 0, 0, 2)
- 	ZEND_ARG_INFO(0, options)
- ZEND_END_ARG_INFO()
- 
--static zend_object_handlers dio_raw_object_handlers;
-+// not used static zend_object_handlers dio_raw_object_handlers;
- 
- static zend_function_entry dio_functions[] = {
- 	/* Class functions. */
-diff --git a/dio_posix.c b/dio_posix.c
-index 16fb3d6..01e1109 100644
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -266,7 +266,6 @@ size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count
-  * earlier than early time.
-  */
- static int dio_timeval_subtract(struct timeval *late, struct timeval *early, struct timeval *diff) {
--	struct timeval *tmp;
- 
- 	/* Handle negatives */
- 	if (late->tv_sec < early->tv_sec) {
--- 
-2.5.0
-

+ 0 - 39
lang/php7-pecl-dio/patches/0003-Fix-Wmaybe-uninitialized.patch

@@ -1,39 +0,0 @@
-From 6cbc1651b6b6f865f9aae1e9adff73743298666f Mon Sep 17 00:00:00 2001
-From: remi <remi@c90b9560-bf6c-de11-be94-00142212c4b1>
-Date: Wed, 9 Oct 2013 12:18:34 +0000
-Subject: [PATCH 03/16] Fix [-Wmaybe-uninitialized]
-
-git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331750 c90b9560-bf6c-de11-be94-00142212c4b1
----
- dio_stream_wrappers.c | 6 ++----
- 1 file changed, 2 insertions(+), 4 deletions(-)
-
-diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c
-index 844b006..811bc07 100644
---- a/dio_stream_wrappers.c
-+++ b/dio_stream_wrappers.c
-@@ -228,9 +228,8 @@ PHP_FUNCTION(dio_raw) {
- 			efree(data);
- 			RETURN_FALSE;
- 		}
-+		php_stream_to_zval(stream, return_value);
- 	}
--
--	php_stream_to_zval(stream, return_value);
- }
- /* }}} */
- 
-@@ -390,9 +389,8 @@ PHP_FUNCTION(dio_serial) {
- 			efree(data);
- 			RETURN_FALSE;
- 		}
-+		php_stream_to_zval(stream, return_value);
- 	}
--
--	php_stream_to_zval(stream, return_value);
- }
- /* }}} */
- 
--- 
-2.5.0
-

+ 0 - 42
lang/php7-pecl-dio/patches/0004-Fix-last-build-warning-Wunused-but-set-variable-sorr.patch

@@ -1,42 +0,0 @@
-From 1e6f98d9fb65b9c052e6d555eab573d7e5073dae Mon Sep 17 00:00:00 2001
-From: remi <remi@c90b9560-bf6c-de11-be94-00142212c4b1>
-Date: Wed, 9 Oct 2013 12:24:28 +0000
-Subject: [PATCH 04/16] Fix last build warning [-Wunused-but-set-variable]
- (sorry for legibility...)
-
-git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331751 c90b9560-bf6c-de11-be94-00142212c4b1
----
- dio_posix.c | 7 ++++++-
- 1 file changed, 6 insertions(+), 1 deletion(-)
-
-diff --git a/dio_posix.c b/dio_posix.c
-index 01e1109..6ed8630 100644
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -28,7 +28,10 @@
-  * Convert an fopen() mode string to open() flags
-  */
- static int dio_stream_mode_to_flags(const char *mode) {
--	int  flags = 0, ch = 0, bin = 1;
-+	int  flags = 0, ch = 0;
-+#if defined(_O_TEXT) && defined(O_BINARY)
-+	int  bin = 1;
-+#endif
- 
- 	switch(mode[ch++]) {
- 		case 'r':
-@@ -45,9 +48,11 @@ static int dio_stream_mode_to_flags(const char *mode) {
- 			break;
- 	}
- 
-+#if defined(_O_TEXT) && defined(O_BINARY)
- 	if (mode[ch] != '+') {
- 		bin = (mode[ch++] == 'b');
- 	}
-+#endif
- 
- 	if (mode[ch] == '+') {
- 		flags |= O_RDWR;
--- 
-2.5.0
-

+ 0 - 91
lang/php7-pecl-dio/patches/0005-Added-LICENCE-file-as-requested-in-Request-65869.patch

@@ -1,91 +0,0 @@
-From 7c85a44880d9d748e7554f8fe7448505fa86aa28 Mon Sep 17 00:00:00 2001
-From: cyberspice <cyberspice@c90b9560-bf6c-de11-be94-00142212c4b1>
-Date: Sat, 12 Oct 2013 22:20:19 +0000
-Subject: [PATCH 05/16] Added LICENCE file as requested in Request #65869
-
-Files added:
-   LICENCE
-
-git-svn-id: http://svn.php.net/repository/pecl/dio/trunk@331788 c90b9560-bf6c-de11-be94-00142212c4b1
----
- LICENSE | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
- 1 file changed, 68 insertions(+)
- create mode 100644 LICENSE
-
-diff --git a/LICENSE b/LICENSE
-new file mode 100644
-index 0000000..d376afe
---- /dev/null
-+++ b/LICENSE
-@@ -0,0 +1,68 @@
-+-------------------------------------------------------------------- 
-+                  The PHP License, version 3.01
-+Copyright (c) 2008 - 2013 The PHP Group. All rights reserved.
-+-------------------------------------------------------------------- 
-+
-+Redistribution and use in source and binary forms, with or without
-+modification, is permitted provided that the following conditions
-+are met:
-+
-+  1. Redistributions of source code must retain the above copyright
-+     notice, this list of conditions and the following disclaimer.
-+ 
-+  2. Redistributions in binary form must reproduce the above copyright
-+     notice, this list of conditions and the following disclaimer in
-+     the documentation and/or other materials provided with the
-+     distribution.
-+ 
-+  3. The name "PHP" must not be used to endorse or promote products
-+     derived from this software without prior written permission. For
-+     written permission, please contact group@php.net.
-+  
-+  4. Products derived from this software may not be called "PHP", nor
-+     may "PHP" appear in their name, without prior written permission
-+     from group@php.net.  You may indicate that your software works in
-+     conjunction with PHP by saying "Foo for PHP" instead of calling
-+     it "PHP Foo" or "phpfoo"
-+ 
-+  5. The PHP Group may publish revised and/or new versions of the
-+     license from time to time. Each version will be given a
-+     distinguishing version number.
-+     Once covered code has been published under a particular version
-+     of the license, you may always continue to use it under the terms
-+     of that version. You may also choose to use such covered code
-+     under the terms of any subsequent version of the license
-+     published by the PHP Group. No one other than the PHP Group has
-+     the right to modify the terms applicable to covered code created
-+     under this License.
-+
-+  6. Redistributions of any form whatsoever must retain the following
-+     acknowledgment:
-+     "This product includes PHP software, freely available from
-+     <http://www.php.net/software/>".
-+
-+THIS SOFTWARE IS PROVIDED BY THE PHP DEVELOPMENT TEAM ``AS IS'' AND 
-+ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
-+PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE PHP
-+DEVELOPMENT TEAM OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
-+INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
-+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-+SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-+HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
-+OF THE POSSIBILITY OF SUCH DAMAGE.
-+
-+-------------------------------------------------------------------- 
-+
-+This software consists of voluntary contributions made by many
-+individuals on behalf of the PHP Group.
-+
-+The PHP Group can be contacted via Email at group@php.net.
-+
-+For more information on the PHP Group and the PHP project, 
-+please see <http://www.php.net>.
-+
-+PHP includes the Zend Engine, freely available at
-+<http://www.zend.com>.
--- 
-2.5.0
-

+ 0 - 117
lang/php7-pecl-dio/patches/0006-Replace-ZEND_FETCH_RESOURCE-macro-with-zend_fetch_re.patch

@@ -1,117 +0,0 @@
-From b69e1067f70ef293587b72979193e68b01d90902 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Wed, 13 Jul 2016 00:23:29 +0200
-Subject: [PATCH 06/16] Replace ZEND_FETCH_RESOURCE macro with
- zend_fetch_resource
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 36 +++++++++++++++++++++++++++---------
- 1 file changed, 27 insertions(+), 9 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index 408a171..6b687ac 100644
---- a/dio.c
-+++ b/dio.c
-@@ -161,7 +161,9 @@ PHP_FUNCTION(dio_dup)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	dfd = dup(f->fd);
- 	if (dfd == -1) {
-@@ -192,7 +194,9 @@ PHP_FUNCTION(dio_read)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	if (bytes <= 0) {
- 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
-@@ -233,7 +237,9 @@ PHP_FUNCTION(dio_write)
- 		RETURN_FALSE;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	res = write(f->fd, data, trunc_len ? trunc_len : data_len);
- 	if (res == -1) {
-@@ -258,7 +264,9 @@ PHP_FUNCTION(dio_truncate)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	if (ftruncate(f->fd, offset) == -1) {
- 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno));
-@@ -284,7 +292,9 @@ PHP_FUNCTION(dio_stat)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	if (fstat(f->fd, &s) == -1) {
- 		php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
-@@ -323,7 +333,9 @@ PHP_FUNCTION(dio_seek)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	RETURN_LONG(lseek(f->fd, offset, whence));
- }
-@@ -344,7 +356,9 @@ PHP_FUNCTION(dio_fcntl)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	switch (cmd) {
- 		case F_SETLK:
-@@ -454,7 +468,9 @@ PHP_FUNCTION(dio_tcsetattr)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	if (Z_TYPE_P(arg) != IS_ARRAY) {
- 		php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array");
-@@ -639,7 +655,9 @@ PHP_FUNCTION(dio_close)
- 		return;
- 	}
- 
--	ZEND_FETCH_RESOURCE(f, php_fd_t *, &r_fd, -1, le_fd_name, le_fd);
-+	if ((f = (php_fd_t *)zend_fetch_resource(Z_RES_P(r_fd), le_fd_name, le_fd)) == NULL) {
-+		RETURN_FALSE;
-+	}
- 
- 	zend_list_delete(Z_LVAL_P(r_fd));
- }
--- 
-2.5.0
-

+ 0 - 66
lang/php7-pecl-dio/patches/0007-Replace-ZEND_REGISTER_RESOURCE-with-zend_register_re.patch

@@ -1,66 +0,0 @@
-From dbf03eb09bf1a41bcd140c4edba351121ac24729 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Wed, 13 Jul 2016 00:36:46 +0200
-Subject: [PATCH 07/16] Replace ZEND_REGISTER_RESOURCE with
- zend_register_resource
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 12 ++++++------
- 1 file changed, 6 insertions(+), 6 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index 6b687ac..6f2d58c 100644
---- a/dio.c
-+++ b/dio.c
-@@ -72,9 +72,9 @@ static int new_php_fd(php_fd_t **f, int fd)
- 	return 1;
- }
- 
--static void _dio_close_fd(zend_rsrc_list_entry *rsrc TSRMLS_DC)
-+static void _dio_close_fd(zend_resource *res)
- {
--	php_fd_t *f = (php_fd_t *) rsrc->ptr;
-+	php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd);
- 	if (f) {
- 		close(f->fd);
- 		free(f);
-@@ -115,7 +115,7 @@ PHP_FUNCTION(dio_open)
- 		RETURN_FALSE;
- 	}
- 
--	ZEND_REGISTER_RESOURCE(return_value, f, le_fd);
-+	RETVAL_RES(zend_register_resource(f, le_fd));
- }
- /* }}} */
- 
-@@ -144,7 +144,7 @@ PHP_FUNCTION(dio_fdopen)
- 		RETURN_FALSE;
- 	}
- 
--	ZEND_REGISTER_RESOURCE(return_value, f, le_fd);
-+	RETVAL_RES(zend_register_resource(f, le_fd));
- }
- /* }}} */
- 
-@@ -175,7 +175,7 @@ PHP_FUNCTION(dio_dup)
- 		RETURN_FALSE;
- 	}
- 
--	ZEND_REGISTER_RESOURCE(return_value, df, le_fd);
-+	RETVAL_RES(zend_register_resource(f, le_fd));
- }
- /* }}} */
- #endif
-@@ -434,7 +434,7 @@ PHP_FUNCTION(dio_fcntl)
- 			if (!new_php_fd(&new_f, fcntl(f->fd, cmd, Z_LVAL_P(arg)))) {
- 				RETURN_FALSE;
- 			}
--			ZEND_REGISTER_RESOURCE(return_value, new_f, le_fd);
-+			RETVAL_RES(zend_register_resource(new_f, le_fd));
- 			break;
- 		}
- 		default:
--- 
-2.5.0
-

+ 0 - 34
lang/php7-pecl-dio/patches/0008-RETURN_STRINGL-takes-only-2-arguments.patch

@@ -1,34 +0,0 @@
-From 47422cf01f0a352c3f5f015585a28c99dba79862 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Wed, 13 Jul 2016 00:40:08 +0200
-Subject: [PATCH 08/16] RETURN_STRINGL takes only 2 arguments
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/dio.c b/dio.c
-index 6f2d58c..e8660f8 100644
---- a/dio.c
-+++ b/dio.c
-@@ -24,6 +24,7 @@
- #include "php.h"
- #include "php_ini.h"
- #include "ext/standard/info.h"
-+#include "ext/standard/php_string.h"
- 
- #include "php_dio.h"
- #include "php_dio_stream_wrappers.h"
-@@ -213,7 +214,7 @@ PHP_FUNCTION(dio_read)
- 	data = erealloc(data, res + 1);
- 	data[res] = 0;
- 
--	RETURN_STRINGL(data, res, 0);
-+	RETURN_STRINGL(data, res);
- }
- /* }}} */
- 
--- 
-2.5.0
-

+ 0 - 125
lang/php7-pecl-dio/patches/0009-Replace-zend_hash_find-with-zend_hash_str_find.patch

@@ -1,125 +0,0 @@
-From 7533f64b19006262fae7c6a4769392c67078166b Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Wed, 13 Jul 2016 01:07:22 +0200
-Subject: [PATCH 09/16] Replace zend_hash_find with zend_hash_str_find
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 44 ++++++++++++++++++++++----------------------
- 1 file changed, 22 insertions(+), 22 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index e8660f8..b489747 100644
---- a/dio.c
-+++ b/dio.c
-@@ -364,7 +364,7 @@ PHP_FUNCTION(dio_fcntl)
- 	switch (cmd) {
- 		case F_SETLK:
- 		case F_SETLKW: {
--			zval          **element;
-+			zval           *element;
- 			struct flock    lk = {0};
- 			HashTable      *fh;
- 
-@@ -374,28 +374,28 @@ PHP_FUNCTION(dio_fcntl)
- 			}
- 			if (Z_TYPE_P(arg) == IS_ARRAY) {
- 				fh = HASH_OF(arg);
--				if (zend_hash_find(fh, "start", sizeof("start"), (void **) &element) == FAILURE) {
-+				if ((element = zend_hash_str_find(fh, "start", sizeof("start"))) == NULL) {
- 					lk.l_start = 0;
- 				} else {
--					lk.l_start = Z_LVAL_PP(element);
-+					lk.l_start = Z_LVAL_P(element);
- 				}
- 
--				if (zend_hash_find(fh, "length", sizeof("length"), (void **) &element) == FAILURE) {
-+				if ((element = zend_hash_str_find(fh, "length", sizeof("length"))) == NULL) {
- 					lk.l_len = 0;
- 				} else {
--					lk.l_len = Z_LVAL_PP(element);
-+					lk.l_len = Z_LVAL_P(element);
- 				}
- 
--				if (zend_hash_find(fh, "whence", sizeof("whence"), (void **) &element) == FAILURE) {
-+				if ((element = zend_hash_str_find(fh, "whence", sizeof("whence"))) == NULL) {
- 					lk.l_whence = 0;
- 				} else {
--					lk.l_whence = Z_LVAL_PP(element);
-+					lk.l_whence = Z_LVAL_P(element);
- 				}
- 
--				if (zend_hash_find(fh, "type", sizeof("type"), (void **) &element) == FAILURE) {
-+				if ((element = zend_hash_str_find(fh, "type", sizeof("type"))) == NULL) {
- 					lk.l_type = 0;
- 				} else {
--					lk.l_type = Z_LVAL_PP(element);
-+					lk.l_type = Z_LVAL_P(element);
- 				}
- 			} else if (Z_TYPE_P(arg) == IS_LONG) {
- 				lk.l_start  = 0;
-@@ -463,7 +463,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 	int Baud_Rate, Data_Bits=8, Stop_Bits=1, Parity=0, Flow_Control=1, Is_Canonical=1;
- 	long BAUD,DATABITS,STOPBITS,PARITYON,PARITY;
- 	HashTable      *fh;
--	zval          **element;
-+	zval           *element;
- 
- 	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) {
- 		return;
-@@ -480,40 +480,40 @@ PHP_FUNCTION(dio_tcsetattr)
- 
- 	fh = HASH_OF(arg);
- 
--	if (zend_hash_find(fh, "baud", sizeof("baud"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "baud", sizeof("baud"))) == NULL) {
- 		Baud_Rate = 9600;
- 	} else {
--		Baud_Rate = Z_LVAL_PP(element);
-+		Baud_Rate = Z_LVAL_P(element);
- 	}
- 
--	if (zend_hash_find(fh, "bits", sizeof("bits"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "bits", sizeof("bits"))) == NULL) {
- 		Data_Bits = 8;
- 	} else {
--		Data_Bits = Z_LVAL_PP(element);
-+		Data_Bits = Z_LVAL_P(element);
- 	}
- 
--	if (zend_hash_find(fh, "stop", sizeof("stop"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "stop", sizeof("stop"))) == NULL) {
- 		Stop_Bits = 1;
- 	} else {
--		Stop_Bits = Z_LVAL_PP(element);
-+		Stop_Bits = Z_LVAL_P(element);
- 	}
- 
--	if (zend_hash_find(fh, "parity", sizeof("parity"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "parity", sizeof("parity"))) == NULL) {
- 		Parity = 0;
- 	} else {
--		Parity = Z_LVAL_PP(element);
-+		Parity = Z_LVAL_P(element);
- 	}
- 
--	if (zend_hash_find(fh, "flow_control", sizeof("flow_control"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "flow_control", sizeof("flow_control"))) == NULL) {
- 		Flow_Control = 1;
- 	} else {
--		Flow_Control = Z_LVAL_PP(element);
-+		Flow_Control = Z_LVAL_P(element);
- 	}
- 
--	if (zend_hash_find(fh, "is_canonical", sizeof("is_canonical"), (void **) &element) == FAILURE) {
-+	if ((element = zend_hash_str_find(fh, "is_canonical", sizeof("is_canonical"))) == NULL) {
- 		Is_Canonical = 0;
- 	} else {
--		Is_Canonical = Z_LVAL_PP(element);
-+		Is_Canonical = Z_LVAL_P(element);
- 	}
- 
- 	/* assign to correct values... */
--- 
-2.5.0
-

+ 0 - 240
lang/php7-pecl-dio/patches/0010-Replace-dio_convert_to_long.patch

@@ -1,240 +0,0 @@
-From fb31b1cf4da2bfd0830d0a83754f5ecb125d1c4a Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Thu, 14 Jul 2016 00:38:52 +0200
-Subject: [PATCH 10/16] Replace dio_convert_to_long
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio_common.c     | 106 +++++++++++++++++++++++--------------------------------
- php_dio_common.h |   2 --
- 2 files changed, 44 insertions(+), 64 deletions(-)
-
-diff --git a/dio_common.c b/dio_common.c
-index c50f56d..a5f4c63 100644
---- a/dio_common.c
-+++ b/dio_common.c
-@@ -52,29 +52,12 @@ void dio_init_stream_data(php_dio_stream_data *data) {
- }
- /* }}} */
- 
--/* {{{ dio_convert_to_long
-- * Returns as a long, the value of the zval regardless of its type.
-- */
--long dio_convert_to_long(zval *val) {
--	zval *copyval;
--	long  longval;
--
--	ALLOC_INIT_ZVAL(copyval);
--	*copyval = *val;
--	convert_to_long(copyval);
--	longval = Z_LVAL_P(copyval);
--	zval_ptr_dtor(&copyval);
--
--	return longval;
--}
--/* }}} */
--
- /* {{{ dio_assoc_array_get_basic_options
-  * Retrieves the basic open option values from an associative array
-  */
- void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
- #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
--	zval **tmpzval;
-+	zval *tmpzval;
- 	HashTable *opthash;
- 
- 	opthash = HASH_OF(options);
-@@ -82,8 +65,8 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data
- 
- #ifdef DIO_HAS_FILEPERMS
- 	/* This is the file mode flags used by open(). */
--	if (zend_hash_find(opthash, "perms", sizeof("perms"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->perms = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "perms", sizeof("perms"))) != NULL) {
-+		data->perms = (int)zval_get_long(tmpzval);
- 		data->has_perms = 1;
- 	}
- #endif
-@@ -91,20 +74,20 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data
- #ifdef DIO_NONBLOCK
- 	/* This sets the underlying stream to be blocking/non
- 	   block (i.e. O_NONBLOCK) */
--	if (zend_hash_find(opthash, "is_blocking", sizeof("is_blocking"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0;
-+	if ((tmpzval = zend_hash_str_find(opthash, "is_blocking", sizeof("is_blocking"))) != NULL) {
-+		data->is_blocking = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- 
- 	/* This is the timeout value for reads in seconds.  Only one of
- 	   timeout_secs or timeout_usecs need be defined to define a timeout. */
--	if (zend_hash_find(opthash, "timeout_secs", sizeof("timeout_secs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->timeout_sec = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "timeout_secs", sizeof("timeout_secs"))) != NULL) {
-+		data->timeout_sec = zval_get_long(tmpzval);
- 	}
- 
- 	/* This is the timeout value for reads in microseconds.  Only one of
- 	   timeout_secs or timeout_usecs need be defined to define a timeout. */
--	if (zend_hash_find(opthash, "timeout_usecs", sizeof("timeout_usecs"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->timeout_usec = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "timeout_usecs", sizeof("timeout_usecs"))) != NULL) {
-+		data->timeout_usec = zval_get_long(tmpzval);
- 	}
- 
- 	data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0;
-@@ -116,33 +99,33 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data
-  * Retrieves the serial open option values from an associative array
-  */
- void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
--	zval **tmpzval;
-+	zval *tmpzval;
- 	HashTable *opthash;
- 
- 	opthash = HASH_OF(options);
- 
--	if (zend_hash_find(opthash, "data_rate", sizeof("data_rate"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->data_rate = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "data_rate", sizeof("data_rate"))) != NULL) {
-+		data->data_rate = zval_get_long(tmpzval);
- 	}
- 
--	if (zend_hash_find(opthash, "data_bits", sizeof("data_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->data_bits = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "data_bits", sizeof("data_bits"))) != NULL) {
-+		data->data_bits = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (zend_hash_find(opthash, "stop_bits", sizeof("stop_bits"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->stop_bits = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "stop_bits", sizeof("stop_bits"))) != NULL) {
-+		data->stop_bits = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (zend_hash_find(opthash, "parity", sizeof("parity"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->parity = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = zend_hash_str_find(opthash, "parity", sizeof("parity"))) != NULL) {
-+		data->parity = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (zend_hash_find(opthash, "flow_control", sizeof("flow_control"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0);
-+	if ((tmpzval = zend_hash_str_find(opthash, "flow_control", sizeof("flow_control"))) != NULL) {
-+		data->flow_control = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- 
--	if (zend_hash_find(opthash, "is_canonical", sizeof("is_canonical"), (void **)&tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0);
-+	if ((tmpzval = zend_hash_str_find(opthash, "is_canonical", sizeof("is_canonical"))) != NULL) {
-+		data->canonical = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- }
- /* }}} */
-@@ -152,13 +135,13 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data
-  */
- void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
- #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
--	zval **tmpzval;
-+	zval *tmpzval;
- #endif
- 
- #ifdef DIO_HAS_FILEPERMS
- 	/* This is the file mode flags used by open(). */
--	if (php_stream_context_get_option(context, "dio", "perms", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->perms = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "perms")) != NULL) {
-+		data->perms = (int)zval_get_long(tmpzval);
- 		data->has_perms = 1;
- 	}
- #endif
-@@ -166,20 +149,20 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s
- #ifdef DIO_NONBLOCK
- 	/* This sets the underlying stream to be blocking/non
- 	   block (i.e. O_NONBLOCK) */
--	if (php_stream_context_get_option(context, "dio", "is_blocking", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->is_blocking = dio_convert_to_long(*tmpzval) ? 1 : 0;
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "is_blocking")) != NULL) {
-+		data->is_blocking = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- 
- 	/* This is the timeout value for reads in seconds.  Only one of
- 	   timeout_secs or timeout_usecs need be defined to define a timeout. */
--	if (php_stream_context_get_option(context, "dio", "timeout_secs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->timeout_sec = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_secs")) != NULL) {
-+		data->timeout_sec = zval_get_long(tmpzval);
- 	}
- 
- 	/* This is the timeout value for reads in microseconds.  Only one of
- 	   timeout_secs or timeout_usecs need be defined to define a timeout. */
--	if (php_stream_context_get_option(context, "dio", "timeout_usecs", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->timeout_usec = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "timeout_usecs")) != NULL) {
-+		data->timeout_usec = zval_get_long(tmpzval);
- 	}
- 
- 	data->has_timeout = (data->timeout_sec | data->timeout_usec) ? 1 : 0;
-@@ -191,30 +174,30 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s
-  * Extracts the option values for dio.serial mode from a context
-  */
- void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
--	zval **tmpzval;
-+	zval *tmpzval;
- 
--	if (php_stream_context_get_option(context, "dio", "data_rate", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->data_rate = dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) {
-+		data->data_rate = zval_get_long(tmpzval);
- 	}
- 
--	if (php_stream_context_get_option(context, "dio", "data_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->data_bits = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "data_bits")) != NULL) {
-+		data->data_bits = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (php_stream_context_get_option(context, "dio", "stop_bits", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->stop_bits = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "stop_bits")) != NULL) {
-+		data->stop_bits = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (php_stream_context_get_option(context, "dio", "parity", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->parity = (int)dio_convert_to_long(*tmpzval);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "parity")) != NULL) {
-+		data->parity = (int)zval_get_long(tmpzval);
- 	}
- 
--	if (php_stream_context_get_option(context, "dio", "flow_control", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->flow_control = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "flow_control")) != NULL) {
-+		data->flow_control = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- 
--	if (php_stream_context_get_option(context, "dio", "is_canonical", &tmpzval) == SUCCESS && tmpzval && *tmpzval) {
--		data->canonical = (int)(dio_convert_to_long(*tmpzval) ? 1 : 0);
-+	if ((tmpzval = php_stream_context_get_option(context, "dio", "is_canonical")) != NULL) {
-+		data->canonical = zval_get_long(tmpzval) ? 1 : 0;
- 	}
- }
- /* }}} */
-@@ -227,4 +210,3 @@ void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_
-  * vim600: fdm=marker
-  * vim: sw=4 ts=4 noet
-  */
--
-diff --git a/php_dio_common.h b/php_dio_common.h
-index f6e4d98..6b14040 100644
---- a/php_dio_common.h
-+++ b/php_dio_common.h
-@@ -35,8 +35,6 @@
- #define DIO_STREAM_TYPE_RAW    1
- #define DIO_STREAM_TYPE_SERIAL 2
- 
--long dio_convert_to_long(zval *val);
--
- php_dio_stream_data * dio_create_stream_data(void);
- 
- void dio_init_stream_data(php_dio_stream_data *data);
--- 
-2.5.0
-

+ 0 - 89
lang/php7-pecl-dio/patches/0011-Adopt-to-changed-stream-API-interface.patch

@@ -1,89 +0,0 @@
-From 3d71063ada4f1a4ef90611d263aa8e1d4f275359 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Thu, 14 Jul 2016 00:50:12 +0200
-Subject: [PATCH 11/16] Adopt to changed stream API interface
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio_posix.c           |  2 +-
- dio_stream_wrappers.c | 14 +++++++-------
- dio_win32.c           |  2 +-
- php_dio_common.h      |  2 +-
- 4 files changed, 10 insertions(+), 10 deletions(-)
-
-diff --git a/dio_posix.c b/dio_posix.c
-index 6ed8630..527d683 100644
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
- /* {{{ dio_raw_open_stream
-  * Opens the underlying stream.
-  */
--int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
- 	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
- 	pdata->flags = dio_stream_mode_to_flags(mode);
- 
-diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c
-index 811bc07..817b0d1 100644
---- a/dio_stream_wrappers.c
-+++ b/dio_stream_wrappers.c
-@@ -126,12 +126,12 @@ php_stream_ops dio_raw_stream_ops = {
-  * fopen for the dio.raw stream.
-  */
- static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper,
--                                         char *path, char *mode,
--                                         int options, char **opened_path,
--                                         php_stream_context *context STREAMS_DC TSRMLS_DC) {
-+                                         const char *path, const char *mode, int options,
-+                                         zend_string **opened_path, php_stream_context *context STREAMS_DC)
-+{
- 	php_dio_stream_data *data;
- 	php_stream *stream;
--	char *filename;
-+	const char *filename;
- 
- 	/* Check it was actually for us (not a corrupted function pointer
- 	   somewhere!). */
-@@ -287,9 +287,9 @@ php_stream_ops dio_serial_stream_ops = {
-  * fopen for the dio.raw stream.
-  */
- static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
--                                         char *path, char *mode,
--                                         int options, char **opened_path,
--                                         php_stream_context *context STREAMS_DC TSRMLS_DC) {
-+                                            const char *path, const char *mode, int options,
-+                                            zend_string **opened_path, php_stream_context *context STREAMS_DC)
-+{
- 	php_dio_stream_data *data;
- 	php_stream *stream;
- 	char *filename;
-diff --git a/dio_win32.c b/dio_win32.c
-index e7ccedd..1023d36 100644
---- a/dio_win32.c
-+++ b/dio_win32.c
-@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
- /* {{{ dio_raw_open_stream
-  * Opens the underlying stream.
-  */
--int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
- 	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
- 	DWORD err;
- 
-diff --git a/php_dio_common.h b/php_dio_common.h
-index 6b14040..7a75370 100644
---- a/php_dio_common.h
-+++ b/php_dio_common.h
-@@ -55,7 +55,7 @@ int dio_common_close(php_dio_stream_data *data);
- 
- int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam);
- 
--int dio_raw_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
-+int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
- 
- int dio_serial_uninit(php_dio_stream_data *data);
- 
--- 
-2.5.0
-

+ 0 - 829
lang/php7-pecl-dio/patches/0012-Remove-ancient-macros-TSRMLS_CC-and-TSRMLS_DC.patch

@@ -1,829 +0,0 @@
-From 760ec7072cbba2cbbb6e4e17b0c54ee3c7b661a8 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Thu, 14 Jul 2016 00:59:42 +0200
-Subject: [PATCH 12/16] Remove ancient macros TSRMLS_CC and TSRMLS_DC
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c                 | 70 +++++++++++++++++++++++++--------------------------
- dio_common.c          |  8 +++---
- dio_posix.c           | 22 ++++++++--------
- dio_stream_wrappers.c | 48 +++++++++++++++++------------------
- dio_win32.c           | 46 ++++++++++++++++-----------------
- php_dio_common.h      | 12 ++++-----
- 6 files changed, 103 insertions(+), 103 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index b489747..7bad575 100644
---- a/dio.c
-+++ b/dio.c
-@@ -93,11 +93,11 @@ PHP_FUNCTION(dio_open)
- 	long      mode = 0;
- 	int       fd;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl|l", &file_name, &file_name_length, &flags, &mode) == FAILURE) {
- 		return;
- 	}
- 
--	if (php_check_open_basedir(file_name TSRMLS_CC) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) {
-+	if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) {
- 		RETURN_FALSE;
- 	}
- 
-@@ -108,7 +108,7 @@ PHP_FUNCTION(dio_open)
- 	}
- 
- 	if (fd == -1) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno));
-+		php_error_docref(NULL, E_WARNING, "cannot open file %s with flags %ld and permissions %ld: %s", file_name, flags, mode, strerror(errno));
- 		RETURN_FALSE;
- 	}
- 
-@@ -130,14 +130,14 @@ PHP_FUNCTION(dio_fdopen)
- 	long lfd;
- 	int fd;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &lfd) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "l", &lfd) == FAILURE) {
- 		return;
- 	}
- 
- 	fd = (int)lfd;
- 
- 	if ((fcntl(fd, F_GETFL, 0) == -1) && (errno == EBADF)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Bad file descriptor %d", fd);
-+		php_error_docref(NULL, E_WARNING, "Bad file descriptor %d", fd);
- 		RETURN_FALSE;
- 	}
- 
-@@ -158,7 +158,7 @@ PHP_FUNCTION(dio_dup)
- 	php_fd_t *f, *df;
- 	int dfd;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
- 		return;
- 	}
- 
-@@ -168,7 +168,7 @@ PHP_FUNCTION(dio_dup)
- 
- 	dfd = dup(f->fd);
- 	if (dfd == -1) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno));
-+		php_error_docref(NULL, E_WARNING, "cannot duplication file descriptor %d: %s", f->fd, strerror(errno));
- 		RETURN_FALSE;
- 	}
- 
-@@ -191,7 +191,7 @@ PHP_FUNCTION(dio_read)
- 	long      bytes = 1024;
- 	ssize_t   res;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &r_fd, &bytes) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r|l", &r_fd, &bytes) == FAILURE) {
- 		return;
- 	}
- 
-@@ -200,7 +200,7 @@ PHP_FUNCTION(dio_read)
- 	}
- 
- 	if (bytes <= 0) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "Length parameter must be greater than 0.");
-+		php_error_docref(NULL, E_WARNING, "Length parameter must be greater than 0.");
- 		RETURN_FALSE;
- 	}
- 
-@@ -229,12 +229,12 @@ PHP_FUNCTION(dio_write)
- 	long      trunc_len = 0;
- 	ssize_t   res;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rs|l", &r_fd, &data, &data_len, &trunc_len) == FAILURE) {
- 		return;
- 	}
- 
- 	if (trunc_len < 0 || trunc_len > data_len) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
-+		php_error_docref(NULL, E_WARNING, "length must be greater or equal to zero and less then the length of the specified string.");
- 		RETURN_FALSE;
- 	}
- 
-@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_write)
- 
- 	res = write(f->fd, data, trunc_len ? trunc_len : data_len);
- 	if (res == -1) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno));
-+		php_error_docref(NULL, E_WARNING, "cannot write data to file descriptor %d: %s", f->fd, strerror(errno));
- 	}
- 
- 	RETURN_LONG(res);
-@@ -261,7 +261,7 @@ PHP_FUNCTION(dio_truncate)
- 	php_fd_t *f;
- 	long      offset;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl", &r_fd, &offset) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl", &r_fd, &offset) == FAILURE) {
- 		return;
- 	}
- 
-@@ -270,7 +270,7 @@ PHP_FUNCTION(dio_truncate)
- 	}
- 
- 	if (ftruncate(f->fd, offset) == -1) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno));
-+		php_error_docref(NULL, E_WARNING, "couldn't truncate %d to %ld bytes: %s", f->fd, offset, strerror(errno));
- 		RETURN_FALSE;
- 	}
- 
-@@ -289,7 +289,7 @@ PHP_FUNCTION(dio_stat)
- 	php_fd_t    *f;
- 	struct stat  s;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
- 		return;
- 	}
- 
-@@ -298,7 +298,7 @@ PHP_FUNCTION(dio_stat)
- 	}
- 
- 	if (fstat(f->fd, &s) == -1) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
-+		php_error_docref(NULL, E_WARNING, "cannot stat %d: %s", f->fd, strerror(errno));
- 		RETURN_FALSE;
- 	}
- 
-@@ -330,7 +330,7 @@ PHP_FUNCTION(dio_seek)
- 	long      offset;
- 	long      whence = SEEK_SET;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|l", &r_fd, &offset, &whence) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|l", &r_fd, &offset, &whence) == FAILURE) {
- 		return;
- 	}
- 
-@@ -353,7 +353,7 @@ PHP_FUNCTION(dio_fcntl)
- 	php_fd_t *f;
- 	long      cmd;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rl|z", &r_fd, &cmd, &arg) == FAILURE) {
- 		return;
- 	}
- 
-@@ -369,7 +369,7 @@ PHP_FUNCTION(dio_fcntl)
- 			HashTable      *fh;
- 
- 			if (!arg) {
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, none given");
-+				php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, none given");
- 				RETURN_FALSE;
- 			}
- 			if (Z_TYPE_P(arg) == IS_ARRAY) {
-@@ -403,7 +403,7 @@ PHP_FUNCTION(dio_fcntl)
- 				lk.l_whence = SEEK_SET;
- 				lk.l_type   = Z_LVAL_P(arg);
- 			} else {
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
-+				php_error_docref(NULL, E_WARNING, "expects argument 3 to be array or int, %s given", zend_zval_type_name(arg));
- 				RETURN_FALSE;
- 			}
- 
-@@ -428,7 +428,7 @@ PHP_FUNCTION(dio_fcntl)
- 			php_fd_t *new_f;
- 
- 			if (!arg || Z_TYPE_P(arg) != IS_LONG) {
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
-+				php_error_docref(NULL, E_WARNING, "expects argument 3 to be int");
- 				RETURN_FALSE;
- 			}
- 
-@@ -440,7 +440,7 @@ PHP_FUNCTION(dio_fcntl)
- 		}
- 		default:
- 			if (!arg || Z_TYPE_P(arg) != IS_LONG) {
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "expects argument 3 to be int");
-+				php_error_docref(NULL, E_WARNING, "expects argument 3 to be int");
- 				RETURN_FALSE;
- 			}
- 
-@@ -465,7 +465,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 	HashTable      *fh;
- 	zval           *element;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rz", &r_fd, &arg) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "rz", &r_fd, &arg) == FAILURE) {
- 		return;
- 	}
- 
-@@ -474,7 +474,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 	}
- 
- 	if (Z_TYPE_P(arg) != IS_ARRAY) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING,"tcsetattr, third argument should be an associative array");
-+		php_error_docref(NULL, E_WARNING,"tcsetattr, third argument should be an associative array");
- 		return;
- 	}
- 
-@@ -564,7 +564,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 			BAUD = B50;
- 			break;
- 		default:
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid baud rate %d", Baud_Rate);
-+			php_error_docref(NULL, E_WARNING, "invalid baud rate %d", Baud_Rate);
- 			RETURN_FALSE;
- 	}
- 	switch (Data_Bits) {
-@@ -581,7 +581,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 			DATABITS = CS5;
- 			break;
- 		default:
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data bits %d", Data_Bits);
-+			php_error_docref(NULL, E_WARNING, "invalid data bits %d", Data_Bits);
- 			RETURN_FALSE;
- 	}
- 	switch (Stop_Bits) {
-@@ -592,7 +592,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 			STOPBITS = CSTOPB;
- 			break;
- 		default:
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop bits %d", Stop_Bits);
-+			php_error_docref(NULL, E_WARNING, "invalid stop bits %d", Stop_Bits);
- 			RETURN_FALSE;
- 	}
- 
-@@ -610,7 +610,7 @@ PHP_FUNCTION(dio_tcsetattr)
- 			PARITY = 0;
- 			break;
- 		default:
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity %d", Parity);
-+			php_error_docref(NULL, E_WARNING, "invalid parity %d", Parity);
- 			RETURN_FALSE;
- 	}
- 
-@@ -652,7 +652,7 @@ PHP_FUNCTION(dio_close)
- 	zval     *r_fd;
- 	php_fd_t *f;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &r_fd) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "r", &r_fd) == FAILURE) {
- 		return;
- 	}
- 
-@@ -669,7 +669,7 @@ PHP_FUNCTION(dio_close)
- /* {{{ dio_init_legacy_defines
-  * Initialises the legacy PHP defines
-  */
--static void dio_init_legacy_defines(int module_number TSRMLS_DC) {
-+static void dio_init_legacy_defines(int module_number) {
- 	RDIOC(O_RDONLY);
- 	RDIOC(O_WRONLY);
- 	RDIOC(O_RDWR);
-@@ -852,11 +852,11 @@ PHP_MINIT_FUNCTION(dio)
- 	/* Legacy resource destructor. */
- 	le_fd = zend_register_list_destructors_ex(_dio_close_fd, NULL, le_fd_name, module_number);
- 
--	dio_init_legacy_defines(module_number TSRMLS_CC);
-+	dio_init_legacy_defines(module_number);
- 
- 	/* Register the stream wrappers */
--	return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper TSRMLS_CC) == SUCCESS &&
--			php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE;
-+	return (php_register_url_stream_wrapper(DIO_RAW_STREAM_NAME, &php_dio_raw_stream_wrapper) == SUCCESS &&
-+			php_register_url_stream_wrapper(DIO_SERIAL_STREAM_NAME, &php_dio_serial_stream_wrapper) == SUCCESS) ? SUCCESS : FAILURE;
- }
- /* }}} */
- 
-@@ -864,8 +864,8 @@ PHP_MINIT_FUNCTION(dio)
-  */
- PHP_MSHUTDOWN_FUNCTION(dio)
- {
--	return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME TSRMLS_CC) == SUCCESS &&
--			php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME TSRMLS_CC) == SUCCESS) ? SUCCESS : FAILURE;
-+	return (php_unregister_url_stream_wrapper(DIO_RAW_STREAM_NAME) == SUCCESS &&
-+			php_unregister_url_stream_wrapper(DIO_SERIAL_STREAM_NAME) == SUCCESS) ? SUCCESS : FAILURE;
- }
- /* }}} */
- 
-diff --git a/dio_common.c b/dio_common.c
-index a5f4c63..d09c0ec 100644
---- a/dio_common.c
-+++ b/dio_common.c
-@@ -55,7 +55,7 @@ void dio_init_stream_data(php_dio_stream_data *data) {
- /* {{{ dio_assoc_array_get_basic_options
-  * Retrieves the basic open option values from an associative array
-  */
--void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
-+void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data) {
- #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
- 	zval *tmpzval;
- 	HashTable *opthash;
-@@ -98,7 +98,7 @@ void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data
- /* {{{ dio_assoc_array_get_serial_options
-  * Retrieves the serial open option values from an associative array
-  */
--void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC) {
-+void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data) {
- 	zval *tmpzval;
- 	HashTable *opthash;
- 
-@@ -133,7 +133,7 @@ void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data
- /* {{{ dio_stream_context_get_raw_options
-  * Extracts the option values for dio.raw mode from a context
-  */
--void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
-+void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data) {
- #if defined(DIO_HAS_FILEPERMS) || defined(DIO_NONBLOCK)
- 	zval *tmpzval;
- #endif
-@@ -173,7 +173,7 @@ void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_s
- /* {{{ dio_stream_context_get_serial_options
-  * Extracts the option values for dio.serial mode from a context
-  */
--void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC) {
-+void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data) {
- 	zval *tmpzval;
- 
- 	if ((tmpzval = php_stream_context_get_option(context, "dio", "data_rate")) != NULL) {
-diff --git a/dio_posix.c b/dio_posix.c
-index 527d683..843e234 100644
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -474,7 +474,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
- /* {{{ dio_raw_open_stream
-  * Opens the underlying stream.
-  */
--int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) {
- 	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
- 	pdata->flags = dio_stream_mode_to_flags(mode);
- 
-@@ -498,7 +498,7 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
- 	if (pdata->fd < 0) {
- 		switch (errno) {
- 			case EEXIST:
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
-+				php_error_docref(NULL, E_WARNING, "File exists!");
- 				return 0;
- 			default:
- 				return 0;
-@@ -512,36 +512,36 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
- /* {{{ dio_serial_init
-  * Initialises the serial settings storing the original settings before hand.
-  */
--static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
-+static int dio_serial_init(php_dio_stream_data *data) {
- 	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
- 	int ret = 0, data_bits_def, stop_bits_def, parity_def;
- 	struct termios tio;
- 	speed_t rate_def;
- 
- 	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
-+		php_error_docref(NULL, E_WARNING, "invalid data_rate value (%ld)", data->data_rate);
- 		return 0;
- 	}
- 
- 	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
-+		php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
- 		return 0;
- 	}
- 
- 	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
-+		php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
- 		return 0;
- 	}
- 
- 	if (!dio_parity_to_define(data->parity, &parity_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
-+		php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity);
- 		return 0;
- 	}
- 
- 	ret = tcgetattr(pdata->fd, &(pdata->oldtio));
- 	if (ret < 0) {
- 		if ((errno == ENOTTY) || (errno == ENODEV)) {
--			php_error_docref(NULL TSRMLS_CC, E_WARNING, "Not a serial port or terminal!");
-+			php_error_docref(NULL, E_WARNING, "Not a serial port or terminal!");
- 		}
- 		return 0;
- 	}
-@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) {
- /* {{{ dio_serial_open_stream
-  * Opens the underlying stream.
-  */
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) {
- 	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
- 
- #ifdef O_NOCTTY
-@@ -640,11 +640,11 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data
- 	pdata->flags |= O_NOCTTY;
- #endif
- 
--	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (!dio_raw_open_stream(filename, mode, data)) {
- 		return 0;
- 	}
- 
--	if (!dio_serial_init(data TSRMLS_CC)) {
-+	if (!dio_serial_init(data)) {
- 		close(pdata->fd);
- 		return 0;
- 	}
-diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c
-index 817b0d1..eb23752 100644
---- a/dio_stream_wrappers.c
-+++ b/dio_stream_wrappers.c
-@@ -36,7 +36,7 @@
- /* {{{ dio_stream_write
-  * Write to the stream
-  */
--static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
-+static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count)
- {
- 	return dio_common_write((php_dio_stream_data*)stream->abstract, buf, count);
- }
-@@ -45,7 +45,7 @@ static size_t dio_stream_write(php_stream *stream, const char *buf, size_t count
- /* {{{ dio_stream_read
-  * Read from the stream
-  */
--static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS_DC)
-+static size_t dio_stream_read(php_stream *stream, char *buf, size_t count)
- {
- 	php_dio_stream_data* data = (php_dio_stream_data*)stream->abstract;
- 	size_t bytes = dio_common_read(data, buf, count);
-@@ -58,7 +58,7 @@ static size_t dio_stream_read(php_stream *stream, char *buf, size_t count TSRMLS
- /* {{{ dio_stream_flush
-  * Flush the stream.  For raw streams this does nothing.
-  */
--static int dio_stream_flush(php_stream *stream TSRMLS_DC)
-+static int dio_stream_flush(php_stream *stream)
- {
- 	return 1;
- }
-@@ -67,7 +67,7 @@ static int dio_stream_flush(php_stream *stream TSRMLS_DC)
- /* {{{ dio_stream_close
-  * Close the stream
-  */
--static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
-+static int dio_stream_close(php_stream *stream, int close_handle)
- {
- 	php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
- 
-@@ -83,7 +83,7 @@ static int dio_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
- /* {{{ dio_stream_set_option
-  * Set the stream options.
-  */
--static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam TSRMLS_DC)
-+static int dio_stream_set_option(php_stream *stream, int option, int value, void *ptrparam)
- {
- 	php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
- 
-@@ -143,7 +143,7 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper,
- 	filename = path + sizeof(DIO_RAW_STREAM_PROTOCOL) - 1;
- 
- 	/* Check we can actually access it. */
--	if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
-+	if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
- 		return NULL;
- 	}
- 
-@@ -152,11 +152,11 @@ static php_stream *dio_raw_fopen_wrapper(php_stream_wrapper *wrapper,
- 
- 	/* Parse the context. */
- 	if (context) {
--		dio_stream_context_get_basic_options(context, data TSRMLS_CC);
-+		dio_stream_context_get_basic_options(context, data);
- 	}
- 
- 	/* Try and open a raw stream. */
--	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (!dio_raw_open_stream(filename, mode, data)) {
- 		return NULL;
- 	}
- 
-@@ -199,7 +199,7 @@ PHP_FUNCTION(dio_raw) {
- 	char *mode;
- 	int   mode_len;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
- 		RETURN_FALSE;
- 	}
- 
-@@ -209,7 +209,7 @@ PHP_FUNCTION(dio_raw) {
- 	}
- 
- 	/* Check we can actually access the file. */
--	if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
-+	if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
- 		RETURN_FALSE;
- 	}
- 
-@@ -217,11 +217,11 @@ PHP_FUNCTION(dio_raw) {
- 	data->stream_type = DIO_STREAM_TYPE_RAW;
- 
- 	if (options) {
--		dio_assoc_array_get_basic_options(options, data TSRMLS_CC);
-+		dio_assoc_array_get_basic_options(options, data);
- 	}
- 
- 	/* Try and open a raw stream. */
--	if (dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (dio_raw_open_stream(filename, mode, data)) {
- 		stream = php_stream_alloc(&dio_raw_stream_ops, data, 0, mode);
- 		if (!stream) {
- 			(void) dio_common_close(data);
-@@ -244,7 +244,7 @@ PHP_FUNCTION(dio_raw) {
-  * stream, if it is write only it flushes the write, otherwise it flushes
-  * both.
-  */
--static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC)
-+static int dio_serial_stream_flush(php_stream *stream)
- {
- 	return dio_serial_purge((php_dio_stream_data*)stream->abstract);
- }
-@@ -254,7 +254,7 @@ static int dio_serial_stream_flush(php_stream *stream TSRMLS_DC)
-  * Close the stream.  Restores the serial settings to their value before
-  * the stream was open.
-  */
--static int dio_serial_stream_close(php_stream *stream, int close_handle TSRMLS_DC)
-+static int dio_serial_stream_close(php_stream *stream, int close_handle)
- {
- 	php_dio_stream_data *abstract = (php_dio_stream_data*)stream->abstract;
- 
-@@ -304,7 +304,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
- 	filename = path + sizeof(DIO_SERIAL_STREAM_PROTOCOL) - 1;
- 
- 	/* Check we can actually access it. */
--	if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
-+	if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
- 		return NULL;
- 	}
- 
-@@ -313,12 +313,12 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
- 
- 	/* Parse the context. */
- 	if (context) {
--		dio_stream_context_get_basic_options(context, data TSRMLS_CC);
--		dio_stream_context_get_serial_options(context, data TSRMLS_CC);
-+		dio_stream_context_get_basic_options(context, data);
-+		dio_stream_context_get_serial_options(context, data);
- 	}
- 
- 	/* Try and open a serial stream. */
--	if (!dio_serial_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (!dio_serial_open_stream(filename, mode, data)) {
- 		return NULL;
- 	}
- 
-@@ -359,18 +359,18 @@ PHP_FUNCTION(dio_serial) {
- 	char *mode;
- 	int   mode_len;
- 
--	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
-+	if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss|z", &filename, &filename_len, &mode, &mode_len, &options) == FAILURE) {
- 		RETURN_FALSE;
- 	}
- 
- 	/* Check the third argument is an array. */
- 	if (options && (Z_TYPE_P(options) != IS_ARRAY)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING,"dio_serial, the third argument should be an array of options");
-+		php_error_docref(NULL, E_WARNING,"dio_serial, the third argument should be an array of options");
- 		RETURN_FALSE;
- 	}
- 
- 	/* Check we can actually access the file. */
--	if (php_check_open_basedir(filename TSRMLS_CC) || DIO_SAFE_MODE_CHECK(filename, mode)) {
-+	if (php_check_open_basedir(filename) || DIO_SAFE_MODE_CHECK(filename, mode)) {
- 		RETURN_FALSE;
- 	}
- 
-@@ -378,12 +378,12 @@ PHP_FUNCTION(dio_serial) {
- 	data->stream_type = DIO_STREAM_TYPE_SERIAL;
- 
- 	if (options) {
--		dio_assoc_array_get_basic_options(options, data TSRMLS_CC);
--		dio_assoc_array_get_serial_options(options, data TSRMLS_CC);
-+		dio_assoc_array_get_basic_options(options, data);
-+		dio_assoc_array_get_serial_options(options, data);
- 	}
- 
- 	/* Try and open a serial stream. */
--	if (dio_serial_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (dio_serial_open_stream(filename, mode, data)) {
- 		stream = php_stream_alloc(&dio_serial_stream_ops, data, 0, mode);
- 		if (!stream) {
- 			efree(data);
-diff --git a/dio_win32.c b/dio_win32.c
-index 1023d36..25c838a 100644
---- a/dio_win32.c
-+++ b/dio_win32.c
-@@ -30,7 +30,7 @@
- /* {{{ dio_last_error_php_error
-  * Generates a PHP error message based upon the last Windows error.
-  */
--static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
-+static void dio_last_error_php_error(int level, char * message) {
- 	LPVOID msgbuf;
- 	DWORD  msgbuflen;
- 	char * errmsg;
-@@ -68,7 +68,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
- 	/* Allocate a buffer */
- 	errmsg = emalloc(errmsglen);
- 	if (!errmsg) {
--		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory in dio_last_error_php_error()!");
-+		php_error_docref(NULL, E_ERROR, "Out of memory in dio_last_error_php_error()!");
- 		LocalFree(msgbuf);
- 		return;
- 	}
-@@ -88,7 +88,7 @@ static void dio_last_error_php_error(int level, char * message TSRMLS_DC) {
- 	errmsg = (char *)msgbuf;
- #endif
- 
--	php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
-+	php_error_docref(NULL, E_WARNING, "%s[ERROR %d] %s", message, err, errmsg);
- 
- 	LocalFree(msgbuf);
- #ifdef UNICODE
-@@ -505,7 +505,7 @@ int dio_common_set_option(php_dio_stream_data *data, int option, int value, void
- /* {{{ dio_raw_open_stream
-  * Opens the underlying stream.
-  */
--int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) {
- 	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
- 	DWORD err;
- 
-@@ -543,29 +543,29 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
- 		err = GetLastError();
- 		switch (err) {
- 			case ERROR_FILE_EXISTS:
--				php_error_docref(NULL TSRMLS_CC, E_WARNING, "File exists!");
-+				php_error_docref(NULL, E_WARNING, "File exists!");
- 				return 0;
- 
- 			case ERROR_FILE_NOT_FOUND:
- 				/* ERROR_FILE_NOT_FOUND with TRUNCATE_EXISTING means that
- 				 * the file doesn't exist so now try to create it. */
- 				if (TRUNCATE_EXISTING == wdata->creation_disposition) {
--					php_error_docref(NULL TSRMLS_CC, E_NOTICE, "File does not exist, creating new file!");
-+					php_error_docref(NULL, E_NOTICE, "File does not exist, creating new file!");
- 
- 					wdata->handle = CreateFile(filename, wdata->desired_access, 0,
- 								NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
- 					if (INVALID_HANDLE_VALUE == wdata->handle) {
--						dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
-+						dio_last_error_php_error(E_WARNING, "CreateFile() failed:");
- 						return 0;
- 					}
- 				} else {
--					php_error_docref(NULL TSRMLS_CC, E_WARNING, "File not found!");
-+					php_error_docref(NULL, E_WARNING, "File not found!");
- 					return 0;
- 				}
- 				break;
- 
- 			default:
--				dio_last_error_php_error(E_WARNING, "CreateFile() failed:" TSRMLS_CC);
-+				dio_last_error_php_error(E_WARNING, "CreateFile() failed:");
- 				return 0;
- 		}
- 	}
-@@ -584,33 +584,33 @@ int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *d
- /* {{{ dio_serial_init
-  * Initialises the serial port
-  */
--static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
-+static int dio_serial_init(php_dio_stream_data *data) {
- 	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
- 	DWORD rate_def, data_bits_def, stop_bits_def, parity_def;
- 	DCB dcb;
- 
- 	if (!dio_data_rate_to_define(data->data_rate, &rate_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
-+		php_error_docref(NULL, E_WARNING, "invalid data_rate value (%d)", data->data_rate);
- 		return 0;
- 	}
- 
- 	if (!dio_data_bits_to_define(data->data_bits, &data_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
-+		php_error_docref(NULL, E_WARNING, "invalid data_bits value (%d)", data->data_bits);
- 		return 0;
- 	}
- 
- 	if (!dio_stop_bits_to_define(data->stop_bits, &stop_bits_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
-+		php_error_docref(NULL, E_WARNING, "invalid stop_bits value (%d)", data->stop_bits);
- 		return 0;
- 	}
- 
- 	if (!dio_parity_to_define(data->parity, &parity_def)) {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "invalid parity value (%d)", data->parity);
-+		php_error_docref(NULL, E_WARNING, "invalid parity value (%d)", data->parity);
- 		return 0;
- 	}
- 
- 	if (!GetCommState(wdata->handle, &(wdata->olddcb))) {
--		dio_last_error_php_error(E_WARNING, "GetCommState() failed:" TSRMLS_CC);
-+		dio_last_error_php_error(E_WARNING, "GetCommState() failed:");
- 		return 0;
- 	}
- 
-@@ -646,7 +646,7 @@ static int dio_serial_init(php_dio_stream_data *data TSRMLS_DC) {
- 	}
- 
- 	if (!SetCommState(wdata->handle, &dcb)) {
--		dio_last_error_php_error(E_WARNING, "SetCommState() failed:" TSRMLS_CC);
-+		dio_last_error_php_error(E_WARNING, "SetCommState() failed:");
- 		return 0;
- 	}
- 
-@@ -698,23 +698,23 @@ int dio_serial_purge(php_dio_stream_data *data) {
- /* {{{ dio_serial_open_stream
-  * Opens the underlying stream.
-  */
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC) {
-+int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) {
- 	php_dio_win32_stream_data *wdata = (php_dio_win32_stream_data*)data;
- 	COMMTIMEOUTS cto = { 0, 0, 0, 0, 0 };
- 
--	php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
-+	php_error_docref(NULL, E_NOTICE, "Opening \"%s\" as a serial port (mode=\"%s\").", filename, mode);
- 
- 	if (*mode != 'r') {
--		php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must open serial ports in read or read/write mode!");
-+		php_error_docref(NULL, E_WARNING, "You must open serial ports in read or read/write mode!");
- 		return 0;
- 	}
- 
--	if (!dio_raw_open_stream(filename, mode, data TSRMLS_CC)) {
-+	if (!dio_raw_open_stream(filename, mode, data)) {
- 		return 0;
- 	}
- 
- 	if (!GetCommTimeouts(wdata->handle, &(wdata->oldcto))) {
--		dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):" TSRMLS_CC);
-+		dio_last_error_php_error(E_WARNING, "GetCommTimeouts() failed (Not a comm port?):");
- 		CloseHandle(wdata->handle);
- 		return 0;
- 	}
-@@ -735,12 +735,12 @@ int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data
- 	}
- 
- 	if (!SetCommTimeouts(wdata->handle, &cto)) {
--		dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:" TSRMLS_CC);
-+		dio_last_error_php_error(E_WARNING, "SetCommTimeouts() failed:");
- 		CloseHandle(wdata->handle);
- 		return 0;
- 	}
- 
--	if (!dio_serial_init(data TSRMLS_CC)) {
-+	if (!dio_serial_init(data)) {
- 		CloseHandle(wdata->handle);
- 		return 0;
- 	}
-diff --git a/php_dio_common.h b/php_dio_common.h
-index 7a75370..6af202f 100644
---- a/php_dio_common.h
-+++ b/php_dio_common.h
-@@ -39,13 +39,13 @@ php_dio_stream_data * dio_create_stream_data(void);
- 
- void dio_init_stream_data(php_dio_stream_data *data);
- 
--void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data TSRMLS_DC);
-+void dio_assoc_array_get_basic_options(zval *options, php_dio_stream_data *data);
- 
--void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data TSRMLS_DC);
-+void dio_assoc_array_get_serial_options(zval *options, php_dio_stream_data *data);
- 
--void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC);
-+void dio_stream_context_get_basic_options(php_stream_context *context, php_dio_stream_data *data);
- 
--void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data TSRMLS_DC);
-+void dio_stream_context_get_serial_options(php_stream_context *context, php_dio_stream_data *data);
- 
- size_t dio_common_write(php_dio_stream_data *data, const char *buf, size_t count);
- 
-@@ -55,13 +55,13 @@ int dio_common_close(php_dio_stream_data *data);
- 
- int dio_common_set_option(php_dio_stream_data *data, int option, int value, void *ptrparam);
- 
--int dio_raw_open_stream(const char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
-+int dio_raw_open_stream(const char *filename, const char *mode, php_dio_stream_data *data);
- 
- int dio_serial_uninit(php_dio_stream_data *data);
- 
- int dio_serial_purge(php_dio_stream_data *data);
- 
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data TSRMLS_DC);
-+int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data);
- 
- #endif /* PHP_DIO_COMMON_H_ */
- 
--- 
-2.5.0
-

+ 0 - 69
lang/php7-pecl-dio/patches/0013-Fix-tests-for-legacy-interface.patch

@@ -1,69 +0,0 @@
-From 942b77d84417298fb9e99c216029f22fbd1e2d98 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Thu, 14 Jul 2016 01:47:05 +0200
-Subject: [PATCH 13/16] Fix tests for legacy interface
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 16 ++++++++++------
- 1 file changed, 10 insertions(+), 6 deletions(-)
-
-diff --git a/dio.c b/dio.c
-index 7bad575..1a130a2 100644
---- a/dio.c
-+++ b/dio.c
-@@ -73,9 +73,9 @@ static int new_php_fd(php_fd_t **f, int fd)
- 	return 1;
- }
- 
--static void _dio_close_fd(zend_resource *res)
-+static void _dio_close_fd(zend_resource *rsrc)
- {
--	php_fd_t *f = (php_fd_t *)zend_fetch_resource(res, NULL, le_fd);
-+	php_fd_t *f = (php_fd_t *)rsrc->ptr;
- 	if (f) {
- 		close(f->fd);
- 		free(f);
-@@ -87,8 +87,8 @@ static void _dio_close_fd(zend_resource *res)
- PHP_FUNCTION(dio_open)
- {
- 	php_fd_t *f;
--	char     *file_name;
--	int       file_name_length;
-+	char     *file_name = NULL;
-+	size_t    file_name_length = 0;
- 	long      flags;
- 	long      mode = 0;
- 	int       fd;
-@@ -97,6 +97,10 @@ PHP_FUNCTION(dio_open)
- 		return;
- 	}
- 
-+	if (!file_name || file_name[0] == '\0') {
-+		RETURN_FALSE;
-+	}
-+
- 	if (php_check_open_basedir(file_name) || DIO_SAFE_MODE_CHECK(file_name, "wb+")) {
- 		RETURN_FALSE;
- 	}
-@@ -176,7 +180,7 @@ PHP_FUNCTION(dio_dup)
- 		RETURN_FALSE;
- 	}
- 
--	RETVAL_RES(zend_register_resource(f, le_fd));
-+	RETVAL_RES(zend_register_resource(df, le_fd));
- }
- /* }}} */
- #endif
-@@ -660,7 +664,7 @@ PHP_FUNCTION(dio_close)
- 		RETURN_FALSE;
- 	}
- 
--	zend_list_delete(Z_LVAL_P(r_fd));
-+	zend_list_delete(Z_RES_P(r_fd));
- }
- /* }}} */
- 
--- 
-2.5.0
-

+ 0 - 54
lang/php7-pecl-dio/patches/0014-Add-missing-changes-from-changed-stream-API-interfac.patch

@@ -1,54 +0,0 @@
-From ff469d3a11409e9b043dc10ddfc44792c5359ff1 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Thu, 14 Jul 2016 01:47:05 +0200
-Subject: [PATCH 14/16] Add missing changes from changed stream API interface
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio_posix.c           | 2 +-
- dio_stream_wrappers.c | 2 +-
- php_dio_common.h      | 2 +-
- 3 files changed, 3 insertions(+), 3 deletions(-)
-
-diff --git a/dio_posix.c b/dio_posix.c
-index 843e234..b2aa228 100644
---- a/dio_posix.c
-+++ b/dio_posix.c
-@@ -632,7 +632,7 @@ int dio_serial_purge(php_dio_stream_data *data) {
- /* {{{ dio_serial_open_stream
-  * Opens the underlying stream.
-  */
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data) {
-+int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data) {
- 	php_dio_posix_stream_data *pdata = (php_dio_posix_stream_data*)data;
- 
- #ifdef O_NOCTTY
-diff --git a/dio_stream_wrappers.c b/dio_stream_wrappers.c
-index eb23752..0a00daa 100644
---- a/dio_stream_wrappers.c
-+++ b/dio_stream_wrappers.c
-@@ -292,7 +292,7 @@ static php_stream *dio_serial_fopen_wrapper(php_stream_wrapper *wrapper,
- {
- 	php_dio_stream_data *data;
- 	php_stream *stream;
--	char *filename;
-+	const char *filename;
- 
- 	/* Check it was actually for us (not a corrupted function pointer
- 	   somewhere!). */
-diff --git a/php_dio_common.h b/php_dio_common.h
-index 6af202f..7068ea7 100644
---- a/php_dio_common.h
-+++ b/php_dio_common.h
-@@ -61,7 +61,7 @@ int dio_serial_uninit(php_dio_stream_data *data);
- 
- int dio_serial_purge(php_dio_stream_data *data);
- 
--int dio_serial_open_stream(char *filename, char *mode, php_dio_stream_data *data);
-+int dio_serial_open_stream(const char *filename, const char *mode, php_dio_stream_data *data);
- 
- #endif /* PHP_DIO_COMMON_H_ */
- 
--- 
-2.5.0
-

+ 0 - 48
lang/php7-pecl-dio/patches/0015-Add-.gitignore.patch

@@ -1,48 +0,0 @@
-From def92a2db269d4ea6d2e8b7f8fe9dd473886a6b1 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Sun, 17 Jul 2016 01:08:47 +0200
-Subject: [PATCH 15/16] Add .gitignore
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- .gitignore | 28 ++++++++++++++++++++++++++++
- 1 file changed, 28 insertions(+)
- create mode 100644 .gitignore
-
-diff --git a/.gitignore b/.gitignore
-new file mode 100644
-index 0000000..dae52e8
---- /dev/null
-+++ b/.gitignore
-@@ -0,0 +1,28 @@
-+.deps
-+.libs
-+Makefile
-+Makefile.fragments
-+Makefile.global
-+Makefile.objects
-+acinclude.m4
-+aclocal.m4
-+autom4te.cache
-+build
-+config.guess
-+config.h
-+config.h.in
-+config.log
-+config.nice
-+config.status
-+config.sub
-+configure
-+configure.in
-+*.la
-+*.lo
-+install-sh
-+libtool
-+ltmain.sh
-+missing
-+mkinstalldirs
-+modules
-+run-tests.php
--- 
-2.5.0
-

+ 0 - 44
lang/php7-pecl-dio/patches/0016-Add-additional-baudrates.patch

@@ -1,44 +0,0 @@
-From 0f8df09a8008eed8a7ac0c6400bce523014ff770 Mon Sep 17 00:00:00 2001
-From: Michael Heimpold <mhei@heimpold.de>
-Date: Mon, 18 Jul 2016 22:45:04 +0200
-Subject: [PATCH 16/16] Add additional baudrates
-
-Signed-off-by: Michael Heimpold <mhei@heimpold.de>
----
- dio.c | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/dio.c b/dio.c
-index 1a130a2..a4e8e7d 100644
---- a/dio.c
-+++ b/dio.c
-@@ -522,6 +522,26 @@ PHP_FUNCTION(dio_tcsetattr)
- 
- 	/* assign to correct values... */
- 	switch (Baud_Rate)  {
-+#ifdef B460800
-+		case 460800:
-+			BAUD = B460800;
-+			break;
-+#endif
-+#ifdef B230400
-+		case 230400:
-+			BAUD = B230400;
-+			break;
-+#endif
-+#ifdef B115200
-+		case 115200:
-+			BAUD = B115200;
-+			break;
-+#endif
-+#ifdef B57600
-+		case 57600:
-+			BAUD = B57600;
-+			break;
-+#endif
- 		case 38400:
- 			BAUD = B38400;
- 			break;
--- 
-2.5.0
-

+ 16 - 5
lang/php7-pecl-http/Makefile

@@ -8,9 +8,9 @@ include $(TOPDIR)/rules.mk
 PECL_NAME:=pecl_http
 PECL_NAME:=pecl_http
 PECL_LONGNAME:=Extended HTTP Support
 PECL_LONGNAME:=Extended HTTP Support
 
 
-PKG_VERSION:=3.0.1
+PKG_VERSION:=3.1.0
 PKG_RELEASE:=2
 PKG_RELEASE:=2
-PKG_MD5SUM:=042c97314c180f6473338f0c5d35fabd
+PKG_MD5SUM:=e3de67b156e7d5f6c2e5eb1e2b5f0acceb7004f1260d68c9f8b2c0f9629aabf0
 
 
 PKG_NAME:=php7-pecl-http
 PKG_NAME:=php7-pecl-http
 PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
 PKG_SOURCE:=$(PECL_NAME)-$(PKG_VERSION).tgz
@@ -32,8 +32,19 @@ include $(INCLUDE_DIR)/nls.mk
 include ../php7/pecl.mk
 include ../php7/pecl.mk
 
 
 CONFIGURE_VARS+= \
 CONFIGURE_VARS+= \
-	PHP_PROPRO=yes \
-	PHP_RAPHF=yes \
+	PECL_cv_HAVE_EXT_propro=yes \
+	PECL_cv_HAVE_EXT_raphf=yes \
+	PECL_cv_HAVE_LIBCURL_ARES=no \
+	PECL_cv_HAVE_LIBCURL_OpenSSL=$(if $(CONFIG_LIBCURL_OPENSSL),yes,no) \
+	PECL_cv_HAVE_LIBCURL_GnuTLS=$(if $(CONFIG_LIBCURL_GNUTLS),yes,no) \
+	PECL_cv_HAVE_LIBCURL_NSS=no \
+	PECL_cv_HAVE_LIBCURL_SecureTransport=no \
+	PECL_cv_HAVE_LIBCURL_GSKit=no \
+	PECL_cv_HAVE_LIBCURL_PolarSSL=no \
+	PECL_cv_HAVE_LIBCURL_WolfSSL=$(if $(CONFIG_LIBCURL_CYASSL),yes,no) \
+	PECL_cv_HAVE_LIBCURL_mbedTLS=$(if $(CONFIG_LIBCURL_MBEDTLS),yes,no) \
+	PECL_cv_HAVE_LIBCURL_axTLS=no \
+	PECL_cv_LIBCURL_TLSAUTH_SRP=$(if $(CONFIG_LIBCURL_TLS_SRP),yes,no) \
 
 
 CONFIGURE_ARGS+= \
 CONFIGURE_ARGS+= \
 	--with-http \
 	--with-http \
@@ -42,5 +53,5 @@ CONFIGURE_ARGS+= \
 	--with-http-libevent-dir="$(STAGING_DIR)/usr" \
 	--with-http-libevent-dir="$(STAGING_DIR)/usr" \
 	--with-http-libidn-dir="$(STAGING_DIR)/usr"
 	--with-http-libidn-dir="$(STAGING_DIR)/usr"
 
 
-$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+libcurl +librt +libevent2 +libidn +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30))
+$(eval $(call PECLPackage,http,$(PECL_LONGNAME),+icu +libcurl +librt +libevent2 +libidn +php7-mod-iconv +php7-mod-session +php7-pecl-raphf +php7-pecl-propro,30))
 $(eval $(call BuildPackage,$(PKG_NAME)))
 $(eval $(call BuildPackage,$(PKG_NAME)))

+ 0 - 0
lang/php7-pecl-http/patches/100_config9-m4.patch → lang/php7-pecl-http/patches.old/100_config9-m4.patch


+ 11 - 0
lang/php7-pecl-http/patches/100_php_http_etag_bigendian_check.patch

@@ -0,0 +1,11 @@
+--- a/src/php_http_etag.c	2016-12-12 10:04:21.000000000 +0100
++++ b/src/php_http_etag.c	2016-12-23 21:10:59.523222367 +0100
+@@ -60,7 +60,7 @@
+ 		unsigned char buf[4];
+ 
+ 		*((uint *) e->ctx) = ~*((uint *) e->ctx);
+-#if WORDS_BIGENDIAN
++#ifdef WORDS_BIGENDIAN
+ 		etag = php_http_etag_digest((unsigned char *) e->ctx, 4);
+ #else
+ 		buf[0] = ((unsigned char *) e->ctx)[3];

+ 3 - 2
lang/php7/Makefile

@@ -6,7 +6,7 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=php
 PKG_NAME:=php
-PKG_VERSION:=7.0.13
+PKG_VERSION:=7.1.1
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 
 
 PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
 PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
@@ -16,7 +16,8 @@ PKG_LICENSE_FILES:=LICENSE
 
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://www.php.net/distributions/
 PKG_SOURCE_URL:=http://www.php.net/distributions/
-PKG_MD5SUM:=eb117bf1d1efc99c522f132b265a3402
+PKG_MD5SUM:=65eef256f6e7104a05361939f5e23ada
+PKG_HASH:=b3565b0c1441064eba204821608df1ec7367abff881286898d900c2c2a5ffe70
 
 
 PKG_FIXUP:=libtool autoreconf
 PKG_FIXUP:=libtool autoreconf
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_PARALLEL:=1

+ 27 - 16
lang/php7/patches/0013-Add-support-for-use-of-the-system-timezone-database.patch

@@ -1,11 +1,12 @@
 From: Joe Orton <jorton@redhat.com>
 From: Joe Orton <jorton@redhat.com>
-Date: Sun, 18 Oct 2015 02:15:17 +0200
+Date: Thu, 20 Oct 2016 11:44:14 +0200
 Subject: Add support for use of the system timezone database
 Subject: Add support for use of the system timezone database
 
 
 Add support for use of the system timezone database, rather
 Add support for use of the system timezone database, rather
 than embedding a copy.  Discussed upstream but was not desired.
 than embedding a copy.  Discussed upstream but was not desired.
 
 
 History:
 History:
+r14: improve check for valid tz file
 r13: adapt for upstream changes to use PHP allocator
 r13: adapt for upstream changes to use PHP allocator
 r12: adapt for upstream changes for new zic
 r12: adapt for upstream changes for new zic
 r11: use canonical names to avoid more case sensitivity issues
 r11: use canonical names to avoid more case sensitivity issues
@@ -25,12 +26,12 @@ r3: fix a crash if /usr/share/zoneinfo doesn't exist (Raphael Geissert)
 r2: add filesystem trawl to set up name alias index
 r2: add filesystem trawl to set up name alias index
 r1: initial revision
 r1: initial revision
 ---
 ---
- ext/date/lib/parse_tz.c | 549 +++++++++++++++++++++++++++++++++++++++++++++++-
- ext/date/lib/timelib.m4 |  14 ++
- 2 files changed, 552 insertions(+), 11 deletions(-)
+ ext/date/lib/parse_tz.c | 560 +++++++++++++++++++++++++++++++++++++++++++++++-
+ ext/date/lib/timelib.m4 |  13 ++
+ 2 files changed, 562 insertions(+), 11 deletions(-)
 
 
 diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
 diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
-index 20d7eea..6301dc5 100644
+index 20d7eea..ed7717e 100644
 --- a/ext/date/lib/parse_tz.c
 --- a/ext/date/lib/parse_tz.c
 +++ b/ext/date/lib/parse_tz.c
 +++ b/ext/date/lib/parse_tz.c
 @@ -24,6 +24,16 @@
 @@ -24,6 +24,16 @@
@@ -75,7 +76,7 @@ index 20d7eea..6301dc5 100644
  	/* read ID */
  	/* read ID */
  	version = (*tzf)[3] - '0';
  	version = (*tzf)[3] - '0';
  	*tzf += 4;
  	*tzf += 4;
-@@ -302,7 +321,418 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
+@@ -302,7 +321,429 @@ void timelib_dump_tzinfo(timelib_tzinfo *tz)
  	}
  	}
  }
  }
  
  
@@ -294,6 +295,7 @@ index 20d7eea..6301dc5 100644
 +		&& strcmp(ent->d_name, "posix") != 0
 +		&& strcmp(ent->d_name, "posix") != 0
 +		&& strcmp(ent->d_name, "posixrules") != 0
 +		&& strcmp(ent->d_name, "posixrules") != 0
 +		&& strcmp(ent->d_name, "right") != 0
 +		&& strcmp(ent->d_name, "right") != 0
++		&& strstr(ent->d_name, ".list") == NULL
 +		&& strstr(ent->d_name, ".tab") == NULL;
 +		&& strstr(ent->d_name, ".tab") == NULL;
 +}
 +}
 +
 +
@@ -434,8 +436,18 @@ index 20d7eea..6301dc5 100644
 +
 +
 +/* Returns true if the passed-in stat structure describes a
 +/* Returns true if the passed-in stat structure describes a
 + * probably-valid timezone file. */
 + * probably-valid timezone file. */
-+static int is_valid_tzfile(const struct stat *st)
++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;
 +	return S_ISREG(st->st_mode) && st->st_size > 20;
 +}
 +}
 +
 +
@@ -473,11 +485,11 @@ index 20d7eea..6301dc5 100644
 +	}
 +	}
 +
 +
 +	snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
 +	snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
-+	
++
 +	fd = open(fname, O_RDONLY);
 +	fd = open(fname, O_RDONLY);
 +	if (fd == -1) {
 +	if (fd == -1) {
 +		return NULL;
 +		return NULL;
-+	} else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st)) {
++	} else if (fstat(fd, &st) != 0 || !is_valid_tzfile(&st, fd)) {
 +		close(fd);
 +		close(fd);
 +		return NULL;
 +		return NULL;
 +	}
 +	}
@@ -495,7 +507,7 @@ index 20d7eea..6301dc5 100644
  {
  {
  	int left = 0, right = tzdb->index_size - 1;
  	int left = 0, right = tzdb->index_size - 1;
  #ifdef HAVE_SETLOCALE
  #ifdef HAVE_SETLOCALE
-@@ -341,21 +771,88 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
+@@ -341,21 +782,88 @@ static int seek_to_tz_position(const unsigned char **tzf, char *timezone, const
  	return 0;
  	return 0;
  }
  }
  
  
@@ -577,7 +589,7 @@ index 20d7eea..6301dc5 100644
 +
 +
 +		snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
 +		snprintf(fname, sizeof fname, ZONEINFO_PREFIX "/%s", canonical_tzname(timezone));
 +
 +
-+		return stat(fname, &st) == 0 && is_valid_tzfile(&st);
++		return stat(fname, &st) == 0 && is_valid_tzfile(&st, 0);
 +	}
 +	}
 +#endif
 +#endif
 +
 +
@@ -585,7 +597,7 @@ index 20d7eea..6301dc5 100644
  }
  }
  
  
  static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
  static void skip_64bit_preamble(const unsigned char **tzf, timelib_tzinfo *tz)
-@@ -380,24 +877,54 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
+@@ -380,24 +888,54 @@ static void read_64bit_header(const unsigned char **tzf, timelib_tzinfo *tz)
  timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
  timelib_tzinfo *timelib_parse_tzfile(char *timezone, const timelib_tzdb *tzdb)
  {
  {
  	const unsigned char *tzf;
  	const unsigned char *tzf;
@@ -650,13 +662,13 @@ index 20d7eea..6301dc5 100644
  		tmp = NULL;
  		tmp = NULL;
  	}
  	}
 diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4
 diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4
-index c725572..4c837c7 100644
+index 99bf9fa..4bf7e46 100644
 --- a/ext/date/lib/timelib.m4
 --- a/ext/date/lib/timelib.m4
 +++ b/ext/date/lib/timelib.m4
 +++ b/ext/date/lib/timelib.m4
-@@ -78,3 +78,17 @@ stdlib.h
+@@ -78,3 +78,16 @@ stdlib.h
  
  
  dnl Check for strtoll, atoll
  dnl Check for strtoll, atoll
- AC_CHECK_FUNCS(strtoll atoll strftime)
+ AC_CHECK_FUNCS(strtoll atoll strftime gettimeofday)
 +
 +
 +PHP_ARG_WITH(system-tzdata, for use of system timezone data,
 +PHP_ARG_WITH(system-tzdata, for use of system timezone data,
 +[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
 +[  --with-system-tzdata[=DIR]      to specify use of system timezone data],
@@ -670,4 +682,3 @@ index c725572..4c837c7 100644
 +                         [Define for location of system timezone data])
 +                         [Define for location of system timezone data])
 +   fi
 +   fi
 +fi
 +fi
-+

+ 2 - 2
lang/php7/patches/0032-Use-system-timezone.patch

@@ -14,10 +14,10 @@ To be used in tandem with use_embedded_timezonedb.patch and use_embedded_timezon
  1 file changed, 17 insertions(+)
  1 file changed, 17 insertions(+)
 
 
 diff --git a/ext/date/php_date.c b/ext/date/php_date.c
 diff --git a/ext/date/php_date.c b/ext/date/php_date.c
-index e780b2e..2b5a528 100644
+index cbe6e91..1999c83 100644
 --- a/ext/date/php_date.c
 --- a/ext/date/php_date.c
 +++ b/ext/date/php_date.c
 +++ b/ext/date/php_date.c
-@@ -992,6 +992,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb)
+@@ -1003,6 +1003,23 @@ static char* guess_timezone(const timelib_tzdb *tzdb)
  		DATEG(timezone_valid) = 1;
  		DATEG(timezone_valid) = 1;
  		return DATEG(default_timezone);
  		return DATEG(default_timezone);
  	}
  	}

+ 24 - 41
lang/php7/patches/0041-Add-patch-to-remove-build-timestamps-from-generated-.patch

@@ -8,15 +8,14 @@ Subject: Add patch to remove build timestamps from generated binaries.
  sapi/cgi/cgi_main.c           |  4 ++--
  sapi/cgi/cgi_main.c           |  4 ++--
  sapi/cli/php_cli.c            |  4 ++--
  sapi/cli/php_cli.c            |  4 ++--
  sapi/fpm/fpm/fpm_main.c       |  4 ++--
  sapi/fpm/fpm/fpm_main.c       |  4 ++--
- sapi/litespeed/lsapi_main.c   |  4 ++--
  sapi/phpdbg/phpdbg.c          |  4 +---
  sapi/phpdbg/phpdbg.c          |  4 +---
- 7 files changed, 12 insertions(+), 24 deletions(-)
+ 6 files changed, 10 insertions(+), 22 deletions(-)
 
 
 diff --git a/ext/standard/info.c b/ext/standard/info.c
 diff --git a/ext/standard/info.c b/ext/standard/info.c
-index e6eaac3..024e5c9 100644
+index e74d6b4..883fbdf 100644
 --- a/ext/standard/info.c
 --- a/ext/standard/info.c
 +++ b/ext/standard/info.c
 +++ b/ext/standard/info.c
-@@ -863,7 +863,6 @@ PHPAPI void php_print_info(int flag)
+@@ -865,7 +865,6 @@ PHPAPI void php_print_info(int flag)
  		php_info_print_box_end();
  		php_info_print_box_end();
  		php_info_print_table_start();
  		php_info_print_table_start();
  		php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
  		php_info_print_table_row(2, "System", ZSTR_VAL(php_uname));
@@ -51,78 +50,62 @@ index f286b1a..fba92b8 100644
    case $host_alias in
    case $host_alias in
    *aix*)
    *aix*)
 diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
 diff --git a/sapi/cgi/cgi_main.c b/sapi/cgi/cgi_main.c
-index 8983b53..589e299 100644
+index 0b6deb1..bb9014a 100644
 --- a/sapi/cgi/cgi_main.c
 --- a/sapi/cgi/cgi_main.c
 +++ b/sapi/cgi/cgi_main.c
 +++ b/sapi/cgi/cgi_main.c
-@@ -2216,9 +2216,9 @@ consult the installation file that came with this distribution, or visit \n\
+@@ -2342,9 +2342,9 @@ consult the installation file that came with this distribution, or visit \n\
  								SG(request_info).no_headers = 1;
  								SG(request_info).no_headers = 1;
  							}
  							}
  #if ZEND_DEBUG
  #if ZEND_DEBUG
--							php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+							php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+-							php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++							php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
  #else
  #else
--							php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+							php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+-							php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
++							php_printf("PHP %s (%s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
  #endif
  #endif
  							php_request_shutdown((void *) 0);
  							php_request_shutdown((void *) 0);
  							fcgi_shutdown();
  							fcgi_shutdown();
 diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
 diff --git a/sapi/cli/php_cli.c b/sapi/cli/php_cli.c
-index 978c8b3..3ee61a4 100644
+index dc92045..bb28364 100644
 --- a/sapi/cli/php_cli.c
 --- a/sapi/cli/php_cli.c
 +++ b/sapi/cli/php_cli.c
 +++ b/sapi/cli/php_cli.c
-@@ -682,8 +682,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
+@@ -690,8 +690,8 @@ static int do_cli(int argc, char **argv) /* {{{ */
  				goto out;
  				goto out;
  
  
  			case 'v': /* show php version & quit */
  			case 'v': /* show php version & quit */
--				php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s",
+-				php_printf("PHP %s (%s) (built: %s %s) ( %s)\nCopyright (c) 1997-2017 The PHP Group\n%s",
 -					PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
 -					PHP_VERSION, cli_sapi_module.name, __DATE__, __TIME__,
-+				php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2016 The PHP Group\n%s",
++				php_printf("PHP %s (%s) ( %s)\nCopyright (c) 1997-2017 The PHP Group\n%s",
 +					PHP_VERSION, cli_sapi_module.name,
 +					PHP_VERSION, cli_sapi_module.name,
  #if ZTS
  #if ZTS
  					"ZTS "
  					"ZTS "
  #else
  #else
 diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
 diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
-index 5adeb63..5e60255 100644
+index 6768113..545c52e 100644
 --- a/sapi/fpm/fpm/fpm_main.c
 --- a/sapi/fpm/fpm/fpm_main.c
 +++ b/sapi/fpm/fpm/fpm_main.c
 +++ b/sapi/fpm/fpm/fpm_main.c
-@@ -1757,9 +1757,9 @@ int main(int argc, char *argv[])
+@@ -1756,9 +1756,9 @@ int main(int argc, char *argv[])
  				SG(request_info).no_headers = 1;
  				SG(request_info).no_headers = 1;
  
  
  #if ZEND_DEBUG
  #if ZEND_DEBUG
--				php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__,        __TIME__, get_zend_version());
-+				php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+-				php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__,        __TIME__, get_zend_version());
++				php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
  #else
  #else
--				php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__,      get_zend_version());
-+				php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
+-				php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__,      get_zend_version());
++				php_printf("PHP %s (%s)\nCopyright (c) 1997-2017 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
  #endif
  #endif
  				php_request_shutdown((void *) 0);
  				php_request_shutdown((void *) 0);
  				fcgi_shutdown();
  				fcgi_shutdown();
-diff --git a/sapi/litespeed/lsapi_main.c b/sapi/litespeed/lsapi_main.c
-index b0ea105..4feb8f3 100644
---- a/sapi/litespeed/lsapi_main.c
-+++ b/sapi/litespeed/lsapi_main.c
-@@ -811,9 +811,9 @@ static int cli_main( int argc, char * argv[] )
-             case 'v':
-                 if (php_request_startup() != FAILURE) {
- #if ZEND_DEBUG
--                    php_printf("PHP %s (%s) (built: %s %s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+                    php_printf("PHP %s (%s) (DEBUG)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, get_zend_version());
- #else
--                    php_printf("PHP %s (%s) (built: %s %s)\nCopyright (c) 1997-2016 The PHP Group\n%s", PHP_VERSION, sapi_module.name, __DATE__, __TIME__, get_zend_version());
-+                    php_printf("PHP %s (%s)\nCopyright (c) 1997-2016 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/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
 diff --git a/sapi/phpdbg/phpdbg.c b/sapi/phpdbg/phpdbg.c
-index 68a164c..82565d8 100644
+index b47c7c8..ab94bba 100644
 --- a/sapi/phpdbg/phpdbg.c
 --- a/sapi/phpdbg/phpdbg.c
 +++ b/sapi/phpdbg/phpdbg.c
 +++ b/sapi/phpdbg/phpdbg.c
-@@ -1657,10 +1657,8 @@
- 				phpdbg_do_help(NULL);
+@@ -1699,10 +1699,8 @@ phpdbg_main:
+ 				phpdbg_do_help_cmd(exec);
  			} else if (show_version) {
  			} else if (show_version) {
  				phpdbg_out(
  				phpdbg_out(
--					"phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s",
-+					"phpdbg %s\nPHP %s, Copyright (c) 1997-2016 The PHP Group\n%s",
+-					"phpdbg %s (built: %s %s)\nPHP %s, Copyright (c) 1997-2017 The PHP Group\n%s",
++					"phpdbg %s\nPHP %s, Copyright (c) 1997-2017 The PHP Group\n%s",
  					PHPDBG_VERSION,
  					PHPDBG_VERSION,
 -					__DATE__,
 -					__DATE__,
 -					__TIME__,
 -					__TIME__,

+ 29 - 0
lang/php7/patches/1005-fix-asm-constraints-in-aarch64-multiply-macro.patch

@@ -0,0 +1,29 @@
+From 6cbb9f4c247c5361b8c165fbb40b4118d5d7c0e5 Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@linux-m68k.org>
+Date: Mon, 25 Apr 2016 11:59:14 +0200
+Subject: [PATCH] Fix asm constraints in aarch64 multiply macro
+
+All operands must be register operands and the output operands are early
+clobbered.
+---
+ Zend/zend_multiply.h | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Zend/zend_multiply.h b/Zend/zend_multiply.h
+index dfd21f7..651dd43 100644
+--- a/Zend/zend_multiply.h
++++ b/Zend/zend_multiply.h
+@@ -53,8 +53,8 @@
+ 	__asm__("mul %0, %2, %3\n"										\
+ 		"smulh %1, %2, %3\n"										\
+ 		"sub %1, %1, %0, asr #63\n"									\
+-			: "=X"(__tmpvar), "=X"(usedval)							\
+-			: "X"(a), "X"(b));										\
++			: "=&r"(__tmpvar), "=&r"(usedval)						\
++			: "r"(a), "r"(b));										\
+ 	if (usedval) (dval) = (double) (a) * (double) (b);				\
+ 	else (lval) = __tmpvar;											\
+ } while (0)
+-- 
+2.8.0
+

+ 3 - 0
lang/php7/pecl.mk

@@ -16,6 +16,9 @@ define Build/Prepare
 	( cd $(PKG_BUILD_DIR); $(STAGING_DIR)/usr/bin/phpize7 )
 	( cd $(PKG_BUILD_DIR); $(STAGING_DIR)/usr/bin/phpize7 )
 endef
 endef
 
 
+CONFIGURE_VARS+= \
+        ac_cv_c_bigendian_php=$(if $(CONFIG_BIG_ENDIAN),yes,no)
+
 CONFIGURE_ARGS+= \
 CONFIGURE_ARGS+= \
 	--with-php-config=$(STAGING_DIR)/usr/bin/php7-config
 	--with-php-config=$(STAGING_DIR)/usr/bin/php7-config
 
 

+ 1 - 1
lang/python-cffi/Makefile

@@ -45,7 +45,7 @@ define Build/Compile
 endef
 endef
 
 
 define Host/Compile
 define Host/Compile
-	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(HOST_BUILD_PREFIX)")
+	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
 endef
 
 
 define Host/Install
 define Host/Install

+ 0 - 44
lang/python-gmpy/Makefile

@@ -1,44 +0,0 @@
-#
-# Copyright (C) 2015 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=gmpy
-PKG_VERSION:=1.17
-PKG_RELEASE:=1
-
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).zip
-PKG_SOURCE_URL:=https://pypi.python.org/packages/source/g/gmpy
-PKG_MD5SUM:=2bf419076b06e107167e219f60ac6d27
-
-PKG_LICENSE:=LGPL-2.1+
-PKG_LICENSE_FILES:=lgpl-2.1.txt
-PKG_MAINTAINER:=Jeffery To <jeffery.to@gmail.com>
-
-include $(INCLUDE_DIR)/package.mk
-$(call include_mk, python-package.mk)
-
-define Package/python-gmpy
-	SECTION:=lang
-	CATEGORY:=Languages
-	SUBMENU:=Python
-	TITLE:=python-gmpy
-	URL:=http://code.google.com/p/gmpy/
-	DEPENDS:=+libgmp +python-light
-endef
-
-define Package/python-gmpy/description
-gmpy is a C-coded Python extension module that provides access to the
-GMP (or MPIR) multiple-precision arithmetic library.
-endef
-
-define Build/Compile
-	$(call Build/Compile/PyMod,,install --prefix="/usr" --root="$(PKG_INSTALL_DIR)")
-endef
-
-$(eval $(call PyPackage,python-gmpy))
-$(eval $(call BuildPackage,python-gmpy))

+ 2 - 2
lang/python-packages/Makefile

@@ -69,7 +69,7 @@ CONFIG_PACKAGE_python-packages-envs:=$(call qstrip,$(CONFIG_PACKAGE_python-packa
 CONFIG_PACKAGE_python-packages-extra-deps:=$(call qstrip,$(CONFIG_PACKAGE_python-packages-extra-deps))
 CONFIG_PACKAGE_python-packages-extra-deps:=$(call qstrip,$(CONFIG_PACKAGE_python-packages-extra-deps))
 CONFIG_PACKAGE_python-packages-pip-opts:=$(call qstrip,$(CONFIG_PACKAGE_python-packages-pip-opts))
 CONFIG_PACKAGE_python-packages-pip-opts:=$(call qstrip,$(CONFIG_PACKAGE_python-packages-pip-opts))
 
 
-HOST_PYTHON_PIP:=$(STAGING_DIR)/host/bin/pip$(PYTHON_VERSION)
+HOST_PYTHON_PIP:=$(STAGING_DIR_HOSTPKG)/bin/pip$(PYTHON_VERSION)
 
 
 decr=$(word $(1),0 1 2 3 4 5 6 7 8 9 10)
 decr=$(word $(1),0 1 2 3 4 5 6 7 8 9 10)
 recur=$(if $(subst 0,,$(2)),$(call recur,$(1),$(call decr,$(2)),$(call $(1)$(2),$(3))),$(3))
 recur=$(if $(subst 0,,$(2)),$(call recur,$(1),$(call decr,$(2)),$(call $(1)$(2),$(3))),$(3))
@@ -92,7 +92,7 @@ HOST_PYTHON_PIP_INSTALL=$(HOST_PYTHON_PIP) install \
 	$(if $(CONFIG_PACKAGE_python-packages-index-url), --index-url $(CONFIG_PACKAGE_python-packages-index-url)) \
 	$(if $(CONFIG_PACKAGE_python-packages-index-url), --index-url $(CONFIG_PACKAGE_python-packages-index-url)) \
 	$(if $(CONFIG_PACKAGE_python-packages-pip-opts), $(CONFIG_PACKAGE_python-packages-pip-opts)) \
 	$(if $(CONFIG_PACKAGE_python-packages-pip-opts), $(CONFIG_PACKAGE_python-packages-pip-opts)) \
 
 
-HOST_PYTHON_PIP_INSTALL_HOST:=$(call HOST_PYTHON_PIP_INSTALL,$(STAGING_DIR)/host,"")
+HOST_PYTHON_PIP_INSTALL_HOST:=$(call HOST_PYTHON_PIP_INSTALL,$(STAGING_DIR_HOSTPKG),"")
 HOST_PYTHON_PIP_INSTALL_TARGET=$(call HOST_PYTHON_PIP_INSTALL,$(PKG_INSTALL_DIR)/$(call req2dir,$(pkg)),/usr)
 HOST_PYTHON_PIP_INSTALL_TARGET=$(call HOST_PYTHON_PIP_INSTALL,$(PKG_INSTALL_DIR)/$(call req2dir,$(pkg)),/usr)
 HOST_PYTHON_PIP_INSTALL_CLEANUP:=$(call HOST_PYTHON_PIP_INSTALL,$(PKG_INSTALL_DIR)/_cleanup,/usr)
 HOST_PYTHON_PIP_INSTALL_CLEANUP:=$(call HOST_PYTHON_PIP_INSTALL,$(PKG_INSTALL_DIR)/_cleanup,/usr)
 
 

+ 1 - 1
lang/python-pip/Makefile

@@ -62,7 +62,7 @@ endef
 
 
 define Host/Compile
 define Host/Compile
 	$(call Build/Compile/HostPyMod,,\
 	$(call Build/Compile/HostPyMod,,\
-		install --root="$(STAGING_DIR)/host" --prefix="" \
+		install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
 		--single-version-externally-managed \
 		--single-version-externally-managed \
 	)
 	)
 endef
 endef

+ 1 - 1
lang/python-ply/Makefile

@@ -46,7 +46,7 @@ define Build/Compile
 endef
 endef
 
 
 define Host/Compile
 define Host/Compile
-	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(HOST_BUILD_PREFIX)")
+	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
 endef
 
 
 define Host/Install
 define Host/Install

+ 1 - 1
lang/python-pycparser/Makefile

@@ -47,7 +47,7 @@ define Build/Compile
 endef
 endef
 
 
 define Host/Compile
 define Host/Compile
-	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(HOST_BUILD_PREFIX)")
+	$(call Build/Compile/HostPyMod,,install --prefix="" --root="$(STAGING_DIR_HOSTPKG)")
 endef
 endef
 
 
 define Host/Install
 define Host/Install

+ 1 - 1
lang/python-setuptools/Makefile

@@ -63,7 +63,7 @@ endef
 
 
 define Host/Compile
 define Host/Compile
 	$(call Build/Compile/HostPyMod,,\
 	$(call Build/Compile/HostPyMod,,\
-		install --root="$(HOST_BUILD_PREFIX)" --prefix="" \
+		install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
 		--single-version-externally-managed \
 		--single-version-externally-managed \
 	)
 	)
 endef
 endef

+ 24 - 13
lang/python/Makefile

@@ -10,23 +10,24 @@ include $(TOPDIR)/rules.mk
 # For PYTHON_VERSION
 # For PYTHON_VERSION
 include ./files/python-version.mk
 include ./files/python-version.mk
 
 
-# This file provides the necsessary host build variables
-include ./files/python-host.mk
-
-# For PyPackage
-include ./files/python-package.mk
-
 PKG_NAME:=python
 PKG_NAME:=python
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
-PKG_RELEASE:=2
+PKG_RELEASE:=4
 
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
 PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
-PKG_MD5SUM:=57dffcee9cee8bb2ab5f82af1d8e9a69
+PKG_MD5SUM:=53b43534153bb2a0363f08bae8b9d990
+PKG_HASH:=35d543986882f78261f97787fd3e06274bfa6df29fac9b4a94f73930ff98f731
 
 
 PKG_LICENSE:=PSF
 PKG_LICENSE:=PSF
 PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
 PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
 
 
+# This file provides the necsessary host build variables
+include ./files/python-host.mk
+
+# For PyPackage
+include ./files/python-package.mk
+
 PKG_INSTALL:=1
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
@@ -35,7 +36,7 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 
 PKG_BUILD_DEPENDS:=python/host
 PKG_BUILD_DEPENDS:=python/host
-HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
+HOST_BUILD_DEPENDS:=bzip2/host expat/host
 
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/package.mk
@@ -122,13 +123,21 @@ ifeq ($(CONFIG_IPV6),y)
 	ENABLE_IPV6 += --enable-ipv6
 	ENABLE_IPV6 += --enable-ipv6
 endif
 endif
 
 
+PYTHON_FOR_BUILD:= \
+	_PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \
+	_PYTHON_HOST_PLATFORM=linux2 \
+	PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \
+	_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
+	$(HOST_PYTHON_BIN)
+
 CONFIGURE_ARGS+= \
 CONFIGURE_ARGS+= \
 	--sysconfdir=/etc \
 	--sysconfdir=/etc \
 	--enable-shared \
 	--enable-shared \
 	--without-cxx-main \
 	--without-cxx-main \
 	--with-threads \
 	--with-threads \
-	--with-system-ffi="$(STAGING_DIR)/usr" \
+	--with-system-ffi \
 	--without-pymalloc \
 	--without-pymalloc \
+	PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
 	$(ENABLE_IPV6) \
 	$(ENABLE_IPV6) \
 	CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
 	CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
 	OPT="$(TARGET_CFLAGS)"
 	OPT="$(TARGET_CFLAGS)"
@@ -220,6 +229,9 @@ define PyPackage/python/filespec
 -|$(PYTHON_PKG_DIR)
 -|$(PYTHON_PKG_DIR)
 endef
 endef
 
 
+HOST_LDFLAGS += \
+	$$$$(pkg-config --static --libs libcrypto libssl)
+
 HOST_CONFIGURE_ARGS+= \
 HOST_CONFIGURE_ARGS+= \
 	--without-cxx-main \
 	--without-cxx-main \
 	--without-pymalloc \
 	--without-pymalloc \
@@ -227,9 +239,8 @@ HOST_CONFIGURE_ARGS+= \
 	--prefix=$(HOST_PYTHON_DIR) \
 	--prefix=$(HOST_PYTHON_DIR) \
 	--exec-prefix=$(HOST_PYTHON_DIR) \
 	--exec-prefix=$(HOST_PYTHON_DIR) \
 	--with-system-expat=$(STAGING_DIR_HOSTPKG) \
 	--with-system-expat=$(STAGING_DIR_HOSTPKG) \
-	--with-system-ffi=$(STAGING_DIR_HOSTPKG) \
-	CONFIG_SITE= \
-	CFLAGS="$(HOST_CFLAGS)"
+	--with-system-ffi=no \
+	CONFIG_SITE=
 
 
 define Host/Install
 define Host/Install
 	$(MAKE) -C $(HOST_BUILD_DIR) install
 	$(MAKE) -C $(HOST_BUILD_DIR) install

+ 7 - 6
lang/python/files/python-host.mk

@@ -11,12 +11,6 @@ __python_host_mk_inc=1
 # For PYTHON_VERSION
 # For PYTHON_VERSION
 $(call include_mk, python-version.mk)
 $(call include_mk, python-version.mk)
 
 
-# Compatibility fallback for older OpenWrt and LEDE versions
-ifeq ($(STAGING_DIR_HOSTPKG),)
-  $(warning STAGING_DIR_HOSTPKG is unset - falling back to $$(STAGING_DIR)/host)
-  STAGING_DIR_HOSTPKG := $(STAGING_DIR)/host
-endif
-
 HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
 HOST_PYTHON_DIR:=$(STAGING_DIR_HOSTPKG)
 HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
 HOST_PYTHON_INC_DIR:=$(HOST_PYTHON_DIR)/include/python$(PYTHON_VERSION)
 HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
 HOST_PYTHON_LIB_DIR:=$(HOST_PYTHON_DIR)/lib/python$(PYTHON_VERSION)
@@ -77,4 +71,11 @@ define Build/Compile/HostPyMod
 		$(3))
 		$(3))
 endef
 endef
 
 
+define HostPy/Compile/Default
+	$(call Build/Compile/HostPyMod,,\
+		install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
+		--single-version-externally-managed \
+	)
+endef
+
 endif # __python_host_mk_inc
 endif # __python_host_mk_inc

+ 1 - 1
lang/python/files/python-package-dev.mk

@@ -8,7 +8,7 @@
 define Package/python-dev
 define Package/python-dev
 $(call Package/python/Default)
 $(call Package/python/Default)
   TITLE:=Python $(PYTHON_VERSION) development files
   TITLE:=Python $(PYTHON_VERSION) development files
-  DEPENDS:=+python
+  DEPENDS:=+python +python-lib2to3
 endef
 endef
 
 
 define PyPackage/python-dev/install
 define PyPackage/python-dev/install

+ 19 - 16
lang/python/files/python-package.mk

@@ -41,6 +41,15 @@ define PyPackage
     endef
     endef
   endif
   endif
 
 
+  ifndef PyPackage/$(1)/install
+    define PyPackage/$(1)/install
+		if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
+			$(INSTALL_DIR) $$(1)/usr/bin \
+			$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/
+		fi
+    endef
+  endif
+
   $(call shexport,PyPackage/$(1)/filespec)
   $(call shexport,PyPackage/$(1)/filespec)
 
 
   define Package/$(1)/install
   define Package/$(1)/install
@@ -115,21 +124,15 @@ define Build/Compile/PyMod
 	find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f
 	find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f
 endef
 endef
 
 
-define PyMod/Default
-  define Build/Compile
-	$$(call Build/Compile/PyMod,,install --prefix=/usr --root=$(PKG_INSTALL_DIR))
-  endef
-
-  define Package/$(PKG_NAME)/install
-	$(INSTALL_DIR) $$(1)$(PYTHON_PKG_DIR) $$(1)/usr/bin
-	if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then find $(PKG_INSTALL_DIR)/usr/bin -mindepth 1 -maxdepth 1 -type f -exec $(CP) \{\} $$(1)/usr/bin/ \; ; fi
-	find $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR) -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec $(CP) \{\} $$(1)$(PYTHON_PKG_DIR)/ \;
-  endef
-
-  define Build/InstallDev
-	$(INSTALL_DIR) $$(1)/usr/bin $$(1)$(PYTHON_PKG_DIR)
-	if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then find $(PKG_INSTALL_DIR)/usr/bin -mindepth 1 -maxdepth 1 -type f -exec $(CP) \{\} $$(1)/usr/bin/ \; ; fi
-	find $(PKG_INSTALL_DIR)$(PYTHON_PKG_DIR) -mindepth 1 -maxdepth 1 \( -type f -o -type d \) -exec $(CP) \{\} $$(1)$(PYTHON_PKG_DIR)/ \;
-  endef
+define PyBuild/Compile/Default
+	$(call Build/Compile/PyMod,, \
+		install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+		--single-version-externally-managed \
+	)
 endef
 endef
 
 
+ifeq ($(BUILD_VARIANT),python)
+define Build/Compile
+	$(call PyBuild/Compile/Default)
+endef
+endif # python

+ 1 - 1
lang/python/files/python-version.mk

@@ -6,5 +6,5 @@
 #
 #
 
 
 PYTHON_VERSION:=2.7
 PYTHON_VERSION:=2.7
-PYTHON_VERSION_MICRO:=12
+PYTHON_VERSION_MICRO:=13
 
 

+ 0 - 31
lang/python/patches/005-fix-libffi-x86-64-configure.patch

@@ -1,31 +0,0 @@
-diff --git a/Modules/_ctypes/libffi/configure b/Modules/_ctypes/libffi/configure
-index 75f62a7..4d6c9f2 100755
---- a/Modules/_ctypes/libffi/configure
-+++ b/Modules/_ctypes/libffi/configure
-@@ -17257,20 +17257,12 @@ case "$host" in
- 	fi
- 	;;
- 
--  i?86-*-* | x86_64-*-*)
--	TARGETDIR=x86
--	if test $ac_cv_sizeof_size_t = 4; then
--	  case "$host" in
--	    *-gnux32)
--	      TARGET=X86_64
--	      ;;
--	    *)
--	      TARGET=X86
--	      ;;
--          esac
--	else
--	  TARGET=X86_64;
--	fi
-+  i?86-*-*)
-+	TARGET=X86; TARGETDIR=x86
-+	;;
-+
-+  x86_64-*-*)
-+	TARGET=X86_64; TARGETDIR=x86
- 	;;
- 
-   ia64*-*-*)

+ 0 - 15
lang/python/patches/011-do-not-prefer-ncursesw.patch

@@ -1,15 +0,0 @@
-diff --git a/setup.py b/setup.py
-index 7868b7b..86b0119 100644
---- a/setup.py
-+++ b/setup.py
-@@ -725,8 +725,8 @@ class PyBuildExt(build_ext):
-         # use the same library for the readline and curses modules.
-         if 'curses' in readline_termcap_library:
-             curses_library = readline_termcap_library
--        elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
--            curses_library = 'ncursesw'
-+        #elif self.compiler.find_library_file(lib_dirs, 'ncursesw'):
-+        #    curses_library = 'ncursesw'
-         elif self.compiler.find_library_file(lib_dirs, 'ncurses'):
-             curses_library = 'ncurses'
-         elif self.compiler.find_library_file(lib_dirs, 'curses'):

+ 12 - 0
lang/python/patches/011-remove-setupterm-definition.patch

@@ -0,0 +1,12 @@
+diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
+index e478a57..eb297b4 100644
+--- a/Modules/_cursesmodule.c
++++ b/Modules/_cursesmodule.c
+@@ -117,7 +117,6 @@ char *PyCursesVersion = "2.2";
+     #defines many common symbols (such as "lines") which breaks the
+     curses module in other ways.  So the code will just specify
+     explicit prototypes here. */
+-extern int setupterm(char *,int,int *);
+ #ifdef __sgi
+ #include <term.h>
+ #endif

+ 31 - 8
lang/python3/Makefile

@@ -8,22 +8,29 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 # The file included below defines PYTHON_VERSION
 # The file included below defines PYTHON_VERSION
-include ./files/python3-package.mk
+include ./files/python3-version.mk
 
 
 PYTHON_VERSION:=$(PYTHON3_VERSION)
 PYTHON_VERSION:=$(PYTHON3_VERSION)
 PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
 PYTHON_VERSION_MICRO:=$(PYTHON3_VERSION_MICRO)
 
 
 PKG_NAME:=python3
 PKG_NAME:=python3
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
 
 
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
 PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
-PKG_MD5SUM:=8906efbacfcdc7c3c9198aeefafd159e
+PKG_MD5SUM:=82b143ebbf4514d7e05876bed7a6b1f5
+PKG_HASH:=b0c5f904f685e32d9232f7bdcbece9819a892929063b6e385414ad2dd6a23622
 
 
 PKG_LICENSE:=PSF
 PKG_LICENSE:=PSF
 PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
 PKG_LICENSE_FILES:=LICENSE Modules/_ctypes/libffi_msvc/LICENSE Modules/_ctypes/darwin/LICENSE Modules/_ctypes/libffi/LICENSE Modules/_ctypes/libffi_osx/LICENSE Tools/pybench/LICENSE
 
 
+# This file provides the necsessary host build variables
+include ./files/python3-host.mk
+
+# For Py3Package
+include ./files/python3-package.mk
+
 PKG_INSTALL:=1
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
@@ -31,7 +38,7 @@ HOST_BUILD_PARALLEL:=1
 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
 
 
-PKG_BUILD_DEPENDS:=libbz2/host expat/host python3/host
+PKG_BUILD_DEPENDS:=python3/host
 HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
 HOST_BUILD_DEPENDS:=bzip2/host expat/host libffi/host
 
 
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/host-build.mk
@@ -81,8 +88,12 @@ endef
 PYTHON3_LIB_FILES_DEL:=
 PYTHON3_LIB_FILES_DEL:=
 PYTHON3_PACKAGES:=
 PYTHON3_PACKAGES:=
 PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR).so
 PYTHON3_SO_SUFFIX:=cpython-$(PYTHON3_VERSION_MAJOR)$(PYTHON3_VERSION_MINOR).so
+PYTHON3_PACKAGES_DEPENDS:=
 define Py3BasePackage
 define Py3BasePackage
   PYTHON3_PACKAGES+=$(1)
   PYTHON3_PACKAGES+=$(1)
+  ifeq ($(3),)
+    PYTHON3_PACKAGES_DEPENDS+=$(1)
+  endif
   PYTHON3_LIB_FILES_DEL+=$(2)
   PYTHON3_LIB_FILES_DEL+=$(2)
   define Py3Package/$(1)/filespec
   define Py3Package/$(1)/filespec
     $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
     $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
@@ -93,7 +104,7 @@ include ./files/python3-package-*.mk
 
 
 define Package/python3
 define Package/python3
 $(call Package/python3/Default)
 $(call Package/python3/Default)
-  DEPENDS:=+python3-light $(foreach package,$(filter-out python3-dev python3-lib2to3,$(PYTHON3_PACKAGES)),+$(package))
+  DEPENDS:=+python3-light $(foreach package,$(PYTHON3_PACKAGES_DEPENDS),+$(package))
 endef
 endef
 
 
 define Package/python3/description
 define Package/python3/description
@@ -120,14 +131,22 @@ ifeq ($(CONFIG_IPV6),y)
 	ENABLE_IPV6 += --enable-ipv6
 	ENABLE_IPV6 += --enable-ipv6
 endif
 endif
 
 
+PYTHON_FOR_BUILD:= \
+	_PYTHON_PROJECT_BASE=$(PKG_BUILD_DIR) \
+	_PYTHON_HOST_PLATFORM=linux2 \
+	PYTHONPATH="$(PKG_BUILD_DIR)/Lib:$(PKG_BUILD_DIR)/build/lib.linux2-$(PYTHON_VERSION)" \
+	_PYTHON_SYSCONFIGDATA_NAME=_sysconfigdata \
+	$(HOST_PYTHON3_BIN)
+
 CONFIGURE_ARGS+= \
 CONFIGURE_ARGS+= \
 	--sysconfdir=/etc \
 	--sysconfdir=/etc \
 	--enable-shared \
 	--enable-shared \
 	--without-cxx-main \
 	--without-cxx-main \
 	--with-threads \
 	--with-threads \
-	--with-system-ffi="$(STAGING_DIR)/usr" \
+	--with-system-ffi \
 	--without-pymalloc \
 	--without-pymalloc \
 	--with-ensurepip=no \
 	--with-ensurepip=no \
+	PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
 	$(ENABLE_IPV6) \
 	$(ENABLE_IPV6) \
 	CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
 	CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
 	OPT="$(TARGET_CFLAGS)"
 	OPT="$(TARGET_CFLAGS)"
@@ -141,7 +160,11 @@ define Build/InstallDev
 	$(INSTALL_DIR) $(STAGING_DIR)/mk/
 	$(INSTALL_DIR) $(STAGING_DIR)/mk/
 	$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/
 	$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/
 	$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
 	$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
-	$(INSTALL_DATA) ./files/python3-package.mk $(STAGING_DIR)/mk/
+	$(INSTALL_DATA) \
+		./files/python3-package.mk \
+		./files/python3-host.mk \
+		./files/python3-version.mk \
+		$(STAGING_DIR)/mk/
 	$(CP) \
 	$(CP) \
 		$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
 		$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
 		$(1)/usr/include/
 		$(1)/usr/include/
@@ -215,7 +238,7 @@ HOST_CONFIGURE_ARGS+= \
 	--prefix=$(HOST_PYTHON3_DIR) \
 	--prefix=$(HOST_PYTHON3_DIR) \
 	--exec-prefix=$(HOST_PYTHON3_DIR) \
 	--exec-prefix=$(HOST_PYTHON3_DIR) \
 	--with-system-expat=$(STAGING_DIR_HOSTPKG) \
 	--with-system-expat=$(STAGING_DIR_HOSTPKG) \
-	--with-system-ffi=$(STAGING_DIR_HOSTPKG) \
+	--with-system-ffi \
 	--with-ensurepip=no \
 	--with-ensurepip=no \
 	CONFIG_SITE= \
 	CONFIG_SITE= \
 	CFLAGS="$(HOST_CFLAGS)"
 	CFLAGS="$(HOST_CFLAGS)"

+ 90 - 0
lang/python3/files/python3-host.mk

@@ -0,0 +1,90 @@
+#
+# Copyright (C) 2017 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+ifneq ($(__python3_host_mk_inc),1)
+__python3_host_mk_inc=1
+
+# For PYTHON3_VERSION
+$(call include_mk, python3-version.mk)
+
+HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG)
+HOST_PYTHON3_INC_DIR:=$(HOST_PYTHON3_DIR)/include/python$(PYTHON3_VERSION)
+HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
+
+HOST_PYTHON3_PKG_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)/site-packages
+
+HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python$(PYTHON3_VERSION)
+
+HOST_PYTHON3PATH:=$(HOST_PYTHON3_LIB_DIR):$(HOST_PYTHON3_PKG_DIR)
+
+define HostPython3
+	if [ "$(strip $(3))" == "HOST" ]; then \
+		export PYTHONPATH="$(HOST_PYTHON3PATH)"; \
+		export PYTHONDONTWRITEBYTECODE=0; \
+	else \
+		export PYTHONPATH="$(PYTHON3PATH)"; \
+		export PYTHONDONTWRITEBYTECODE=1; \
+		export _python_sysroot="$(STAGING_DIR)"; \
+		export _python_prefix="/usr"; \
+		export _python_exec_prefix="/usr"; \
+	fi; \
+	export PYTHONOPTIMIZE=""; \
+	$(1) \
+	$(HOST_PYTHON3_BIN) $(2);
+endef
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
+# $(3) => additional variables
+define Build/Compile/HostPy3RunHost
+	$(call HostPython3, \
+		$(if $(1),$(1);) \
+		CC="$(HOSTCC)" \
+		CCSHARED="$(HOSTCC) $(HOST_FPIC)" \
+		CXX="$(HOSTCXX)" \
+		LD="$(HOSTCC)" \
+		LDSHARED="$(HOSTCC) -shared" \
+		CFLAGS="$(HOST_CFLAGS)" \
+		CPPFLAGS="$(HOST_CPPFLAGS) -I$(HOST_PYTHON3_INC_DIR)" \
+		LDFLAGS="$(HOST_LDFLAGS) -lpython$(PYTHON3_VERSION) -Wl$(comma)-rpath=$(STAGING_DIR_HOSTPKG)/lib" \
+		_PYTHON_HOST_PLATFORM=linux2 \
+		$(3) \
+		, \
+		$(2) \
+		, \
+		HOST \
+	)
+endef
+
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/HostPy3Mod
+	$(call Build/Compile/HostPy3RunHost, \
+		cd $(HOST_BUILD_DIR)/$(strip $(1)), \
+		./setup.py $(2), \
+		$(3))
+endef
+
+define HostPy3/Compile/Default
+	$(call Build/Compile/HostPy3Mod,,\
+		install --root="$(STAGING_DIR_HOSTPKG)" --prefix="" \
+		--single-version-externally-managed \
+	)
+endef
+
+ifeq ($(BUILD_VARIANT),python3)
+define Host/Compile
+	$(call HostPy3/Compile/Default)
+endef
+
+define Host/Install
+endef
+endif # python3
+
+endif # __python3_host_mk_inc

+ 3 - 1
lang/python3/files/python3-package-dev.mk

@@ -8,7 +8,7 @@
 define Package/python3-dev
 define Package/python3-dev
 $(call Package/python3/Default)
 $(call Package/python3/Default)
   TITLE:=Python $(PYTHON3_VERSION) development files
   TITLE:=Python $(PYTHON3_VERSION) development files
-  DEPENDS:=+python3
+  DEPENDS:=+python3 +python3-lib2to3
 endef
 endef
 
 
 define Py3Package/python3-dev/install
 define Py3Package/python3-dev/install
@@ -22,4 +22,6 @@ $(eval $(call Py3BasePackage,python3-dev, \
     /usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
     /usr/lib/python$(PYTHON_VERSION)/config-$(PYTHON_VERSION) \
     /usr/include/python$(PYTHON_VERSION) \
     /usr/include/python$(PYTHON_VERSION) \
     /usr/lib/pkgconfig \
     /usr/lib/pkgconfig \
+	, \
+	DO_NOT_ADD_TO_PACKAGE_DEPENDS \
 ))
 ))

+ 2 - 0
lang/python3/files/python3-package-lib2to3.mk

@@ -13,4 +13,6 @@ endef
 
 
 $(eval $(call Py3BasePackage,python3-lib2to3, \
 $(eval $(call Py3BasePackage,python3-lib2to3, \
 	/usr/lib/python$(PYTHON3_VERSION)/lib2to3 \
 	/usr/lib/python$(PYTHON3_VERSION)/lib2to3 \
+	, \
+	DO_NOT_ADD_TO_PACKAGE_DEPENDS \
 ))
 ))

+ 41 - 32
lang/python3/files/python3-package.mk

@@ -5,17 +5,7 @@
 # See /LICENSE for more information.
 # See /LICENSE for more information.
 #
 #
 
 
-# Compatibility fallback for older OpenWrt and LEDE versions
-ifeq ($(STAGING_DIR_HOSTPKG),)
-  $(warning STAGING_DIR_HOSTPKG is unset - falling back to $$(STAGING_DIR)/host)
-  STAGING_DIR_HOSTPKG := $(STAGING_DIR)/host
-endif
-
-PYTHON3_VERSION_MAJOR:=3
-PYTHON3_VERSION_MINOR:=5
-PYTHON3_VERSION_MICRO:=2
-
-PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
+$(call include_mk, python3-version.mk)
 
 
 PYTHON3_DIR:=$(STAGING_DIR)/usr
 PYTHON3_DIR:=$(STAGING_DIR)/usr
 PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin
 PYTHON3_BIN_DIR:=$(PYTHON3_DIR)/bin
@@ -26,22 +16,7 @@ PYTHON3_PKG_DIR:=/usr/lib/python$(PYTHON3_VERSION)/site-packages
 
 
 PYTHON3:=python$(PYTHON3_VERSION)
 PYTHON3:=python$(PYTHON3_VERSION)
 
 
-HOST_PYTHON3_DIR:=$(STAGING_DIR_HOSTPKG)
-HOST_PYTHON3_LIB_DIR:=$(HOST_PYTHON3_DIR)/lib/python$(PYTHON3_VERSION)
-HOST_PYTHON3_BIN:=$(HOST_PYTHON3_DIR)/bin/python3
-
 PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
 PYTHON3PATH:=$(PYTHON3_LIB_DIR):$(STAGING_DIR)/$(PYTHON3_PKG_DIR):$(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
-define HostPython3
-	(	export PYTHONPATH="$(PYTHON3PATH)"; \
-		export PYTHONOPTIMIZE=""; \
-		export PYTHONDONTWRITEBYTECODE=1; \
-		export _python_sysroot="$(STAGING_DIR)"; \
-		export _python_prefix="/usr"; \
-		export _python_exec_prefix="/usr"; \
-		$(1) \
-		$(HOST_PYTHON3_BIN) $(2); \
-	)
-endef
 
 
 # These configure args are needed in detection of path to Python header files
 # These configure args are needed in detection of path to Python header files
 # using autotools.
 # using autotools.
@@ -66,6 +41,15 @@ define Py3Package
     endef
     endef
   endif
   endif
 
 
+  ifndef Py3Package/$(1)/install
+    define Py3Package/$(1)/install
+		if [ -d $(PKG_INSTALL_DIR)/usr/bin ]; then \
+			$(INSTALL_DIR) $$(1)/usr/bin \
+			$(CP) $(PKG_INSTALL_DIR)/usr/bin/* $$(1)/usr/bin/
+		fi
+    endef
+  endif
+
   $(call shexport,Py3Package/$(1)/filespec)
   $(call shexport,Py3Package/$(1)/filespec)
 
 
   define Package/$(1)/install
   define Package/$(1)/install
@@ -104,15 +88,17 @@ define Py3Package
   endef
   endef
 endef
 endef
 
 
-# $(1) => build subdir
-# $(2) => additional arguments to setup.py
+$(call include_mk, python3-host.mk)
+
+# $(1) => commands to execute before running pythons script
+# $(2) => python script and its arguments
 # $(3) => additional variables
 # $(3) => additional variables
-define Build/Compile/Py3Mod
-	$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+define Build/Compile/HostPy3RunTarget
 	$(call HostPython3, \
 	$(call HostPython3, \
-		cd $(PKG_BUILD_DIR)/$(strip $(1)); \
+		$(if $(1),$(1);) \
 		CC="$(TARGET_CC)" \
 		CC="$(TARGET_CC)" \
 		CCSHARED="$(TARGET_CC) $(FPIC)" \
 		CCSHARED="$(TARGET_CC) $(FPIC)" \
+		CXX="$(TARGET_CXX)" \
 		LD="$(TARGET_CC)" \
 		LD="$(TARGET_CC)" \
 		LDSHARED="$(TARGET_CC) -shared" \
 		LDSHARED="$(TARGET_CC) -shared" \
 		CFLAGS="$(TARGET_CFLAGS)" \
 		CFLAGS="$(TARGET_CFLAGS)" \
@@ -122,8 +108,31 @@ define Build/Compile/Py3Mod
 		__PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
 		__PYVENV_LAUNCHER__="/usr/bin/$(PYTHON3)" \
 		$(3) \
 		$(3) \
 		, \
 		, \
-		./setup.py $(2) \
+		$(2) \
 	)
 	)
+endef
+
+# $(1) => build subdir
+# $(2) => additional arguments to setup.py
+# $(3) => additional variables
+define Build/Compile/Py3Mod
+	$(INSTALL_DIR) $(PKG_INSTALL_DIR)/$(PYTHON3_PKG_DIR)
+	$(call Build/Compile/HostPy3RunTarget, \
+		cd $(PKG_BUILD_DIR)/$(strip $(1)), \
+		./setup.py $(2), \
+		$(3))
 	find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f
 	find $(PKG_INSTALL_DIR) -name "*\.pyc" -o -name "*\.pyo" -o -name "*\.exe" | xargs rm -f
 endef
 endef
 
 
+define Py3Build/Compile/Default
+	$(call Build/Compile/Py3Mod,, \
+		install --prefix="/usr" --root="$(PKG_INSTALL_DIR)" \
+		--single-version-externally-managed \
+	)
+endef
+
+ifeq ($(BUILD_VARIANT),python3)
+define Build/Compile
+	$(call Py3Build/Compile/Default)
+endef
+endif # python3

+ 13 - 0
lang/python3/files/python3-version.mk

@@ -0,0 +1,13 @@
+#
+# Copyright (C) 2007-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON3_VERSION_MAJOR:=3
+PYTHON3_VERSION_MINOR:=6
+PYTHON3_VERSION_MICRO:=0
+
+PYTHON3_VERSION:=$(PYTHON3_VERSION_MAJOR).$(PYTHON3_VERSION_MINOR)
+

+ 24 - 0
lang/python3/patches/011-fix-ncursesw-definition-colisions.patch

@@ -0,0 +1,24 @@
+diff --git a/Modules/_cursesmodule.c b/Modules/_cursesmodule.c
+index 3bf2ca7..c156964 100644
+--- a/Modules/_cursesmodule.c
++++ b/Modules/_cursesmodule.c
+@@ -116,7 +116,6 @@ char *PyCursesVersion = "2.2";
+     #defines many common symbols (such as "lines") which breaks the
+     curses module in other ways.  So the code will just specify
+     explicit prototypes here. */
+-extern int setupterm(char *,int,int *);
+ #ifdef __sgi
+ #include <term.h>
+ #endif
+diff --git a/setup.py b/setup.py
+index af9a414..ee19ecd 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1349,7 +1349,6 @@ class PyBuildExt(build_ext):
+         panel_library = 'panel'
+         if curses_library == 'ncursesw':
+             curses_defines.append(('HAVE_NCURSESW', '1'))
+-            curses_includes.append('/usr/include/ncursesw')
+             # Bug 1464056: If _curses.so links with ncursesw,
+             # _curses_panel.so must link with panelw.
+             panel_library = 'panelw'

+ 72 - 0
lang/python3/patches/016-adjust-config-paths.patch

@@ -0,0 +1,72 @@
+diff --git a/Lib/distutils/sysconfig.py b/Lib/distutils/sysconfig.py
+index 8bf1a70..c2708c3 100644
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -424,6 +424,7 @@ def _init_posix():
+         platform=sys.platform,
+         multiarch=getattr(sys.implementation, '_multiarch', ''),
+     ))
++    name = '_sysconfigdata'
+     _temp = __import__(name, globals(), locals(), ['build_time_vars'], 0)
+     build_time_vars = _temp.build_time_vars
+     global _config_vars
+diff --git a/Lib/sysconfig.py b/Lib/sysconfig.py
+index 9314e71..4861261 100644
+--- a/Lib/sysconfig.py
++++ b/Lib/sysconfig.py
+@@ -343,6 +343,7 @@ def get_makefile_filename():
+ 
+ 
+ def _get_sysconfigdata_name():
++    return '_sysconfigdata'
+     return os.environ.get('_PYTHON_SYSCONFIGDATA_NAME',
+         '_sysconfigdata_{abi}_{platform}_{multiarch}'.format(
+         abi=sys.abiflags,
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index cd7d33d..ad6572f 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1301,7 +1301,7 @@ libinstall:	build_all $(srcdir)/Modules/xxmodule.c
+ 			esac; \
+ 		done; \
+ 	done
+-	$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py \
++	$(INSTALL_DATA) `cat pybuilddir.txt`/_sysconfigdata*.py \
+ 		$(DESTDIR)$(LIBDEST); \
+ 	$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
+ 	if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
+@@ -1436,7 +1436,7 @@ sharedinstall: sharedmods
+ 		--install-scripts=$(BINDIR) \
+ 		--install-platlib=$(DESTSHARED) \
+ 		--root=$(DESTDIR)/
+-	-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata_$(ABIFLAGS)_$(MACHDEP)_$(MULTIARCH).py
++	-rm $(DESTDIR)$(DESTSHARED)/_sysconfigdata*.py
+ 	-rm -r $(DESTDIR)$(DESTSHARED)/__pycache__
+ 
+ # Here are a couple of targets for MacOSX again, to install a full
+diff --git a/configure b/configure
+index cf95b27..8203fbb 100755
+--- a/configure
++++ b/configure
+@@ -14895,7 +14895,7 @@ LDVERSION='$(VERSION)$(ABIFLAGS)'
+ $as_echo "$LDVERSION" >&6; }
+ 
+ 
+-if test x$PLATFORM_TRIPLET = x; then
++if true ; then
+   LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ else
+   LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"
+diff --git a/configure.ac b/configure.ac
+index 1d63813..25f25ed 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -4600,7 +4600,7 @@ AC_MSG_RESULT($LDVERSION)
+ 
+ dnl define LIBPL after ABIFLAGS and LDVERSION is defined.
+ AC_SUBST(PY_ENABLE_SHARED)
+-if test x$PLATFORM_TRIPLET = x; then
++if true ; then
+   LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}"
+ else
+   LIBPL='$(prefix)'"/lib/python${VERSION}/config-${LDVERSION}-${PLATFORM_TRIPLET}"

+ 226 - 223
lang/ruby/Makefile

@@ -1,23 +1,25 @@
 #
 #
 # Copyright (C) 2006-2016 OpenWrt.org
 # Copyright (C) 2006-2016 OpenWrt.org
+# Copyright (C) 2017 Luiz Angelo Daros de Luca <luizluca@gmail.com>
 #
 #
 # This is free software, licensed under the GNU General Public License v2.
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 # See /LICENSE for more information.
 #
 #
 # To Do:
 # To Do:
-#  - dirs not removed when uninstalling!
+#  - dirs not removed when uninstalling! opkg bug?
 #
 #
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=ruby
 PKG_NAME:=ruby
-PKG_VERSION:=2.3.3
+PKG_VERSION:=2.4.1
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 
 
-PKG_LIBVER:=2.3
+# First two numbes
+PKG_ABI_VERSION:=$(subst $(space),.,$(wordlist 1, 2, $(subst .,$(space),$(PKG_VERSION))))
 
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
-PKG_SOURCE_URL:=http://cache.ruby-lang.org/pub/ruby/$(PKG_LIBVER)/
-PKG_MD5SUM:=882e6146ed26c6e78c02342835f5d46b86de95f0dc4e16543294bc656594cc5b
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://cache.ruby-lang.org/pub/ruby/$(PKG_ABI_VERSION)/
+PKG_HASH:=4fc8a9992de3e90191de369270ea4b6c1b171b7941743614cc50822ddc1fe654
 PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
 PKG_MAINTAINER:=Luiz Angelo Daros de Luca <luizluca@gmail.com>
 PKG_LICENSE:=BSD-2-Clause
 PKG_LICENSE:=BSD-2-Clause
 PKG_LICENSE_FILES:=COPYING
 PKG_LICENSE_FILES:=COPYING
@@ -36,7 +38,7 @@ HOST_CONFIGURE_ARGS += \
 	--disable-install-rdoc \
 	--disable-install-rdoc \
 	--disable-install-capi \
 	--disable-install-capi \
 	--without-gmp \
 	--without-gmp \
-	--with-out-ext=tk,tk/tkutil,win32,win32ole,dbm,gdbm,readline \
+	--with-out-ext=-test-/array/resize,-test-/bignum,-test-/bug-3571,-test-/bug-5832,-test-/bug_reporter,-test-/class,-test-/debug,-test-/dln/empty,-test-/exception,-test-/fatal,-test-/file,-test-/float,-test-/funcall,-test-/gvl/call_without_gvl,-test-/hash,-test-/integer,-test-/iseq_load,-test-/iter,-test-/load/dot.dot,-test-/marshal/compat,-test-/marshal/internal_ivar,-test-/marshal/usr,-test-/memory_status,-test-/method,-test-/notimplement,-test-/num2int,-test-/path_to_class,-test-/popen_deadlock,-test-/postponed_job,-test-/printf,-test-/proc,-test-/rational,-test-/recursion,-test-/st/foreach,-test-/st/numhash,-test-/st/update,-test-/string,-test-/struct,-test-/symbol,-test-/time,-test-/tracepoint,-test-/typeddata,-test-/vm,-test-/wait_for_single_fd,-test-/win32/console,-test-/win32/dln,-test-/win32/fd_setsize,bigdecimal,cgi/escape,continuation,coverage,dbm,etc,fcntl,fiber,fiddle,gdbm,io/console,io/nonblock,io/wait,json,json/generator,json/parser,mathn/complex,mathn/rational,nkf,objspace,openssl,pathname,pty,racc/cparse,rbconfig/sizeof,readline,ripper,rubyvm,sdbm,socket,syslog,win32,win32ole,win32/resolv,zlib
 
 
 # Does not compile with this. Workaround is --without-gmp
 # Does not compile with this. Workaround is --without-gmp
 # https://bugs.ruby-lang.org/issues/11940
 # https://bugs.ruby-lang.org/issues/11940
@@ -57,7 +59,7 @@ CONFIGURE_ARGS += \
 	--disable-install-capi \
 	--disable-install-capi \
 	--with-ruby-version=minor \
 	--with-ruby-version=minor \
 	--with-iconv-dir=$(ICONV_PREFIX) \
 	--with-iconv-dir=$(ICONV_PREFIX) \
-	--with-out-ext=tk,tk/tkutil,win32,win32ole
+	--with-out-ext=win32,win32ole
 
 
 ifndef CONFIG_RUBY_DIGEST_USE_OPENSSL
 ifndef CONFIG_RUBY_DIGEST_USE_OPENSSL
 CONFIGURE_ARGS += \
 CONFIGURE_ARGS += \
@@ -73,7 +75,7 @@ TARGET_LDFLAGS += -L$(PKG_BUILD_DIR)
 # Ruby uses DLDFLAGS and not LDFLAGS for libraries. LDFLAGS is only for execs.
 # Ruby uses DLDFLAGS and not LDFLAGS for libraries. LDFLAGS is only for execs.
 # However, DLDFLAGS from configure is not passed to Makefile when target is linux.
 # However, DLDFLAGS from configure is not passed to Makefile when target is linux.
 # XLDFLAGS is used by both libraries and execs. This is somehow brute force but
 # XLDFLAGS is used by both libraries and execs. This is somehow brute force but
-# if will fix when some LD_FLAGS is needef for libraries. As side effect, it will
+# it will fix when some LD_FLAGS is needed for libraries. As side effect, it will
 # duplicate ld args for binaries.
 # duplicate ld args for binaries.
 CONFIGURE_VARS += XLDFLAGS="$(TARGET_LDFLAGS)"
 CONFIGURE_VARS += XLDFLAGS="$(TARGET_LDFLAGS)"
 
 
@@ -90,7 +92,7 @@ endef
 define Host/Install
 define Host/Install
 	# When ruby version is updated, make install asks in some cases before replace
 	# When ruby version is updated, make install asks in some cases before replace
 	# an existing different file. Remove them before install and avoid the interaction
 	# an existing different file. Remove them before install and avoid the interaction
-	rm -f $(HOST_BUILD_PREFIX)/bin/rake
+	rm -f $(STAGING_DIR_HOSTPKG)/bin/rake
 	$(call Host/Install/Default)
 	$(call Host/Install/Default)
 endef
 endef
 
 
@@ -155,15 +157,15 @@ endef
 
 
 define Package/ruby/install
 define Package/ruby/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_DIR) $(1)/usr/bin
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_LIBVER)
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/vendor_ruby/$(PKG_LIBVER)
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/site_ruby/$(PKG_LIBVER)
-	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ruby $(1)/usr/lib/ruby/ruby$(PKG_LIBVER)-bin
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/$(PKG_ABI_VERSION)
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/vendor_ruby/$(PKG_ABI_VERSION)
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/site_ruby/$(PKG_ABI_VERSION)
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ruby $(1)/usr/lib/ruby/ruby$(PKG_ABI_VERSION)-bin
 	$(INSTALL_BIN) ./files/ruby $(1)/usr/bin/ruby
 	$(INSTALL_BIN) ./files/ruby $(1)/usr/bin/ruby
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/vendor_ruby/$(PKG_LIBVER)/* $(1)/usr/lib/ruby/vendor_ruby/$(PKG_LIBVER)/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/site_ruby/$(PKG_LIBVER)/* $(1)/usr/lib/ruby/site_ruby/$(PKG_LIBVER)/
-	$(SED) "s%@RUBY_LIBPATH@%/usr/lib/ruby/$(PKG_LIBVER)%" $(1)/usr/bin/ruby
-	$(SED) "s%@RUBY_BINPATH@%/usr/lib/ruby/ruby$(PKG_LIBVER)-bin%" $(1)/usr/bin/ruby
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/vendor_ruby/$(PKG_ABI_VERSION)/* $(1)/usr/lib/ruby/vendor_ruby/$(PKG_ABI_VERSION)/
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/ruby/site_ruby/$(PKG_ABI_VERSION)/* $(1)/usr/lib/ruby/site_ruby/$(PKG_ABI_VERSION)/
+	$(SED) "s%@RUBY_LIBPATH@%/usr/lib/ruby/$(PKG_ABI_VERSION)%" $(1)/usr/bin/ruby
+	$(SED) "s%@RUBY_BINPATH@%/usr/lib/ruby/ruby$(PKG_ABI_VERSION)-bin%" $(1)/usr/bin/ruby
 endef
 endef
 
 
 define Package/libruby
 define Package/libruby
@@ -173,7 +175,7 @@ $(call Package/ruby/Default)
   CATEGORY:=Libraries
   CATEGORY:=Libraries
   TITLE+= (shared library)
   TITLE+= (shared library)
   DEPENDS+= +libpthread +librt +libgmp
   DEPENDS+= +libpthread +librt +libgmp
-  ABI_VERSION:=$(PKG_LIBVER)
+  ABI_VERSION:=$(PKG_ABI_VERSION)
 endef
 endef
 define Package/libruby/install
 define Package/libruby/install
 	$(INSTALL_DIR) $(1)/usr/lib
 	$(INSTALL_DIR) $(1)/usr/lib
@@ -200,25 +202,25 @@ define Package/ruby-stdlib/install
 endef
 endef
 
 
 define Package/ruby-bigdecimal/files
 define Package/ruby-bigdecimal/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/bigdecimal.so
-/usr/lib/ruby/$(PKG_LIBVER)/bigdecimal/
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default/bigdecimal-*.gemspec
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/bigdecimal.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/bigdecimal/
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/bigdecimal-*.gemspec
 endef
 endef
 
 
 define Package/ruby-cgi/files
 define Package/ruby-cgi/files
-/usr/lib/ruby/$(PKG_LIBVER)/cgi
-/usr/lib/ruby/$(PKG_LIBVER)/cgi.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/cgi/escape.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/cgi
+/usr/lib/ruby/$(PKG_ABI_VERSION)/cgi.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/cgi/escape.so
 endef
 endef
 
 
 define Package/ruby-csv/files
 define Package/ruby-csv/files
-/usr/lib/ruby/$(PKG_LIBVER)/csv.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/csv.rb
 endef
 endef
 
 
 define Package/ruby-datetime/files
 define Package/ruby-datetime/files
-/usr/lib/ruby/$(PKG_LIBVER)/time.rb
-/usr/lib/ruby/$(PKG_LIBVER)/date.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/date_core.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/time.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/date.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/date_core.so
 endef
 endef
 
 
 define Package/ruby-dbm/description
 define Package/ruby-dbm/description
@@ -227,28 +229,28 @@ define Package/ruby-dbm/description
 
 
 endef
 endef
 define Package/ruby-dbm/files
 define Package/ruby-dbm/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/dbm.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/dbm.so
 endef
 endef
 
 
 define Package/ruby-debuglib/files
 define Package/ruby-debuglib/files
-/usr/lib/ruby/$(PKG_LIBVER)/profile.rb
-/usr/lib/ruby/$(PKG_LIBVER)/profiler.rb
-/usr/lib/ruby/$(PKG_LIBVER)/debug.rb
-/usr/lib/ruby/$(PKG_LIBVER)/tracer.rb
-/usr/lib/ruby/$(PKG_LIBVER)/benchmark.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/objspace.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/profile.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/profiler.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/debug.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/tracer.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/benchmark.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/objspace.so
 endef
 endef
 
 
 define Package/ruby-did-you-mean/files
 define Package/ruby-did-you-mean/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/did_you_mean-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/did_you_mean-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/
 endef
 endef
 define Package/ruby-did-you-mean/files-excluded
 define Package/ruby-did-you-mean/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/benchmark
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/doc
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/evaluation
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/test
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/did_you_mean-*/*.md
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/benchmark
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/doc
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/evaluation
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/test
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/*.md
 endef
 endef
 
 
 define Package/ruby-digest/description
 define Package/ruby-digest/description
@@ -270,26 +272,26 @@ define Package/ruby-digest/config
 
 
 endef
 endef
 define Package/ruby-digest/files
 define Package/ruby-digest/files
-/usr/lib/ruby/$(PKG_LIBVER)/digest
-/usr/lib/ruby/$(PKG_LIBVER)/digest.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/digest.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/digest/*
+/usr/lib/ruby/$(PKG_ABI_VERSION)/digest
+/usr/lib/ruby/$(PKG_ABI_VERSION)/digest.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/digest.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/digest/*
 endef
 endef
 
 
 define Package/ruby-drb/files
 define Package/ruby-drb/files
-/usr/lib/ruby/$(PKG_LIBVER)/drb.rb
-/usr/lib/ruby/$(PKG_LIBVER)/drb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/drb.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/drb
 endef
 endef
 
 
 define Package/ruby-enc/files
 define Package/ruby-enc/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/enc/encdb.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/enc/iso_8859_1.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/enc/utf_*.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/enc/euc_jp.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc/encdb.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc/iso_8859_1.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc/utf_*.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc/euc_jp.so
 endef
 endef
 
 
 define Package/ruby-enc-extra/files
 define Package/ruby-enc-extra/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/enc
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc
 endef
 endef
 define Package/ruby-enc-extra/files-excluded
 define Package/ruby-enc-extra/files-excluded
 $(call Package/ruby-enc/files)
 $(call Package/ruby-enc/files)
@@ -297,59 +299,59 @@ endef
 
 
 define Package/ruby-erb/files
 define Package/ruby-erb/files
 /usr/bin/erb
 /usr/bin/erb
-/usr/lib/ruby/$(PKG_LIBVER)/erb.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/erb.rb
 endef
 endef
 
 
 define Package/ruby-fiddle/files
 define Package/ruby-fiddle/files
-/usr/lib/ruby/$(PKG_LIBVER)/fiddle.rb
-/usr/lib/ruby/$(PKG_LIBVER)/fiddle/
-/usr/lib/ruby/$(PKG_LIBVER)/*/fiddle.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/fiddle.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/fiddle/
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/fiddle.so
 endef
 endef
 
 
 define Package/ruby-filelib/files
 define Package/ruby-filelib/files
-/usr/lib/ruby/$(PKG_LIBVER)/tmpdir.rb
-/usr/lib/ruby/$(PKG_LIBVER)/tempfile.rb
-/usr/lib/ruby/$(PKG_LIBVER)/pathname.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/pathname.so
-/usr/lib/ruby/$(PKG_LIBVER)/find.rb
-/usr/lib/ruby/$(PKG_LIBVER)/fileutils.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/tmpdir.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/tempfile.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/pathname.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/pathname.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/find.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/fileutils.rb
 endef
 endef
 
 
 define Package/ruby-gdbm/files
 define Package/ruby-gdbm/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/gdbm.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/gdbm.so
 endef
 endef
 
 
 define Package/ruby-gems/files
 define Package/ruby-gems/files
-/usr/lib/ruby/$(PKG_LIBVER)/ubygems.rb
-/usr/lib/ruby/$(PKG_LIBVER)/rubygems.rb
-/usr/lib/ruby/$(PKG_LIBVER)/rubygems
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ubygems.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems
 endef
 endef
 define Package/ruby-gems/files-excluded
 define Package/ruby-gems/files-excluded
-/usr/lib/ruby/$(PKG_LIBVER)/rubygems/test_case.rb
-/usr/lib/ruby/$(PKG_LIBVER)/rubygems/package/tar_test_case.rb
-/usr/lib/ruby/$(PKG_LIBVER)/rubygems/installer_test_case.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems/test_case.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems/package/tar_test_case.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems/installer_test_case.rb
 endef
 endef
 define Package/ruby-gems/install
 define Package/ruby-gems/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gem $(1)/usr/bin/
 	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gem $(1)/usr/bin/
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/gems
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/doc
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/cache
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/extensions
-	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_LIBVER)/build_info
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/doc
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/cache
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/extensions
+	$(INSTALL_DIR) $(1)/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/build_info
 	$(call RubyBuildPackage/install,gems,$(1))
 	$(call RubyBuildPackage/install,gems,$(1))
 endef
 endef
 
 
 define Package/ruby-io-console/files
 define Package/ruby-io-console/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/io/console.so
-/usr/lib/ruby/$(PKG_LIBVER)/io/console/
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default/io-console-*.gemspec
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/io/console.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/io/console/
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/io-console-*.gemspec
 endef
 endef
 
 
 define Package/ruby-irb/files
 define Package/ruby-irb/files
-/usr/lib/ruby/$(PKG_LIBVER)/irb
-/usr/lib/ruby/$(PKG_LIBVER)/irb.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/irb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/irb.rb
 endef
 endef
 define Package/ruby-irb/install
 define Package/ruby-irb/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_DIR) $(1)/usr/bin
@@ -358,159 +360,156 @@ define Package/ruby-irb/install
 endef
 endef
 
 
 define Package/ruby-json/files
 define Package/ruby-json/files
-/usr/lib/ruby/$(PKG_LIBVER)/json.rb
-/usr/lib/ruby/$(PKG_LIBVER)/json
-/usr/lib/ruby/$(PKG_LIBVER)/*/json
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default/json-*.gemspec
+/usr/lib/ruby/$(PKG_ABI_VERSION)/json.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/json
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/json
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/json-*.gemspec
 endef
 endef
 define Package/ruby-json/files-excluded
 define Package/ruby-json/files-excluded
 $(call Package/ruby-psych/files)
 $(call Package/ruby-psych/files)
 endef
 endef
 
 
 define Package/ruby-logger/files
 define Package/ruby-logger/files
-/usr/lib/ruby/$(PKG_LIBVER)/logger.rb
-/usr/lib/ruby/$(PKG_LIBVER)/syslog/logger.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/syslog.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/logger.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/syslog/logger.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/syslog.so
 endef
 endef
 
 
 define Package/ruby-math/files
 define Package/ruby-math/files
-/usr/lib/ruby/$(PKG_LIBVER)/prime.rb
-/usr/lib/ruby/$(PKG_LIBVER)/mathn.rb
-/usr/lib/ruby/$(PKG_LIBVER)/cmath.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/mathn
-/usr/lib/ruby/$(PKG_LIBVER)/matrix.rb
-/usr/lib/ruby/$(PKG_LIBVER)/matrix
+/usr/lib/ruby/$(PKG_ABI_VERSION)/prime.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/mathn.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/cmath.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/mathn
+/usr/lib/ruby/$(PKG_ABI_VERSION)/matrix.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/matrix
 endef
 endef
 
 
 define Package/ruby-minitest/files
 define Package/ruby-minitest/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/minitest-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/minitest-*
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/minitest-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/minitest-*
 endef
 endef
 define Package/ruby-minitest/files-excluded
 define Package/ruby-minitest/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/minitest-*/test
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/minitest-*/*.rdoc
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/minitest-*/*.txt
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/minitest-*/test
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/minitest-*/*.rdoc
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/minitest-*/*.txt
 endef
 endef
 
 
 define Package/ruby-misc/files
 define Package/ruby-misc/files
-/usr/lib/ruby/$(PKG_LIBVER)/English.rb
-/usr/lib/ruby/$(PKG_LIBVER)/abbrev.rb
-/usr/lib/ruby/$(PKG_LIBVER)/base64.rb
-/usr/lib/ruby/$(PKG_LIBVER)/delegate.rb
-/usr/lib/ruby/$(PKG_LIBVER)/e2mmap.rb
-/usr/lib/ruby/$(PKG_LIBVER)/expect.rb
-/usr/lib/ruby/$(PKG_LIBVER)/getoptlong.rb
-/usr/lib/ruby/$(PKG_LIBVER)/open3.rb
-/usr/lib/ruby/$(PKG_LIBVER)/ostruct.rb
-/usr/lib/ruby/$(PKG_LIBVER)/scanf.rb
-/usr/lib/ruby/$(PKG_LIBVER)/securerandom.rb
-/usr/lib/ruby/$(PKG_LIBVER)/set.rb
-/usr/lib/ruby/$(PKG_LIBVER)/shellwords.rb
-/usr/lib/ruby/$(PKG_LIBVER)/tsort.rb
-/usr/lib/ruby/$(PKG_LIBVER)/weakref.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/continuation.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/coverage.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/etc.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/fcntl.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/fiber.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/pty.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/stringio.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/strscan.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/English.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/abbrev.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/base64.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/delegate.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/e2mmap.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/expect.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/getoptlong.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/open3.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ostruct.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/scanf.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/securerandom.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/set.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/shellwords.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/tsort.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/weakref.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/continuation.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/coverage.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/etc.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/fcntl.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/fiber.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/pty.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/stringio.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/strscan.so
 endef
 endef
 
 
 define Package/ruby-mkmf/files
 define Package/ruby-mkmf/files
-/usr/lib/ruby/$(PKG_LIBVER)/mkmf.rb
-/usr/lib/ruby/$(PKG_LIBVER)/un.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/mkmf.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/un.rb
 endef
 endef
 
 
 define Package/ruby-multithread/files
 define Package/ruby-multithread/files
-/usr/lib/ruby/$(PKG_LIBVER)/monitor.rb
-/usr/lib/ruby/$(PKG_LIBVER)/timeout.rb
-/usr/lib/ruby/$(PKG_LIBVER)/thwait.rb
-/usr/lib/ruby/$(PKG_LIBVER)/mutex_m.rb
-/usr/lib/ruby/$(PKG_LIBVER)/sync.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/thread.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/io/wait.so
-/usr/lib/ruby/$(PKG_LIBVER)/*/io/nonblock.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/monitor.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/timeout.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/thwait.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/mutex_m.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/sync.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/io/wait.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/io/nonblock.so
 endef
 endef
 
 
 define Package/ruby-net/files
 define Package/ruby-net/files
-/usr/lib/ruby/$(PKG_LIBVER)/open-uri.rb
-/usr/lib/ruby/$(PKG_LIBVER)/net/*
+/usr/lib/ruby/$(PKG_ABI_VERSION)/open-uri.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/net/*
 endef
 endef
 
 
 define Package/ruby-net-telnet/files
 define Package/ruby-net-telnet/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/net-telnet-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/net-telnet-*/
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/net-telnet-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/
 endef
 endef
 define Package/ruby-net-telnet/files-excluded
 define Package/ruby-net-telnet/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/net-telnet-*/*.md
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/net-telnet-*/*.txt
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/*.md
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/*.txt
 endef
 endef
 
 
 define Package/ruby-nkf/files
 define Package/ruby-nkf/files
-/usr/lib/ruby/$(PKG_LIBVER)/kconv.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/nkf.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/kconv.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/nkf.so
 endef
 endef
 
 
 define Package/ruby-openssl/files
 define Package/ruby-openssl/files
-/usr/lib/ruby/$(PKG_LIBVER)/openssl
-/usr/lib/ruby/$(PKG_LIBVER)/openssl.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/openssl.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/openssl
+/usr/lib/ruby/$(PKG_ABI_VERSION)/openssl.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/openssl.so
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/openssl-*.gemspec
 endef
 endef
 
 
 define Package/ruby-optparse/files
 define Package/ruby-optparse/files
-/usr/lib/ruby/$(PKG_LIBVER)/optparse.rb
-/usr/lib/ruby/$(PKG_LIBVER)/optionparser.rb
-/usr/lib/ruby/$(PKG_LIBVER)/optparse
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optparse.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optionparser.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optparse
 endef
 endef
 
 
 define Package/ruby-patterns/files
 define Package/ruby-patterns/files
-/usr/lib/ruby/$(PKG_LIBVER)/observer.rb
-/usr/lib/ruby/$(PKG_LIBVER)/singleton.rb
-/usr/lib/ruby/$(PKG_LIBVER)/forwardable.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/observer.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/singleton.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/forwardable.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/forwardable
 endef
 endef
 
 
 define Package/ruby-powerassert/files
 define Package/ruby-powerassert/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/power_assert-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/power_assert-*
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/power_assert-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/power_assert-*
 endef
 endef
 define Package/ruby-powerassert/files-excluded
 define Package/ruby-powerassert/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/power_assert-*/test
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/power_assert-*/test
 endef
 endef
 
 
 define Package/ruby-prettyprint/files
 define Package/ruby-prettyprint/files
-/usr/lib/ruby/$(PKG_LIBVER)/pp.rb
-/usr/lib/ruby/$(PKG_LIBVER)/prettyprint.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/pp.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/prettyprint.rb
 endef
 endef
 
 
 define Package/ruby-pstore/files
 define Package/ruby-pstore/files
-/usr/lib/ruby/$(PKG_LIBVER)/pstore.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/pstore.rb
 endef
 endef
 
 
 define Package/ruby-psych/files
 define Package/ruby-psych/files
-/usr/lib/ruby/$(PKG_LIBVER)/psych
-/usr/lib/ruby/$(PKG_LIBVER)/psych.rb
-/usr/lib/ruby/$(PKG_LIBVER)/psych_jars.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/psych.so
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default/psych-*.gemspec
+/usr/lib/ruby/$(PKG_ABI_VERSION)/psych
+/usr/lib/ruby/$(PKG_ABI_VERSION)/psych.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/psych.so
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/psych-*.gemspec
 endef
 endef
 
 
 define Package/ruby-racc/files
 define Package/ruby-racc/files
-/usr/lib/ruby/$(PKG_LIBVER)/racc
-/usr/lib/ruby/$(PKG_LIBVER)/*/racc/*.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/racc
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/racc/*.so
 endef
 endef
 
 
 define Package/ruby-rake/files
 define Package/ruby-rake/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/rake-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-*/
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/rake-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/
 endef
 endef
 define Package/ruby-rake/files-excluded
 define Package/ruby-rake/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-*/doc
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-*/test
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-*/*.rdoc
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-*/*.txt
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rake-10.4.2/lib/rake/runtest.rb
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/doc
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/*.rdoc
 endef
 endef
 define Package/ruby-rake/install
 define Package/ruby-rake/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_DIR) $(1)/usr/bin
@@ -519,21 +518,21 @@ define Package/ruby-rake/install
 endef
 endef
 
 
 define Package/ruby-rbconfig/files
 define Package/ruby-rbconfig/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/rbconfig.rb
-/usr/lib/ruby/$(PKG_LIBVER)/rbconfig/*
-/usr/lib/ruby/$(PKG_LIBVER)/*/rbconfig/*.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/rbconfig.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rbconfig/*
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/rbconfig/*.so
 endef
 endef
 
 
 define Package/ruby-rdoc/files
 define Package/ruby-rdoc/files
-	/usr/lib/ruby/$(PKG_LIBVER)/rdoc.rb
-	/usr/lib/ruby/$(PKG_LIBVER)/rdoc
-	/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/rdoc-*
-	/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/default/rdoc-*.gemspec
+	/usr/lib/ruby/$(PKG_ABI_VERSION)/rdoc.rb
+	/usr/lib/ruby/$(PKG_ABI_VERSION)/rdoc
+	/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rdoc-*
+	/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/default/rdoc-*.gemspec
 endef
 endef
 define Package/ruby-rdoc/files-excluded
 define Package/ruby-rdoc/files-excluded
-	/usr/lib/ruby/$(PKG_LIBVER)/rdoc/test_case.rb
-	/usr/lib/ruby/$(PKG_LIBVER)/rdoc/markup/formatter_test_case.rb
-	/usr/lib/ruby/$(PKG_LIBVER)/rdoc/markup/text_formatter_test_case.rb
+	/usr/lib/ruby/$(PKG_ABI_VERSION)/rdoc/test_case.rb
+	/usr/lib/ruby/$(PKG_ABI_VERSION)/rdoc/markup/formatter_test_case.rb
+	/usr/lib/ruby/$(PKG_ABI_VERSION)/rdoc/markup/text_formatter_test_case.rb
 endef
 endef
 define Package/ruby-rdoc/install
 define Package/ruby-rdoc/install
 	$(INSTALL_DIR) $(1)/usr/bin
 	$(INSTALL_DIR) $(1)/usr/bin
@@ -543,83 +542,87 @@ define Package/ruby-rdoc/install
 endef
 endef
 
 
 define Package/ruby-readline/files
 define Package/ruby-readline/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/readline.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/readline.so
 endef
 endef
 
 
 define Package/ruby-rexml/files
 define Package/ruby-rexml/files
-/usr/lib/ruby/$(PKG_LIBVER)/rexml
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rexml
 endef
 endef
 
 
 define Package/ruby-rinda/files
 define Package/ruby-rinda/files
-/usr/lib/ruby/$(PKG_LIBVER)/rinda
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rinda
 endef
 endef
 
 
 define Package/ruby-ripper/files
 define Package/ruby-ripper/files
-/usr/lib/ruby/$(PKG_LIBVER)/ripper.rb
-/usr/lib/ruby/$(PKG_LIBVER)/ripper
-/usr/lib/ruby/$(PKG_LIBVER)/*/ripper.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ripper.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ripper
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/ripper.so
 endef
 endef
 
 
 define Package/ruby-rss/files
 define Package/ruby-rss/files
-/usr/lib/ruby/$(PKG_LIBVER)/rss
-/usr/lib/ruby/$(PKG_LIBVER)/rss.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rss
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rss.rb
 endef
 endef
 
 
 define Package/ruby-sdbm/files
 define Package/ruby-sdbm/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/sdbm.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/sdbm.so
 endef
 endef
 
 
 define Package/ruby-shell/files
 define Package/ruby-shell/files
-/usr/lib/ruby/$(PKG_LIBVER)/shell.rb
-/usr/lib/ruby/$(PKG_LIBVER)/shell
+/usr/lib/ruby/$(PKG_ABI_VERSION)/shell.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/shell
 endef
 endef
 
 
 define Package/ruby-socket/files
 define Package/ruby-socket/files
-/usr/lib/ruby/$(PKG_LIBVER)/ipaddr.rb
-/usr/lib/ruby/$(PKG_LIBVER)/resolv-replace.rb
-/usr/lib/ruby/$(PKG_LIBVER)/resolv.rb
-/usr/lib/ruby/$(PKG_LIBVER)/socket.rb
-/usr/lib/ruby/$(PKG_LIBVER)/*/socket.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ipaddr.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/resolv-replace.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/resolv.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/socket.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/socket.so
 endef
 endef
 
 
 define Package/ruby-testunit/files
 define Package/ruby-testunit/files
-/usr/lib/ruby/gems/$(PKG_LIBVER)/specifications/test-unit-*.gemspec
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/test-unit-*
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/test-unit-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*
 endef
 endef
 define Package/ruby-testunit/files-excluded
 define Package/ruby-testunit/files-excluded
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/test-unit-*/doc
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/test-unit-*/test
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/test-unit-*/sample
-/usr/lib/ruby/gems/$(PKG_LIBVER)/gems/test-unit-*/*.md
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*/doc
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*/test
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*/sample
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*/*.md
 endef
 endef
 
 
 define Package/ruby-unicodenormalize/files
 define Package/ruby-unicodenormalize/files
-/usr/lib/ruby/$(PKG_LIBVER)/unicode_normalize.rb
-/usr/lib/ruby/$(PKG_LIBVER)/unicode_normalize
+/usr/lib/ruby/$(PKG_ABI_VERSION)/unicode_normalize.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/unicode_normalize
 endef
 endef
 
 
 define Package/ruby-uri/files
 define Package/ruby-uri/files
-/usr/lib/ruby/$(PKG_LIBVER)/uri.rb
-/usr/lib/ruby/$(PKG_LIBVER)/uri
+/usr/lib/ruby/$(PKG_ABI_VERSION)/uri.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/uri
 endef
 endef
 
 
 define Package/ruby-webrick/files
 define Package/ruby-webrick/files
-/usr/lib/ruby/$(PKG_LIBVER)/webrick
-/usr/lib/ruby/$(PKG_LIBVER)/webrick.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/webrick
+/usr/lib/ruby/$(PKG_ABI_VERSION)/webrick.rb
 endef
 endef
 
 
 define Package/ruby-xmlrpc/files
 define Package/ruby-xmlrpc/files
-/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc
-/usr/lib/ruby/$(PKG_LIBVER)/xmlrpc.rb
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/xmlrpc-*
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/xmlrpc-*.gemspec
+endef
+define Package/ruby-xmlrpc/files-excluded
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/xmlrpc-0.2.1/*.md
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/xmlrpc-0.2.1/*.txt
 endef
 endef
 
 
 define Package/ruby-yaml/files
 define Package/ruby-yaml/files
-/usr/lib/ruby/$(PKG_LIBVER)/yaml
-/usr/lib/ruby/$(PKG_LIBVER)/yaml.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/yaml
+/usr/lib/ruby/$(PKG_ABI_VERSION)/yaml.rb
 endef
 endef
 
 
 define Package/ruby-zlib/files
 define Package/ruby-zlib/files
-/usr/lib/ruby/$(PKG_LIBVER)/*/zlib.so
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/zlib.so
 endef
 endef
 
 
 RUBY_FILES = $(strip $(call Package/ruby-$(1)/files))
 RUBY_FILES = $(strip $(call Package/ruby-$(1)/files))
@@ -690,14 +693,14 @@ $(patsubst /%,
   $$(eval $$(call BuildPackage,ruby-$(1)))
   $$(eval $$(call BuildPackage,ruby-$(1)))
 endef
 endef
 
 
-$(eval $(call BuildPackage,ruby))
 $(eval $(call BuildPackage,libruby))
 $(eval $(call BuildPackage,libruby))
+$(eval $(call BuildPackage,ruby))
 $(eval $(call RubyBuildPackage,bigdecimal,Arbitrary-precision decimal floating-point library,))
 $(eval $(call RubyBuildPackage,bigdecimal,Arbitrary-precision decimal floating-point library,))
 $(eval $(call RubyBuildPackage,cgi,CGI support toolkit,+ruby-filelib +ruby-pstore))
 $(eval $(call RubyBuildPackage,cgi,CGI support toolkit,+ruby-filelib +ruby-pstore))
-$(eval $(call RubyBuildPackage,csv,CSV library,+ruby-patterns +ruby-datetime +ruby-enc))
+$(eval $(call RubyBuildPackage,csv,CSV library,+ruby-patterns +ruby-datetime +ruby-enc +ruby-misc))
 $(eval $(call RubyBuildPackage,datetime,date library))
 $(eval $(call RubyBuildPackage,datetime,date library))
 $(eval $(call RubyBuildPackage,dbm,support for dbm,+libdb47))
 $(eval $(call RubyBuildPackage,dbm,support for dbm,+libdb47))
-$(eval $(call RubyBuildPackage,debuglib,debug library,+ruby-multithread +ruby-prettyprint))
+$(eval $(call RubyBuildPackage,debuglib,debug library,+ruby-prettyprint))
 $(eval $(call RubyBuildPackage,did-you-mean,did you mean? experience,+ruby-misc))
 $(eval $(call RubyBuildPackage,did-you-mean,did you mean? experience,+ruby-misc))
 $(eval $(call RubyBuildPackage,digest,Digest Library,+RUBY_DIGEST_USE_OPENSSL:libopenssl))
 $(eval $(call RubyBuildPackage,digest,Digest Library,+RUBY_DIGEST_USE_OPENSSL:libopenssl))
 $(eval $(call RubyBuildPackage,drb,distributed object system,+ruby-filelib +ruby-patterns +ruby-socket))
 $(eval $(call RubyBuildPackage,drb,distributed object system,+ruby-filelib +ruby-patterns +ruby-socket))
@@ -712,7 +715,7 @@ $(eval $(call RubyBuildPackage,io-console,Console interface,))
 $(eval $(call RubyBuildPackage,irb,(interactive shell),+ruby-debuglib +ruby-filelib +ruby-math))
 $(eval $(call RubyBuildPackage,irb,(interactive shell),+ruby-debuglib +ruby-filelib +ruby-math))
 $(eval $(call RubyBuildPackage,json,support for JSON,+ruby-datetime +ruby-misc))
 $(eval $(call RubyBuildPackage,json,support for JSON,+ruby-datetime +ruby-misc))
 $(eval $(call RubyBuildPackage,logger,logger and syslog library,+ruby-multithread))
 $(eval $(call RubyBuildPackage,logger,logger and syslog library,+ruby-multithread))
-$(eval $(call RubyBuildPackage,math,math library,+ruby-patterns))
+$(eval $(call RubyBuildPackage,math,math library,+ruby-patterns +ruby-misc))
 $(eval $(call RubyBuildPackage,minitest,Gem minitest,+ruby-gems))
 $(eval $(call RubyBuildPackage,minitest,Gem minitest,+ruby-gems))
 $(eval $(call RubyBuildPackage,misc,standard libraries subset (miscellaneous files),))
 $(eval $(call RubyBuildPackage,misc,standard libraries subset (miscellaneous files),))
 $(eval $(call RubyBuildPackage,mkmf,makefile library,+ruby-filelib +ruby-optparse +ruby-rbconfig))
 $(eval $(call RubyBuildPackage,mkmf,makefile library,+ruby-filelib +ruby-optparse +ruby-rbconfig))
@@ -722,24 +725,24 @@ $(eval $(call RubyBuildPackage,net-telnet,telnet client,+ruby-net))
 $(eval $(call RubyBuildPackage,nkf,Network Kanji Filter,+ruby-enc))
 $(eval $(call RubyBuildPackage,nkf,Network Kanji Filter,+ruby-enc))
 $(eval $(call RubyBuildPackage,openssl,support for openssl,+ruby-enc +ruby-multithread +libopenssl))
 $(eval $(call RubyBuildPackage,openssl,support for openssl,+ruby-enc +ruby-multithread +libopenssl))
 $(eval $(call RubyBuildPackage,optparse,command-line option analysis,+ruby-misc))
 $(eval $(call RubyBuildPackage,optparse,command-line option analysis,+ruby-misc))
-$(eval $(call RubyBuildPackage,patterns,design patterns implementation,+ruby-multithread))
-$(eval $(call RubyBuildPackage,powerassert,Gem power_assert,+ruby-ripper))
+$(eval $(call RubyBuildPackage,patterns,design patterns implementation,))
+$(eval $(call RubyBuildPackage,powerassert,Gem power_assert,+ruby-ripper +ruby-debuglib))
 $(eval $(call RubyBuildPackage,prettyprint,PrettyPrint library,+ruby-misc))
 $(eval $(call RubyBuildPackage,prettyprint,PrettyPrint library,+ruby-misc))
 $(eval $(call RubyBuildPackage,pstore,file based persistence,+ruby-digest +ruby-enc))
 $(eval $(call RubyBuildPackage,pstore,file based persistence,+ruby-digest +ruby-enc))
 $(eval $(call RubyBuildPackage,psych,YAML parser and emitter,+ruby-bigdecimal +ruby-datetime +ruby-misc +ruby-enc +libyaml))
 $(eval $(call RubyBuildPackage,psych,YAML parser and emitter,+ruby-bigdecimal +ruby-datetime +ruby-misc +ruby-enc +libyaml))
 $(eval $(call RubyBuildPackage,racc,LALR parser generator,))
 $(eval $(call RubyBuildPackage,racc,LALR parser generator,))
-$(eval $(call RubyBuildPackage,rake,Rake (make replacement),+ruby-datetime +ruby-filelib +ruby-optparse +ruby-patterns +ruby-rbconfig))
+$(eval $(call RubyBuildPackage,rake,Rake (make replacement),+ruby-filelib +ruby-optparse +ruby-patterns +ruby-rbconfig +ruby-multithread))
 $(eval $(call RubyBuildPackage,rbconfig,RbConfig,))
 $(eval $(call RubyBuildPackage,rbconfig,RbConfig,))
 $(eval $(call RubyBuildPackage,rdoc,documentation generator,+ruby-erb +ruby-irb +ruby-json +ruby-racc +ruby-rake +ruby-yaml +ruby-zlib))
 $(eval $(call RubyBuildPackage,rdoc,documentation generator,+ruby-erb +ruby-irb +ruby-json +ruby-racc +ruby-rake +ruby-yaml +ruby-zlib))
 $(eval $(call RubyBuildPackage,readline,support for readline,+libncurses +libreadline))
 $(eval $(call RubyBuildPackage,readline,support for readline,+libncurses +libreadline))
-$(eval $(call RubyBuildPackage,rexml,XML toolkit,+ruby-patterns +ruby-enc))
+$(eval $(call RubyBuildPackage,rexml,XML toolkit,+ruby-patterns +ruby-enc +ruby-misc))
 $(eval $(call RubyBuildPackage,rinda,Linda paradigm implementation,+ruby-drb))
 $(eval $(call RubyBuildPackage,rinda,Linda paradigm implementation,+ruby-drb))
 $(eval $(call RubyBuildPackage,ripper,script parser,))
 $(eval $(call RubyBuildPackage,ripper,script parser,))
 $(eval $(call RubyBuildPackage,rss,RSS toolkit,+ruby-net +ruby-nkf +ruby-rexml))
 $(eval $(call RubyBuildPackage,rss,RSS toolkit,+ruby-net +ruby-nkf +ruby-rexml))
 $(eval $(call RubyBuildPackage,sdbm,simple file-based key-value dbm implementation,))
 $(eval $(call RubyBuildPackage,sdbm,simple file-based key-value dbm implementation,))
-$(eval $(call RubyBuildPackage,shell,idiomatic Ruby interface,+ruby-patterns))
+$(eval $(call RubyBuildPackage,shell,idiomatic Ruby interface,+ruby-patterns +ruby-multithread))
 $(eval $(call RubyBuildPackage,socket,socket support,+ruby-multithread))
 $(eval $(call RubyBuildPackage,socket,socket support,+ruby-multithread))
-$(eval $(call RubyBuildPackage,testunit,Gem test-unit,+ruby-csv +ruby-erb +ruby-optparse +ruby-powerassert +ruby-prettyprint +ruby-rexml +ruby-yaml))
+$(eval $(call RubyBuildPackage,testunit,Gem test-unit,+ruby-csv +ruby-erb +ruby-optparse +ruby-powerassert +ruby-rexml +ruby-yaml))
 $(eval $(call RubyBuildPackage,unicodenormalize,String additions for Unicode normalization,+ruby-enc +ruby-enc-extra))
 $(eval $(call RubyBuildPackage,unicodenormalize,String additions for Unicode normalization,+ruby-enc +ruby-enc-extra))
 $(eval $(call RubyBuildPackage,uri,library to handle URI,+ruby-socket +ruby-enc))
 $(eval $(call RubyBuildPackage,uri,library to handle URI,+ruby-socket +ruby-enc))
 $(eval $(call RubyBuildPackage,webrick,Web server toolkit,+ruby-erb +ruby-net +ruby-patterns +ruby-rbconfig))
 $(eval $(call RubyBuildPackage,webrick,Web server toolkit,+ruby-erb +ruby-net +ruby-patterns +ruby-rbconfig))

+ 0 - 152
lang/ruby/patches/001-acinclude.m4_rename_aclocal.m4.patch

@@ -1,152 +0,0 @@
-https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/53414
-
-Fixes:
-
-https://bugs.ruby-lang.org/issues/11941
-
-It might be incorporated in the following release
-
-Index: aclocal.m4
-===================================================================
---- a/aclocal.m4	(revision 53413)
-+++ b/aclocal.m4	(revision 53414)
-@@ -1,46 +0,0 @@
--# -*- autoconf -*-
--
--AC_DEFUN([_COLORIZE_RESULT_PREPARE], [
--    msg_checking= msg_result_yes= msg_result_no= msg_result_other= msg_reset=
--    AS_IF([test "x${CONFIGURE_TTY}" = xyes -o -t 1], [
--	msg_begin="`tput smso 2>/dev/null`"
--    	AS_CASE(["$msg_begin"], ['@<:@'*m],
--	    [msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`"
--	    msg_checking="${msg_begin}33m"
--	    AS_IF([test ${TEST_COLORS:+set}], [
--		msg_result_yes=[`expr ":$TEST_COLORS:" : ".*:pass=\([^:]*\):"`]
--		msg_result_no=[`expr ":$TEST_COLORS:" : ".*:fail=\([^:]*\):"`]
--		msg_result_other=[`expr ":$TEST_COLORS:" : ".*:skip=\([^:]*\):"`]
--	    ])
--	    msg_result_yes="${msg_begin}${msg_result_yes:-32;1}m"
--	    msg_result_no="${msg_begin}${msg_result_no:-31;1}m"
--	    msg_result_other="${msg_begin}${msg_result_other:-33;1}m"
--	    msg_reset="${msg_begin}m"
--	    ])
--	AS_UNSET(msg_begin)
--	])
--    AS_REQUIRE_SHELL_FN([colorize_result],
--	[AS_FUNCTION_DESCRIBE([colorize_result], [MSG], [Colorize result])],
--        [AS_CASE(["$[]1"],
--            [yes], [AS_ECHO(["${msg_result_yes}$[]1${msg_reset}]")],
--            [no], [AS_ECHO(["${msg_result_no}$[]1${msg_reset}]")],
--            [AS_ECHO(["${msg_result_other}$[]1${msg_reset}]")])])
--])
--
--AC_DEFUN([COLORIZE_RESULT], [AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
--    AS_LITERAL_IF([$1],
--	[m4_case([$1],
--		[yes], [AS_ECHO(["${msg_result_yes}$1${msg_reset}"])],
--		[no], [AS_ECHO(["${msg_result_no}$1${msg_reset}"])],
--		[AS_ECHO(["${msg_result_other}$1${msg_reset}"])])],
--	[colorize_result "$1"]) dnl
--])
--
--AC_DEFUN([AC_CHECKING],[dnl
--AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
--AS_MESSAGE([checking ${msg_checking}$1${msg_reset}...])])
--
--AC_DEFUN([AC_MSG_RESULT], [dnl
--{ _AS_ECHO_LOG([result: $1])
--COLORIZE_RESULT([$1]); dnl
--}])
-Index: acinclude.m4
-===================================================================
---- a/acinclude.m4	(revision 0)
-+++ b/acinclude.m4	(revision 53414)
-@@ -0,0 +1,46 @@
-+# -*- autoconf -*-
-+
-+AC_DEFUN([_COLORIZE_RESULT_PREPARE], [
-+    msg_checking= msg_result_yes= msg_result_no= msg_result_other= msg_reset=
-+    AS_IF([test "x${CONFIGURE_TTY}" = xyes -o -t 1], [
-+	msg_begin="`tput smso 2>/dev/null`"
-+	AS_CASE(["$msg_begin"], ['@<:@'*m],
-+	    [msg_begin="`echo "$msg_begin" | sed ['s/[0-9]*m$//']`"
-+	    msg_checking="${msg_begin}33m"
-+	    AS_IF([test ${TEST_COLORS:+set}], [
-+		msg_result_yes=[`expr ":$TEST_COLORS:" : ".*:pass=\([^:]*\):"`]
-+		msg_result_no=[`expr ":$TEST_COLORS:" : ".*:fail=\([^:]*\):"`]
-+		msg_result_other=[`expr ":$TEST_COLORS:" : ".*:skip=\([^:]*\):"`]
-+	    ])
-+	    msg_result_yes="${msg_begin}${msg_result_yes:-32;1}m"
-+	    msg_result_no="${msg_begin}${msg_result_no:-31;1}m"
-+	    msg_result_other="${msg_begin}${msg_result_other:-33;1}m"
-+	    msg_reset="${msg_begin}m"
-+	    ])
-+	AS_UNSET(msg_begin)
-+	])
-+    AS_REQUIRE_SHELL_FN([colorize_result],
-+	[AS_FUNCTION_DESCRIBE([colorize_result], [MSG], [Colorize result])],
-+        [AS_CASE(["$[]1"],
-+            [yes], [AS_ECHO(["${msg_result_yes}$[]1${msg_reset}]")],
-+            [no], [AS_ECHO(["${msg_result_no}$[]1${msg_reset}]")],
-+            [AS_ECHO(["${msg_result_other}$[]1${msg_reset}]")])])
-+])
-+
-+AC_DEFUN([COLORIZE_RESULT], [AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
-+    AS_LITERAL_IF([$1],
-+	[m4_case([$1],
-+		[yes], [AS_ECHO(["${msg_result_yes}$1${msg_reset}"])],
-+		[no], [AS_ECHO(["${msg_result_no}$1${msg_reset}"])],
-+		[AS_ECHO(["${msg_result_other}$1${msg_reset}"])])],
-+	[colorize_result "$1"]) dnl
-+])
-+
-+AC_DEFUN([AC_CHECKING],[dnl
-+AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl
-+AS_MESSAGE([checking ${msg_checking}$1${msg_reset}...])])
-+
-+AC_DEFUN([AC_MSG_RESULT], [dnl
-+{ _AS_ECHO_LOG([result: $1])
-+COLORIZE_RESULT([$1]); dnl
-+}])
-
-Property changes on: acinclude.m4
-___________________________________________________________________
-Added: svn:eol-style
-## -0,0 +1 ##
-+LF
-\ No newline at end of property
-Index: common.mk
-===================================================================
---- a/common.mk	(revision 53413)
-+++ b/common.mk	(revision 53414)
-@@ -518,7 +518,7 @@
- 	$(Q)$(RM) id.c id.h probes.dmyh
- 	$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) parse.c parse.h lex.c enc/trans/newline.c $(PRELUDES) revision.h
- 	$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) id.c id.h probes.dmyh
--	$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) configure tool/config.guess tool/config.sub gems/*.gem
-+	$(Q)$(CHDIR) $(srcdir) && $(exec) $(RM) configure aclocal.m4 tool/config.guess tool/config.sub gems/*.gem
- realclean-ext:: PHONY
- realclean-golf: distclean-golf
- 	$(Q)$(RM) $(GOLFPRELUDES)
-Index: Makefile.in
-===================================================================
---- a/Makefile.in	(revision 53413)
-+++ b/Makefile.in	(revision 53414)
-@@ -22,6 +22,7 @@
- YACC = bison
- PURIFY =
- AUTOCONF = autoconf
-+ACLOCAL = aclocal
- CONFIGURE = @CONFIGURE@
- @SET_MAKE@
- MKFILES = @MAKEFILES@
-@@ -310,6 +311,9 @@
- $(srcdir)/$(CONFIGURE): $(srcdir)/configure.in $(srcdir)/aclocal.m4
- 	$(CHDIR) $(srcdir) && exec $(AUTOCONF) -o $(@F)
- 
-+$(srcdir)/aclocal.m4: $(srcdir)/acinclude.m4
-+	$(CHDIR) $(srcdir) && exec $(ACLOCAL)
-+
- incs: id.h
- all-incs: probes.h
- 

+ 2 - 2
lang/ruby/ruby_find_pkgsdeps

@@ -25,7 +25,7 @@ require_regex_ignore=/^require ([a-zA-Z\$]|["']$|.*\/$)/
 require_ignore=%w{drb/invokemethod16 foo rubygems/defaults/operating_system win32console java Win32API
 require_ignore=%w{drb/invokemethod16 foo rubygems/defaults/operating_system win32console java Win32API
                   builder/xchar json/pure simplecov win32/sspi rdoc/markdown/literals_1_8 enumerator win32/resolv rbtree
                   builder/xchar json/pure simplecov win32/sspi rdoc/markdown/literals_1_8 enumerator win32/resolv rbtree
                   nqxml/streamingparser nqxml/treeparser xmlscan/parser xmlscan/scanner xmltreebuilder xml/parser xmlparser xml/encoding-ja xmlencoding-ja
                   nqxml/streamingparser nqxml/treeparser xmlscan/parser xmlscan/scanner xmltreebuilder xml/parser xmlparser xml/encoding-ja xmlencoding-ja
-                  iconv uconv win32ole gettext/po_parser gettext/mo libxml psych.jar jar-dependencies}
+                  iconv uconv win32ole gettext/po_parser gettext/mo libxml psych.jar psych_jars jar-dependencies thread minitest/proveit}
 
 
 builtin_enc=[
 builtin_enc=[
 	Encoding.find("ASCII-8BIT"),
 	Encoding.find("ASCII-8BIT"),
@@ -164,7 +164,7 @@ package_requires_files.each do
 		else
 		else
 			found = package_files.detect {|(pkg,files)| files.detect {|file| $:.detect {|path| "#{path}/#{require}" == file.gsub(/\.(so|rb)$/,"") } } }
 			found = package_files.detect {|(pkg,files)| files.detect {|file| $:.detect {|path| "#{path}/#{require}" == file.gsub(/\.(so|rb)$/,"") } } }
 			if not found
 			if not found
-				$stderr.puts "#{pkg}: Nothing provides #{require}"
+				$stderr.puts "#{pkg}: Nothing provides #{require} for #{files.collect {|file| file.sub("/usr/lib/ruby/","") }.join(",")}"
 				failed = true
 				failed = true
 				next
 				next
 			end
 			end

+ 1 - 1
lang/ruby/ruby_missingfiles

@@ -5,7 +5,7 @@
 
 
 function list_staging_files {
 function list_staging_files {
 	cd "$1"; find \
 	cd "$1"; find \
-		\( \( -name "root-x86" -or -name "packages" -or -name "stamp" -or -name "pkginfo" \) -prune \) -or -true \
+		\( \( -name "root-*" -or -name "packages" -or -name "stamp" -or -name "pkginfo" -or -name "host" \) -prune \) -or -true \
 		\( -path "*ruby*" -or -name "erb" -or -name "gem" -or -name "irb" -or -name "rake" -or -name "rdoc" -or -name "ri" -or -name "testrb" \) \
 		\( -path "*ruby*" -or -name "erb" -or -name "gem" -or -name "irb" -or -name "rake" -or -name "rdoc" -or -name "ri" -or -name "testrb" \) \
 		-not -path "*/usr/include/*" -not -path "*/usr/lib/pkgconfig/*" -not -path "*/usr/lib/lib*.a" \
 		-not -path "*/usr/include/*" -not -path "*/usr/lib/pkgconfig/*" -not -path "*/usr/lib/lib*.a" \
 		-not -path "*/usr/lib/ruby/gems/*/cache/*" \
 		-not -path "*/usr/lib/ruby/gems/*/cache/*" \

+ 13 - 11
libs/boost/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Copyright (C) 2015-2016 OpenWrt.org
+# Copyright (C) 2015-2017 OpenWrt.org
 #
 #
 # This is free software, licensed under the GNU General Public License v2.
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 # See /LICENSE for more information.
@@ -16,15 +16,15 @@ include $(INCLUDE_DIR)/nls.mk
 include $(INCLUDE_DIR)/target.mk 
 include $(INCLUDE_DIR)/target.mk 
 
 
 PKG_NAME:=boost
 PKG_NAME:=boost
-PKG_VERSION:=1.62.0
-PKG_SOURCE_VERSION:=1_62_0
-PKG_RELEASE:=5
+PKG_VERSION:=1.63.0
+PKG_SOURCE_VERSION:=1_63_0
+PKG_RELEASE:=1
 
 
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
 PKG_SOURCE:=$(PKG_NAME)_$(PKG_SOURCE_VERSION).tar.bz2
 PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
 PKG_SOURCE_URL:=https://sourceforge.net/projects/boost/files/boost/$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
 HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/$(PKG_NAME)_$(PKG_SOURCE_VERSION)
-PKG_MD5SUM:=36c96b0f6155c98404091d8ceb48319a28279ca0333fba1ad8611eb90afb2ca0
+PKG_MD5SUM:=beae2529f759f6b3bf3f4969a19c2e9d6f0c503edcb2de4a61d1428519fcb3b0
 PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
 PKG_LICENSE:=Boost Software License <http://www.boost.org/users/license.html>
 PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
 PKG_MAINTAINER:=Carlos M. Ferreira <carlosmf.pt@gmail.com>
 
 
@@ -44,7 +44,7 @@ define Package/boost/Default
 endef
 endef
 
 
 define Package/boost/description
 define Package/boost/description
-This package provides the Boost v1.62 libraries.
+This package provides the Boost v1.63 libraries.
 Boost is a set of free, peer-reviewed, portable C++ source libraries.
 Boost is a set of free, peer-reviewed, portable C++ source libraries.
 
 
 -----------------------------------------------------------------------------
 -----------------------------------------------------------------------------
@@ -68,7 +68,7 @@ This package provides the following run-time libraries:
  - date_time
  - date_time
  - exception
  - exception
  - filesystem
  - filesystem
- - fiber (Requires GCC v5 and up) - BROKEN
+ - fiber (Requires GCC v5 and up)
  - graph
  - graph
  - - graph-parallel
  - - graph-parallel
  - iostreams
  - iostreams
@@ -88,7 +88,7 @@ This package provides the following run-time libraries:
  - wave
  - wave
 
 
 There are many more header-only libraries supported by Boost.
 There are many more header-only libraries supported by Boost.
-See more at http://www.boost.org/doc/libs/1_62_0/
+See more at http://www.boost.org/doc/libs/1_63_0/
 endef
 endef
 
 
 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
 PKG_BUILD_DEPENDS:=boost/host PACKAGE_python:python PACKAGE_python3:python3
@@ -336,6 +336,8 @@ TARGET_CFLAGS += \
 	$(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
 	$(if $(CONFIG_PACKAGE_boost-python3), -I$(STAGING_DIR)/usr/include/python3.5/) \
 	$(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
 	$(if $(CONFIG_SOFT_FLOAT),-DBOOST_NO_FENV_H) -fPIC
 
 
+EXTRA_CXXFLAGS += $(if $(CONFIG_GCC_VERSION_4_8),-std=gnu++11,-std=gnu++14)
+
 ifneq ($(findstring mips,$(ARCH)),)
 ifneq ($(findstring mips,$(ARCH)),)
     BOOST_ABI = o32
     BOOST_ABI = o32
     ifneq ($(findstring 64,$(ARCH)),)
     ifneq ($(findstring 64,$(ARCH)),)
@@ -354,7 +356,7 @@ comma := ,
 define Build/Compile
 define Build/Compile
 	$(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
 	$(info Selected Boost API $(BOOST_ABI) for architecture $(ARCH) and cpu $(CPU_TYPE) $(CPU_SUBTYPE))
 	( cd $(PKG_BUILD_DIR) ; \
 	( cd $(PKG_BUILD_DIR) ; \
-		echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(if $(CONFIG_boost-coroutine2),-std=c++14,)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
+		echo "using gcc : $(ARCH) : $(GNU_TARGET_NAME)-gcc : <compileflags>\"$(TARGET_CFLAGS)\" <cxxflags>\"$(TARGET_CXXFLAGS) $(EXTRA_CXXFLAGS)\" <linkflags>\"$(TARGET_LDFLAGS)\" ;" > tools/build/src/user-config.jam ; \
 		$(if $(CONFIG_PACKAGE_boost-python3), \
 		$(if $(CONFIG_PACKAGE_boost-python3), \
 			echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
 			echo "using python : 3.5 : $(STAGING_DIR_ROOT)/usr/bin/python3 : $(STAGING_DIR)/usr/include/python3.5/ ;" >> \
 				tools/build/src/user-config.jam; \
 				tools/build/src/user-config.jam; \
@@ -415,11 +417,11 @@ endef
 
 
 define Host/Install
 define Host/Install
 	$(INSTALL_DIR) \
 	$(INSTALL_DIR) \
-		$(STAGING_DIR)/host/bin
+		$(STAGING_DIR_HOSTPKG)/bin
 
 
 	$(CP) \
 	$(CP) \
 		$(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
 		$(HOST_BUILD_DIR)/tools/build/src/engine/bin.*/b2 \
-		$(STAGING_DIR)/host/bin/
+		$(STAGING_DIR_HOSTPKG)/bin/
 endef
 endef
 
 
 define Package/boost/Default/install
 define Package/boost/Default/install

+ 5 - 4
libs/boost/patches/01_fiber_fix.patch

@@ -1,8 +1,8 @@
-Index: boost_1_62_0/libs/fiber/build/Jamfile.v2
+Index: boost_1_63_0/libs/fiber/build/Jamfile.v2
 ===================================================================
 ===================================================================
---- boost_1_62_0.orig/libs/fiber/build/Jamfile.v2
-+++ boost_1_62_0/libs/fiber/build/Jamfile.v2
-@@ -43,19 +43,6 @@ lib boost_fiber
+--- boost_1_63_0.orig/libs/fiber/build/Jamfile.v2
++++ boost_1_63_0/libs/fiber/build/Jamfile.v2
+@@ -44,20 +44,6 @@ lib boost_fiber
        recursive_timed_mutex.cpp
        recursive_timed_mutex.cpp
        timed_mutex.cpp
        timed_mutex.cpp
        scheduler.cpp
        scheduler.cpp
@@ -11,6 +11,7 @@ Index: boost_1_62_0/libs/fiber/build/Jamfile.v2
 -               cxx11_constexpr
 -               cxx11_constexpr
 -               cxx11_defaulted_functions
 -               cxx11_defaulted_functions
 -               cxx11_final
 -               cxx11_final
+-               cxx11_hdr_mutex
 -               cxx11_hdr_tuple
 -               cxx11_hdr_tuple
 -               cxx11_lambdas
 -               cxx11_lambdas
 -               cxx11_noexcept
 -               cxx11_noexcept

+ 74 - 0
libs/dtc/Makefile

@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2016 Yousong Zhou <yszhou4tech@gmail.com>
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=dtc
+PKG_VERSION:=1.4.2
+PKG_RELEASE:=2
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://www.kernel.org/pub/software/utils/dtc
+PKG_SOURCE_MD5SUM:=3d5814e31b2046ef51fca8fece998db0
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=GPL
+PKG_INSTALL:=1
+PKG_MAINTAINER:=Yousong Zhou <yszhou4tech@gmail.com>
+
+include $(INCLUDE_DIR)/package.mk
+
+
+define Package/dtc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=Device Tree Compiler
+  URL:=http://devicetree.org/Device_Tree_Compiler
+endef
+
+define Package/dtc/description
+  Device Tree Compiler for Flat Device Trees Device Tree Compiler, dtc, takes
+  as input a device-tree in a given format and outputs a device-tree in another
+  format for booting kernels on embedded systems.
+endef
+
+define Package/dtc/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(CP) $(PKG_INSTALL_DIR)/bin/dtc $(1)/usr/bin
+endef
+
+
+define Package/libfdt
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=a utility library for reading and manipulating dtb files
+  URL:=http://devicetree.org/Device_Tree_Compiler
+endef
+
+define Package/libfdt/description
+  This is a library containing functions for manipulating Flat Device Trees.
+endef
+
+define Package/libfdt/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/lib/libfdt*.so* $(1)/usr/lib
+endef
+
+TARGET_CFLAGS += \
+	$(FPIC)
+
+MAKE_FLAGS += \
+	PREFIX= \
+	CFLAGS="$(TARGET_CFLAGS)"
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/include/* $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/lib/* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,dtc))
+$(eval $(call BuildPackage,libfdt))

+ 44 - 0
libs/eventlog/Makefile

@@ -0,0 +1,44 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=eventlog
+PKG_VERSION:=0.2.12
+PKG_RELEASE:=2
+
+PKG_MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+
+PKG_SOURCE_URL:=https://my.balabit.com/downloads/eventlog/0.2/
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=3d6ebda8a161d36cb40d09328f78786b
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libeventlog
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A new API to format and send structured log messages.
+endef
+
+define Package/eventlog/description
+  A new API to format and send structured log messages. It supports multiple message
+  representations (plain, XML attributes and XML tags) and multiple output methods
+  (local syslogd).
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/eventlog $(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.{a,so*} $(1)/usr/lib/
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/eventlog.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/libeventlog/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/libevtlog.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libeventlog))

+ 4 - 4
libs/expat/Makefile

@@ -8,11 +8,11 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=expat
 PKG_NAME:=expat
-PKG_VERSION:=2.1.0
-PKG_RELEASE:=3
+PKG_VERSION:=2.2.0
+PKG_RELEASE:=1
 
 
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_MD5SUM:=dd7dab7a5fea97d2a6a43f511449b7cd
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=2f47841c829facb346eb6e3fab5212e2
 PKG_SOURCE_URL:=@SF/expat
 PKG_SOURCE_URL:=@SF/expat
 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
 PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
 
 

+ 2 - 2
libs/fftw3/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=fftw3
 PKG_NAME:=fftw3
-PKG_VERSION:=3.3.4
+PKG_VERSION:=3.3.6
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 PKG_LICENSE:=GPL-2.0+
 PKG_LICENSE:=GPL-2.0+
 
 
 PKG_SOURCE:=fftw-$(PKG_VERSION).tar.gz
 PKG_SOURCE:=fftw-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://www.fftw.org
 PKG_SOURCE_URL:=http://www.fftw.org
-PKG_MD5SUM:=2edab8c06b24feeb3b82bbb3ebf3e7b3
+PKG_MD5SUM:=ccd91b5b12bd0a441e100070ff09a310
 
 
 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/fftw-$(PKG_VERSION)
 PKG_BUILD_DIR=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/fftw-$(PKG_VERSION)
 PKG_FIXUP:=autoreconf
 PKG_FIXUP:=autoreconf

+ 8 - 8
libs/fftw3/patches/001-makefile.patch

@@ -1,19 +1,19 @@
 --- a/Makefile.in
 --- a/Makefile.in
 +++ b/Makefile.in
 +++ b/Makefile.in
-@@ -232,7 +232,7 @@ 
+@@ -241,7 +241,7 @@
  CTAGS = ctags
  CTAGS = ctags
  CSCOPE = cscope
  CSCOPE = cscope
  DIST_SUBDIRS = support genfft kernel simd-support dft rdft reodft api \
  DIST_SUBDIRS = support genfft kernel simd-support dft rdft reodft api \
 -	libbench2 . threads tests mpi doc tools m4
 -	libbench2 . threads tests mpi doc tools m4
 +	libbench2 . threads mpi doc tools m4
 +	libbench2 . threads mpi doc tools m4
- DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
- distdir = $(PACKAGE)-$(VERSION)
- top_distdir = $(distdir)
-@@ -444,7 +444,7 @@
- #
- @COMBINED_THREADS_TRUE@CHICKEN_EGG = threads .
+ am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ 	$(srcdir)/fftw.pc.in AUTHORS COPYING ChangeLog INSTALL NEWS \
+ 	README TODO compile config.guess config.sub install-sh \
+@@ -470,7 +470,7 @@
+ # tools are available, such as fig2dev in maintainer mode)
+ @BUILD_DOC_TRUE@DOCDIR = doc
  SUBDIRS = support $(GENFFT) kernel simd-support dft rdft reodft api	\
  SUBDIRS = support $(GENFFT) kernel simd-support dft rdft reodft api	\
--libbench2 $(CHICKEN_EGG) tests mpi doc tools m4
+-libbench2 $(CHICKEN_EGG) tests mpi $(DOCDIR) tools m4
 +libbench2 $(CHICKEN_EGG) mpi m4
 +libbench2 $(CHICKEN_EGG) mpi m4
  
  
  EXTRA_DIST = COPYRIGHT bootstrap.sh CONVENTIONS fftw.pc.in
  EXTRA_DIST = COPYRIGHT bootstrap.sh CONVENTIONS fftw.pc.in

+ 8 - 6
libs/glib2/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=glib2
 PKG_NAME:=glib2
-PKG_VERSION:=2.49.7
-PKG_RELEASE:=1
+PKG_VERSION:=2.50.2
+PKG_RELEASE:=2
 
 
 PKG_SOURCE:=glib-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=glib-$(PKG_VERSION).tar.xz
 PKG_BUILD_DIR:=$(BUILD_DIR)/glib-$(PKG_VERSION)
 PKG_BUILD_DIR:=$(BUILD_DIR)/glib-$(PKG_VERSION)
-PKG_SOURCE_URL:=@GNOME/glib/2.49
-PKG_MD5SUM:=397ead3fcf325cb921d54e2c9e7dfd7a
+PKG_SOURCE_URL:=@GNOME/glib/2.50
+PKG_MD5SUM:=5eeb2bfaf78a07be59585e8b6e80b1d6
 
 
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
 HOST_BUILD_PARALLEL:=1
@@ -47,13 +47,15 @@ endef
 HOST_CONFIGURE_ARGS += \
 HOST_CONFIGURE_ARGS += \
 	--disable-selinux \
 	--disable-selinux \
 	--with-libiconv=gnu \
 	--with-libiconv=gnu \
-	--with-pcre=internal
+	--with-pcre=internal \
+	--enable-libmount=no
 
 
 CONFIGURE_ARGS += \
 CONFIGURE_ARGS += \
 	--enable-shared \
 	--enable-shared \
 	--enable-static \
 	--enable-static \
 	--enable-debug=no \
 	--enable-debug=no \
 	--disable-selinux \
 	--disable-selinux \
+	--enable-libmount=no \
 	--disable-fam \
 	--disable-fam \
 	--with-libiconv=gnu \
 	--with-libiconv=gnu \
 	--with-pcre=internal
 	--with-pcre=internal
@@ -61,7 +63,7 @@ CONFIGURE_ARGS += \
 CONFIGURE_VARS += \
 CONFIGURE_VARS += \
 	glib_cv_stack_grows=no \
 	glib_cv_stack_grows=no \
 	glib_cv_uscore=no \
 	glib_cv_uscore=no \
-	ac_cv_path_GLIB_GENMARSHAL=$(STAGING_DIR)/host/bin/glib-genmarshal \
+	ac_cv_path_GLIB_GENMARSHAL=$(STAGING_DIR_HOSTPKG)/bin/glib-genmarshal \
 	ac_cv_func_mmap_fixed_mapped=yes \
 	ac_cv_func_mmap_fixed_mapped=yes \
 	ac_cv_func_posix_getpwuid_r=yes \
 	ac_cv_func_posix_getpwuid_r=yes \
 	ac_cv_func_posix_getgrgid_r=yes
 	ac_cv_func_posix_getgrgid_r=yes

+ 4 - 2
libs/gnutls/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=gnutls
 PKG_NAME:=gnutls
-PKG_VERSION:=3.5.6
+PKG_VERSION:=3.5.11
 PKG_RELEASE:=1
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 PKG_USE_MIPS16:=0
 
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5
 PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5
-PKG_MD5SUM:=7a38b23757aae009c3eb5bb12fb0afda
+PKG_HASH:=51765cc5579e250da77fbd7871507c517d01b15353cc40af7b67e9ec7b6fe28f
 #PKG_FIXUP:=autoreconf gettext-version
 #PKG_FIXUP:=autoreconf gettext-version
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
 PKG_LICENSE:=LGPLv2.1+
 PKG_LICENSE:=LGPLv2.1+
@@ -110,8 +110,10 @@ CONFIGURE_ARGS+= \
 	--enable-static \
 	--enable-static \
 	--disable-rpath \
 	--disable-rpath \
 	--disable-libdane \
 	--disable-libdane \
+	--with-included-unistring \
 	--disable-guile \
 	--disable-guile \
 	--disable-nls \
 	--disable-nls \
+	--without-idn \
 	--without-zlib \
 	--without-zlib \
 	--enable-local-libopts \
 	--enable-local-libopts \
 	--disable-doc \
 	--disable-doc \

+ 41 - 28
libs/icu/Makefile

@@ -1,5 +1,5 @@
 #
 #
-# Copyright (C) 2006-2010 OpenWrt.org
+# Copyright (C) 2006-2016 OpenWrt.org
 #
 #
 # This is free software, licensed under the GNU General Public License v2.
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 # See /LICENSE for more information.
@@ -8,17 +8,17 @@
 include $(TOPDIR)/rules.mk
 include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=icu4c
 PKG_NAME:=icu4c
-PKG_VERSION:=55.1
-PKG_RELEASE:=1
+PKG_VERSION:=58.2
+PKG_RELEASE:=2
 
 
-PKG_SOURCE:=$(PKG_NAME)-55_1-src.tgz
-PKG_SOURCE_URL:=http://download.icu-project.org/files/icu4c/55.1
-PKG_MD5SUM:=e2d523df79d6cb7855c2fbe284f4db29
+PKG_SOURCE:=$(PKG_NAME)-58_2-src.tgz
+PKG_SOURCE_URL:=http://download.icu-project.org/files/$(PKG_NAME)/$(PKG_VERSION)
+PKG_MD5SUM:=fac212b32b7ec7ab007a12dff1f3aea1
 
 
 PKG_LICENSE:=ICU-1.8.1+
 PKG_LICENSE:=ICU-1.8.1+
-PKG_LICENSE_FILES:=license.html
+PKG_LICENSE_FILES:=LICENSE
 
 
-PKG_MAINTAINER:=Mirko Vogt <mirko@openwrt.org>
+PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
 
 
 PKG_INSTALL:=1
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
 PKG_BUILD_PARALLEL:=1
@@ -26,7 +26,6 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
 
 
 PKG_BUILD_DEPENDS:=icu/host
 PKG_BUILD_DEPENDS:=icu/host
 
 
-
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/package.mk
 include $(INCLUDE_DIR)/host-build.mk
 include $(INCLUDE_DIR)/host-build.mk
 
 
@@ -41,25 +40,39 @@ define Package/icu
   DEPENDS:=+libstdcpp +libpthread
   DEPENDS:=+libstdcpp +libpthread
 endef
 endef
 
 
-define Build/Configure
-	$(call Build/Configure/Default, \
-		--disable-debug \
-		--enable-release \
-		--enable-shared \
-		--enable-static \
-		--enable-draft \
-		--enable-renaming \
-		--disable-tracing \
-		--disable-extras \
-		--enable-dyload \
-		--enable-layout \
-		--enable-layoutex \
-		--disable-tools \
-		--disable-tests \
-		--disable-samples \
-		--with-cross-build="$(HOST_BUILD_DIR)" \
-	)
-endef
+CONFIGURE_CMD:= ./runConfigureICU
+CONFIGURE_VARS:=
+CONFIGURE_ARGS:= \
+	Linux/gcc \
+	--disable-debug \
+	--enable-release \
+	--enable-shared \
+	--enable-static \
+	--enable-draft \
+	--enable-renaming \
+	--disable-tracing \
+	--disable-extras \
+	--enable-dyload \
+	--disable-tools \
+	--disable-tests \
+	--disable-samples \
+	--with-cross-build="$(HOST_BUILD_DIR)" \
+	--prefix=/usr
+
+HOST_CONFIGURE_CMD:= ./runConfigureICU
+HOST_CONFIGURE_VARS:=
+HOST_CONFIGURE_ARGS:= \
+	Linux/gcc \
+	--disable-debug \
+	--enable-release \
+	--enable-shared \
+	--enable-static \
+	--enable-draft \
+	--enable-renaming \
+	--disable-tracing \
+	--disable-extras \
+	--enable-dyload \
+	--prefix=$(HOST_BUILD_PREFIX)
 
 
 define Build/InstallDev
 define Build/InstallDev
 	$(INSTALL_DIR) \
 	$(INSTALL_DIR) \

+ 1 - 1
libs/icu/patches/000-dont-cpy-files-from-topdirs.patch

@@ -6,7 +6,7 @@ index 9db6c52..6aa2273 100644
  	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
  	$(INSTALL_SCRIPT) $(top_srcdir)/install-sh $(DESTDIR)$(pkgdatadir)/install-sh
  	@$(MKINSTALLDIRS) $(DESTDIR)$(libdir)/pkgconfig
  	@$(MKINSTALLDIRS) $(DESTDIR)$(libdir)/pkgconfig
  	$(INSTALL_DATA) $(ALL_PKGCONFIG_FILES) $(DESTDIR)$(libdir)/pkgconfig/
  	$(INSTALL_DATA) $(ALL_PKGCONFIG_FILES) $(DESTDIR)$(libdir)/pkgconfig/
--	$(INSTALL_DATA) $(top_srcdir)/../license.html $(DESTDIR)$(pkgdatadir)/license.html
+-	$(INSTALL_DATA) $(top_srcdir)/../LICENSE $(DESTDIR)$(pkgdatadir)/LICENSE
  	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
  	$(INSTALL_SCRIPT) $(top_builddir)/config/icu-config $(DESTDIR)$(bindir)/icu-config
  	$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
  	$(INSTALL_DATA) $(top_builddir)/config/Makefile.inc $(DESTDIR)$(pkglibdir)/Makefile.inc
  	$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc
  	$(INSTALL_DATA) $(top_builddir)/config/pkgdata.inc $(DESTDIR)$(pkglibdir)/pkgdata.inc

+ 26 - 0
libs/icu/patches/001-disable-strtod_l.patch

@@ -0,0 +1,26 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -893,8 +893,8 @@
+ AC_CHECK_FUNC(strtod_l)
+ if test x$ac_cv_func_strtod_l = xyes
+ then
+-     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1"
+-     U_HAVE_STRTOD_L=1
++     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
++     U_HAVE_STRTOD_L=0
+ else
+      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
+      U_HAVE_STRTOD_L=0
+--- a/configure
++++ b/configure
+@@ -7053,8 +7053,8 @@
+ 
+ if test x$ac_cv_func_strtod_l = xyes
+ then
+-     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=1"
+-     U_HAVE_STRTOD_L=1
++     CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
++     U_HAVE_STRTOD_L=0
+ else
+      CONFIG_CPPFLAGS="${CONFIG_CPPFLAGS} -DU_HAVE_STRTOD_L=0"
+      U_HAVE_STRTOD_L=0

+ 176 - 0
libs/icu/patches/CVE-2017-7867_CVE-2017-7868.patch

@@ -0,0 +1,176 @@
+Index: source/test/intltest/utxttest.h
+===================================================================
+--- source/test/intltest/utxttest.h	(revision 39670)
++++ source/test/intltest/utxttest.h	(revision 39671)
+@@ -38,6 +38,7 @@
+     void Ticket10562();
+     void Ticket10983();
+     void Ticket12130();
++    void Ticket12888();
+ 
+ private:
+     struct m {                              // Map between native indices & code points.
+Index: source/test/intltest/utxttest.cpp
+===================================================================
+--- source/test/intltest/utxttest.cpp	(revision 39670)
++++ source/test/intltest/utxttest.cpp	(revision 39671)
+@@ -67,6 +67,8 @@
+             if (exec) Ticket10983();  break;
+         case 7: name = "Ticket12130";
+             if (exec) Ticket12130(); break;
++        case 8: name = "Ticket12888";
++            if (exec) Ticket12888(); break;
+         default: name = "";          break;
+     }
+ }
+@@ -1583,3 +1585,63 @@
+     }
+     utext_close(&ut);
+ }
++
++// Ticket 12888: bad handling of illegal utf-8 containing many instances of the archaic, now illegal,
++//               six byte utf-8 forms. Original implementation had an assumption that
++//               there would be at most three utf-8 bytes per UTF-16 code unit.
++//               The five and six byte sequences map to a single replacement character.
++
++void UTextTest::Ticket12888() {
++    const char *badString = 
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80"
++            "\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80\xfd\x80\x80\x80\x80\x80";
++
++    UErrorCode status = U_ZERO_ERROR;
++    LocalUTextPointer ut(utext_openUTF8(NULL, badString, -1, &status));
++    TEST_SUCCESS(status);
++    for (;;) {
++        UChar32 c = utext_next32(ut.getAlias());
++        if (c == U_SENTINEL) {
++            break;
++        }
++    }
++    int32_t endIdx = utext_getNativeIndex(ut.getAlias());
++    if (endIdx != (int32_t)strlen(badString)) {
++        errln("%s:%d expected=%d, actual=%d", __FILE__, __LINE__, strlen(badString), endIdx);
++        return;
++    }
++
++    for (int32_t prevIndex = endIdx; prevIndex>0;) {
++        UChar32 c = utext_previous32(ut.getAlias());
++        int32_t currentIndex = utext_getNativeIndex(ut.getAlias());
++        if (c != 0xfffd) {
++            errln("%s:%d (expected, actual, index) = (%d, %d, %d)\n",
++                    __FILE__, __LINE__, 0xfffd, c, currentIndex);
++            break;
++        }
++        if (currentIndex != prevIndex - 6) {
++            errln("%s:%d: wrong index. Expected, actual = %d, %d",
++                    __FILE__, __LINE__, prevIndex - 6, currentIndex);
++            break;
++        }
++        prevIndex = currentIndex;
++    }
++}
+Index: source/common/utext.cpp
+===================================================================
+--- source/common/utext.cpp	(revision 39670)
++++ source/common/utext.cpp	(revision 39671)
+@@ -847,9 +847,15 @@
+ //------------------------------------------------------------------------------
+ 
+ // Chunk size.
+-//     Must be less than 85, because of byte mapping from UChar indexes to native indexes.
+-//     Worst case is three native bytes to one UChar.  (Supplemenaries are 4 native bytes
+-//     to two UChars.)
++//     Must be less than 42  (256/6), because of byte mapping from UChar indexes to native indexes.
++//     Worst case there are six UTF-8 bytes per UChar.
++//         obsolete 6 byte form fd + 5 trails maps to fffd
++//         obsolete 5 byte form fc + 4 trails maps to fffd
++//         non-shortest 4 byte forms maps to fffd
++//         normal supplementaries map to a pair of utf-16, two utf8 bytes per utf-16 unit
++//     mapToUChars array size must allow for the worst case, 6.
++//     This could be brought down to 4, by treating fd and fc as pure illegal,
++//     rather than obsolete lead bytes. But that is not compatible with the utf-8 access macros.
+ //
+ enum { UTF8_TEXT_CHUNK_SIZE=32 };
+ 
+@@ -889,7 +895,7 @@
+                                                      //  Requires two extra slots,
+                                                      //    one for a supplementary starting in the last normal position,
+                                                      //    and one for an entry for the buffer limit position.
+-    uint8_t   mapToUChars[UTF8_TEXT_CHUNK_SIZE*3+6]; // Map native offset from bufNativeStart to
++    uint8_t   mapToUChars[UTF8_TEXT_CHUNK_SIZE*6+6]; // Map native offset from bufNativeStart to
+                                                      //   correspoding offset in filled part of buf.
+     int32_t   align;
+ };
+@@ -1032,6 +1038,7 @@
+             // Requested index is in this buffer.
+             u8b = (UTF8Buf *)ut->p;   // the current buffer
+             mapIndex = ix - u8b->toUCharsMapStart;
++            U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
+             ut->chunkOffset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx;
+             return TRUE;
+ 
+@@ -1298,6 +1305,10 @@
+         // Can only do this if the incoming index is somewhere in the interior of the string.
+         //   If index is at the end, there is no character there to look at.
+         if (ix != ut->b) {
++            // Note: this function will only move the index back if it is on a trail byte
++            //       and there is a preceding lead byte and the sequence from the lead 
++            //       through this trail could be part of a valid UTF-8 sequence
++            //       Otherwise the index remains unchanged.
+             U8_SET_CP_START(s8, 0, ix);
+         }
+ 
+@@ -1311,7 +1322,10 @@
+         UChar   *buf = u8b->buf;
+         uint8_t *mapToNative = u8b->mapToNative;
+         uint8_t *mapToUChars = u8b->mapToUChars;
+-        int32_t  toUCharsMapStart = ix - (UTF8_TEXT_CHUNK_SIZE*3 + 1);
++        int32_t  toUCharsMapStart = ix - sizeof(UTF8Buf::mapToUChars) + 1;
++        // Note that toUCharsMapStart can be negative. Happens when the remaining
++        // text from current position to the beginning is less than the buffer size.
++        // + 1 because mapToUChars must have a slot at the end for the bufNativeLimit entry.
+         int32_t  destIx = UTF8_TEXT_CHUNK_SIZE+2;   // Start in the overflow region
+                                                     //   at end of buffer to leave room
+                                                     //   for a surrogate pair at the
+@@ -1338,6 +1352,7 @@
+             if (c<0x80) {
+                 // Special case ASCII range for speed.
+                 buf[destIx] = (UChar)c;
++                U_ASSERT(toUCharsMapStart <= srcIx);
+                 mapToUChars[srcIx - toUCharsMapStart] = (uint8_t)destIx;
+                 mapToNative[destIx] = (uint8_t)(srcIx - toUCharsMapStart);
+             } else {
+@@ -1367,6 +1382,7 @@
+                 do {
+                     mapToUChars[sIx-- - toUCharsMapStart] = (uint8_t)destIx;
+                 } while (sIx >= srcIx);
++                U_ASSERT(toUCharsMapStart <= (srcIx+1));
+ 
+                 // Set native indexing limit to be the current position.
+                 //   We are processing a non-ascii, non-native-indexing char now;
+@@ -1541,6 +1557,7 @@
+     U_ASSERT(index>=ut->chunkNativeStart+ut->nativeIndexingLimit);
+     U_ASSERT(index<=ut->chunkNativeLimit);
+     int32_t mapIndex = index - u8b->toUCharsMapStart;
++    U_ASSERT(mapIndex < (int32_t)sizeof(UTF8Buf::mapToUChars));
+     int32_t offset = u8b->mapToUChars[mapIndex] - u8b->bufStartIdx;
+     U_ASSERT(offset>=0 && offset<=ut->chunkLength);
+     return offset;

+ 71 - 0
libs/libcanfestival/Makefile

@@ -0,0 +1,71 @@
+#
+# Copyright (C) 2015-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libcanfestival
+PKG_RELEASE:=3
+
+PKG_SOURCE_PROTO:=hg
+PKG_SOURCE_URL:=http://dev.automforge.net/CanFestival-3
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_VERSION:=8bfe0ac00cdb
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
+
+PKG_MAINTAINER:=Anton Glukhov <anton.a.glukhov@gmail.com>
+PKG_LICENSE:=LGPL-2.1+
+PKG_LICENSE_FILES:=LICENCE
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcanfestival
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=Free software CANopen library
+  URL:=http://canfestival.org
+  DEPENDS:=+libpthread +librt
+endef
+
+define Package/libcanfestival/description
+  CanFestival library
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS := \
+	--cc=$(TARGET_CC) \
+	--cxx=$(TARGET_CXX) \
+	--ld=$(TARGET_CC) \
+	--arch=$(ARCH) \
+	--binutils=$(TARGET_CROSS) \
+	--os=Linux \
+	--kerneldir=$(LINUX_DIR) \
+	--prefix=/usr \
+	--target=unix \
+	--can=socket \
+	--timers=unix \
+	--debug=ERR \
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+endef
+
+define Package/libcanfestival/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcanfestival_can_socket.so $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcanfestival))

+ 11 - 0
libs/libcanfestival/patches/001-sigval-ref-fix.patch

@@ -0,0 +1,11 @@
+--- a/drivers/timers_unix/timers_unix.c
++++ b/drivers/timers_unix/timers_unix.c
+@@ -33,7 +33,7 @@
+ 	}
+ }
+ 
+-void timer_notify(sigval_t val)
++void timer_notify(void)
+ {
+ 	if(gettimeofday(&last_sig,NULL)) {
+ 		perror("gettimeofday()");

+ 33 - 0
libs/libcanfestival/patches/002-makefile-gcc-linker.patch

@@ -0,0 +1,33 @@
+--- a/examples/TestMasterMicroMod/Makefile.in
++++ b/examples/TestMasterMicroMod/Makefile.in
+@@ -56,7 +56,7 @@
+ 
+ 
+ $(TESTMASTERMICROMOD): $(OBJS)
+-	$(LD) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
++	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
+ 
+ 	
+ TestMaster.c: TestMaster.od
+--- a/examples/TestMasterSlave/Makefile.in
++++ b/examples/TestMasterSlave/Makefile.in
+@@ -65,7 +65,7 @@
+ 
+ 
+ $(TESTMASTERSLAVE): $(OBJS)
+-	$(LD) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
++	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
+ 	
+ TestSlave.c: TestSlave.od
+ 	$(MAKE) -C ../../objdictgen gnosis
+--- a/examples/CANOpenShell/Makefile.in
++++ b/examples/CANOpenShell/Makefile.in
+@@ -64,7 +64,7 @@
+ 	$(MAKE) -C ../../drivers/$(TARGET) libcanfestival_$(TARGET).a
+ 
+ $(CANOPENSHELL): $(OBJS)
+-	$(LD) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
++	$(CC) $(CFLAGS) $(PROG_CFLAGS) ${PROGDEFINES} $(INCLUDES) -o $@ $(OBJS) $(EXE_CFLAGS)
+ 	mkdir -p Debug; cp $(CANOPENSHELL) Debug
+ 	
+ CANOpenShellMasterOD.c: CANOpenShellMasterOD.od

+ 20 - 0
libs/libcanfestival/patches/003-makefile-skip-examples.patch

@@ -0,0 +1,20 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -21,7 +21,7 @@
+ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ # 
+ 
+-all: objdictedit canfestival examples
++all: objdictedit canfestival
+ 
+ examples: canfestival driver
+ 	$(MAKE) -C examples all
+@@ -44,7 +44,7 @@ driver:
+ install: canfestival driver
+ 	$(MAKE) -C drivers $@
+ 	$(MAKE) -C src $@
+-	$(MAKE) -C examples $@
++	#$(MAKE) -C examples $@
+ 	$(MAKE) -C objdictgen $@
+ 	ldconfig
+ 

+ 64 - 0
libs/libcoap/Makefile

@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2015 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=libcoap
+PKG_RELEASE:=3
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/obgm/libcoap
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)
+PKG_SOURCE_VERSION:=2da31de732c0e51a9bc9e1d4aea21e25da89cf87
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.bz2
+
+PKG_MAINTAINER:=Anton Glukhov <anton.a.glukhov@gmail.com>
+PKG_LICENSE:=GPL-2.0+ BSD-2-Clause
+PKG_LICENSE_FILES:=COPYING LICENSE.GPL LICENSE.BSD
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libcoap
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=CoAP (RFC 7252) library
+  URL:=http://libcoap.net/
+endef
+
+define Package/libcoap/description
+  Constrained Application Protocol (RFC 7252) library
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS += \
+	--disable-examples \
+	--disable-documentation
+
+ifeq ($(CONFIG_BIG_ENDIAN),y)
+TARGET_CFLAGS += -DWORDS_BIGENDIAN
+endif
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
+endef
+
+define Package/libcoap/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcoap-1.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libcoap))

+ 0 - 51
libs/libevhtp/Makefile

@@ -1,51 +0,0 @@
-#
-# Copyright (C) 2007-2016 OpenWrt.org
-#
-# This is free software, licensed under the GNU General Public License v2.
-# See /LICENSE for more information.
-#
-
-# NOTE: please DO NOT update this package without the maintainer's consent.
-# See https://github.com/haiwen/seafile/issues/1119
-
-include $(TOPDIR)/rules.mk
-
-PKG_NAME:=libevhtp
-PKG_VERSION:=1.1.6
-PKG_RELEASE:=1
-PKG_LICENSE:=BSD-3-Clause
-
-PKG_SOURCE_PROTO:=git
-PKG_SOURCE_URL:=https://github.com/ellzey/libevhtp.git
-PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
-PKG_SOURCE_VERSION:=91071e2f20749cd469b87ac2ef1c158dc2a6806f
-PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
-
-PKG_INSTALL:=1
-
-include $(INCLUDE_DIR)/package.mk
-
-define Package/libevhtp
-    SECTION:=libs
-    CATEGORY:=Libraries
-    TITLE:=A more flexible replacement for libevent's httpd API
-    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
-    URL:=https://github.com/ellzey/libevhtp
-    DEPENDS:=+libevent2 +libevent2-openssl +libevent2-pthreads +libopenssl +libpthread
-endef
-
-define Package/libevhtp/description
-   Libevhtp was created as a replacement API for Libevent's current HTTP API.
-   The reality of libevent's http interface is that it was created as a JIT server,
-   meaning the developer never thought of it being used for creating a full-fledged HTTP service.
-endef
-
-include $(INCLUDE_DIR)/cmake.mk
-
-define Build/InstallDev
-	$(INSTALL_DIR) $(1)/usr/{include,lib}
-	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
-	$(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
-endef
-
-$(eval $(call BuildPackage,libevhtp))

+ 0 - 49
libs/libevhtp/patches/010-strcmp-endianness-fix.patch

@@ -1,49 +0,0 @@
-diff -rupN libevhtp-1.2.9.orig/htparse/htparse.c libevhtp-1.2.9/htparse/htparse.c
---- libevhtp-1.2.9.orig/htparse/htparse.c	2014-03-23 12:50:50.000000000 +0100
-+++ libevhtp-1.2.9/htparse/htparse.c	2014-12-09 01:12:22.242001241 +0100
-@@ -197,6 +197,7 @@ static const char * method_strmap[] = {
- 
- #define _MIN_READ(a, b) ((a) < (b) ? (a) : (b))
- 
-+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
- #define _str3_cmp(m, c0, c1, c2, c3) \
-     *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)
- 
-@@ -226,6 +227,37 @@ static const char * method_strmap[] = {
-     *(uint32_t *)m == ((c3 << 24) | (c2 << 16) | (c1 << 8) | c0)        \
-     && ((uint32_t *)m)[1] == ((c7 << 24) | (c6 << 16) | (c5 << 8) | c4) \
-     && m[8] == c8
-+#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
-+#define _str3_cmp(m, c0, c1, c2, c3) \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
-+
-+#define _str3Ocmp(m, c0, c1, c2, c3) \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
-+
-+#define _str4cmp(m, c0, c1, c2, c3) \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)
-+
-+#define _str5cmp(m, c0, c1, c2, c3, c4)                          \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
-+    && m[4] == c4
-+
-+#define _str6cmp(m, c0, c1, c2, c3, c4, c5)                      \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
-+    && (((uint32_t *)m)[1] & 0xffff0000) == ((c4 << 24) | c5 << 16)
-+
-+#define _str7_cmp(m, c0, c1, c2, c3, c4, c5, c6, c7)             \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
-+    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
-+
-+#define _str8cmp(m, c0, c1, c2, c3, c4, c5, c6, c7)              \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3) \
-+    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7)
-+
-+#define _str9cmp(m, c0, c1, c2, c3, c4, c5, c6, c7, c8)                 \
-+    *(uint32_t *)m == ((c0 << 24) | (c1 << 16) | (c2 << 8) | c3)        \
-+    && ((uint32_t *)m)[1] == ((c4 << 24) | (c5 << 16) | (c6 << 8) | c7) \
-+    && m[8] == c8
-+#endif
- 
- #define __HTPARSE_GENHOOK(__n)                                                    \
-     static inline int hook_ ## __n ## _run(htparser * p, htparse_hooks * hooks) { \

+ 1 - 0
libs/libexif/Makefile

@@ -41,6 +41,7 @@ CONFIGURE_ARGS+= \
 	--enable-shared \
 	--enable-shared \
 	--enable-static \
 	--enable-static \
 	--disable-rpath \
 	--disable-rpath \
+	--disable-nls \
 	--without-libiconv-prefix \
 	--without-libiconv-prefix \
 	--without-libintl-prefix \
 	--without-libintl-prefix \
 
 

+ 3 - 4
libs/libextractor/Makefile

@@ -1,6 +1,4 @@
 #
 #
-# Copyright (C) 2015 OpenWrt.org
-#
 # This is free software, licensed under the GNU General Public License v2.
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
 # See /LICENSE for more information.
 #
 #
@@ -9,7 +7,7 @@ include $(TOPDIR)/rules.mk
 
 
 PKG_NAME:=libextractor
 PKG_NAME:=libextractor
 PKG_VERSION:=1.3
 PKG_VERSION:=1.3
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 
 # ToDo:
 # ToDo:
 # - package missing optional dependencies: libexiv2, gsf, librpm, smf, tidy
 # - package missing optional dependencies: libexiv2, gsf, librpm, smf, tidy
@@ -17,6 +15,7 @@ PKG_RELEASE:=3
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
 PKG_MD5SUM:=35b8913dbebafe583a2781bf71509c48
 PKG_MD5SUM:=35b8913dbebafe583a2781bf71509c48
+PKG_HASH:=868ad64c9a056d6b923d451d746935bffb1ddf5d89c3eb4f67d786001a3f7b7f
 
 
 PKG_LICENSE:=GPL-3.0
 PKG_LICENSE:=GPL-3.0
 PKG_LICENSE_FILES:=COPYING
 PKG_LICENSE_FILES:=COPYING
@@ -31,7 +30,7 @@ PLUGINS:= \
 	dvi \
 	dvi \
 	flac:+libflac \
 	flac:+libflac \
 	gif:+giflib \
 	gif:+giflib \
-	gstreamer:+libgstreamer1:+libgst1app:+libgst1pbutils:+libgst1tag \
+	gstreamer:+libgstreamer1:+gstreamer1-plugins-base:+libgst1app:+libgst1pbutils:+libgst1tag \
 	it \
 	it \
 	jpeg:+libjpeg \
 	jpeg:+libjpeg \
 	man \
 	man \

+ 347 - 0
libs/libextractor/patches/002-ffmpeg2.9_api_backport.patch

@@ -0,0 +1,347 @@
+--- a/src/plugins/thumbnailffmpeg_extractor.c
++++ b/src/plugins/thumbnailffmpeg_extractor.c
+@@ -59,6 +59,20 @@
+ #include <ffmpeg/swscale.h>
+ #endif
+ 
++#if USE_JPEG
++#ifdef PIX_FMT_YUVJ420P
++#define PIX_OUTPUT_FORMAT PIX_FMT_YUVJ420P
++#else
++#define PIX_OUTPUT_FORMAT AV_PIX_FMT_YUVJ420P
++#endif
++#else
++#ifdef PIX_FMT_RGB24
++#define PIX_OUTPUT_FORMAT PIX_FMT_RGB24
++#else
++#define PIX_OUTPUT_FORMAT AV_PIX_FMT_RGB24
++#endif
++#endif
++
+ /**
+  * Set to 1 to enable debug output.
+  */ 
+@@ -153,7 +167,7 @@
+ static size_t 
+ create_thumbnail (int src_width, int src_height, 
+ 		  int src_stride[],
+-		  enum PixelFormat src_pixfmt, 
++		  enum AVPixelFormat src_pixfmt, 
+ 		  const uint8_t * const src_data[],
+ 		  int dst_width, int dst_height,
+ 		  uint8_t **output_data, 
+@@ -189,7 +203,8 @@
+   if (NULL == 
+       (scaler_ctx =
+        sws_getContext (src_width, src_height, src_pixfmt,
+-		       dst_width, dst_height, PIX_FMT_RGB24, 
++		       dst_width, dst_height,
++		       PIX_OUTPUT_FORMAT, 
+ 		       SWS_BILINEAR, NULL, NULL, NULL)))
+     {
+ #if DEBUG
+@@ -199,7 +214,12 @@
+       return 0;
+     }
+ 
+-  if (NULL == (dst_frame = avcodec_alloc_frame ()))
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  dst_frame = av_frame_alloc ();
++#else
++  dst_frame = avcodec_alloc_frame();
++#endif
++  if (NULL == dst_frame)
+     {
+ #if DEBUG
+       fprintf (stderr,
+@@ -209,18 +229,24 @@
+       return 0;
+     }
+   if (NULL == (dst_buffer =
+-	       av_malloc (avpicture_get_size (PIX_FMT_RGB24, dst_width, dst_height))))
++	       av_malloc (avpicture_get_size (PIX_OUTPUT_FORMAT,
++                                              dst_width, dst_height))))
+     {
+ #if DEBUG
+       fprintf (stderr,
+                "Failed to allocate the destination image buffer\n");
+ #endif
+-      av_free (dst_frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&dst_frame);
++#else
++      avcodec_free_frame (&dst_frame);
++#endif
+       sws_freeContext (scaler_ctx);
+       return 0;
+     }
+   avpicture_fill ((AVPicture *) dst_frame, dst_buffer,
+-                  PIX_FMT_RGB24, dst_width, dst_height);
++                  PIX_OUTPUT_FORMAT,
++                  dst_width, dst_height);
+   sws_scale (scaler_ctx,
+              src_data, 
+              src_stride,
+@@ -236,7 +262,11 @@
+                "Failed to allocate the encoder output buffer\n");
+ #endif
+       av_free (dst_buffer);
+-      av_free (dst_frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&dst_frame);
++#else
++      avcodec_free_frame (&dst_frame);
++#endif
+       sws_freeContext (scaler_ctx);
+       return 0;
+     }
+@@ -249,13 +279,17 @@
+ #endif
+       av_free (encoder_output_buffer);
+       av_free (dst_buffer);
+-      av_free (dst_frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&dst_frame);
++#else
++      avcodec_free_frame (&dst_frame);
++#endif
+       sws_freeContext (scaler_ctx);
+       return 0;
+     }
+   encoder_codec_ctx->width = dst_width;
+   encoder_codec_ctx->height = dst_height;
+-  encoder_codec_ctx->pix_fmt = PIX_FMT_RGB24;
++  encoder_codec_ctx->pix_fmt = PIX_OUTPUT_FORMAT;
+   opts = NULL;
+   if (avcodec_open2 (encoder_codec_ctx, encoder_codec, &opts) < 0)
+     {
+@@ -263,10 +297,14 @@
+       fprintf (stderr,
+                "Failed to open the encoder\n");
+ #endif
+-      av_free (encoder_codec_ctx);
++      avcodec_free_context (&encoder_codec_ctx);
+       av_free (encoder_output_buffer);
+       av_free (dst_buffer);
+-      av_free (dst_frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&dst_frame);
++#else
++      avcodec_free_frame (&dst_frame);
++#endif
+       sws_freeContext  (scaler_ctx);
+       return 0;
+     }
+@@ -295,9 +333,13 @@
+ cleanup:
+   av_dict_free (&opts);
+   avcodec_close (encoder_codec_ctx);
+-  av_free (encoder_codec_ctx);
++  avcodec_free_context (&encoder_codec_ctx);
+   av_free (dst_buffer);
+-  av_free (dst_frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  av_frame_free (&dst_frame);
++#else
++  avcodec_free_frame (&dst_frame);
++#endif
+   sws_freeContext (scaler_ctx);
+   *output_data = encoder_output_buffer;
+ 
+@@ -406,18 +448,23 @@
+       fprintf (stderr,
+ 	       "Failed to open image codec\n");
+ #endif
+-      av_free (codec_ctx);
++      avcodec_free_context (&codec_ctx);
+       return;
+     }
+   av_dict_free (&opts);
+-  if (NULL == (frame = avcodec_alloc_frame ()))
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  frame = av_frame_alloc ();
++#else
++  frame = avcodec_alloc_frame();
++#endif
++  if (NULL == frame)
+     {
+ #if DEBUG
+       fprintf (stderr,
+                "Failed to allocate frame\n");
+ #endif
+       avcodec_close (codec_ctx);
+-      av_free (codec_ctx);
++      avcodec_free_context (&codec_ctx);
+       return;
+     }
+ 
+@@ -441,9 +488,13 @@
+       fprintf (stderr,
+ 	       "Failed to decode a complete frame\n");
+ #endif
+-      av_free (frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&frame);
++#else
++      avcodec_free_frame (&frame);
++#endif
+       avcodec_close (codec_ctx);
+-      av_free (codec_ctx);
++      avcodec_free_context (&codec_ctx);
+       return;
+     }
+   calculate_thumbnail_dimensions (codec_ctx->width, codec_ctx->height,
+@@ -467,9 +518,13 @@
+ 		err);
+       av_free (encoded_thumbnail);
+     }
+-  av_free (frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  av_frame_free (&frame);
++#else
++  avcodec_free_frame (&frame);
++#endif
+   avcodec_close (codec_ctx);
+-  av_free (codec_ctx);
++  avcodec_free_context (&codec_ctx);
+ }
+ 
+ 
+@@ -563,7 +618,12 @@
+       return;
+     }
+ 
+-  if (NULL == (frame = avcodec_alloc_frame ()))
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  frame = av_frame_alloc ();
++#else
++  frame = avcodec_alloc_frame();
++#endif
++  if (NULL == frame)
+     {
+ #if DEBUG
+       fprintf (stderr,
+@@ -616,7 +676,11 @@
+       fprintf (stderr,
+ 	       "Failed to decode a complete frame\n");
+ #endif
+-      av_free (frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++      av_frame_free (&frame);
++#else
++      avcodec_free_frame (&frame);
++#endif
+       avcodec_close (codec_ctx);
+       avformat_close_input (&format_ctx);
+       av_free (io_ctx);
+@@ -643,7 +707,11 @@
+ 		err);
+       av_free (encoded_thumbnail);
+     }
+-  av_free (frame);
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  av_frame_free (&frame);
++#else
++  avcodec_free_frame (&frame);
++#endif
+   avcodec_close (codec_ctx);
+   avformat_close_input (&format_ctx);
+   av_free (io_ctx);
+--- a/src/plugins/previewopus_extractor.c
++++ b/src/plugins/previewopus_extractor.c
+@@ -296,7 +296,12 @@
+ /** Initialize one audio frame for reading from the input file */
+ static int init_input_frame(AVFrame **frame)
+ {
+-    if (!(*frame = avcodec_alloc_frame())) {
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++    *frame = av_frame_alloc ();
++#else
++    *frame = avcodec_alloc_frame();
++#endif
++    if (NULL == *frame) {
+  #if DEBUG
+         fprintf(stderr, "Could not allocate input frame\n");
+ #endif
+@@ -655,7 +660,11 @@
+         av_freep(&converted_input_samples[0]);
+         free(converted_input_samples);
+     }
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++    av_frame_free (&input_frame);
++#else
+     avcodec_free_frame(&input_frame);
++#endif
+ 
+     return ret;
+ }
+@@ -671,7 +680,12 @@
+     int error;
+ 
+     /** Create a new frame to store the audio samples. */
+-    if (!(*frame = avcodec_alloc_frame())) {
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++    *frame = av_frame_alloc ();
++#else
++    *frame = avcodec_alloc_frame();
++#endif
++    if (NULL == *frame) {
+         #if DEBUG
+ 		fprintf(stderr, "Could not allocate output frame\n");
+ 		#endif
+@@ -702,7 +716,11 @@
+         #if DEBUG
+ 		fprintf(stderr, "Could allocate output frame samples (error '%s')\n", get_error_text(error));
+ 		#endif
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++        av_frame_free (frame);
++#else
+         avcodec_free_frame(frame);
++#endif
+         return error;
+     }
+ 
+@@ -783,17 +801,29 @@
+         #if DEBUG
+ 		fprintf(stderr, "Could not read data from FIFO\n");
+ 		#endif
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++        av_frame_free (&output_frame);
++#else
+         avcodec_free_frame(&output_frame);
++#endif
+         return AVERROR_EXIT;
+     }
+ 
+     /** Encode one frame worth of audio samples. */
+     if (encode_audio_frame(output_frame, output_format_context,
+                            output_codec_context, &data_written)) {
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++        av_frame_free (&output_frame);
++#else
+         avcodec_free_frame(&output_frame);
++#endif
+         return AVERROR_EXIT;
+     }
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++    av_frame_free (&output_frame);
++#else
+     avcodec_free_frame(&output_frame);
++#endif
+     return 0;
+ }
+ /** Write the trailer of the output file container. */
+@@ -907,7 +937,12 @@
+       return;
+     }
+ 
+-  if (NULL == (frame = avcodec_alloc_frame ()))
++#if LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(55,28,1)
++  frame = av_frame_alloc ();
++#else
++  frame = avcodec_alloc_frame();
++#endif
++  if (NULL == frame)
+     {
+ #if DEBUG
+       fprintf (stderr,

+ 1 - 1
libs/libgd/Makefile

@@ -54,7 +54,7 @@ CONFIGURE_ARGS += \
 	--without-iconv
 	--without-iconv
 
 
 CONFIGURE_VARS += \
 CONFIGURE_VARS += \
-	LIBPNG12_CONFIG="$(STAGING_DIR)/host/bin/libpng12-config" \
+	LIBPNG12_CONFIG="$(STAGING_DIR_HOSTPKG)/bin/libpng12-config" \
 	ac_cv_header_iconv_h=no
 	ac_cv_header_iconv_h=no
 
 
 define Build/InstallDev
 define Build/InstallDev

Some files were not shown because too many files changed in this diff