Browse Source

Revert package feed back

RISCi_ATOM 3 years ago
parent
commit
9810a4e618
100 changed files with 5808 additions and 8160 deletions
  1. 5 5
      admin/monit/Makefile
  2. 1 1
      admin/monit/patches/001-fix-default-piddir.patch
  3. 2 2
      admin/zabbix/Makefile
  4. 9 11
      admin/zabbix/files/mac80211
  5. 42 0
      devel/lpc21isp/Makefile
  6. 264 0
      lang/python/Makefile
  7. 10 0
      lang/python/files/python-version.mk
  8. 25 0
      lang/python/patches/001-enable-zlib.patch
  9. 14 0
      lang/python/patches/002-do-not-add-include-dirs-when-cross-compiling.patch
  10. 20 0
      lang/python/patches/003-do-not-compile-tests-at-build.patch
  11. 22 0
      lang/python/patches/004-do-not-write-bytes-codes.patch
  12. 14 0
      lang/python/patches/006-remove-debian-multiarch-support.patch
  13. 54 0
      lang/python/patches/008-distutils-use-python-sysroot.patch
  14. 34 0
      lang/python/patches/009-do-not-use-dblib_dir-when-cross-compiling.patch
  15. 15 0
      lang/python/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch
  16. 12 0
      lang/python/patches/011-remove-setupterm-definition.patch
  17. 753 0
      lang/ruby/Makefile
  18. 91 0
      libs/alsa-lib/Makefile
  19. 3 3
      libs/gnutls/Makefile
  20. 106 0
      libs/icu/Makefile
  21. 10 0
      libs/libradcli/Config.in
  22. 75 0
      libs/libradcli/Makefile
  23. 5 6
      libs/libssh2/Makefile
  24. 2 2
      libs/libtasn1/Makefile
  25. 152 0
      libs/libxslt/Makefile
  26. 2 2
      libs/openldap/Makefile
  27. 2 3
      libs/p11-kit/Makefile
  28. 2 3
      libs/pcre/Makefile
  29. 53 0
      libs/pcre/patches/001-CVE-2017-7186
  30. 231 0
      libs/postgresql/Makefile
  31. 4 7
      libs/sqlite3/Makefile
  32. 109 0
      libs/tiff/Makefile
  33. 33 0
      libs/tiff/patches/001-autoconf-compat.patch
  34. 136 0
      libs/tiff/patches/002-CVE-2015-8665_and_CVE-2015-8683.patch
  35. 193 0
      libs/tiff/patches/003-fix_potential_out-of-bound_writes_in_decode_functions.patch
  36. 72 0
      libs/tiff/patches/004-fix_potential_out-of-bound_write_in_NeXTDecode.patch
  37. 11 0
      libs/tiff/patches/005-fix-ftell-macro.patch
  38. 0 59
      mail/nail/Makefile
  39. 0 22
      mail/nail/patches/100-handle-openssl-without-sslv2-sslv3.patch
  40. 473 0
      multimedia/ffmpeg/Config.in
  41. 645 0
      multimedia/ffmpeg/Makefile
  42. 277 0
      multimedia/gst1-plugins-bad/Makefile
  43. 26 0
      multimedia/gst1-plugins-bad/patches/001-no-translations.patch
  44. 57 0
      multimedia/gst1-plugins-bad/patches/002-no-tests.patch
  45. 177 0
      multimedia/gst1-plugins-ugly/Makefile
  46. 23 0
      multimedia/gst1-plugins-ugly/patches/001-no-translations.patch
  47. 23 0
      multimedia/gst1-plugins-ugly/patches/002-no-tests.patch
  48. 23 0
      multimedia/gst1-plugins-ugly/patches/003-no-docs.patch
  49. 85 0
      multimedia/minidlna/Makefile
  50. 17 0
      multimedia/minidlna/files/minidlna.config
  51. 97 0
      multimedia/minidlna/files/minidlna.init
  52. 19 0
      multimedia/minidlna/patches/010-libav-fix.patch
  53. 4 5
      net/acme/Makefile
  54. 0 4
      net/acme/files/run.sh
  55. 4 6
      net/adblock/Makefile
  56. 102 146
      net/adblock/files/README.md
  57. 66 77
      net/adblock/files/adblock.conf
  58. 14 42
      net/adblock/files/adblock.init
  59. 0 56
      net/adblock/files/adblock.notify
  60. 225 610
      net/adblock/files/adblock.sh
  61. 148 0
      net/cjdns/Makefile
  62. 127 0
      net/cjdns/files/cjdns.defaults
  63. 32 0
      net/cjdns/files/cjdns.init
  64. 30 0
      net/cjdns/files/cjdrouteconf
  65. 105 0
      net/cjdns/lua/cjdns/admin.lua
  66. 7 0
      net/cjdns/lua/cjdns/common.lua
  67. 12 0
      net/cjdns/lua/cjdns/init.lua
  68. 289 0
      net/cjdns/lua/cjdns/uci.lua
  69. 102 0
      net/cjdns/lua/cjdns/udp.lua
  70. 0 14
      net/freeradius2/Config.in
  71. 0 636
      net/freeradius2/Makefile
  72. 0 29
      net/freeradius2/files/radiusd.init
  73. 0 12
      net/freeradius2/patches/001-fix-makefile.patch
  74. 0 613
      net/freeradius2/patches/002-config.patch
  75. 0 4257
      net/freeradius2/patches/004-ldap_configure.patch
  76. 0 17
      net/freeradius2/patches/008-honor_ccpflags.patch
  77. 0 40
      net/freeradius2/patches/010-disbale-openssl-check.patch
  78. 2 2
      net/git/Makefile
  79. 3 3
      net/haproxy/Makefile
  80. 0 299
      net/haproxy/patches/0001-BUG-MINOR-peers-peer-synchronization-issue-with-seve.patch
  81. 0 36
      net/haproxy/patches/0002-BUG-MINOR-lua-In-error-case-the-safe-mode-is-not-rem.patch
  82. 0 59
      net/haproxy/patches/0003-BUG-MINOR-lua-executes-the-function-destroying-the-L.patch
  83. 0 97
      net/haproxy/patches/0004-BUG-MAJOR-lua-socket-resources-not-detroyed-when-the.patch
  84. 0 46
      net/haproxy/patches/0005-BUG-MEDIUM-lua-bad-memory-access.patch
  85. 0 64
      net/haproxy/patches/0006-DOC-update-CONTRIBUTING-regarding-optional-parts-and.patch
  86. 0 36
      net/haproxy/patches/0007-DOC-update-the-list-of-OpenSSL-versions-in-the-READM.patch
  87. 0 129
      net/haproxy/patches/0008-MINOR-tools-add-a-portable-timegm-alternative.patch
  88. 0 38
      net/haproxy/patches/0009-BUILD-lua-replace-timegm-with-my_timegm-to-fix-build.patch
  89. 0 32
      net/haproxy/patches/0010-DOC-Updated-51Degrees-git-URL-to-point-to-a-stable-v.patch
  90. 0 33
      net/haproxy/patches/0011-BUG-MINOR-http-Set-the-response-error-state-in-http_.patch
  91. 0 100
      net/haproxy/patches/0012-MINOR-http-Reorder-rewrite-checks-in-http_resync_sta.patch
  92. 0 153
      net/haproxy/patches/0013-MINOR-http-Switch-requests-responses-in-TUNNEL-mode-.patch
  93. 0 118
      net/haproxy/patches/0014-BUG-MEDIUM-http-Switch-HTTP-responses-in-TUNNEL-mode.patch
  94. 0 43
      net/haproxy/patches/0015-BUG-MAJOR-http-Fix-possible-infinity-loop-in-http_sy.patch
  95. 0 45
      net/haproxy/patches/0016-BUG-MINOR-lua-Fix-Server.get_addr-port-values.patch
  96. 0 34
      net/haproxy/patches/0017-BUG-MINOR-lua-Correctly-use-INET6_ADDRSTRLEN-in-Serv.patch
  97. 0 45
      net/haproxy/patches/0018-BUG-MINOR-lua-always-detach-the-tcp-http-tasks-befor.patch
  98. 0 51
      net/horst/Makefile
  99. 4 5
      net/https-dns-proxy/Makefile
  100. 2 2
      net/jool/Makefile

+ 5 - 5
admin/monit/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=monit
-PKG_VERSION:=5.24.0
+PKG_VERSION:=5.18
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=754d1f0e165e5a26d4639a6a83f44ccf839e381f2622e0946d5302fa1f2d2414
-PKG_SOURCE_URL:=https://mmonit.com/monit/dist
+PKG_SOURCE_URL:=http://mmonit.com/monit/dist
+PKG_MD5SUM:=a1bfac0fbb83439435f8616200d2364d
 
 PKG_LICENSE:=AGPL-3.0
 PKG_LICENSE_FILES:=COPYING
@@ -26,9 +26,9 @@ include $(INCLUDE_DIR)/package.mk
 define Package/monit/Default
   SECTION:=admin
   CATEGORY:=Administration
-  DEPENDS:= +libpthread +zlib
+  DEPENDS:= +libpthread
   TITLE:=System services monitoring utility
-  URL:=https://mmonit.com/monit/
+  URL:=http://mmonit.com/monit/
   MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
 endef
 

+ 1 - 1
admin/monit/patches/001-fix-default-piddir.patch

@@ -1,6 +1,6 @@
 --- a/configure
 +++ b/configure
-@@ -13852,14 +13852,7 @@ fi
+@@ -13849,14 +13849,7 @@ fi
  # Find the right directory to put the root-mode PID file in
  { $as_echo "$as_me:${as_lineno-$LINENO}: checking pid file location" >&5
  $as_echo_n "checking pid file location... " >&6; }

+ 2 - 2
admin/zabbix/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=zabbix
-PKG_VERSION:=3.2.6
+PKG_VERSION:=3.0.3
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_HASH:=98f025b39515b196552b8a23e2fe20a8180b5e99e613ce7378725a46ed8b62d6
 PKG_SOURCE_URL:=@SF/zabbix
+PKG_MD5SUM:=7c45d37000e67d75042695344c9937e0
 
 PKG_LICENSE:=GPL-2.0
 PKG_LICENSE_FILES:=COPYING

+ 9 - 11
admin/zabbix/files/mac80211

@@ -15,15 +15,13 @@ UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFail
 UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount
 UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount
 UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount
-
-# hidden behind MAC80211_DEBUG_COUNTERS
-UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 dot11FailedCount
-UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 dot11FrameDuplicateCount
-UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 dot11MulticastReceivedFrameCount
-UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 dot11MulticastTransmittedFrameCount
-UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 dot11MultipleRetryCount
-UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 dot11ReceivedFragmentCount
-UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 dot11RetryCount
-UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 dot11TransmittedFragmentCount
-UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 dot11TransmittedFrameCount
+UserParameter=mac80211.FailedCount[*],zabbix_helper_mac80211 $1 failed_count
+UserParameter=mac80211.FrameDuplicateCount[*],zabbix_helper_mac80211 $1 frame_duplicate_count
+UserParameter=mac80211.MulticastReceivedFrameCount[*],zabbix_helper_mac80211 $1 multicast_received_frame_count
+UserParameter=mac80211.MulticastTransmittedFrameCount[*],zabbix_helper_mac80211 $1 multicast_transmitted_frame_count
+UserParameter=mac80211.MultipleRetryCount[*],zabbix_helper_mac80211 $1 multiple_retry_count
+UserParameter=mac80211.ReceivedFragmentCount[*],zabbix_helper_mac80211 $1 received_fragment_count
+UserParameter=mac80211.RetryCount[*],zabbix_helper_mac80211 $1 retry_count
+UserParameter=mac80211.TransmittedFragmentCount[*],zabbix_helper_mac80211 $1 transmitted_fragment_count
+UserParameter=mac80211.TransmittedFrameCount[*],zabbix_helper_mac80211 $1 transmitted_frame_count
 

+ 42 - 0
devel/lpc21isp/Makefile

@@ -0,0 +1,42 @@
+#
+# Copyright (C) 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:=lpc21isp
+PKG_VERSION:=197
+PKG_RELEASE:=1
+PKG_LICENSE:=LGPL-3.0+
+PKG_LICENSE_FILES:=README gpl.txt lgpl-3.0.txt
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/lpc21isp_$(PKG_VERSION)
+PKG_SOURCE:=lpc21isp_$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/lpc21isp
+PKG_MD5SUM:=0b286859a05a725647ecb1b3fe9ba606
+PKG_CAT:=zcat
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lpc21isp
+  SECTION:=base
+  CATEGORY:=Development
+  TITLE:=Command line ISP for NXP LPC family and ADUC70xx
+  URL:=http://lpc21isp.sourceforge.net/
+  MAINTAINER:=Emil 'Skeen' Madsen <sovende@gmail.com>
+endef
+
+define Package/lpc21isp/description
+ Portable command line ISP (In-circuit Programmer) for NXP LPC family
+ and Analog Devices ADUC70xx.
+endef
+
+define Package/lpc21isp/install
+		$(INSTALL_DIR) $(1)/usr/sbin
+		$(INSTALL_BIN) $(PKG_BUILD_DIR)/lpc21isp $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,lpc21isp))

+ 264 - 0
lang/python/Makefile

@@ -0,0 +1,264 @@
+#
+# Copyright (C) 2006-2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+include $(TOPDIR)/rules.mk
+
+# For PYTHON_VERSION
+include ./files/python-version.mk
+
+PKG_NAME:=python
+PKG_VERSION:=$(PYTHON_VERSION).$(PYTHON_VERSION_MICRO)
+PKG_RELEASE:=4
+
+PKG_SOURCE:=Python-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=https://www.python.org/ftp/python/$(PKG_VERSION)
+PKG_MD5SUM:=53b43534153bb2a0363f08bae8b9d990
+PKG_HASH:=35d543986882f78261f97787fd3e06274bfa6df29fac9b4a94f73930ff98f731
+
+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
+
+# This file provides the necsessary host build variables
+include ./files/python-host.mk
+
+# For PyPackage
+include ./files/python-package.mk
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+HOST_BUILD_PARALLEL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/Python-$(PKG_VERSION)
+HOST_BUILD_DIR:=$(BUILD_DIR_HOST)/Python-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=python/host
+HOST_BUILD_DEPENDS:=bzip2/host expat/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/python/Default
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python $(PYTHON_VERSION) programming language
+  URL:=https://www.python.org/
+  MAINTAINER:=Alexandru Ardelean <ardeleanalex@gmail.com>
+endef
+
+define Package/python/Default/description
+ Python is a dynamic object-oriented programming language that can be used
+ for many kinds of software development. It offers strong support for
+ integration with other languages and tools, comes with extensive standard
+ libraries, and can be learned in a few days. Many Python programmers
+ report substantial productivity gains and feel the language encourages
+ the development of higher quality, more maintainable code.
+endef
+
+define Package/python-base
+$(call Package/python/Default)
+  TITLE:=Python $(PYTHON_VERSION) interpreter
+  DEPENDS:=+libpthread +zlib
+endef
+
+define Package/python-base/description
+  This package contains only the interpreter and the bare minimum
+  for the interpreter to start.
+endef
+
+define Package/python-light
+$(call Package/python/Default)
+  TITLE:=Python $(PYTHON_VERSION) light installation
+  DEPENDS:=+python-base +libffi +libbz2
+endef
+
+define Package/python-light/description
+  This package is essentially the python-base package plus
+  a few of the rarely used (and big) libraries stripped out
+  into separate packages.
+endef
+
+PYTHON_LIB_FILES_DEL:=
+PYTHON_PACKAGES:=
+PYTHON_PACKAGES_DEPENDS:=
+define PyBasePackage
+  PYTHON_PACKAGES+=$(1)
+  ifeq ($(3),)
+    PYTHON_PACKAGES_DEPENDS+=$(1)
+  endif
+  PYTHON_LIB_FILES_DEL+=$(2)
+  define PyPackage/$(1)/filespec
+    $(subst $(space),$(newline),$(foreach lib_file,$(2),+|$(lib_file)))
+  endef
+endef
+
+include ./files/python-package-*.mk
+
+define Package/python
+$(call Package/python/Default)
+  DEPENDS:=+python-light $(foreach package,$(PYTHON_PACKAGES_DEPENDS),+$(package))
+endef
+
+define Package/python/description
+  This package contains the (almost) full Python install.
+  It's python-light + all other packages.
+endef
+
+MAKE_FLAGS+=\
+	CROSS_COMPILE=yes \
+	LD="$(TARGET_CC)" \
+	PGEN=pgen2
+
+EXTRA_CFLAGS+= \
+	-DNDEBUG -fno-inline
+EXTRA_LDFLAGS+= \
+	-L$(PKG_BUILD_DIR)
+
+ENABLE_IPV6:=
+ifeq ($(CONFIG_IPV6),y)
+	ENABLE_IPV6 += --enable-ipv6
+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+= \
+	--sysconfdir=/etc \
+	--enable-shared \
+	--without-cxx-main \
+	--with-threads \
+	--with-system-ffi \
+	--without-pymalloc \
+	PYTHON_FOR_BUILD="$(PYTHON_FOR_BUILD)" \
+	$(ENABLE_IPV6) \
+	CONFIG_SITE="$(PKG_BUILD_DIR)/config.site" \
+	OPT="$(TARGET_CFLAGS)"
+
+define Build/Prepare
+	$(call Build/Prepare/Default)
+	$(CP) ./files/config.site $(PKG_BUILD_DIR)/config.site
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(STAGING_DIR)/mk/
+	$(INSTALL_DIR) $(1)/usr/include/ $(1)/usr/lib/ $(1)/usr/lib/pkgconfig
+	$(INSTALL_DIR) $(1)/usr/lib/python$(PYTHON_VERSION)/
+	$(INSTALL_DATA) \
+		./files/python-package.mk \
+		./files/python-host.mk \
+		./files/python-version.mk \
+		$(STAGING_DIR)/mk/
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/include/python$(PYTHON_VERSION) \
+		$(1)/usr/include/
+	$(CP) \
+		$(HOST_PYTHON_LIB_DIR) \
+		$(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* \
+		$(1)/usr/lib/
+	$(CP) \
+		$(HOST_PYTHON_DIR)/lib/pkgconfig/python.pc \
+		$(HOST_PYTHON_DIR)/lib/pkgconfig/python2.pc \
+		$(HOST_PYTHON_DIR)/lib/pkgconfig/python-$(PYTHON_VERSION).pc \
+		$(1)/usr/lib/pkgconfig
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/python$(PYTHON_VERSION)/config \
+		$(1)/usr/lib/python$(PYTHON_VERSION)/
+endef
+
+PYTHON_BASE_LIB_FILES:= \
+	/usr/lib/python$(PYTHON_VERSION)/_abcoll.py \
+	/usr/lib/python$(PYTHON_VERSION)/_sysconfigdata.py \
+	/usr/lib/python$(PYTHON_VERSION)/_weakrefset.py \
+	/usr/lib/python$(PYTHON_VERSION)/abc.py \
+	/usr/lib/python$(PYTHON_VERSION)/copy_reg.py \
+	/usr/lib/python$(PYTHON_VERSION)/genericpath.py \
+	/usr/lib/python$(PYTHON_VERSION)/linecache.py \
+	/usr/lib/python$(PYTHON_VERSION)/posixpath.py \
+	/usr/lib/python$(PYTHON_VERSION)/os.py \
+	/usr/lib/python$(PYTHON_VERSION)/re.py \
+	/usr/lib/python$(PYTHON_VERSION)/site.py \
+	/usr/lib/python$(PYTHON_VERSION)/sre_compile.py \
+	/usr/lib/python$(PYTHON_VERSION)/sre_constants.py \
+	/usr/lib/python$(PYTHON_VERSION)/sre_parse.py \
+	/usr/lib/python$(PYTHON_VERSION)/sysconfig.py \
+	/usr/lib/python$(PYTHON_VERSION)/stat.py \
+	/usr/lib/python$(PYTHON_VERSION)/traceback.py \
+	/usr/lib/python$(PYTHON_VERSION)/types.py \
+	/usr/lib/python$(PYTHON_VERSION)/UserDict.py \
+	/usr/lib/python$(PYTHON_VERSION)/warnings.py
+
+PYTHON_LIB_FILES_DEL+=$(PYTHON_BASE_LIB_FILES)
+
+define PyPackage/python-base/filespec
++|/usr/bin/python$(PYTHON_VERSION)
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_BASE_LIB_FILES),+|$(lib_file)))
+endef
+
+define PyPackage/python-light/filespec
++|/usr/lib/python$(PYTHON_VERSION)
+-|/usr/lib/python$(PYTHON_VERSION)/distutils/cygwinccompiler.py
+-|/usr/lib/python$(PYTHON_VERSION)/distutils/command/wininst*
+-|/usr/lib/python$(PYTHON_VERSION)/ensurepip
+-|/usr/lib/python$(PYTHON_VERSION)/idlelib
+-|/usr/lib/python$(PYTHON_VERSION)/lib-tk
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/_testcapi.so
+-|/usr/lib/python$(PYTHON_VERSION)/pdb.doc
+-|/usr/lib/python$(PYTHON_VERSION)/test
+-|/usr/lib/python$(PYTHON_VERSION)/webbrowser.py
+-|/usr/lib/python$(PYTHON_VERSION)/*/test
+-|/usr/lib/python$(PYTHON_VERSION)/*/tests
+-|/usr/lib/python$(PYTHON_VERSION)/lib-dynload/readline.so
+$(subst $(space),$(newline),$(foreach lib_file,$(PYTHON_LIB_FILES_DEL),-|$(lib_file)))
+endef
+
+define PyPackage/python-base/install
+	$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python
+	$(LN) python$(PYTHON_VERSION) $(1)/usr/bin/python2
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpython$(PYTHON_VERSION).so* $(1)/usr/lib/
+endef
+
+define PyPackage/python/filespec
+-|$(PYTHON_PKG_DIR)
+endef
+
+HOST_LDFLAGS += \
+	$$$$(pkg-config --static --libs libcrypto libssl)
+
+HOST_CONFIGURE_ARGS+= \
+	--without-cxx-main \
+	--without-pymalloc \
+	--with-threads \
+	--prefix=$(HOST_PYTHON_DIR) \
+	--exec-prefix=$(HOST_PYTHON_DIR) \
+	--with-system-expat=$(STAGING_DIR_HOSTPKG) \
+	--with-system-ffi=no \
+	CONFIG_SITE=
+
+define Host/Install
+	$(MAKE) -C $(HOST_BUILD_DIR) install
+	$(INSTALL_DIR) $(HOST_PYTHON_DIR)/bin/
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/Parser/pgen $(HOST_PYTHON_DIR)/bin/pgen2
+endef
+
+$(eval $(call HostBuild))
+
+$(foreach package, $(PYTHON_PACKAGES),  \
+	$(eval $(call PyPackage,$(package))) \
+	$(eval $(call BuildPackage,$(package))) \
+)
+
+$(eval $(call PyPackage,python-base))
+$(eval $(call PyPackage,python-light))
+$(eval $(call PyPackage,python))
+
+$(eval $(call BuildPackage,python-base))
+$(eval $(call BuildPackage,python-light))
+$(eval $(call BuildPackage,python))

+ 10 - 0
lang/python/files/python-version.mk

@@ -0,0 +1,10 @@
+#
+# Copyright (C) 2016 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+PYTHON_VERSION:=2.7
+PYTHON_VERSION_MICRO:=13
+

+ 25 - 0
lang/python/patches/001-enable-zlib.patch

@@ -0,0 +1,25 @@
+From 6eeab87bc852481e599325549c854b701bf2e39f Mon Sep 17 00:00:00 2001
+From: Alexandru Ardelean <aa@ocedo.com>
+Date: Thu, 25 Sep 2014 18:18:29 +0300
+Subject: [PATCH] enable zlib
+
+---
+ Modules/Setup.dist | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/Modules/Setup.dist b/Modules/Setup.dist
+index 01fb85f..01ac492 100644
+--- a/Modules/Setup.dist
++++ b/Modules/Setup.dist
+@@ -358,7 +358,7 @@ _symtable symtablemodule.c
+ # Andrew Kuchling's zlib module.
+ # This require zlib 1.1.3 (or later).
+ # See http://www.gzip.org/zlib/
+-#zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
++zlib zlibmodule.c -lz
+ 
+ # Interface to the Expat XML parser
+ #
+-- 
+1.8.4.5
+

+ 14 - 0
lang/python/patches/002-do-not-add-include-dirs-when-cross-compiling.patch

@@ -0,0 +1,14 @@
+diff --git a/setup.py b/setup.py
+index cbdeaf3..5154412 100644
+--- a/setup.py
++++ b/setup.py
+@@ -480,7 +480,8 @@ class PyBuildExt(build_ext):
+                         add_dir_to_list(dir_list, directory)
+ 
+         if os.path.normpath(sys.prefix) != '/usr' \
+-                and not sysconfig.get_config_var('PYTHONFRAMEWORK'):
++                and not sysconfig.get_config_var('PYTHONFRAMEWORK') \
++                and not cross_compiling:
+             # OSX note: Don't add LIBDIR and INCLUDEDIR to building a framework
+             # (PYTHONFRAMEWORK is set) to avoid # linking problems when
+             # building a framework with different architectures than

+ 20 - 0
lang/python/patches/003-do-not-compile-tests-at-build.patch

@@ -0,0 +1,20 @@
+diff --git a/Makefile.pre.in b/Makefile.pre.in
+index 7f4ec2f..e270bf2 100644
+--- a/Makefile.pre.in
++++ b/Makefile.pre.in
+@@ -1038,6 +1038,7 @@ libinstall:	build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
+ 		done; \
+ 	done
+ 	$(INSTALL_DATA) $(srcdir)/LICENSE $(DESTDIR)$(LIBDEST)/LICENSE.txt
++ifeq (@COMPILE_ALL_TESTS@,yes)
+ 	if test -d $(DESTDIR)$(LIBDEST)/distutils/tests; then \
+ 		$(INSTALL_DATA) $(srcdir)/Modules/xxmodule.c \
+ 			$(DESTDIR)$(LIBDEST)/distutils/tests ; \
+@@ -1064,6 +1065,7 @@ libinstall:	build_all $(srcdir)/Lib/$(PLATDIR) $(srcdir)/Modules/xxmodule.c
+ 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/Grammar.txt
+ 	-PYTHONPATH=$(DESTDIR)$(LIBDEST) $(RUNSHARED) \
+ 		$(PYTHON_FOR_BUILD) -m lib2to3.pgen2.driver $(DESTDIR)$(LIBDEST)/lib2to3/PatternGrammar.txt
++endif
+ 
+ # Create the PLATDIR source directory, if one wasn't distributed..
+ $(srcdir)/Lib/$(PLATDIR):

+ 22 - 0
lang/python/patches/004-do-not-write-bytes-codes.patch

@@ -0,0 +1,22 @@
+diff --git a/Python/pythonrun.c b/Python/pythonrun.c
+index 748a63b..cb6e291 100644
+--- a/Python/pythonrun.c
++++ b/Python/pythonrun.c
+@@ -79,7 +79,7 @@ int Py_InteractiveFlag; /* Needed by Py_FdIsInteractive() below */
+ int Py_InspectFlag; /* Needed to determine whether to exit at SystemExit */
+ int Py_NoSiteFlag; /* Suppress 'import site' */
+ int Py_BytesWarningFlag; /* Warn on str(bytes) and str(buffer) */
+-int Py_DontWriteBytecodeFlag; /* Suppress writing bytecode files (*.py[co]) */
++int Py_DontWriteBytecodeFlag = 1; /* Suppress writing bytecode files (*.py[co]) */
+ int Py_UseClassExceptionsFlag = 1; /* Needed by bltinmodule.c: deprecated */
+ int Py_FrozenFlag; /* Needed by getpath.c */
+ int Py_UnicodeFlag = 0; /* Needed by compile.c */
+@@ -174,7 +174,7 @@ Py_InitializeEx(int install_sigs)
+     if ((p = Py_GETENV("PYTHONOPTIMIZE")) && *p != '\0')
+         Py_OptimizeFlag = add_flag(Py_OptimizeFlag, p);
+     if ((p = Py_GETENV("PYTHONDONTWRITEBYTECODE")) && *p != '\0')
+-        Py_DontWriteBytecodeFlag = add_flag(Py_DontWriteBytecodeFlag, p);
++        Py_DontWriteBytecodeFlag = atoi(p);
+     /* The variable is only tested for existence here; _PyRandom_Init will
+        check its value further. */
+     if ((p = Py_GETENV("PYTHONHASHSEED")) && *p != '\0')

+ 14 - 0
lang/python/patches/006-remove-debian-multiarch-support.patch

@@ -0,0 +1,14 @@
+diff --git a/setup.py b/setup.py
+index 1d1ae72..511aed5 100644
+--- a/setup.py
++++ b/setup.py
+@@ -444,7 +444,8 @@ class PyBuildExt(build_ext):
+             add_dir_to_list(self.compiler.include_dirs, '/usr/local/include')
+         if cross_compiling:
+             self.add_gcc_paths()
+-        self.add_multiarch_paths()
++        else:
++            self.add_multiarch_paths()
+ 
+         # Add paths specified in the environment variables LDFLAGS and
+         # CPPFLAGS for header and library files.

+ 54 - 0
lang/python/patches/008-distutils-use-python-sysroot.patch

@@ -0,0 +1,54 @@
+Adjust library/header paths for cross-compilation
+
+When cross-compiling third-party extensions, the get_python_inc() or
+get_python_lib() can be called, to return the path to headers or
+libraries. However, they use the sys.prefix of the host Python, which
+returns incorrect paths when cross-compiling (paths pointing to host
+headers and libraries).
+
+In order to fix this, we introduce the _python_sysroot, _python_prefix
+and _python_exec_prefix variables, that allow to override these
+values, and get correct header/library paths when cross-compiling
+third-party Python modules.
+
+The _python_sysroot variable is also used to prefix the LIBDIR value
+taken from the sysconfigdata module.
+
+Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
+
+Index: b/Lib/distutils/sysconfig.py
+===================================================================
+--- a/Lib/distutils/sysconfig.py
++++ b/Lib/distutils/sysconfig.py
+@@ -19,8 +19,13 @@
+ from distutils.errors import DistutilsPlatformError
+ 
+ # These are needed in a couple of spots, so just compute them once.
+-PREFIX = os.path.normpath(sys.prefix)
+-EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
++if "_python_sysroot" in os.environ:
++    _sysroot=os.environ.get('_python_sysroot')
++    PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_prefix'))
++    EXEC_PREFIX = os.path.normpath(_sysroot + os.environ.get('_python_exec_prefix'))
++else:
++    PREFIX = os.path.normpath(sys.prefix)
++    EXEC_PREFIX = os.path.normpath(sys.exec_prefix)
+ 
+ # Path to the base directory of the project. On Windows the binary may
+ # live in project/PCBuild9.  If we're dealing with an x64 Windows build,
+Index: b/Lib/distutils/command/build_ext.py
+===================================================================
+--- a/Lib/distutils/command/build_ext.py
++++ b/Lib/distutils/command/build_ext.py
+@@ -237,7 +237,10 @@
+         if (sysconfig.get_config_var('Py_ENABLE_SHARED')):
+             if not sysconfig.python_build:
+                 # building third party extensions
+-                self.library_dirs.append(sysconfig.get_config_var('LIBDIR'))
++                libdir = sysconfig.get_config_var('LIBDIR')
++                if "_python_sysroot" in os.environ:
++                    libdir = os.environ.get("_python_sysroot") + libdir
++                self.library_dirs.append(libdir)
+             else:
+                 # building python standard extensions
+                 self.library_dirs.append('.')

+ 34 - 0
lang/python/patches/009-do-not-use-dblib_dir-when-cross-compiling.patch

@@ -0,0 +1,34 @@
+diff --git a/setup.py b/setup.py
+index 7868b7b..10ec68f 100644
+--- a/setup.py
++++ b/setup.py
+@@ -1067,6 +1067,7 @@ class PyBuildExt(build_ext):
+                         if db_setup_debug: print "db lib: ", dblib, "not found"
+ 
+         except db_found:
++            rt_dblib_dir = None if cross_compiling else dblib_dir
+             if db_setup_debug:
+                 print "bsddb using BerkeleyDB lib:", db_ver, dblib
+                 print "bsddb lib dir:", dblib_dir, " inc dir:", db_incdir
+@@ -1081,7 +1082,7 @@ class PyBuildExt(build_ext):
+             exts.append(Extension('_bsddb', ['_bsddb.c'],
+                                   depends = ['bsddb.h'],
+                                   library_dirs=dblib_dir,
+-                                  runtime_library_dirs=dblib_dir,
++                                  runtime_library_dirs=rt_dblib_dir,
+                                   include_dirs=db_incs,
+                                   libraries=dblibs))
+         else:
+@@ -1292,10 +1293,11 @@ class PyBuildExt(build_ext):
+                             break
+                 elif cand == "bdb":
+                     if db_incs is not None:
++                        rt_dblib_dir = None if cross_compiling else dblib_dir
+                         print "building dbm using bdb"
+                         dbmext = Extension('dbm', ['dbmmodule.c'],
+                                            library_dirs=dblib_dir,
+-                                           runtime_library_dirs=dblib_dir,
++                                           runtime_library_dirs=rt_dblib_dir,
+                                            include_dirs=db_incs,
+                                            define_macros=[
+                                                ('HAVE_BERKDB_H', None),

+ 15 - 0
lang/python/patches/010-do-not-add-rt-lib-dirs-when-cross-compiling.patch

@@ -0,0 +1,15 @@
+diff --git a/setup.py b/setup.py
+index 7868b7b..544fa7e 100644
+--- a/setup.py
++++ b/setup.py
+@@ -452,8 +452,9 @@ class PyBuildExt(build_ext):
+         # directly since an inconsistently reproducible issue comes up where
+         # the environment variable is not set even though the value were passed
+         # into configure and stored in the Makefile (issue found on OS X 10.3).
++        rt_lib_dirs = [] if cross_compiling else self.compiler.runtime_library_dirs
+         for env_var, arg_name, dir_list in (
+-                ('LDFLAGS', '-R', self.compiler.runtime_library_dirs),
++                ('LDFLAGS', '-R', rt_lib_dirs),
+                 ('LDFLAGS', '-L', self.compiler.library_dirs),
+                 ('CPPFLAGS', '-I', self.compiler.include_dirs)):
+             env_val = sysconfig.get_config_var(env_var)

+ 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

+ 753 - 0
lang/ruby/Makefile

@@ -0,0 +1,753 @@
+#
+# 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.
+# See /LICENSE for more information.
+#
+# To Do:
+#  - dirs not removed when uninstalling! opkg bug?
+#
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=ruby
+PKG_VERSION:=2.4.1
+PKG_RELEASE:=1
+
+# First two numbes
+PKG_ABI_VERSION:=$(subst $(space),.,$(wordlist 1, 2, $(subst .,$(space),$(PKG_VERSION))))
+
+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_LICENSE:=BSD-2-Clause
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DEPENDS:=ruby/host
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+HOST_CONFIGURE_ARGS += \
+	--disable-install-doc \
+	--disable-install-rdoc \
+	--disable-install-capi \
+	--without-gmp \
+	--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
+# https://bugs.ruby-lang.org/issues/11940
+	#--with-static-linked-ext \
+
+# even not used, host build with restricted exts results in gems not being
+# compiled for target (probably some cross compiling problem like checking
+# host for selecting target features)
+#	--with-out-ext \
+#	--with-ext=thread,stringio \
+
+CONFIGURE_ARGS += \
+	--enable-shared \
+	--enable-static \
+	--disable-rpath \
+	$(call autoconf_bool,CONFIG_IPV6,ipv6) \
+	--disable-install-doc \
+	--disable-install-capi \
+	--with-ruby-version=minor \
+	--with-iconv-dir=$(ICONV_PREFIX) \
+	--with-out-ext=win32,win32ole
+
+ifndef CONFIG_RUBY_DIGEST_USE_OPENSSL
+CONFIGURE_ARGS += \
+	--with-bundled-sha1\
+	--with-bundled-md5\
+	--with-bundled-rmd160\
+	--with-bundled-sha2 \
+
+endif
+
+TARGET_LDFLAGS += -L$(PKG_BUILD_DIR)
+
+# 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.
+# XLDFLAGS is used by both libraries and execs. This is somehow brute force but
+# it will fix when some LD_FLAGS is needed for libraries. As side effect, it will
+# duplicate ld args for binaries.
+CONFIGURE_VARS += XLDFLAGS="$(TARGET_LDFLAGS)"
+
+MAKE_FLAGS += \
+	DESTDIR="$(PKG_INSTALL_DIR)" \
+	SHELL="/bin/bash"
+
+define Build/InstallDev
+	( cd $(PKG_INSTALL_DIR); $(TAR) -cf - \
+		. \
+	) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Host/Install
+	# 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
+	rm -f $(STAGING_DIR_HOSTPKG)/bin/rake
+	$(call Host/Install/Default)
+endef
+
+define Package/ruby/Default
+  SUBMENU:=Ruby
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Ruby scripting language
+  URL:=http://www.ruby-lang.org/
+endef
+
+define Package/ruby/Default/description
+ Ruby is the interpreted scripting language for quick and easy
+ object-oriented programming.  It has many features to process text files
+ and to do system management tasks (as in perl).  It is simple,
+ straight-forward, and extensible.
+
+endef
+
+define Package/ruby
+$(call Package/ruby/Default)
+  TITLE+= (interpreter)
+  DEPENDS:=+libruby
+endef
+
+define Package/ruby/description
+$(call Package/ruby/Default/description)
+endef
+
+define RubyDependency
+    $(eval \
+        $(call Package/Default)
+        $(call Package/ruby-$(1))
+        FILTER_CONFIG:=$$(strip \
+            $$(foreach config_dep, \
+                $$(filter @%, \
+                    $$(foreach v, \
+                        $$(DEPENDS), \
+                        $$(if $$(findstring :,$$v),,$$v) \
+                    ) \
+                ), \
+                $$(subst @,,$$(config_dep)) \
+            ) \
+        )
+        ifneq (,$$(FILTER_CONFIG))
+           FILTER_CONFIG:=($$(subst $$(space),&&,$$(FILTER_CONFIG))):
+        endif
+    ) \
+    +$(FILTER_CONFIG)ruby-$(1)
+endef
+
+define Package/ruby/config
+    comment "Standard Library"
+      depends on PACKAGE_ruby
+
+    config PACKAGE_ruby-stdlib
+      depends on PACKAGE_ruby
+      default m if ALL
+      prompt "Select Ruby Complete Standard Library (ruby-stdlib)"
+
+endef
+
+define Package/ruby/install
+	$(INSTALL_DIR) $(1)/usr/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
+	$(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
+
+define Package/libruby
+$(call Package/ruby/Default)
+  SUBMENU:=
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= (shared library)
+  DEPENDS+= +libpthread +librt +libgmp
+  ABI_VERSION:=$(PKG_ABI_VERSION)
+endef
+define Package/libruby/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libruby.so.* $(1)/usr/lib/
+endef
+
+RUBY_STDLIB :=
+define Package/ruby-stdlib
+$(call Package/ruby/Default)
+  TITLE:=Ruby standard libraries (metadata for all stdlib subsets)
+  DEPENDS:=ruby $(foreach subpackage,$(RUBY_STDLIB),$(strip $(call RubyDependency,$(subpackage))))
+  HIDDEN:=1
+endef
+
+define Package/ruby-stdlib/description
+ This metapackage currently install all ruby-* packages,
+ providing a complete Ruby Standard Library.
+
+endef
+
+# nothing to do
+define Package/ruby-stdlib/install
+	/bin/true
+endef
+
+define Package/ruby-bigdecimal/files
+/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
+
+define Package/ruby-cgi/files
+/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
+
+define Package/ruby-csv/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/csv.rb
+endef
+
+define Package/ruby-datetime/files
+/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
+
+define Package/ruby-dbm/description
+ The DBM class provides a wrapper to a Unix-style dbm or Database Manager library.
+ This package provides dbm.so file.
+
+endef
+define Package/ruby-dbm/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/dbm.so
+endef
+
+define Package/ruby-debuglib/files
+/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
+
+define Package/ruby-did-you-mean/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/did_you_mean-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/did_you_mean-*/
+endef
+define Package/ruby-did-you-mean/files-excluded
+/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
+
+define Package/ruby-digest/description
+ Provides digest* files. Can be configured to use OpenSSL or
+ bundled hash functions.
+
+endef
+define Package/ruby-digest/config
+
+	config RUBY_DIGEST_USE_OPENSSL
+		bool "Use OpenSSL functions for ruby digest hash functions"
+        depends on PACKAGE_ruby-digest
+		help
+			Ruby can use OpenSSL hash functions or compile alternative implementations. Using
+			OpenSSL saves about 30KBytes (less when compressed) but requires OpenSSL (that
+			is way bigger than that). However, if OpenSSL is already needed by another usage,
+			as ruby-openssl or any other non ruby package, it is better to mark this option.
+		default n
+
+endef
+define Package/ruby-digest/files
+/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
+
+define Package/ruby-drb/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/drb.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/drb
+endef
+
+define Package/ruby-enc/files
+/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
+
+define Package/ruby-enc-extra/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/enc
+endef
+define Package/ruby-enc-extra/files-excluded
+$(call Package/ruby-enc/files)
+endef
+
+define Package/ruby-erb/files
+/usr/bin/erb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/erb.rb
+endef
+
+define Package/ruby-fiddle/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/fiddle.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/fiddle/
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/fiddle.so
+endef
+
+define Package/ruby-filelib/files
+/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
+
+define Package/ruby-gdbm/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/gdbm.so
+endef
+
+define Package/ruby-gems/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ubygems.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rubygems
+endef
+define Package/ruby-gems/files-excluded
+/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
+define Package/ruby-gems/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gem $(1)/usr/bin/
+	$(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))
+endef
+
+define Package/ruby-io-console/files
+/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
+
+define Package/ruby-irb/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/irb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/irb.rb
+endef
+define Package/ruby-irb/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/irb $(1)/usr/bin/
+	$(call RubyBuildPackage/install,irb,$(1))
+endef
+
+define Package/ruby-json/files
+/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
+define Package/ruby-json/files-excluded
+$(call Package/ruby-psych/files)
+endef
+
+define Package/ruby-logger/files
+/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
+
+define Package/ruby-math/files
+/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
+
+define Package/ruby-minitest/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/minitest-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/minitest-*
+endef
+define Package/ruby-minitest/files-excluded
+/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
+
+define Package/ruby-misc/files
+/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
+
+define Package/ruby-mkmf/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/mkmf.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/un.rb
+endef
+
+define Package/ruby-multithread/files
+/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
+
+define Package/ruby-net/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/open-uri.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/net/*
+endef
+
+define Package/ruby-net-telnet/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/net-telnet-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/
+endef
+define Package/ruby-net-telnet/files-excluded
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/*.md
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/net-telnet-*/*.txt
+endef
+
+define Package/ruby-nkf/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/kconv.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/nkf.so
+endef
+
+define Package/ruby-openssl/files
+/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
+
+define Package/ruby-optparse/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optparse.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optionparser.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/optparse
+endef
+
+define Package/ruby-patterns/files
+/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
+
+define Package/ruby-powerassert/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/power_assert-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/power_assert-*
+endef
+define Package/ruby-powerassert/files-excluded
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/power_assert-*/test
+endef
+
+define Package/ruby-prettyprint/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/pp.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/prettyprint.rb
+endef
+
+define Package/ruby-pstore/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/pstore.rb
+endef
+
+define Package/ruby-psych/files
+/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
+
+define Package/ruby-racc/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/racc
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/racc/*.so
+endef
+
+define Package/ruby-rake/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/rake-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/
+endef
+define Package/ruby-rake/files-excluded
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/doc
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/rake-*/*.rdoc
+endef
+define Package/ruby-rake/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rake $(1)/usr/bin/;
+	$(call RubyBuildPackage/install,rake,$(1))
+endef
+
+define Package/ruby-rbconfig/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/rbconfig.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rbconfig/*
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/rbconfig/*.so
+endef
+
+define Package/ruby-rdoc/files
+	/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
+define Package/ruby-rdoc/files-excluded
+	/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
+define Package/ruby-rdoc/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/rdoc $(1)/usr/bin/
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ri $(1)/usr/bin/
+	$(call RubyBuildPackage/install,rdoc,$(1))
+endef
+
+define Package/ruby-readline/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/readline.so
+endef
+
+define Package/ruby-rexml/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rexml
+endef
+
+define Package/ruby-rinda/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rinda
+endef
+
+define Package/ruby-ripper/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ripper.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/ripper
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/ripper.so
+endef
+
+define Package/ruby-rss/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rss
+/usr/lib/ruby/$(PKG_ABI_VERSION)/rss.rb
+endef
+
+define Package/ruby-sdbm/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/sdbm.so
+endef
+
+define Package/ruby-shell/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/shell.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/shell
+endef
+
+define Package/ruby-socket/files
+/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
+
+define Package/ruby-testunit/files
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/specifications/test-unit-*.gemspec
+/usr/lib/ruby/gems/$(PKG_ABI_VERSION)/gems/test-unit-*
+endef
+define Package/ruby-testunit/files-excluded
+/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
+
+define Package/ruby-unicodenormalize/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/unicode_normalize.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/unicode_normalize
+endef
+
+define Package/ruby-uri/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/uri.rb
+/usr/lib/ruby/$(PKG_ABI_VERSION)/uri
+endef
+
+define Package/ruby-webrick/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/webrick
+/usr/lib/ruby/$(PKG_ABI_VERSION)/webrick.rb
+endef
+
+define Package/ruby-xmlrpc/files
+/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
+
+define Package/ruby-yaml/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/yaml
+/usr/lib/ruby/$(PKG_ABI_VERSION)/yaml.rb
+endef
+
+define Package/ruby-zlib/files
+/usr/lib/ruby/$(PKG_ABI_VERSION)/*/zlib.so
+endef
+
+RUBY_FILES = $(strip $(call Package/ruby-$(1)/files))
+RUBY_FILES_EXCLUDED = $(strip $(call Package/ruby-$(1)/files-excluded))
+
+# 1: short name
+# 2: install dir
+define RubyBuildPackage/install
+	( \
+	  cd $(PKG_INSTALL_DIR) && \
+	  $(TAR) -cf - \
+	    $(if $(RUBY_FILES_EXCLUDED),--exclude-from <(ls -1d $(patsubst /%,%,$(RUBY_FILES_EXCLUDED)))) \
+	    --files-from <(ls -1d $(patsubst /%,%,$(RUBY_FILES))) \
+	) | ( \
+	  [ -n "$(2)" ] && cd $(2) && $(TAR) -xf - \
+	)
+endef
+
+# 1: short name
+# 2: description
+# 3: dependencies on other packages
+define RubyBuildPackage
+  RUBY_STDLIB += $(1)
+
+  # Package definition
+  ifndef Package/ruby-$(1)
+    define Package/ruby-$(1)
+      $(call Package/ruby/Default)
+      TITLE:=Ruby $(2)
+      DEPENDS:=ruby $(3)
+    endef
+  endif
+
+  ifndef Package/ruby-$(1)/description
+    define Package/ruby-$(1)/description
+      This package contains the ruby $(2).
+
+    endef
+  endif
+
+  # Description
+  ifndef Package/ruby-$(1)/install
+    ifndef Package/ruby-$(1)/files
+       $$(error It must exists either a Package/ruby-$(1)/install or Package/ruby-$(1)/files)
+    endif
+
+    define Package/ruby-$(1)/description +=
+
+Provides:
+$(patsubst /%,
+ - /%,$(RUBY_FILES))
+
+    endef
+
+    ifneq ($(RUBY_FILES_EXCLUDED),)
+      define Package/ruby-$(1)/description +=
+
+Except:
+$(patsubst /%,
+ - /%,$(RUBY_FILES_EXCLUDED))
+
+      endef
+    endif
+
+    Package/ruby-$(1)/install=$(call RubyBuildPackage/install,$(1),$$(1))
+  endif
+
+  $$(eval $$(call BuildPackage,ruby-$(1)))
+endef
+
+$(eval $(call BuildPackage,libruby))
+$(eval $(call BuildPackage,ruby))
+$(eval $(call RubyBuildPackage,bigdecimal,Arbitrary-precision decimal floating-point library,))
+$(eval $(call RubyBuildPackage,cgi,CGI support toolkit,+ruby-filelib +ruby-pstore))
+$(eval $(call RubyBuildPackage,csv,CSV library,+ruby-patterns +ruby-datetime +ruby-enc +ruby-misc))
+$(eval $(call RubyBuildPackage,datetime,date library))
+$(eval $(call RubyBuildPackage,dbm,support for dbm,+libdb47))
+$(eval $(call RubyBuildPackage,debuglib,debug library,+ruby-prettyprint))
+$(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,drb,distributed object system,+ruby-filelib +ruby-patterns +ruby-socket))
+$(eval $(call RubyBuildPackage,enc,character re-coding library charset (small subset),))
+$(eval $(call RubyBuildPackage,enc-extra,character re-coding library charset (extra subset),+ruby-enc))
+$(eval $(call RubyBuildPackage,erb,(embedded interpreter),+ruby-cgi))
+$(eval $(call RubyBuildPackage,fiddle,libffi wrapper,+libffi))
+$(eval $(call RubyBuildPackage,filelib,file utils library,+ruby-enc +ruby-misc))
+$(eval $(call RubyBuildPackage,gdbm,support for gdbm,+libgdbm))
+$(eval $(call RubyBuildPackage,gems,gems packet management,+ruby-net +ruby-rdoc))
+$(eval $(call RubyBuildPackage,io-console,Console interface,))
+$(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,logger,logger and syslog library,+ruby-multithread))
+$(eval $(call RubyBuildPackage,math,math library,+ruby-patterns +ruby-misc))
+$(eval $(call RubyBuildPackage,minitest,Gem minitest,+ruby-gems))
+$(eval $(call RubyBuildPackage,misc,standard libraries subset (miscellaneous files),))
+$(eval $(call RubyBuildPackage,mkmf,makefile library,+ruby-filelib +ruby-optparse +ruby-rbconfig))
+$(eval $(call RubyBuildPackage,multithread,multithread library,+ruby-misc))
+$(eval $(call RubyBuildPackage,net,Network Protocols Library,+ruby-datetime +ruby-digest +ruby-filelib +ruby-uri))
+$(eval $(call RubyBuildPackage,net-telnet,telnet client,+ruby-net))
+$(eval $(call RubyBuildPackage,nkf,Network Kanji Filter,+ruby-enc))
+$(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,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,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,racc,LALR parser generator,))
+$(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,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,rexml,XML toolkit,+ruby-patterns +ruby-enc +ruby-misc))
+$(eval $(call RubyBuildPackage,rinda,Linda paradigm implementation,+ruby-drb))
+$(eval $(call RubyBuildPackage,ripper,script parser,))
+$(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,shell,idiomatic Ruby interface,+ruby-patterns +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-rexml +ruby-yaml))
+$(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,webrick,Web server toolkit,+ruby-erb +ruby-net +ruby-patterns +ruby-rbconfig))
+$(eval $(call RubyBuildPackage,xmlrpc,XML-RPC toolkit,+ruby-rexml +ruby-webrick))
+$(eval $(call RubyBuildPackage,yaml,YAML toolkit,+ruby-dbm +ruby-pstore +ruby-psych))
+$(eval $(call RubyBuildPackage,zlib,support for zlib,+zlib))
+$(eval $(call BuildPackage,ruby-stdlib))
+$(eval $(call HostBuild))

+ 91 - 0
libs/alsa-lib/Makefile

@@ -0,0 +1,91 @@
+#
+# Copyright (C) 2006-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:=alsa-lib
+PKG_VERSION:=1.1.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=ftp://ftp.alsa-project.org/pub/lib/ \
+		http://alsa.cybermirror.org/lib/
+PKG_MD5SUM:=69515ca73c3c4a212ef45160dea846c1
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>, \
+		Peter Wagner <tripolar@gmx.at>
+
+PKG_LICENSE:=LGPLv2.1 GPLv2
+PKG_LICENSE_FILES:=COPYING aserver/COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+PKG_USE_MIPS16:=0
+PKG_CHECK_FORMAT_SECURITY:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/alsa-lib
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=ALSA (Advanced Linux Sound Architecture) library
+  URL:=http://www.alsa-project.org/
+  DEPENDS:=@AUDIO_SUPPORT +kmod-sound-core +libpthread +librt
+endef
+
+define Package/alsa-lib/description
+ This is the library package for alsa, needed by some userspace programs.
+ You must have enabled the ALSA support in the kernel.
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+CONFIGURE_ARGS+= \
+		--disable-python \
+		--disable-debug \
+		--without-debug \
+		$(SOFT_FLOAT_CONFIG_OPTION) \
+		--with-versioned=no
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include/
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/include/alsa \
+		$(1)/usr/include/
+
+	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libasound.{la,so*} \
+		$(1)/usr/lib/
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/alsa.pc \
+		$(1)/usr/lib/pkgconfig/
+
+	$(INSTALL_DIR) $(1)/usr/share/aclocal
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/share/aclocal/alsa.m4 \
+		$(1)/usr/share/aclocal/
+endef
+
+define Package/alsa-lib/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libasound.so.* \
+		$(1)/usr/lib/
+
+	$(INSTALL_DIR) $(1)/usr/share/alsa/{cards,pcm}
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/share/alsa/alsa.conf \
+		$(1)/usr/share/alsa/
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/share/alsa/pcm/* \
+		$(1)/usr/share/alsa/pcm/
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/share/alsa/cards/* \
+		$(1)/usr/share/alsa/cards/
+endef
+
+$(eval $(call BuildPackage,alsa-lib))

+ 3 - 3
libs/gnutls/Makefile

@@ -8,13 +8,13 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=gnutls
-PKG_VERSION:=3.5.16
+PKG_VERSION:=3.5.11
 PKG_RELEASE:=1
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
-PKG_SOURCE_URL:=https://www.gnupg.org/ftp/gcrypt/gnutls/v3.5
-PKG_HASH:=0924dec90c37c05f49fec966eba3672dab4d336d879e5c06e06e13325cbfec25
+PKG_SOURCE_URL:=ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5
+PKG_HASH:=51765cc5579e250da77fbd7871507c517d01b15353cc40af7b67e9ec7b6fe28f
 #PKG_FIXUP:=autoreconf gettext-version
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
 PKG_LICENSE:=LGPLv2.1+

+ 106 - 0
libs/icu/Makefile

@@ -0,0 +1,106 @@
+#
+# Copyright (C) 2006-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:=icu4c
+PKG_VERSION:=58.2
+PKG_RELEASE:=2
+
+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_FILES:=LICENSE
+
+PKG_MAINTAINER:=Hirokazu MORIKAWA <morikw2@gmail.com>
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
+
+PKG_BUILD_DEPENDS:=icu/host
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/host-build.mk
+
+TAR_OPTIONS+= icu/source --strip-components 2
+TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
+
+define Package/icu
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=International Components for Unicode
+  URL:=http://icu-project.org
+  DEPENDS:=+libstdcpp +libpthread
+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
+	$(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 Host/install
+endef
+
+define Package/icu/install
+	$(INSTALL_DIR) \
+		$(1)/usr/lib
+
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/*.so.* \
+		$(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,icu))
+$(eval $(call HostBuild))

+ 10 - 0
libs/libradcli/Config.in

@@ -0,0 +1,10 @@
+# radcli avanced configuration
+
+menu "Configuration"
+	depends on PACKAGE_libradcli
+
+config RADCLI_TLS
+	bool "enable TLS support"
+	default y
+
+endmenu

+ 75 - 0
libs/libradcli/Makefile

@@ -0,0 +1,75 @@
+#
+# 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:=libradcli
+PKG_VERSION:=1.2.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=radcli-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/radcli/radcli/releases/download/$(PKG_VERSION)/
+PKG_MD5SUM:=b94e46e37668cc562ea5420d095a836b
+PKG_BUILD_DIR:=$(BUILD_DIR)/radcli-$(PKG_VERSION)
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libradcli
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=A library for radius clients
+  URL:=http://radcli.github.io/radcli/
+  MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
+  DEPENDS:= +RADCLI_TLS:libgnutls +libnettle
+endef
+
+define Package/libradcli/decription
+  The radcli library is a library for writing RADIUS Clients. The library's
+  approach is to allow writing RADIUS-aware application in less than 50 lines
+  of C code. It was based originally on freeradius-client and is source 
+  compatible with it.
+endef
+
+CONFIGURE_ARGS+= \
+	--enable-legacy-compat
+
+ifneq ($(CONFIG_RADCLI_TLS),y)
+CONFIGURE_ARGS += --without-tls
+endif
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/include/radcli
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/include/radcli/radcli.h \
+		$(PKG_INSTALL_DIR)/usr/include/radcli/version.h \
+		$(1)/usr/include/radcli
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/include/freeradius-client.h \
+		$(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libradcli.so* \
+		$(PKG_INSTALL_DIR)/usr/lib/libfreeradius-client.so \
+		$(1)/usr/lib/
+endef
+
+define Package/libradcli/conffiles
+/etc/radcli/radiusclient.conf
+endef
+
+define Package/libradcli/install
+	$(INSTALL_DIR) $(1)/etc/radcli
+	$(INSTALL_CONF) $(PKG_BUILD_DIR)/etc/radiusclient.conf $(1)/etc/radcli/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libradcli.so.* \
+		$(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libradcli))

+ 5 - 6
libs/libssh2/Makefile

@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2015-2018 OpenWrt.org
+# Copyright (C) 2015-2016 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -9,10 +9,10 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libssh2
 PKG_VERSION:=1.7.0
-PKG_RELEASE:=2
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
-PKG_SOURCE_URL:=https://www.libssh2.org/download
+PKG_SOURCE_URL:=http://www.libssh2.org/download
 PKG_MD5SUM:=b01662a210e94cccf2f76094db7dac5c
 
 PKG_INSTALL:=1
@@ -26,7 +26,7 @@ define Package/libssh2
   SECTION:=libs
   CATEGORY:=Libraries
   TITLE:=SSH2 library
-  URL:=https://www.libssh2.org/
+  URL:=http://www.libssh2.org/
   DEPENDS:=+libopenssl +zlib
   MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
 endef
@@ -39,8 +39,7 @@ TARGET_CFLAGS += $(FPIC)
 
 CONFIGURE_ARGS += \
 	--disable-examples-build \
-	--with-libssl-prefix=$(STAGING_DIR)/usr \
-	--with-libz-prefix=$(STAGING_DIR)/usr
+	--with-libssl-prefix=$(STAGING_DIR)/usr
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include

+ 2 - 2
libs/libtasn1/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=libtasn1
-PKG_VERSION:=4.12
+PKG_VERSION:=4.9
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
-PKG_HASH:=6753da2e621257f33f5b051cc114d417e5206a0818fe0b1ecfd6153f70934753
+PKG_MD5SUM:=4f6f7a8fd691ac2b8307c8ca365bad711db607d4ad5966f6938a9d2ecd65c920
 PKG_LICENSE:=LGPLv2.1+
 PKG_LICENSE_FILES:=COPYING.LIB
 

+ 152 - 0
libs/libxslt/Makefile

@@ -0,0 +1,152 @@
+#
+# 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:=libxslt
+PKG_VERSION:=1.1.28
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:= \
+	http://xmlsoft.org/sources/ \
+	ftp://fr.rpmfind.net/pub/libxml/
+PKG_MD5SUM:=9667bf6f9310b957254fdcf6596600b7
+
+PKG_LICENSE:=MIT
+PKG_LICENSE_FILES:=COPYING
+
+PKG_MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libxslt
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libxml2
+  TITLE:=Gnome XSLT library
+  URL:=http://xmlsoft.org/XSLT/
+endef
+
+define Package/libxslt/description
+ A library for XML transformation using XSLT.
+endef
+
+define Package/libexslt
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libxslt
+  TITLE:=Gnome XSLT library Extension
+  URL:=http://xmlsoft.org/XSLT/EXSLT/
+endef
+
+define Package/libexslt/description
+ An extension for XSLT.
+endef
+
+define Package/xsltproc
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libxml2 +libxslt +libexslt
+  TITLE:=Gnome XSLT xsltproc Utility
+  URL:=http://xmlsoft.org/XSLT/
+endef
+
+define Package/xsltproc/description
+ XSLT XML transformation utility.
+endef
+
+CONFIGURE_ARGS+= \
+	--enable-shared \
+	--enable-static \
+	--without-python \
+	--without-crypto \
+	--without-debug \
+	--without-mem-debug \
+	--without-debugger \
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/InstallDev/Xslt
+	$(INSTALL_DIR) $(1)/usr/bin $(2)/bin $(1)/usr/include/libxslt \
+		$(1)/usr/include/libexslt $(1)/usr/lib \
+		$(1)/usr/lib/pkgconfig $(2)/share/aclocal
+
+	$(INSTALL_BIN) \
+		$(PKG_INSTALL_DIR)/usr/bin/xslt-config \
+		$(2)/bin/
+
+	ln -sf $(STAGING_DIR)/host/bin/xslt-config $(1)/usr/bin/xslt-config
+
+	$(SED) \
+		's,^\(prefix\|exec_prefix\)=.*,\1=$(STAGING_DIR)/usr,g' \
+		$(2)/bin/xslt-config
+
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/include/libxslt/* \
+		$(1)/usr/include/libxslt/
+
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libxslt.{la,a,so*} \
+		$(1)/usr/lib/
+
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxslt.pc \
+		$(1)/usr/lib/pkgconfig/
+
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/share/aclocal/* \
+		$(2)/share/aclocal
+endef
+
+define Build/InstallDev/Exslt
+	$(INSTALL_DIR) $(1)/usr/include/libexslt $(1)/usr/lib/pkgconfig
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/include/libexslt/* \
+		$(1)/usr/include/libexslt/
+
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libexslt.{la,a,so*} \
+		$(1)/usr/lib/
+
+	$(INSTALL_DATA) \
+		$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libexslt.pc \
+		$(1)/usr/lib/pkgconfig/
+endef
+
+define Build/InstallDev
+	 $(if $(CONFIG_PACKAGE_libxslt),$(call Build/InstallDev/Xslt,$(1),$(2)))
+	 $(if $(CONFIG_PACKAGE_libexslt),$(call Build/InstallDev/Exslt,$(1),$(2)))
+endef
+
+define Package/libxslt/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libxslt.so.* \
+		$(1)/usr/lib/
+endef
+
+define Package/libexslt/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) \
+		$(PKG_INSTALL_DIR)/usr/lib/libexslt.so.* \
+		$(1)/usr/lib/
+endef
+
+define Package/xsltproc/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) \
+		$(PKG_INSTALL_DIR)/usr/bin/xsltproc \
+		$(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libxslt))
+$(eval $(call BuildPackage,libexslt))
+$(eval $(call BuildPackage,xsltproc))

+ 2 - 2
libs/openldap/Makefile

@@ -8,7 +8,7 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openldap
-PKG_VERSION:=2.4.45
+PKG_VERSION:=2.4.44
 PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
@@ -16,7 +16,7 @@ PKG_SOURCE_URL:=ftp://ftp.openldap.org/pub/OpenLDAP/openldap-release/ \
 	ftp://sunsite.cnlab-switch.ch/mirror/OpenLDAP/openldap-release/ \
 	ftp://ftp.nl.uu.net/pub/unix/db/openldap/openldap-release/ \
 	ftp://ftp.plig.org/pub/OpenLDAP/openldap-release/
-PKG_MD5SUM:=00ff8301277cdfd0af728a6927042a13
+PKG_MD5SUM:=693ac26de86231f8dcae2b4e9d768e51
 
 PKG_FIXUP:=autoreconf
 

+ 2 - 3
libs/p11-kit/Makefile

@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=p11-kit
 PKG_VERSION:=0.23.1
-PKG_RELEASE:=2
+PKG_RELEASE:=1
 PKG_MAINTAINER:=Nikos Mavrogiannopoulos <n.mavrogiannopoulos@gmail.com>
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
@@ -35,8 +35,7 @@ define Package/p11-kit/description
 endef
 
 CONFIGURE_ARGS+= \
-	--without-libffi \
-	--disable-trust-module
+	--without-libffi
 
 define Build/InstallDev
 	$(INSTALL_DIR) $(1)/usr/include/p11-kit-1/p11-kit/

+ 2 - 3
libs/pcre/Makefile

@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=pcre
-PKG_VERSION:=8.41
+PKG_VERSION:=8.40
 PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
-PKG_MD5SUM:=c160d22723b1670447341b08c58981c1
+PKG_MD5SUM:=41a842bf7dcecd6634219336e2167d1d
 PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
 
 PKG_LICENSE:=BSD-3-Clause
@@ -53,7 +53,6 @@ CONFIGURE_ARGS += \
 	--enable-utf8 \
 	--enable-unicode-properties \
 	--enable-pcre16 \
-	--with-match-limit-recursion=16000 \
 
 ifneq ($(CONFIG_PACKAGE_libpcrecpp),)
   CONFIGURE_ARGS+= --enable-cpp

+ 53 - 0
libs/pcre/patches/001-CVE-2017-7186

@@ -0,0 +1,53 @@
+#CVE-2017-7186 patch
+--- trunk/pcre_internal.h	2016/05/21 13:34:44	1649
++++ trunk/pcre_internal.h	2017/02/24 17:30:30	1688
+@@ -2772,6 +2772,9 @@
+ extern const pcre_uint16 PRIV(ucd_stage2)[];
+ extern const pcre_uint32 PRIV(ucp_gentype)[];
+ extern const pcre_uint32 PRIV(ucp_gbtable)[];
++#ifdef COMPILE_PCRE32
++extern const ucd_record  PRIV(dummy_ucd_record)[];
++#endif
+ #ifdef SUPPORT_JIT
+ extern const int         PRIV(ucp_typerange)[];
+ #endif
+@@ -2780,9 +2783,15 @@
+ /* UCD access macros */
+ 
+ #define UCD_BLOCK_SIZE 128
+-#define GET_UCD(ch) (PRIV(ucd_records) + \
++#define REAL_GET_UCD(ch) (PRIV(ucd_records) + \
+         PRIV(ucd_stage2)[PRIV(ucd_stage1)[(int)(ch) / UCD_BLOCK_SIZE] * \
+         UCD_BLOCK_SIZE + (int)(ch) % UCD_BLOCK_SIZE])
++        
++#ifdef COMPILE_PCRE32
++#define GET_UCD(ch) ((ch > 0x10ffff)? PRIV(dummy_ucd_record) : REAL_GET_UCD(ch))
++#else
++#define GET_UCD(ch) REAL_GET_UCD(ch)
++#endif 
+ 
+ #define UCD_CHARTYPE(ch)    GET_UCD(ch)->chartype
+ #define UCD_SCRIPT(ch)      GET_UCD(ch)->script
+--- trunk/pcre_ucd.c	2014/06/19 07:51:39	1490
++++ trunk/pcre_ucd.c	2017/02/24 17:30:30	1688
+@@ -38,6 +38,20 @@
+ const pcre_uint32 PRIV(ucd_caseless_sets)[] = {0};
+ #else
+ 
++/* If the 32-bit library is run in non-32-bit mode, character values
++greater than 0x10ffff may be encountered. For these we set up a
++special record. */
++
++#ifdef COMPILE_PCRE32
++const ucd_record PRIV(dummy_ucd_record)[] = {{
++  ucp_Common,    /* script */
++  ucp_Cn,        /* type unassigned */
++  ucp_gbOther,   /* grapheme break property */
++  0,             /* case set */
++  0,             /* other case */
++  }};
++#endif
++
+ /* When recompiling tables with a new Unicode version, please check the
+ types in this structure definition from pcre_internal.h (the actual
+ field names will be different):

+ 231 - 0
libs/postgresql/Makefile

@@ -0,0 +1,231 @@
+#
+# Copyright (C) 2006-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:=postgresql
+PKG_VERSION:=9.5.4
+PKG_RELEASE:=4
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=PostgreSQL
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=\
+	https://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
+	http://ftp.postgresql.org/pub/source/v$(PKG_VERSION) \
+	ftp://ftp.postgresql.org/pub/source/v$(PKG_VERSION)
+PKG_MD5SUM:=cf5e571164ad66028ecd7dd8819e3765470d45bcd440d258b686be7e69c76ed0
+PKG_BUILD_PARALLEL:=1
+PKG_USE_MIPS16:=0
+PKG_FIXUP:=autoreconf
+PKG_MACRO_PATHS:=config
+PKG_BUILD_DEPENDS += postgresql/host
+
+include $(INCLUDE_DIR)/host-build.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/libpq
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+zlib +libreadline +libpthread +libncursesw
+  TITLE:=PostgreSQL client library
+  URL:=http://www.postgresql.org/
+  SUBMENU:=database
+endef
+
+define Package/libpq/description
+PostgreSQL client library.
+endef
+
+define Package/pgsql-cli
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpq +librt
+  TITLE:=Command Line Interface (CLI) to PostgreSQL databases
+  URL:=http://www.postgresql.org/
+  SUBMENU:=database
+endef
+
+define Package/pgsql-cli/description
+Command Line Interface (CLI) to PostgreSQL databases.
+endef
+
+define Package/pgsql-cli-extra
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpq +librt
+  TITLE:=Command Line extras for PostgreSQL databases
+  URL:=http://www.postgresql.org/
+  SUBMENU:=database
+endef
+
+define Package/pgsql-cli-extra/description
+Command Line extras for PostgreSQL databases.
+endef
+
+define Package/pgsql-server
+  SECTION:=utils
+  CATEGORY:=Utilities
+  DEPENDS:=+libpq +librt +pgsql-cli
+  TITLE:=PostgreSQL databases Server
+  URL:=http://www.postgresql.org/
+  SUBMENU:=database
+  USERID:=postgres=5432:postgres=5432
+endef
+
+define Package/pgsql-server/description
+PostgreSQL databases Server.
+endef
+
+PGSQL_CLI_EXTRA_BIN := \
+	clusterdb	\
+	createdb	\
+	createlang	\
+	createuser	\
+	dropdb		\
+	droplang	\
+	dropuser	\
+	pgbench		\
+	reindexdb	\
+	vacuumdb
+
+PGSQL_CONFIG_VARS:= \
+	pgac_cv_snprintf_long_long_int_format="%lld" \
+	pgac_cv_snprintf_size_t_support=yes
+
+ifeq ($(CONFIG_USE_UCLIBC),y)
+# PostgreSQL does not build against uClibc with locales
+# enabled, due to an uClibc bug, see
+# http://lists.uclibc.org/pipermail/uclibc/2014-April/048326.html
+# so overwrite automatic detection and disable locale support
+PGSQL_CONFIG_VARS+= \
+		pgac_cv_type_locale_t=no
+endif
+
+TARGET_CONFIGURE_OPTS+=$(PGSQL_CONFIG_VARS)
+
+HOST_CONFIGURE_ARGS += \
+			$(DISABLE_NLS) \
+			--disable-rpath \
+			--without-bonjour \
+			--without-gssapi \
+			--without-ldap \
+			--without-openssl \
+			--without-pam \
+			--without-perl \
+			--without-python \
+			--without-readline \
+			--without-tcl \
+			--with-zlib="yes" \
+			--enable-depend
+
+CONFIGURE_ARGS += \
+			--disable-rpath \
+			--without-bonjour \
+			--without-gssapi \
+			--without-ldap \
+			--without-openssl \
+			--without-pam \
+			--without-perl \
+			--without-python \
+			--without-tcl \
+			--with-zlib="yes" \
+			--enable-depend \
+			$(if $(CONFIG_TARGET_avr32),--disable-spinlocks)
+
+# Need a native ecpg ,pg_config, and zic for build
+define Host/Compile
+	$(MAKE) -C $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc CC="$(HOSTCC)"
+	$(MAKE) -C $(HOST_BUILD_DIR)/src/timezone CC="$(HOSTCC)"
+	$(MAKE) -C $(HOST_BUILD_DIR)/src/bin/pg_config CC="$(HOSTCC)"
+endef
+
+define Host/Install
+	$(INSTALL_DIR) $(STAGING_DIR)/usr/bin/
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/bin/pg_config/pg_config $(STAGING_DIR)/usr/bin/
+	$(INSTALL_DIR) $(STAGING_DIR_HOSTPKG)/bin/
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/interfaces/ecpg/preproc/ecpg $(STAGING_DIR_HOSTPKG)/bin/
+	$(INSTALL_BIN) $(HOST_BUILD_DIR)/src/timezone/zic $(STAGING_DIR_HOSTPKG)/bin/
+endef
+
+define Build/Configure
+	$(Build/Configure/Default)
+	$(SED) 's@ECPG = ../../preproc/ecpg@ECPG = $(STAGING_DIR_HOSTPKG)/bin/ecpg@' $(PKG_BUILD_DIR)/src/interfaces/ecpg/test/Makefile.regress
+endef
+
+TARGET_CFLAGS += $(FPIC) -lpthread
+
+# because PROFILE means something else in the project Makefile
+unexport PROFILE
+
+define Build/Compile
+	+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		all
+	+$(MAKE) $(PKG_JOBS) -C "$(PKG_BUILD_DIR)" \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		install
+endef
+
+define Package/libpq/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.so.* $(1)/usr/lib/
+endef
+
+define Package/pgsql-cli/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/psql $(1)/usr/bin/
+endef
+
+define Package/pgsql-cli-extra/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(foreach bin,$(PGSQL_CLI_EXTRA_BIN),$(PKG_INSTALL_DIR)/usr/bin/$(bin)) $(1)/usr/bin/
+endef
+
+define Package/pgsql-server/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/pg_* $(PKG_INSTALL_DIR)/usr/bin/postgres \
+			$(PKG_INSTALL_DIR)/usr/bin/initdb $(1)/usr/bin/
+	ln -sf postgres $(1)/usr/bin/postmaster
+
+	$(INSTALL_DIR) $(1)/usr/share/postgresql
+	$(CP) $(PKG_INSTALL_DIR)/usr/share/postgresql/* \
+		$(1)/usr/share/postgresql
+
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/postgresql \
+		$(1)/usr/lib/
+
+	$(INSTALL_DIR) $(1)/lib/functions
+	$(INSTALL_BIN) ./files/postgresql.sh $(1)/lib/functions/
+
+	$(INSTALL_DIR) $(1)/etc/config
+	$(INSTALL_DATA) ./files/postgresql.config $(1)/etc/config/postgresql
+
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/postgresql.init $(1)/etc/init.d/postgresql
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_DIR) $(1)/usr/include
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/libpq $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/libpq-fe.h $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config.h $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_manual.h $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/postgres_ext.h $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/pg_config_ext.h $(1)/usr/include/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/postgresql $(1)/usr/include/
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libpq.{a,so*} $(1)/usr/lib/
+endef
+
+$(eval $(call HostBuild))
+$(eval $(call BuildPackage,libpq))
+$(eval $(call BuildPackage,pgsql-cli))
+$(eval $(call BuildPackage,pgsql-cli-extra))
+$(eval $(call BuildPackage,pgsql-server))

+ 4 - 7
libs/sqlite3/Makefile

@@ -1,5 +1,5 @@
 #
-# Copyright (C) 2006-2018 OpenWrt.org
+# Copyright (C) 2006-2014 OpenWrt.org
 #
 # This is free software, licensed under the GNU General Public License v2.
 # See /LICENSE for more information.
@@ -8,12 +8,12 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=sqlite
-PKG_VERSION:=3190300
-PKG_RELEASE:=2
+PKG_VERSION:=3160000
+PKG_RELEASE:=1
 
 PKG_SOURCE:=$(PKG_NAME)-autoconf-$(PKG_VERSION).tar.gz
-PKG_HASH:=06129c03dced9f87733a8cba408871bd60673b8f93b920ba8d815efab0a06301
 PKG_SOURCE_URL:=http://www.sqlite.org/2017/
+PKG_MD5SUM:=5102404047054b2cec2f43463293f94dea39425d42bf386d24596ab4fac7c7ff
 
 PKG_LICENSE:=PUBLICDOMAIN
 PKG_LICENSE_FILES:=
@@ -68,9 +68,6 @@ $(call Package/sqlite3/Default/description)
  formats.
 endef
 
-# On uClibc libm needs to be linked in for ISNAN()
-TARGET_LDFLAGS += $(if $(CONFIG_USE_UCLIBC),-lm)
-
 TARGET_CFLAGS += $(FPIC) \
 	-DSQLITE_ENABLE_UNLOCK_NOTIFY=1 \
 	-DHAVE_ISNAN=1 \

+ 109 - 0
libs/tiff/Makefile

@@ -0,0 +1,109 @@
+#
+# Copyright (C) 2006-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:=tiff
+PKG_VERSION:=4.0.6
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://download.osgeo.org/libtiff
+PKG_MD5SUM:=d1d2e940dea0b5ad435f21f03d96dd72
+
+PKG_FIXUP:=autoreconf
+PKG_REMOVE_FILES:=autogen.sh aclocal.m4
+
+PKG_LICENSE:=BSD
+PKG_LICENSE_FILES:=COPYRIGHT
+
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_libtiffxx
+
+include $(INCLUDE_DIR)/uclibc++.mk
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tiff/Default
+  TITLE:=TIFF
+  URL:=http://www.remotesensing.org/libtiff/
+  MAINTAINER:=Jiri Slachta <jiri@slachta.eu>
+endef
+
+define Package/libtiff
+$(call Package/tiff/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+  DEPENDS:=+zlib +libjpeg
+endef
+
+define Package/libtiffxx
+$(call Package/tiff/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library(c++ bindings)
+  DEPENDS:=+libtiff $(CXX_DEPENDS)
+endef
+
+define Package/tiff-utils
+$(call Package/tiff/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  SUBMENU:=Image Manipulation
+  TITLE+= utilities
+  DEPENDS:=+libtiff
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+define Build/Configure
+	$(call Build/Configure/Default, \
+		$(if $(CONFIG_PACKAGE_libtiffxx), \
+			--enable-cxx, \
+			--disable-cxx \
+		) \
+		--disable-lzma \
+		--enable-ccitt \
+		--enable-packbits \
+		--enable-lzw \
+		--enable-thunder \
+		--enable-next \
+		--enable-logluv \
+		--enable-mdi \
+		--enable-zlib \
+		--enable-jpeg \
+		--disable-old-jpeg \
+		--disable-jbig \
+		--without-x \
+	)
+endef
+
+define Build/InstallDev
+	$(INSTALL_DIR) $(1)/usr/{lib,include}
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/lib* $(1)/usr/lib/
+	$(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
+endef
+
+define Package/libtiff/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiff.so.* $(1)/usr/lib/
+endef
+
+define Package/libtiffxx/install
+	$(INSTALL_DIR) $(1)/usr/lib
+	$(CP) $(PKG_INSTALL_DIR)/usr/lib/libtiffxx.so.* $(1)/usr/lib/
+endef
+
+define Package/tiff-utils/install
+	$(INSTALL_DIR) $(1)/usr/bin
+	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,libtiff))
+$(eval $(call BuildPackage,libtiffxx))
+$(eval $(call BuildPackage,tiff-utils))

+ 33 - 0
libs/tiff/patches/001-autoconf-compat.patch

@@ -0,0 +1,33 @@
+diff -rupN tiff-4.0.6/Makefile.am tiff-new/Makefile.am
+--- tiff-4.0.6/Makefile.am	2015-09-06 21:30:46.179705536 +0200
++++ tiff-new/Makefile.am	2016-04-05 14:26:09.539194844 +0200
+@@ -25,7 +25,7 @@
+ 
+ docdir = $(LIBTIFF_DOCDIR)
+ 
+-AUTOMAKE_OPTIONS = 1.12 dist-zip foreign
++AUTOMAKE_OPTIONS = dist-zip foreign
+ ACLOCAL_AMFLAGS = -I m4
+ 
+ docfiles = \
+@@ -61,7 +61,7 @@ distcheck-hook:
+ 	rm -rf $(distdir)/_build/cmake
+ 	rm -rf $(distdir)/_inst/cmake
+ 
+-SUBDIRS = port libtiff tools build contrib test man html
++SUBDIRS = port libtiff tools build contrib
+ 
+ release:
+ 	(rm -f $(top_srcdir)/RELEASE-DATE && echo $(LIBTIFF_RELEASE_DATE) > $(top_srcdir)/RELEASE-DATE)
+diff -rupN tiff-4.0.6/test/Makefile.am tiff-new/test/Makefile.am
+--- tiff-4.0.6/test/Makefile.am	2015-09-01 04:41:07.598381354 +0200
++++ tiff-new/test/Makefile.am	2016-04-05 14:26:39.763453075 +0200
+@@ -23,7 +23,7 @@
+ 
+ # Process this file with automake to produce Makefile.in.
+ 
+-AUTOMAKE_OPTIONS = 1.12 color-tests parallel-tests foreign
++AUTOMAKE_OPTIONS = color-tests parallel-tests foreign
+ 
+ LIBTIFF = $(top_builddir)/libtiff/libtiff.la
+ 

+ 136 - 0
libs/tiff/patches/002-CVE-2015-8665_and_CVE-2015-8683.patch

@@ -0,0 +1,136 @@
+From f3f0cad770593eaef0766e5be896a6a034fc6313 Mon Sep 17 00:00:00 2001
+From: erouault <erouault>
+Date: Sat, 26 Dec 2015 17:32:03 +0000
+Subject: [PATCH] * libtiff/tif_getimage.c: fix out-of-bound reads in
+ TIFFRGBAImage interface in case of unsupported values of
+ SamplesPerPixel/ExtraSamples for LogLUV / CIELab. Add explicit call to
+ TIFFRGBAImageOK() in TIFFRGBAImageBegin(). Fix CVE-2015-8665 reported by
+ limingxing and CVE-2015-8683 reported by zzf of Alibaba.
+
+---
+ ChangeLog              |  8 ++++++++
+ libtiff/tif_getimage.c | 37 +++++++++++++++++++++++--------------
+ 2 files changed, 31 insertions(+), 14 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index a7d283a..4beb30b 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,11 @@
++2015-12-26  Even Rouault <even.rouault at spatialys.com>
++
++	* libtiff/tif_getimage.c: fix out-of-bound reads in TIFFRGBAImage
++	interface in case of unsupported values of SamplesPerPixel/ExtraSamples
++	for LogLUV / CIELab. Add explicit call to TIFFRGBAImageOK() in
++	TIFFRGBAImageBegin(). Fix CVE-2015-8665 reported by limingxing and
++	CVE-2015-8683 reported by zzf of Alibaba.
++
+ 2015-09-12  Bob Friesenhahn  <bfriesen@simple.dallas.tx.us>
+ 
+ 	* libtiff 4.0.6 released.
+diff --git a/libtiff/tif_getimage.c b/libtiff/tif_getimage.c
+index fd0a4f9..fae1e31 100644
+--- a/libtiff/tif_getimage.c
++++ b/libtiff/tif_getimage.c
+@@ -1,4 +1,4 @@
+-/* $Id: tif_getimage.c,v 1.90 2015-06-17 01:34:08 bfriesen Exp $ */
++/* $Id: tif_getimage.c,v 1.94 2015-12-26 17:32:03 erouault Exp $ */
+ 
+ /*
+  * Copyright (c) 1991-1997 Sam Leffler
+@@ -182,20 +182,22 @@ TIFFRGBAImageOK(TIFF* tif, char emsg[1024])
+ 				    "Planarconfiguration", td->td_planarconfig);
+ 				return (0);
+ 			}
+-			if( td->td_samplesperpixel != 3 )
++			if( td->td_samplesperpixel != 3 || colorchannels != 3 )
+             {
+                 sprintf(emsg,
+-                        "Sorry, can not handle image with %s=%d",
+-                        "Samples/pixel", td->td_samplesperpixel);
++                        "Sorry, can not handle image with %s=%d, %s=%d",
++                        "Samples/pixel", td->td_samplesperpixel,
++                        "colorchannels", colorchannels);
+                 return 0;
+             }
+ 			break;
+ 		case PHOTOMETRIC_CIELAB:
+-            if( td->td_samplesperpixel != 3 || td->td_bitspersample != 8 )
++            if( td->td_samplesperpixel != 3 || colorchannels != 3 || td->td_bitspersample != 8 )
+             {
+                 sprintf(emsg,
+-                        "Sorry, can not handle image with %s=%d and %s=%d",
++                        "Sorry, can not handle image with %s=%d, %s=%d and %s=%d",
+                         "Samples/pixel", td->td_samplesperpixel,
++                        "colorchannels", colorchannels,
+                         "Bits/sample", td->td_bitspersample);
+                 return 0;
+             }
+@@ -255,6 +257,9 @@ TIFFRGBAImageBegin(TIFFRGBAImage* img, TIFF* tif, int stop, char emsg[1024])
+ 	int colorchannels;
+ 	uint16 *red_orig, *green_orig, *blue_orig;
+ 	int n_color;
++	
++	if( !TIFFRGBAImageOK(tif, emsg) )
++		return 0;
+ 
+ 	/* Initialize to normal values */
+ 	img->row_offset = 0;
+@@ -2508,29 +2513,33 @@ PickContigCase(TIFFRGBAImage* img)
+ 		case PHOTOMETRIC_RGB:
+ 			switch (img->bitspersample) {
+ 				case 8:
+-					if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
++					if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
++						img->samplesperpixel >= 4)
+ 						img->put.contig = putRGBAAcontig8bittile;
+-					else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
++					else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
++							 img->samplesperpixel >= 4)
+ 					{
+ 						if (BuildMapUaToAa(img))
+ 							img->put.contig = putRGBUAcontig8bittile;
+ 					}
+-					else
++					else if( img->samplesperpixel >= 3 )
+ 						img->put.contig = putRGBcontig8bittile;
+ 					break;
+ 				case 16:
+-					if (img->alpha == EXTRASAMPLE_ASSOCALPHA)
++					if (img->alpha == EXTRASAMPLE_ASSOCALPHA &&
++						img->samplesperpixel >=4 )
+ 					{
+ 						if (BuildMapBitdepth16To8(img))
+ 							img->put.contig = putRGBAAcontig16bittile;
+ 					}
+-					else if (img->alpha == EXTRASAMPLE_UNASSALPHA)
++					else if (img->alpha == EXTRASAMPLE_UNASSALPHA &&
++							 img->samplesperpixel >=4 )
+ 					{
+ 						if (BuildMapBitdepth16To8(img) &&
+ 						    BuildMapUaToAa(img))
+ 							img->put.contig = putRGBUAcontig16bittile;
+ 					}
+-					else
++					else if( img->samplesperpixel >=3 )
+ 					{
+ 						if (BuildMapBitdepth16To8(img))
+ 							img->put.contig = putRGBcontig16bittile;
+@@ -2539,7 +2548,7 @@ PickContigCase(TIFFRGBAImage* img)
+ 			}
+ 			break;
+ 		case PHOTOMETRIC_SEPARATED:
+-			if (buildMap(img)) {
++			if (img->samplesperpixel >=4 && buildMap(img)) {
+ 				if (img->bitspersample == 8) {
+ 					if (!img->Map)
+ 						img->put.contig = putRGBcontig8bitCMYKtile;
+@@ -2635,7 +2644,7 @@ PickContigCase(TIFFRGBAImage* img)
+ 			}
+ 			break;
+ 		case PHOTOMETRIC_CIELAB:
+-			if (buildMap(img)) {
++			if (img->samplesperpixel == 3 && buildMap(img)) {
+ 				if (img->bitspersample == 8)
+ 					img->put.contig = initCIELabConversion(img);
+ 				break;

+ 193 - 0
libs/tiff/patches/003-fix_potential_out-of-bound_writes_in_decode_functions.patch

@@ -0,0 +1,193 @@
+From 3899f0ab62dd307f63f87ec99aaf289e104f4070 Mon Sep 17 00:00:00 2001
+From: erouault <erouault>
+Date: Sun, 27 Dec 2015 16:25:11 +0000
+Subject: [PATCH] * libtiff/tif_luv.c: fix potential out-of-bound writes in
+ decode functions in non debug builds by replacing assert()s by regular if
+ checks (bugzilla #2522). Fix potential out-of-bound reads in case of short
+ input data.
+
+---
+ ChangeLog         |  7 +++++++
+ libtiff/tif_luv.c | 57 +++++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 52 insertions(+), 12 deletions(-)
+
+diff --git a/ChangeLog b/ChangeLog
+index 4beb30b..b8aa23c 100644
+--- a/ChangeLog
++++ b/ChangeLog
+@@ -1,3 +1,10 @@
++2015-12-27  Even Rouault <even.rouault at spatialys.com>
++
++	* libtiff/tif_luv.c: fix potential out-of-bound writes in decode
++	functions in non debug builds by replacing assert()s by regular if
++	checks (bugzilla #2522).
++	Fix potential out-of-bound reads in case of short input data.
++
+ 2015-12-26  Even Rouault <even.rouault at spatialys.com>
+ 
+ 	* libtiff/tif_getimage.c: fix out-of-bound reads in TIFFRGBAImage
+diff --git a/libtiff/tif_luv.c b/libtiff/tif_luv.c
+index 4e328ba..60a174d 100644
+--- a/libtiff/tif_luv.c
++++ b/libtiff/tif_luv.c
+@@ -1,4 +1,4 @@
+-/* $Id: tif_luv.c,v 1.40 2015-06-21 01:09:09 bfriesen Exp $ */
++/* $Id: tif_luv.c,v 1.41 2015-12-27 16:25:11 erouault Exp $ */
+ 
+ /*
+  * Copyright (c) 1997 Greg Ward Larson
+@@ -202,7 +202,11 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 	if (sp->user_datafmt == SGILOGDATAFMT_16BIT)
+ 		tp = (int16*) op;
+ 	else {
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");
++			return (0);
++		}
+ 		tp = (int16*) sp->tbuf;
+ 	}
+ 	_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
+@@ -211,9 +215,11 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 	cc = tif->tif_rawcc;
+ 	/* get each byte string */
+ 	for (shft = 2*8; (shft -= 8) >= 0; ) {
+-		for (i = 0; i < npixels && cc > 0; )
++		for (i = 0; i < npixels && cc > 0; ) {
+ 			if (*bp >= 128) {		/* run */
+-				rc = *bp++ + (2-128);   /* TODO: potential input buffer overrun when decoding corrupt or truncated data */
++				if( cc < 2 )
++					break;
++				rc = *bp++ + (2-128);
+ 				b = (int16)(*bp++ << shft);
+ 				cc -= 2;
+ 				while (rc-- && i < npixels)
+@@ -223,6 +229,7 @@ LogL16Decode(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 				while (--cc && rc-- && i < npixels)
+ 					tp[i++] |= (int16)*bp++ << shft;
+ 			}
++		}
+ 		if (i != npixels) {
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
+ 			TIFFErrorExt(tif->tif_clientdata, module,
+@@ -268,13 +275,17 @@ LogLuvDecode24(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+ 		tp = (uint32 *)op;
+ 	else {
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");
++			return (0);
++		}
+ 		tp = (uint32 *) sp->tbuf;
+ 	}
+ 	/* copy to array of uint32 */
+ 	bp = (unsigned char*) tif->tif_rawcp;
+ 	cc = tif->tif_rawcc;
+-	for (i = 0; i < npixels && cc > 0; i++) {
++	for (i = 0; i < npixels && cc >= 3; i++) {
+ 		tp[i] = bp[0] << 16 | bp[1] << 8 | bp[2];
+ 		bp += 3;
+ 		cc -= 3;
+@@ -325,7 +336,11 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 	if (sp->user_datafmt == SGILOGDATAFMT_RAW)
+ 		tp = (uint32*) op;
+ 	else {
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");
++			return (0);
++		}
+ 		tp = (uint32*) sp->tbuf;
+ 	}
+ 	_TIFFmemset((void*) tp, 0, npixels*sizeof (tp[0]));
+@@ -334,11 +349,13 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 	cc = tif->tif_rawcc;
+ 	/* get each byte string */
+ 	for (shft = 4*8; (shft -= 8) >= 0; ) {
+-		for (i = 0; i < npixels && cc > 0; )
++		for (i = 0; i < npixels && cc > 0; ) {
+ 			if (*bp >= 128) {		/* run */
++				if( cc < 2 )
++					break;
+ 				rc = *bp++ + (2-128);
+ 				b = (uint32)*bp++ << shft;
+-				cc -= 2;                /* TODO: potential input buffer overrun when decoding corrupt or truncated data */
++				cc -= 2;
+ 				while (rc-- && i < npixels)
+ 					tp[i++] |= b;
+ 			} else {			/* non-run */
+@@ -346,6 +363,7 @@ LogLuvDecode32(TIFF* tif, uint8* op, tmsize_t occ, uint16 s)
+ 				while (--cc && rc-- && i < npixels)
+ 					tp[i++] |= (uint32)*bp++ << shft;
+ 			}
++		}
+ 		if (i != npixels) {
+ #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__))
+ 			TIFFErrorExt(tif->tif_clientdata, module,
+@@ -413,6 +431,7 @@ LogLuvDecodeTile(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ static int
+ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ {
++	static const char module[] = "LogL16Encode";
+ 	LogLuvState* sp = EncoderState(tif);
+ 	int shft;
+ 	tmsize_t i;
+@@ -433,7 +452,11 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ 		tp = (int16*) bp;
+ 	else {
+ 		tp = (int16*) sp->tbuf;
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");
++			return (0);
++		}
+ 		(*sp->tfunc)(sp, bp, npixels);
+ 	}
+ 	/* compress each byte string */
+@@ -506,6 +529,7 @@ LogL16Encode(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ static int
+ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ {
++	static const char module[] = "LogLuvEncode24";
+ 	LogLuvState* sp = EncoderState(tif);
+ 	tmsize_t i;
+ 	tmsize_t npixels;
+@@ -521,7 +545,11 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ 		tp = (uint32*) bp;
+ 	else {
+ 		tp = (uint32*) sp->tbuf;
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");
++			return (0);
++		}
+ 		(*sp->tfunc)(sp, bp, npixels);
+ 	}
+ 	/* write out encoded pixels */
+@@ -553,6 +581,7 @@ LogLuvEncode24(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ static int
+ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ {
++	static const char module[] = "LogLuvEncode32";
+ 	LogLuvState* sp = EncoderState(tif);
+ 	int shft;
+ 	tmsize_t i;
+@@ -574,7 +603,11 @@ LogLuvEncode32(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s)
+ 		tp = (uint32*) bp;
+ 	else {
+ 		tp = (uint32*) sp->tbuf;
+-		assert(sp->tbuflen >= npixels);
++		if(sp->tbuflen < npixels) {
++			TIFFErrorExt(tif->tif_clientdata, module,
++						 "Translation buffer too short");