Push of various packages from upstream feed.
authornynex <nynex>
Wed, 29 Jul 2015 06:53:04 +0000 (06:53 +0000)
committernynex <nynex>
Wed, 29 Jul 2015 06:53:04 +0000 (06:53 +0000)
194 files changed:
trunk/package/admin/debootstrap/Makefile [new file with mode: 0644]
trunk/package/admin/debootstrap/files/pkgdetails.c [new file with mode: 0644]
trunk/package/admin/debootstrap/patches/100-busybox_fix.patch [new file with mode: 0644]
trunk/package/admin/htop/Makefile [new file with mode: 0644]
trunk/package/admin/monit/Makefile [new file with mode: 0644]
trunk/package/admin/monit/files/monit.init [new file with mode: 0644]
trunk/package/admin/monit/patches/001-fix-default-piddir.patch [new file with mode: 0644]
trunk/package/admin/muninlite/Makefile [new file with mode: 0644]
trunk/package/admin/muninlite/files/etc/xinetd.d/munin [new file with mode: 0644]
trunk/package/admin/muninlite/patches/001-no_disks.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/002-hostname.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/100-fix-no-ethtool.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/110-fix-uptime-days.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/200-add-tap-dev.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/210-add-bridge-devs.patch [new file with mode: 0644]
trunk/package/admin/muninlite/patches/220-modify-ifname-parser.patch [new file with mode: 0644]
trunk/package/admin/sudo/Makefile [new file with mode: 0644]
trunk/package/admin/sudo/files/sudo.init [new file with mode: 0755]
trunk/package/admin/sudo/patches/010-cross-compile-fixes.patch [new file with mode: 0644]
trunk/package/admin/sudo/patches/020-no-owner-change.patch [new file with mode: 0644]
trunk/package/admin/zabbix/Makefile [new file with mode: 0644]
trunk/package/admin/zabbix/files/mac80211 [new file with mode: 0644]
trunk/package/admin/zabbix/files/network [new file with mode: 0644]
trunk/package/admin/zabbix/files/wifi [new file with mode: 0644]
trunk/package/admin/zabbix/files/zabbix_agentd.init [new file with mode: 0755]
trunk/package/admin/zabbix/files/zabbix_helper_mac80211.c [new file with mode: 0644]
trunk/package/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch [new file with mode: 0644]
trunk/package/admin/zabbix/patches/002-uclibc_loadavg.patch [new file with mode: 0644]
trunk/package/admin/zabbix/patches/010-change-agentd-config.patch [new file with mode: 0644]
trunk/package/admin/zabbix/patches/015-daemon-foreground.patch [new file with mode: 0644]
trunk/package/admin/zabbix/patches/100-musl-compat.patch [new file with mode: 0644]
trunk/package/devel/diffutils/Makefile [new file with mode: 0644]
trunk/package/devel/gcc/Makefile [new file with mode: 0644]
trunk/package/devel/gcc/README [new file with mode: 0644]
trunk/package/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/003-mpfr-longlong-mips.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/010-documentation.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/020-disable-check-for-sys-sdt-h.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/100-uclibc-conf.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/200-musl.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/810-arm-softfloat-libgcc.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/820-libgcc_pic.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/830-arm_unbreak_armv4t.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/850-use_shared_libgcc.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/860-uclibc_use_eh_frame.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/870-ppc_no_crtsavres.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/880-no_java_section.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/900-bad-mips16-crt.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/910-mbsd_multi.patch [new file with mode: 0644]
trunk/package/devel/gcc/patches/920-specs_nonfatal_getenv.patch [new file with mode: 0644]
trunk/package/devel/lttng-modules/Makefile [new file with mode: 0644]
trunk/package/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch [new file with mode: 0644]
trunk/package/devel/lttng-tools/Makefile [new file with mode: 0644]
trunk/package/devel/patch/Makefile [new file with mode: 0644]
trunk/package/libs/libftdi/Makefile [new file with mode: 0644]
trunk/package/libs/libftdi/patches/100-fix-x86_64-build.patch [new file with mode: 0644]
trunk/package/libs/libftdi/patches/101-fix-cmake-version-packagekit.patch [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/Makefile [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/controller/lxc.lua [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/lxc.config [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/model/cbi/lxc.lua [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/view/lxc.htm [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/purple.gif [new file with mode: 0644]
trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/red.gif [new file with mode: 0644]
trunk/package/luci/modules/luci-base/src/po2lmo [new file with mode: 0755]
trunk/package/luci/modules/luci-base/src/po2lmo.o [new file with mode: 0644]
trunk/package/luci/modules/luci-base/src/template_lmo.o [new file with mode: 0644]
trunk/package/mail/alpine/Makefile [new file with mode: 0644]
trunk/package/mail/alpine/patches/100-no-openssl-check-cross-compile.patch [new file with mode: 0644]
trunk/package/mail/bogofilter/Makefile [new file with mode: 0644]
trunk/package/mail/bogofilter/files/postfix-bogofilter [new file with mode: 0755]
trunk/package/mail/dovecot/Makefile [new file with mode: 0644]
trunk/package/mail/dovecot/files/dovecot.init [new file with mode: 0644]
trunk/package/mail/dovecot/patches/001-configure_in.patch [new file with mode: 0644]
trunk/package/mail/fdm/Config.in [new file with mode: 0644]
trunk/package/mail/fdm/Makefile [new file with mode: 0644]
trunk/package/mail/fdm/files/etc/fdm.conf [new file with mode: 0644]
trunk/package/mail/fdm/patches/001-base64-fix.patch [new file with mode: 0644]
trunk/package/mail/fdm/patches/002-base64-fix.patch [new file with mode: 0644]
trunk/package/mail/fdm/src/compat/b64_ntop.c [new file with mode: 0644]
trunk/package/mail/fdm/src/compat/b64_pton.c [new file with mode: 0644]
trunk/package/mail/mailman/Makefile [new file with mode: 0644]
trunk/package/mail/mailman/files/mailman.init [new file with mode: 0644]
trunk/package/mail/mailman/patches/100-postfix.patch [new file with mode: 0644]
trunk/package/mail/mailman/patches/200-nohostdnspython.patch [new file with mode: 0644]
trunk/package/mail/mailman/patches/300-targetpython.patch [new file with mode: 0644]
trunk/package/mail/mailman/patches/400-modules.patch [new file with mode: 0644]
trunk/package/mail/mailsend/Makefile [new file with mode: 0644]
trunk/package/mail/msmtp/Makefile [new file with mode: 0644]
trunk/package/mail/nail/Makefile [new file with mode: 0644]
trunk/package/mail/nail/patches/100-handle-openssl-without-sslv2.patch [new file with mode: 0644]
trunk/package/mail/postfix/Makefile [new file with mode: 0644]
trunk/package/mail/postfix/files/main.cf.default [new file with mode: 0644]
trunk/package/mail/postfix/files/postfix.init [new file with mode: 0644]
trunk/package/mail/postfix/patches/100-fsstat.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/200-manpages.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/300-bdb_hash_segfault.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/400-cdb.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/500-crosscompile.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/600-nopostconf.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/700-defaultconfig.patch [new file with mode: 0644]
trunk/package/mail/postfix/patches/800-fmt.patch [new file with mode: 0644]
trunk/package/mail/ssmtp/Makefile [new file with mode: 0644]
trunk/package/mail/ssmtp/patches/002-fix_pointer.patch [new file with mode: 0644]
trunk/package/network/services/git/Makefile [new file with mode: 0644]
trunk/package/network/services/git/patches/100-convert_builtin.patch [new file with mode: 0644]
trunk/package/network/services/git/patches/200-disable_fasthash.patch [new file with mode: 0644]
trunk/package/network/services/git/patches/300-configure_for_crosscompiling [new file with mode: 0644]
trunk/package/network/services/git/patches/400-imapsend_without_curl.patch [new file with mode: 0644]
trunk/package/network/services/gnunet/Makefile [new file with mode: 0644]
trunk/package/network/services/gnunet/files/gnunet.init [new file with mode: 0644]
trunk/package/network/services/gnunet/files/gnunet.upgrade [new file with mode: 0644]
trunk/package/network/services/lighttpd/Makefile [new file with mode: 0644]
trunk/package/network/services/lighttpd/files/lighttpd.conf [new file with mode: 0644]
trunk/package/network/services/lighttpd/files/lighttpd.init [new file with mode: 0644]
trunk/package/network/services/miniupnpc/Makefile [new file with mode: 0644]
trunk/package/network/services/miniupnpc/patches/100-no_minixml_test.patch [new file with mode: 0644]
trunk/package/network/services/miniupnpc/patches/200-miniupnpc_desc.patch [new file with mode: 0644]
trunk/package/network/services/nginx/Config.in [new file with mode: 0644]
trunk/package/network/services/nginx/Makefile [new file with mode: 0644]
trunk/package/network/services/nginx/files/nginx.init [new file with mode: 0644]
trunk/package/network/services/nginx/files/nginx.proxyprotocol.example [new file with mode: 0644]
trunk/package/network/services/nginx/files/nginx.syslog.example [new file with mode: 0644]
trunk/package/network/services/nginx/patches-lua-nginx/300-ldl.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches-nginx-upstream-check/check_1.2.6+.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/100-musl-no-sysctl.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/101-feature_test_fix.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/102-sizeof_test_fix.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/103-sys_nerr.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/200-config.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/300-crosscompile_ccflags.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/400-nginx-1.4.x_proxy_protocol_patch_v2.patch [new file with mode: 0644]
trunk/package/network/services/nginx/patches/401-nginx-1.4.0-syslog.patch [new file with mode: 0644]
trunk/package/network/services/opentracker/Makefile [new file with mode: 0644]
trunk/package/network/services/opentracker/files/opentracker.init [new file with mode: 0755]
trunk/package/network/services/opentracker/files/opentracker6.init [new file with mode: 0755]
trunk/package/network/services/opentracker/patches/100-makefile.patch [new file with mode: 0644]
trunk/package/network/services/seafile-ccnet/Makefile [new file with mode: 0644]
trunk/package/network/services/seafile-seahub/Makefile [new file with mode: 0644]
trunk/package/network/services/seafile-seahub/patches/010-default-config.patch [new file with mode: 0644]
trunk/package/network/services/seafile-server/Makefile [new file with mode: 0644]
trunk/package/network/services/seafile-server/files/seafile.conf [new file with mode: 0644]
trunk/package/network/services/seafile-server/files/seafile.init [new file with mode: 0755]
trunk/package/network/services/seafile-server/patches/020-script-patches.patch [new file with mode: 0644]
trunk/package/network/services/seafile-server/patches/030-pidfiles-in-same-directory.patch [new file with mode: 0644]
trunk/package/network/services/seafile-server/patches/040-seafile-admin.patch [new file with mode: 0644]
trunk/package/network/services/seafile-server/patches/050-libevhtp-search-path-fix.patch [new file with mode: 0644]
trunk/package/network/services/tor/Makefile [new file with mode: 0644]
trunk/package/network/services/tor/files/tor.init [new file with mode: 0644]
trunk/package/network/services/tor/patches/001-torrc.patch [new file with mode: 0644]
trunk/package/network/services/xinetd/Makefile [new file with mode: 0644]
trunk/package/network/services/xinetd/files/xinetd.conf [new file with mode: 0644]
trunk/package/network/services/xinetd/files/xinetd.init [new file with mode: 0644]
trunk/package/network/services/xinetd/patches/001-ar.patch [new file with mode: 0644]
trunk/package/network/services/xinetd/patches/002-destdir.patch [new file with mode: 0644]
trunk/package/network/services/xinetd/patches/003-rpc_fix.patch [new file with mode: 0644]
trunk/package/network/services/xinetd/patches/004-ident-bind.patch [new file with mode: 0644]
trunk/package/network/utils/mtr/Makefile [new file with mode: 0644]
trunk/package/network/utils/mtr/patches/100-disabled-ipv6-fix.patch [new file with mode: 0644]
trunk/package/network/utils/netcat/Makefile [new file with mode: 0644]
trunk/package/network/utils/netcat/patches/001-netcat_flag_count.patch [new file with mode: 0644]
trunk/package/network/utils/nmap/Makefile [new file with mode: 0644]
trunk/package/network/utils/rsync/Config.in [new file with mode: 0644]
trunk/package/network/utils/rsync/Makefile [new file with mode: 0644]
trunk/package/network/utils/rsync/files/rsyncd.conf [new file with mode: 0644]
trunk/package/network/utils/rsync/files/rsyncd.init [new file with mode: 0644]
trunk/package/network/utils/rsync/patches/000-CVE-2014-9512.patch [new file with mode: 0644]
trunk/package/network/utils/wget/Makefile [new file with mode: 0644]
trunk/package/utils/ccrypt/Makefile [new file with mode: 0644]
trunk/package/utils/ccrypt/patches/001-no-intl.patch [new file with mode: 0644]
trunk/package/utils/coreutils/Makefile [new file with mode: 0644]
trunk/package/utils/coreutils/patches/001-no_docs_man_tests.patch [new file with mode: 0644]
trunk/package/utils/coreutils/patches/002-fix_compile_with_uclibc.patch [new file with mode: 0644]
trunk/package/utils/flashrom/Config.in [new file with mode: 0644]
trunk/package/utils/flashrom/Makefile [new file with mode: 0644]
trunk/package/utils/flashrom/flashrom.mk [new file with mode: 0644]
trunk/package/utils/flashrom/patches/0001-fix_internal_bitbang.patch [new file with mode: 0644]
trunk/package/utils/flashrom/patches/0002-fix-musl-compatibility.patch [new file with mode: 0644]
trunk/package/utils/i2c-tools/Makefile [new file with mode: 0644]
trunk/package/utils/lm-sensors/Makefile [new file with mode: 0644]
trunk/package/utils/lm-sensors/files/sensors.conf [new file with mode: 0644]
trunk/package/utils/lm-sensors/patches/100-musl-compat.patch [new file with mode: 0644]
trunk/package/utils/lxc/Config.in [new file with mode: 0644]
trunk/package/utils/lxc/Makefile [new file with mode: 0644]
trunk/package/utils/lxc/files/lxc.conf [new file with mode: 0644]
trunk/package/utils/lxc/patches/010-compile.patch [new file with mode: 0644]
trunk/package/utils/lxc/patches/015-getline.patch [new file with mode: 0644]
trunk/package/utils/lxc/patches/016-uninitialized-ret-in-monitor.patch [new file with mode: 0644]
trunk/package/utils/lxc/patches/020-lxc-checkconfig.patch [new file with mode: 0644]
trunk/package/utils/lxc/patches/025-remove-unsupported-option.patch [new file with mode: 0644]
trunk/package/utils/lxc/patches/030-lxc-download.patch [new file with mode: 0644]

diff --git a/trunk/package/admin/debootstrap/Makefile b/trunk/package/admin/debootstrap/Makefile
new file mode 100644 (file)
index 0000000..629f221
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2010 Gianluigi Tiesi <sherpya@netfarm.it>
+# Copyright (C) 2011-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:=debootstrap
+PKG_VERSION:=1.0.68
+PKG_RELEASE:=1
+PKG_MAINTAINER=Daniel Golle <daniel@makrotopia.org>
+
+PKG_SOURCE:=$(PKG_NAME)-udeb_$(PKG_VERSION)_all.udeb
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/d/debootstrap
+PKG_MD5SUM:=b7e98013966e595ba50230f60efe7cbe
+PKG_LICENSE:=Unique
+PKG_LICENSE_FILES:=debian/copyright
+
+UNPACK_CMD=ar -p "$(DL_DIR)/$(PKG_SOURCE)" data.tar.xz | xzcat | tar -C $(1) -xf -
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/debootstrap
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Bootstrap a basic Debian system
+  URL:=http://wiki.debian.org/Debootstrap
+  DEPENDS:= +coreutils +coreutils-chroot +coreutils-sha1sum +ar
+endef
+
+define Package/debootstrap/description
+ debootstrap is used to create a Debian base system from scratch, without
+ requiring the availability of dpkg or apt. It does this by downloading .deb
+ files from a mirror site, and carefully unpacking them into a directory which
+ can eventually be chrooted into.
+endef
+
+define Build/Compile
+# file pkgdetails.c was imported from debian package base-installer version 1.130
+       $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) ./files/pkgdetails.c -o $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails
+endef
+
+define Package/debootstrap/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/sbin/$(PKG_NAME) $(1)/usr/sbin
+       $(INSTALL_DIR) $(1)/usr/share/debootstrap
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/usr/share/debootstrap/pkgdetails $(1)/usr/share/debootstrap
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/functions $(1)/usr/share/debootstrap
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/devices.tar.gz $(1)/usr/share/debootstrap
+       $(INSTALL_DIR) $(1)/usr/share/debootstrap/scripts
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/usr/share/debootstrap/scripts/* $(1)/usr/share/debootstrap/scripts
+endef
+
+$(eval $(call BuildPackage,debootstrap))
diff --git a/trunk/package/admin/debootstrap/files/pkgdetails.c b/trunk/package/admin/debootstrap/files/pkgdetails.c
new file mode 100644 (file)
index 0000000..99ee190
--- /dev/null
@@ -0,0 +1,347 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <errno.h>
+
+#define MAX_LINE 1000
+#define MAX_PKGS 100
+
+char *checksum_field=NULL;
+
+static void oom_die(void)
+{
+    fputs("Out of memory!\n", stderr);
+    exit(1);
+}
+
+static char *xvasprintf(const char *fmt, va_list ap) {
+    char *ret;
+
+    if (vasprintf (&ret, fmt, ap) < 0) {
+        if (errno == ENOMEM)
+            oom_die();
+        return NULL;
+    }
+    return ret;
+}
+
+static char *xasprintf(const char *fmt, ...) {
+    va_list ap;
+    char *ret;
+
+    va_start(ap, fmt);
+    ret = xvasprintf(fmt, ap);
+    va_end(ap);
+    return ret;
+}
+
+static char *fieldcpy(char *dst, char *fld) {
+    while (*fld && *fld != ':') 
+        fld++;
+    if (!*(fld++)) 
+        return NULL;
+    while (isspace(*fld)) fld++;
+    return strcpy(dst, fld);
+}
+
+static void outputdeps(char *deps) {
+    char *pch = deps;
+
+    while (1) {
+        while (isspace(*pch)) pch++;
+        if (!*pch) break;
+
+        while (*pch && *pch != '(' && *pch != '|' && *pch != ','
+               && !isspace(*pch))
+        {
+            fputc(*pch++, stdout);
+        }
+        fputc('\n', stdout);
+        while (*pch && *pch++ != ',') (void)NULL;
+    }
+}
+
+static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) {
+    char buf[MAX_LINE];
+    char cur_pkg[MAX_LINE];
+    char cur_deps[MAX_LINE];
+    char cur_predeps[MAX_LINE];
+    char prev_pkg[MAX_LINE];
+    char *pkgs[MAX_PKGS];
+    int i;
+    int skip;
+    FILE *f;
+    int output_pkg = -1;
+
+    cur_pkg[0] = cur_deps[0] = cur_predeps[0] = prev_pkg[0] = '\0';
+
+    for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i];
+
+    f = fopen(pkgsfile, "r");
+    if (f == NULL) {
+        perror(pkgsfile);
+        exit(1);
+    }
+
+    skip = 1;
+    while (fgets(buf, sizeof(buf), f)) {
+        if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0';
+        if (strncasecmp(buf, "Package:", 8) == 0) {
+            int any = 0;
+            skip = 1;
+            fieldcpy(cur_pkg, buf);
+            if (strcmp(cur_pkg, prev_pkg) != 0) {
+                if (output_pkg != -1)
+                    pkgs[output_pkg] = NULL;
+                if (cur_deps[0])
+                    outputdeps(cur_deps);
+                if (cur_predeps[0])
+                    outputdeps(cur_predeps);
+                strcpy(prev_pkg, cur_pkg);
+            }
+            cur_deps[0] = cur_predeps[0] = '\0';
+            output_pkg = -1;
+           for (i = 0; i < pkgc; i++) {
+               if (!pkgs[i]) continue;
+               any = 1;
+                if (strcmp(cur_pkg, pkgs[i]) == 0) {
+                    skip = 0;
+                    output_pkg = i;
+                    break;
+                }
+            }
+            if (!any) break;
+        } else if (!skip && strncasecmp(buf, "Depends:", 8) == 0)
+            fieldcpy(cur_deps, buf);
+        else if (!skip && strncasecmp(buf, "Pre-Depends:", 12) == 0)
+            fieldcpy(cur_predeps, buf);
+    }
+    if (cur_deps[0])
+        outputdeps(cur_deps);
+    if (cur_predeps[0])
+        outputdeps(cur_predeps);
+    fclose(f);
+}
+
+static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, 
+        char *fieldname, char **in_pkgs, int pkgc) 
+{
+    char buf[MAX_LINE];
+    char cur_field[MAX_LINE];
+    char cur_pkg[MAX_LINE];
+    char cur_ver[MAX_LINE];
+    char cur_arch[MAX_LINE];
+    char cur_size[MAX_LINE];
+    char cur_checksum[MAX_LINE];
+    char cur_filename[MAX_LINE];
+    char prev_pkg[MAX_LINE];
+    char *pkgs[MAX_PKGS];
+    int i;
+    FILE *f;
+    char *output = NULL;
+    int output_pkg = -1;
+
+    cur_field[0] = cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = prev_pkg[0] = '\0';
+
+    for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i];
+
+    f = fopen(pkgsfile, "r");
+    if (f == NULL) {
+        perror(pkgsfile);
+        exit(1);
+    }
+    while (fgets(buf, sizeof(buf), f)) {
+        if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0';
+        if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) {
+            fieldcpy(cur_field, buf);
+       }
+        if (strncasecmp(buf, "Package:", 8) == 0) {
+            fieldcpy(cur_pkg, buf);
+            if (strcmp(cur_pkg, prev_pkg) != 0) {
+                if (output)
+                    fputs(output, stdout);
+                if (uniq && output_pkg != -1)
+                    pkgs[output_pkg] = NULL;
+                strcpy(prev_pkg, cur_pkg);
+            }
+            free(output);
+            output = NULL;
+            output_pkg = -1;
+        } else if (strncasecmp(buf, "Version:", 8) == 0) {
+            fieldcpy(cur_ver, buf);
+        } else if (strncasecmp(buf, "Architecture:", 13) == 0) {
+            fieldcpy(cur_arch, buf);
+        } else if (strncasecmp(buf, "Size:", 5) == 0) {
+            fieldcpy(cur_size, buf);
+        } else if (strncasecmp(buf, checksum_field, strlen(checksum_field)) == 0
+                  && buf[strlen(checksum_field)] == ':') {
+            fieldcpy(cur_checksum, buf);
+        } else if (strncasecmp(buf, "Filename:", 9) == 0) {
+            fieldcpy(cur_filename, buf);
+        } else if (!*buf) {
+           int any = 0;
+           for (i = 0; i < pkgc; i++) {
+               if (!pkgs[i]) continue;
+               any = 1;
+                if (strcmp(cur_field, pkgs[i]) == 0) {
+                    free(output);
+                    output = xasprintf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_checksum, cur_size);
+                    output_pkg = i;
+                   break;
+               }
+            }
+           if (!any) break;
+            cur_field[0] = '\0';
+        }
+    }
+    if (output)
+        fputs(output, stdout);
+    if (uniq && output_pkg != -1)
+        pkgs[output_pkg] = NULL;
+    fclose(f);
+
+    /* any that weren't found are returned as "pkg -" */
+    if (uniq) {
+        for (i = 0; i < pkgc; i++) {
+            if (pkgs[i]) {
+                printf("%s -\n", pkgs[i]);
+            }
+        }
+    }
+}
+
+static void dopkgstanzas(char *pkgsfile, char **pkgs, int pkgc)
+{
+    char buf[MAX_LINE];
+    char *accum;
+    size_t accum_size = 0, accum_alloc = MAX_LINE * 2;
+    char cur_pkg[MAX_LINE];
+    FILE *f;
+
+    accum = malloc(accum_alloc);
+    if (!accum)
+        oom_die();
+
+    f = fopen(pkgsfile, "r");
+    if (f == NULL) {
+        perror(pkgsfile);
+        free(accum);
+        exit(1);
+    }
+    while (fgets(buf, sizeof(buf), f)) {
+        if (*buf) {
+           size_t len = strlen(buf);
+            if (accum_size + len + 1 > accum_alloc) {
+                accum_alloc = (accum_size + len + 1) * 2;
+                accum = realloc(accum, accum_alloc);
+                if (!accum)
+                    oom_die();
+            }
+            strcpy(accum + accum_size, buf);
+           accum_size += len;
+        }
+        if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0';
+        if (strncasecmp(buf, "Package:", 8) == 0) {
+            fieldcpy(cur_pkg, buf);
+        } else if (!*buf) {
+            int i;
+            for (i = 0; i < pkgc; i++) {
+                if (!pkgs[i]) continue;
+                if (strcmp(cur_pkg, pkgs[i]) == 0) {
+                    fputs(accum, stdout);
+                   if (accum[accum_size - 1] != '\n')
+                       fputs("\n\n", stdout);
+                   else if (accum[accum_size - 2] != '\n')
+                       fputc('\n', stdout);
+                    break;
+                }
+            }
+            *accum = '\0';
+            accum_size = 0;
+        }
+    }
+    fclose(f);
+
+    free(accum);
+}
+
+static int dotranslatewgetpercent(int low, int high, int end, char *str) {
+    int ch;
+    int val, lastval;
+
+    /* print out anything that looks like a % on its own line, appropriately
+     * scaled */
+
+    lastval = val = 0;
+    while ( (ch = getchar()) != EOF ) {
+        if (isdigit(ch)) {
+           val *= 10; val += ch - '0';
+       } else if (ch == '%') {
+           float f = (float) val / 100.0 * (high - low) + low;
+           if (str) {
+               printf("P: %d %d %s\n", (int) f, end, str);
+           } else {
+               printf("P: %d %d\n", (int) f, end);
+           }
+           lastval = val;
+       } else {
+           val = 0;
+       }
+    }
+    return lastval == 100;
+}
+
+int main(int argc, char *argv[]) {
+    checksum_field=getenv("DEBOOTSTRAP_CHECKSUM_FIELD");
+    if (checksum_field == NULL) {
+        checksum_field="MD5sum";
+    }
+
+    if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) {
+       if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), 
+                                  atoi(argv[4]), argc == 6 ? argv[5] : NULL))
+       {
+           exit(0);
+       } else {
+           exit(1);
+       }
+    } else if (argc >= 4 && strcmp(argv[1], "GETDEPS") == 0) {
+        int i;
+        for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) {
+           dogetdeps(argv[2], argv+i, MAX_PKGS);
+       }
+       dogetdeps(argv[2], argv+i, argc-i);
+       exit(0);
+    } else if (argc >= 5 && strcmp(argv[1], "PKGS") == 0) {
+        int i;
+        for (i = 4; argc - i > MAX_PKGS; i += MAX_PKGS) {
+           dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, MAX_PKGS);
+       }
+       dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, argc-i);
+       exit(0);
+    } else if (argc >= 6 && strcmp(argv[1], "FIELD") == 0) {
+        int i;
+        for (i = 5; argc - i > MAX_PKGS; i += MAX_PKGS) {
+           dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, MAX_PKGS);
+       }
+       dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, argc-i);
+       exit(0);
+    } else if (argc >= 4 && strcmp(argv[1], "STANZAS") == 0) {
+       int i;
+       for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) {
+           dopkgstanzas(argv[2], argv+i, MAX_PKGS);
+       }
+       dopkgstanzas(argv[2], argv+i, argc-i);
+       exit(0);
+    } else {
+        fprintf(stderr, "usage: %s PKGS mirror packagesfile pkgs..\n", argv[0]);
+        fprintf(stderr, "   or: %s FIELD field mirror packagesfile pkgs..\n", 
+                argv[0]);
+        fprintf(stderr, "   or: %s GETDEPS packagesfile pkgs..\n", argv[0]);
+        fprintf(stderr, "   or: %s STANZAS packagesfile pkgs..\n", argv[0]);
+       fprintf(stderr, "   or: %s WGET%% low high end reason\n", argv[0]);
+        exit(1);
+    }
+}
diff --git a/trunk/package/admin/debootstrap/patches/100-busybox_fix.patch b/trunk/package/admin/debootstrap/patches/100-busybox_fix.patch
new file mode 100644 (file)
index 0000000..5e8db05
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/usr/share/debootstrap/functions
++++ b/usr/share/debootstrap/functions
+@@ -859,8 +859,6 @@ choose_extractor () {
+       if [ -n "$EXTRACTOR_OVERRIDE" ]; then
+               extractor="$EXTRACTOR_OVERRIDE"
+-      elif type dpkg-deb >/dev/null 2>&1; then
+-              extractor="dpkg-deb"
+       else
+               extractor="ar"
+       fi
diff --git a/trunk/package/admin/htop/Makefile b/trunk/package/admin/htop/Makefile
new file mode 100644 (file)
index 0000000..7cb4706
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2007-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:=htop
+PKG_VERSION:=1.0.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://hisham.hm/htop/releases/$(PKG_VERSION)/
+PKG_MD5SUM:=e768b9b55c033d9c1dffda72db3a6ac7
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/htop
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Interactive processes viewer
+  DEPENDS:=+libncurses
+  URL:=http://htop.sourceforge.net/
+  MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
+endef
+
+define Package/htop/description
+ Htop is an ncursed-based process viewer similar to top, but
+ it allows to scroll the list vertically and horizontally to
+ see all processes and their full command lines.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-native-affinity \
+       --disable-unicode \
+       --enable-hwloc
+
+CONFIGURE_VARS += \
+       ac_cv_file__proc_stat=yes \
+       ac_cv_file__proc_meminfo=yes \
+       ac_cv_func_malloc_0_nonnull=yes \
+       ac_cv_func_realloc_0_nonnull=yes
+
+define Package/htop/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,htop))
diff --git a/trunk/package/admin/monit/Makefile b/trunk/package/admin/monit/Makefile
new file mode 100644 (file)
index 0000000..b172de4
--- /dev/null
@@ -0,0 +1,95 @@
+#
+# 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:=monit
+PKG_VERSION:=5.14
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://mmonit.com/monit/dist
+PKG_MD5SUM:=1b3ae1eb08a0914402a8764e5689c1c5
+
+PKG_LICENSE:=AGPL-3.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/monit/Default
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:= +libpthread
+  TITLE:=System services monitoring utility
+  URL:=http://mmonit.com/monit/
+  MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
+endef
+
+define Package/monit/Default/description
+       An utility for monitoring services on a Unix system
+endef
+
+define Package/monit
+$(call Package/monit/Default)
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/monit/description
+$(call Package/monit/Default/description)
+       This package is built with SSL support.
+endef
+
+define Package/monit-nossl
+$(call Package/monit/Default)
+  TITLE+= (without SSL support)
+  VARIANT:=nossl
+endef
+
+define Package/monit-nossl/description
+$(call Package/monit/Default/description)
+       This package is built without SSL support.
+endef
+
+CONFIGURE_ARGS += \
+       --without-pam \
+       libmonit_cv_setjmp_available=yes \
+       libmonit_cv_vsnprintf_c99_conformant=yes
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-ssl \
+               --with-ssl-dir="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --without-ssl
+endif
+
+define Package/monit/conffiles
+/etc/monitrc
+endef
+
+define Package/monit/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/monitrc $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/monit.init $(1)/etc/init.d/monit
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/monit $(1)/usr/bin/
+endef
+
+Package/monit-nossl/conffiles = $(Package/monit/conffiles)
+Package/monit-nossl/install = $(Package/monit/install)
+
+$(eval $(call BuildPackage,monit))
+$(eval $(call BuildPackage,monit-nossl))
diff --git a/trunk/package/admin/monit/files/monit.init b/trunk/package/admin/monit/files/monit.init
new file mode 100644 (file)
index 0000000..2bb3609
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=60
+USE_PROCD=1
+PROG=/usr/bin/monit
+
+start_service() {
+       [ -f /etc/monitrc ] || { echo "monit: /etc/monitrc is missing"; return 1; }
+       chmod 0600 /etc/monitrc
+       procd_open_instance
+       # -I runs in foreground, as procd requires
+       procd_set_param command "$PROG" -I
+       procd_close_instance
+}
diff --git a/trunk/package/admin/monit/patches/001-fix-default-piddir.patch b/trunk/package/admin/monit/patches/001-fix-default-piddir.patch
new file mode 100644 (file)
index 0000000..7af871f
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/configure
++++ b/configure
+@@ -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; }
+-if test -d "/run"
+-then
+-      piddir="/run"
+-elif test -d "/var/run"; then
+-        piddir="/var/run"
+-elif test -d "/etc"; then
+-        piddir="/etc"
+-fi
++piddir="/var/run"
+ cat >>confdefs.h <<_ACEOF
diff --git a/trunk/package/admin/muninlite/Makefile b/trunk/package/admin/muninlite/Makefile
new file mode 100644 (file)
index 0000000..46fc8c4
--- /dev/null
@@ -0,0 +1,54 @@
+#
+# 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:=muninlite
+PKG_VERSION:=1.0.4
+PKG_RELEASE:=6
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=a8cc86f0cc536a6c22dc298f4ed55339
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=LICENSE
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/muninlite
+  SECTION:=admin
+  CATEGORY:=Administration
+  DEPENDS:=+xinetd
+  TITLE:=Munin node implemented in shell
+  URL:=http://sourceforge.net/projects/muninlite/
+  PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
+endef
+
+define Package/muninlite/Default/description
+       Munin node implemented in shell.
+       Munin is a monitoring system for Unix networks.
+endef
+
+define Package/muninlite/install
+       $(INSTALL_DIR) $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/munin-node $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/xinetd.d
+       $(INSTALL_DATA) ./files/etc/xinetd.d/munin $(1)/etc/xinetd.d/
+endef
+
+define Package/muninlite/conffiles
+/etc/xinetd.d/munin
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+$(eval $(call BuildPackage,muninlite))
diff --git a/trunk/package/admin/muninlite/files/etc/xinetd.d/munin b/trunk/package/admin/muninlite/files/etc/xinetd.d/munin
new file mode 100644 (file)
index 0000000..012d71b
--- /dev/null
@@ -0,0 +1,10 @@
+service munin
+{
+       socket_type     = stream
+       protocol        = tcp
+       wait            = no
+       user            = root
+       group           = root
+       server          = /usr/sbin/munin-node
+       disable         = no
+}
diff --git a/trunk/package/admin/muninlite/patches/001-no_disks.patch b/trunk/package/admin/muninlite/patches/001-no_disks.patch
new file mode 100644 (file)
index 0000000..bf9b2b1
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,7 @@
+-PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats ntpdate plugindir_
+-#PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats
++#PLUGINS=df cpu if_ if_err_ load memory processes swap netstat uptime interrupts irqstats ntpdate plugindir_
++PLUGINS=cpu if_ if_err_ load memory processes netstat uptime interrupts irqstats
+ munin-node: plugins/* munin-node.conf
+       @VERSION=$$(cat VERSION); \
diff --git a/trunk/package/admin/muninlite/patches/002-hostname.patch b/trunk/package/admin/muninlite/patches/002-hostname.patch
new file mode 100644 (file)
index 0000000..5d87168
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/munin-node.in
++++ b/munin-node.in
+@@ -113,7 +113,7 @@ PLUGINS=$RES
+ # ===== MAIN LOOP =====
+ FUNCTIONS="list nodes config fetch version quit"
+-HOSTNAME=$(hostname -f 2>/dev/null || hostname)
++HOSTNAME=$(/sbin/uci get "system.@system[0].hostname" 2>/dev/null || cat /proc/sys/kernel/hostname)
+ echo "# munin node at $HOSTNAME"
+ while read arg0 arg1 
+ do 
diff --git a/trunk/package/admin/muninlite/patches/100-fix-no-ethtool.patch b/trunk/package/admin/muninlite/patches/100-fix-no-ethtool.patch
new file mode 100644 (file)
index 0000000..88f7e30
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/plugins/if_
++++ b/plugins/if_
+@@ -15,10 +15,14 @@ config_if() {
+   echo "up.min 0"
+   echo "up.negative down"
+   echo "up.cdef up,8,*"
+-  if ethtool $1 | grep -q Speed; then
+-    MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\  -f2) * 1000000))
+-    echo "up.max $MAX"
+-    echo "down.max $MAX"
++  if [ -n "$(which ethtool)" ]; then
++      if [ -x "$(which ethtool)" ]; then
++              if ethtool $1 | grep -q Speed; then
++                      MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\  -f2) * 1000000))
++                      echo "up.max $MAX"
++                      echo "down.max $MAX"
++              fi
++      fi
+   fi
+ }
+ fetch_if() {
diff --git a/trunk/package/admin/muninlite/patches/110-fix-uptime-days.patch b/trunk/package/admin/muninlite/patches/110-fix-uptime-days.patch
new file mode 100644 (file)
index 0000000..d9aa43f
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/plugins/uptime
++++ b/plugins/uptime
+@@ -4,8 +4,7 @@ config_uptime() {
+   echo "graph_vlabel uptime in days"
+   echo "uptime.label uptime"
+   echo "uptime.draw AREA"
+-  echo "uptime.cdef uptime,86400,/"
+ }
+ fetch_uptime() {
+-  echo "uptime.value" $(cut -d\  -f1 /proc/uptime)
++  awk '{printf "uptime.value %.2f",$1/86400; print ""}' /proc/uptime
+ }
diff --git a/trunk/package/admin/muninlite/patches/200-add-tap-dev.patch b/trunk/package/admin/muninlite/patches/200-add-tap-dev.patch
new file mode 100644 (file)
index 0000000..fa46ce6
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/munin-node.in
++++ b/munin-node.in
+@@ -72,7 +72,7 @@ RES=""
+ for PLUG in $PLUGINS
+ do 
+   if [ "$PLUG" = "if_" ]; then  
+-    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
++    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
+     do
+       INTERRES=$(echo $INTER | sed 's/\./VLAN/')
+       RES="$RES if_$INTERRES"
+@@ -80,7 +80,7 @@ do
+       eval "config_if_${INTERRES}() { config_if $INTER $@; };"
+     done
+   elif [ "$PLUG" = "if_err_" ]; then
+-    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
++    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
+     do
+       INTERRES=$(echo $INTER | sed 's/\./VLAN/')
+       RES="$RES if_err_$INTERRES"
diff --git a/trunk/package/admin/muninlite/patches/210-add-bridge-devs.patch b/trunk/package/admin/muninlite/patches/210-add-bridge-devs.patch
new file mode 100644 (file)
index 0000000..1a76e97
--- /dev/null
@@ -0,0 +1,24 @@
+--- a/munin-node.in
++++ b/munin-node.in
+@@ -72,17 +72,17 @@ RES=""
+ for PLUG in $PLUGINS
+ do 
+   if [ "$PLUG" = "if_" ]; then  
+-    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
++    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
+     do
+-      INTERRES=$(echo $INTER | sed 's/\./VLAN/')
++      INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/')
+       RES="$RES if_$INTERRES"
+       eval "fetch_if_${INTERRES}() { fetch_if $INTER $@; };"
+       eval "config_if_${INTERRES}() { config_if $INTER $@; };"
+     done
+   elif [ "$PLUG" = "if_err_" ]; then
+-    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
++    for INTER in $(grep '^ *\(ppp\|eth\|wlan\|ath\|ra\|ipsec\|tap\|br-\)\([^:]\)\{1,\}:' /proc/net/dev | cut -f1 -d: | sed 's/ //g');
+     do
+-      INTERRES=$(echo $INTER | sed 's/\./VLAN/')
++      INTERRES=$(echo $INTER | sed -e 's/\./VLAN/' -e 's/\-/_/')
+       RES="$RES if_err_$INTERRES"
+       eval "fetch_if_err_${INTERRES}() { fetch_if_err $INTER $@; };"
+       eval "config_if_err_${INTERRES}() { config_if_err $INTER $@; };"
diff --git a/trunk/package/admin/muninlite/patches/220-modify-ifname-parser.patch b/trunk/package/admin/muninlite/patches/220-modify-ifname-parser.patch
new file mode 100644 (file)
index 0000000..95655cf
--- /dev/null
@@ -0,0 +1,22 @@
+--- a/plugins/if_
++++ b/plugins/if_
+@@ -26,7 +26,7 @@ config_if() {
+   fi
+ }
+ fetch_if() {
+-  IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
++  IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/  */ /g' -e 's/^[ \t]*//')
+   echo "down.value" $(echo $IINFO | cut -d\  -f1)
+   echo "up.value" $(echo $IINFO | cut -d\  -f9)
+ }
+--- a/plugins/if_err_
++++ b/plugins/if_err_
+@@ -15,7 +15,7 @@ config_if_err() {
+   echo "trans.warning 1"
+ }
+ fetch_if_err() {
+-  IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/  / /g')
++  IINFO=$(cat /proc/net/dev | sed -e 's/-/_/g' | grep "$1:" | cut -d: -f2 | sed -e 's/  */ /g' -e 's/^[ \t]*//')
+   echo "rcvd.value" $(echo $IINFO | cut -d\  -f3)
+   echo "trans.value" $(echo $IINFO | cut -d\  -f11)
+ }
diff --git a/trunk/package/admin/sudo/Makefile b/trunk/package/admin/sudo/Makefile
new file mode 100644 (file)
index 0000000..282db1a
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# Copyright (C) 2006-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:=sudo
+PKG_VERSION:=1.8.13
+PKG_RELEASE:=2
+PKG_LICENSE:=ISC
+PKG_LICENSE_FILES:=doc/LICENSE
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.sudo.ws/sudo/dist
+PKG_MD5SUM:=f61577ec330ad1bd504c0e2eec6ea2d8
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DEPENDS:=sudo/host
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/sudo
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Delegate authority to run commands
+  URL:=http://www.sudo.ws/
+  MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+endef
+
+define Package/sudo/description
+ Sudo (su "do") allows a system administrator to delegate authority to
+ give certain users (or groups of users) the ability to run some (or
+ all) commands as root or another user while providing an audit trail of
+ the commands and their arguments.
+endef
+
+define Package/sudo/conffiles
+/etc/sudoers
+/etc/sudoers.d/
+endef
+
+CONFIGURE_ARGS+= \
+       --without-pam \
+       --disable-pam-session \
+       --with-editor=/bin/vi \
+       --without-lecture \
+       --disable-zlib \
+       --with-rundir=/var/lib/sudo \
+       --with-vardir=/var/lib/sudo
+
+CONFIGURE_VARS+= \
+       sudo_cv_uid_t_len=10 \
+       sudo_cv_func_unsetenv_void=no
+
+include $(INCLUDE_DIR)/host-build.mk
+
+define Host/Compile
+       cd $(HOST_BUILD_DIR)/lib/util; \
+           $(MAKE) mksiglist; $(MAKE) mksigname
+endef
+
+define Host/Install
+       $(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
+       $(CP) $(HOST_BUILD_DIR)/lib/util/mksig{list,name} $(STAGING_DIR_HOST)/bin/
+endef
+
+$(eval $(call HostBuild))
+
+define Package/sudo/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/sudo $(1)/usr/bin/
+       chmod 4755 $(1)/usr/bin/sudo
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/usr/sbin/visudo $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(CP) $(PKG_INSTALL_DIR)/etc/sudoers $(1)/etc/
+       chmod 0440 $(1)/etc/sudoers
+       $(INSTALL_DIR) $(1)/etc/sudoers.d
+       $(INSTALL_DIR) $(1)/usr/lib/sudo
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/sudo/*.so* $(1)/usr/lib/sudo/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/sudo.init $(1)/etc/init.d/sudo
+endef
+
+define Package/sudo/postinst
+#!/bin/sh
+
+[ -n "$$IPKG_INSTROOT" ] || {
+       /etc/init.d/sudo enable
+       /etc/init.d/sudo start
+}
+endef
+
+$(eval $(call BuildPackage,sudo))
diff --git a/trunk/package/admin/sudo/files/sudo.init b/trunk/package/admin/sudo/files/sudo.init
new file mode 100755 (executable)
index 0000000..705fe84
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=99
+
+start() {
+       [ -d /var/lib/sudo ] || {
+               mkdir -m 0755 -p /var/lib/sudo
+               chmod 0700 /var/lib/sudo
+       }
+}
diff --git a/trunk/package/admin/sudo/patches/010-cross-compile-fixes.patch b/trunk/package/admin/sudo/patches/010-cross-compile-fixes.patch
new file mode 100644 (file)
index 0000000..4e80d4d
--- /dev/null
@@ -0,0 +1,25 @@
+diff -rupN sudo-1.8.11p2.orig/lib/util/Makefile.in sudo-1.8.11p2/lib/util/Makefile.in
+--- sudo-1.8.11p2.orig/lib/util/Makefile.in    2014-10-07 22:26:20.000000000 +0200
++++ sudo-1.8.11p2/lib/util/Makefile.in 2014-12-09 21:44:35.610041162 +0100
+@@ -17,6 +17,8 @@
+ # @configure_input@
+ #
++include $(TOPDIR)/rules.mk
++
+ #### Start of system configuration section. ####
+ srcdir = @srcdir@
+@@ -142,10 +144,10 @@ libsudo_util.la: $(LTOBJS) @LT_LDDEP@
+       esac
+ siglist.c: mksiglist
+-      ./mksiglist > $@
++      $(STAGING_DIR_HOST)/bin/mksiglist > $@
+ signame.c: mksigname
+-      ./mksigname > $@
++      $(STAGING_DIR_HOST)/bin/mksigname > $@
+ mksiglist: $(srcdir)/mksiglist.c $(srcdir)/mksiglist.h $(incdir)/sudo_compat.h $(top_builddir)/config.h
+       $(CC) $(CPPFLAGS) $(CFLAGS) $(DEFS) $(srcdir)/mksiglist.c -o $@
diff --git a/trunk/package/admin/sudo/patches/020-no-owner-change.patch b/trunk/package/admin/sudo/patches/020-no-owner-change.patch
new file mode 100644 (file)
index 0000000..417e95d
--- /dev/null
@@ -0,0 +1,12 @@
+diff -rupN sudo-1.8.11p2.orig/Makefile.in sudo-1.8.11p2/Makefile.in
+--- sudo-1.8.11p2.orig/Makefile.in     2014-10-07 22:26:20.000000000 +0200
++++ sudo-1.8.11p2/Makefile.in  2014-12-09 22:00:27.256934143 +0100
+@@ -62,7 +62,7 @@ SHELL = @SHELL@
+ SED = @SED@
+ INSTALL = $(SHELL) $(top_srcdir)/install-sh -c
+-INSTALL_OWNER = -o $(install_uid) -g $(install_gid)
++INSTALL_OWNER =
+ ECHO_N = @ECHO_N@
+ ECHO_C = @ECHO_C@
diff --git a/trunk/package/admin/zabbix/Makefile b/trunk/package/admin/zabbix/Makefile
new file mode 100644 (file)
index 0000000..02e1421
--- /dev/null
@@ -0,0 +1,247 @@
+#
+# Copyright (C) 2006-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:=zabbix
+PKG_VERSION:=2.4.5
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/zabbix
+PKG_MD5SUM:=a82eb0d55d3ca947e10a4a55238f4388
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/zabbix/Default
+  SECTION:=admin
+  CATEGORY:=Administration
+  TITLE:=Zabbix
+  URL:=http://www.zabbix.com/
+  SUBMENU:=zabbix
+  MAINTAINER:=Etienne CHAMPETIER <champetier.etienne@gmail.com>
+  USERID:=zabbix=53:zabbix=53
+endef
+
+define Package/zabbix-agent
+  $(call Package/zabbix/Default)
+  TITLE+= agent
+endef
+
+define Package/zabbix-agentd
+  $(call Package/zabbix/Default)
+  TITLE+= agentd
+endef
+
+define Package/zabbix-extra-mac80211
+  $(call Package/zabbix/Default)
+  TITLE+= discovery/userparameters for mac80211
+  DEPENDS += +zabbix-agentd @PACKAGE_MAC80211_DEBUGFS @KERNEL_DEBUG_FS
+endef
+
+define Package/zabbix-extra-network
+  $(call Package/zabbix/Default)
+  TITLE+= discovery/userparameters for network
+  DEPENDS += +zabbix-agentd +libuci-lua +lua
+endef
+
+define Package/zabbix-extra-wifi
+  $(call Package/zabbix/Default)
+  TITLE+= discovery/userparameters for wifi
+  DEPENDS += +zabbix-agentd +libiwinfo-lua +libuci-lua +lua
+endef
+
+define Package/zabbix-sender
+  $(call Package/zabbix/Default)
+  TITLE+= sender
+endef
+
+define Package/zabbix-get
+  $(call Package/zabbix/Default)
+  TITLE+= get
+endef
+
+define Package/zabbix-server
+  $(call Package/zabbix/Default)
+  TITLE+= server
+  DEPENDS += +libsqlite3
+endef
+
+define Package/zabbix-proxy
+  $(call Package/zabbix/Default)
+  TITLE+= proxy
+  DEPENDS += +libsqlite3
+endef
+
+define Package/zabbix-extra-mac80211/description
+An extra package for zabbix-agentd that adds a discovery rule for mac80211 wifi phy and many userparameters.
+It contains an suid helper to allow zabbix-agentd to still run as zabbix user and not as root.
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
+endef
+
+define Package/zabbix-extra-network/description
+An extra package for zabbix-agentd that adds a discovery rule for openwrt network interfaces.
+The idea here is to discover only interfaces listed in /etc/config/network (discover br-lan and not eth0.1 and wlan0)
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
+endef
+
+define Package/zabbix-extra-wifi/description
+An extra package for zabbix-agentd that adds a discovery rule for wifi interfaces and many userparameters.
+As it uses libiwinfo, it works with all wifi devices supported by openwrt.
+See http://wiki.openwrt.org/doc/howto/zabbix for ready to use zabbix templates.
+endef
+
+CONFIGURE_ARGS+= \
+       --enable-agent \
+       --enable-server \
+       --enable-proxy \
+       --disable-java \
+       --with-sqlite3="$(STAGING_DIR)/usr"
+
+MAKE_FLAGS += ARCH="linux"
+
+define Package/zabbix/install/sbin
+       $(INSTALL_DIR) \
+               $(1)/usr/sbin
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/sbin/zabbix_$(2) \
+               $(1)/usr/sbin/
+endef
+
+define Package/zabbix/install/bin
+       $(INSTALL_DIR) \
+               $(1)/usr/bin
+
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/bin/zabbix_$(2) \
+               $(1)/usr/bin/
+endef
+
+define Package/zabbix/install/etc
+       $(INSTALL_DIR) \
+               $(1)/etc
+
+       $(INSTALL_CONF) \
+               $(PKG_INSTALL_DIR)/etc/zabbix_$(2).conf \
+               $(1)/etc/
+endef
+
+define Package/zabbix/install/init.d
+       $(INSTALL_DIR) \
+               $(1)/etc/init.d
+
+       $(INSTALL_BIN) \
+               ./files/zabbix_$(2).init \
+               $(1)/etc/init.d/zabbix_$(2)
+endef
+
+define Package/zabbix/install/zabbix.conf.d
+       $(INSTALL_DIR) \
+               $(1)/etc/zabbix_agentd.conf.d
+
+       $(INSTALL_BIN) \
+               ./files/$(2) \
+               $(1)/etc/zabbix_agentd.conf.d/$(2)
+endef
+
+define Package/zabbix-agent/conffiles
+/etc/zabbix_agent.conf
+endef
+define Package/zabbix-agentd/conffiles
+/etc/zabbix_agentd.conf
+endef
+define Package/zabbix-server/conffiles
+/etc/zabbix_server.conf
+endef
+define Package/zabbix-proxy/conffiles
+/etc/zabbix_proxy.conf
+endef
+
+ifdef CONFIG_PACKAGE_zabbix-extra-mac80211
+define Build/Prepare/zabbix-extra-mac80211
+       mkdir -p $(PKG_BUILD_DIR)/zabbix-extra-mac80211
+       $(CP) ./files/zabbix_helper_mac80211.c $(PKG_BUILD_DIR)/zabbix-extra-mac80211/
+endef
+
+define Build/Compile/zabbix-extra-mac80211
+       $(TARGET_CC) $(TARGET_CFLAGS) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211.c -o $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211
+endef
+endif
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(call Build/Prepare/zabbix-extra-mac80211)
+endef
+
+define Build/Compile
+       $(call Build/Compile/Default)
+       $(call Build/Compile/zabbix-extra-mac80211)
+endef
+
+define Package/zabbix-agent/install
+       $(call Package/zabbix/install/sbin,$(1),agent)
+       $(call Package/zabbix/install/etc,$(1),agent)
+endef
+
+define Package/zabbix-agentd/install
+       $(INSTALL_DIR) $(1)/etc/zabbix_agentd.conf.d
+       $(call Package/zabbix/install/sbin,$(1),agentd)
+       $(call Package/zabbix/install/etc,$(1),agentd)
+       $(call Package/zabbix/install/init.d,$(1),agentd)
+endef
+
+define Package/zabbix-extra-mac80211/install
+       $(call Package/zabbix/install/zabbix.conf.d,$(1),mac80211)
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/zabbix-extra-mac80211/zabbix_helper_mac80211 $(1)/usr/bin/
+       chmod 4755 $(1)/usr/bin/zabbix_helper_mac80211
+endef
+
+define Package/zabbix-extra-network/install
+       $(call Package/zabbix/install/zabbix.conf.d,$(1),network)
+endef
+
+define Package/zabbix-extra-wifi/install
+       $(call Package/zabbix/install/zabbix.conf.d,$(1),wifi)
+endef
+
+define Package/zabbix-sender/install
+       $(call Package/zabbix/install/bin,$(1),sender)
+endef
+
+define Package/zabbix-get/install
+       $(call Package/zabbix/install/bin,$(1),get)
+endef
+
+define Package/zabbix-server/install
+       $(call Package/zabbix/install/sbin,$(1),server)
+       $(call Package/zabbix/install/etc,$(1),server)
+endef
+
+define Package/zabbix-proxy/install
+       $(call Package/zabbix/install/sbin,$(1),proxy)
+       $(call Package/zabbix/install/etc,$(1),proxy)
+endef
+
+$(eval $(call BuildPackage,zabbix-agent))
+$(eval $(call BuildPackage,zabbix-agentd))
+$(eval $(call BuildPackage,zabbix-extra-mac80211))
+$(eval $(call BuildPackage,zabbix-extra-network))
+$(eval $(call BuildPackage,zabbix-extra-wifi))
+$(eval $(call BuildPackage,zabbix-sender))
+$(eval $(call BuildPackage,zabbix-server))
+$(eval $(call BuildPackage,zabbix-proxy))
+$(eval $(call BuildPackage,zabbix-get))
diff --git a/trunk/package/admin/zabbix/files/mac80211 b/trunk/package/admin/zabbix/files/mac80211
new file mode 100644 (file)
index 0000000..93d8351
--- /dev/null
@@ -0,0 +1,27 @@
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
+
+# If you want to know the exact meaning of an UserParameter, you can search in the ieee80211 standard:
+# http://standards.ieee.org/getieee802/download/802.11-2012.pdf
+# exemple: for mac80211.ACKFailureCount search for dot11ACKFailureCount (page 2145)
+
+# mac80211 phy discovery (like 'phy0')
+# exemple: {"data":[{"{#PHY}":"phy0"}]}
+#
+UserParameter=mac80211.phydiscovery,zabbix_helper_mac80211 discovery
+
+#phy statistics (you need {#PHY} as parameter)
+#
+UserParameter=mac80211.ACKFailureCount[*],zabbix_helper_mac80211 $1 dot11ACKFailureCount
+UserParameter=mac80211.FCSErrorCount[*],zabbix_helper_mac80211 $1 dot11FCSErrorCount
+UserParameter=mac80211.RTSFailureCount[*],zabbix_helper_mac80211 $1 dot11RTSFailureCount
+UserParameter=mac80211.RTSSuccessCount[*],zabbix_helper_mac80211 $1 dot11RTSSuccessCount
+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
+
diff --git a/trunk/package/admin/zabbix/files/network b/trunk/package/admin/zabbix/files/network
new file mode 100644 (file)
index 0000000..51cb1cb
--- /dev/null
@@ -0,0 +1,9 @@
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
+
+# network interface discovery
+# exemple: {"data":[{"{#IF}":"lo", "{#NET}":"loopback"},{"{#IF}":"br-lan", "{#NET}":"lan"},{"{#IF}":"eth0.1", "{#NET}":"wan"}]}
+#
+UserParameter=netowrt.discovery,lua -l uci -e 'x = uci.cursor(nil, "/var/state");list = "{\"data\":[";x:foreach("network", "interface", function(s) list=list.."{\"{#IF}\":\""..s.ifname.."\", \"{#NET}\":\""..s[".name"].."\"}," end); list=string.gsub(list,",$",""); print(list.."]}")'
+
+
+
diff --git a/trunk/package/admin/zabbix/files/wifi b/trunk/package/admin/zabbix/files/wifi
new file mode 100644 (file)
index 0000000..6315ea9
--- /dev/null
@@ -0,0 +1,25 @@
+#see http://wiki.openwrt.org/doc/howto/zabbix for ready to use templates
+
+# wifi interface discovery
+# exemple: {"data":[{"{#IF}":"wlan0", "{#MODE}":"ap", "{#SSID}":"Openwrt", "{#NET}":"lan", "{#DEV}":"radio0", "{#ENC}":"psk2+ccmp", "{#TYPE}":"mac80211", "{#HWMODE}":"11ng", "{#CHANNEL}":"11", "{#BSSID}":"xx:xx:xx:xx:xx:xx"}]}
+# ubus call only work as root so you need to run zabbix as root to use wifi.ifdiscovery
+UserParameter=wifi.ifdiscovery, lua -l ubus -l iwinfo -e 'u=ubus.connect();list="{\"data\":[";stat=u:call("network.wireless", "status", {});for dev, dev_table in pairs(stat) do for i, iface in pairs(dev_table["interfaces"]) do c=iface["config"];i=iface["ifname"];t=iwinfo.type(i);iw=iwinfo[t];e = iw.encryption(i);e = e and e.description or "None";n = table.concat(c["network"]," ");list=list.."{\"{#IF}\":\""..i.."\", \"{#MODE}\":\""..iw.mode(i).."\", \"{#SSID}\":\""..c["ssid"].."\", \"{#NET}\":\""..n.."\", \"{#DEV}\":\""..dev.."\", \"{#ENC}\":\""..e.."\", \"{#TYPE}\":\""..t.."\", \"{#HWMODE}\":\"".."?".."\", \"{#CHANNEL}\":\""..iw.channel(i).."\", \"{#BSSID}\":\""..iw.bssid(i).."\"},";end;end;list=string.gsub(list,",$","");print(list.."]}")'
+
+
+#iwinfo info (you need {#IF} as parameter, like 'wlan0')
+UserParameter=wifi.iwinfo.channel[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].channel('$1'))"
+UserParameter=wifi.iwinfo.frequency[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].frequency('$1'))"
+UserParameter=wifi.iwinfo.txpower[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].txpower('$1'))"
+UserParameter=wifi.iwinfo.bitrate[*],lua -l iwinfo -e "b = iwinfo[iwinfo.type('$1')].bitrate('$1'); print(b or '0')"
+UserParameter=wifi.iwinfo.signal[*],lua -l iwinfo -e "s = iwinfo[iwinfo.type('$1')].signal('$1'); print(s or '-255')"
+UserParameter=wifi.iwinfo.noise[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].noise('$1'))"
+UserParameter=wifi.iwinfo.quality[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality('$1'))"
+UserParameter=wifi.iwinfo.quality_max[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].quality_max('$1'))"
+UserParameter=wifi.iwinfo.mode[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].mode('$1'))"
+UserParameter=wifi.iwinfo.ssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].ssid('$1'))"
+UserParameter=wifi.iwinfo.bssid[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].bssid('$1'))"
+UserParameter=wifi.iwinfo.country[*],lua -l iwinfo -e "print(iwinfo[iwinfo.type('$1')].country('$1'))"
+UserParameter=wifi.iwinfo.nbusers[*],lua -l iwinfo -e "n = 0; for _,_ in pairs(iwinfo[iwinfo.type('$1')].assoclist('$1')) do n = n + 1 end; print(n)"
+UserParameter=wifi.iwinfo.encryption[*],lua -l iwinfo -e "e = iwinfo[iwinfo.type('$1')].encryption('$1'); print(e and e.description or 'None')"
+UserParameter=wifi.iwinfo.hwmode[*],lua -l iwinfo -e "x=iwinfo[iwinfo.type('$1')].hwmodelist('$1'); print((x.a and 'a' or '')..(x.b and 'b' or '')..(x.g and 'g' or '')..(x.n and 'n' or ''))"
+
diff --git a/trunk/package/admin/zabbix/files/zabbix_agentd.init b/trunk/package/admin/zabbix/files/zabbix_agentd.init
new file mode 100755 (executable)
index 0000000..86f1ced
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2011 OpenWrt.org
+
+START=60
+
+USE_PROCD=1
+PROG=/usr/sbin/zabbix_agentd
+CONFIG=/etc/zabbix_agentd.conf
+
+start_service() {
+       # Sometimes the agentd config was installed in /etc/zabbix/zabbix_agentd.conf
+       [ -f /etc/zabbix/zabbix_agentd.conf ] && mv /etc/zabbix/zabbix_agentd.conf ${CONFIG}
+
+       [ -f ${CONFIG} ] || return 1
+
+       procd_open_instance
+       procd_set_param command ${PROG} -c ${CONFIG} -f
+       procd_set_param respawn
+       procd_close_instance
+}
+
diff --git a/trunk/package/admin/zabbix/files/zabbix_helper_mac80211.c b/trunk/package/admin/zabbix/files/zabbix_helper_mac80211.c
new file mode 100644 (file)
index 0000000..1442d27
--- /dev/null
@@ -0,0 +1,77 @@
+#define _GNU_SOURCE
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <sys/types.h>
+#include <dirent.h>
+#include <stdbool.h>
+
+int discovery()
+{
+    DIR *dir;
+    struct dirent *ent;
+    bool comma = false;
+    if ((dir = opendir ("/sys/kernel/debug/ieee80211/")) != NULL) {
+        printf("{\"data\":[");
+        while ((ent = readdir (dir)) != NULL) {
+            if (strcmp(".", ent->d_name) && strcmp("..", ent->d_name)) {
+                if (comma)
+                    printf(",");
+                printf("{\"{#PHY}\":\"%s\"}", ent->d_name);
+                comma = true;
+            }
+        }
+        printf("]}\n");
+        closedir(dir);
+    } else {
+        perror("");
+        return EXIT_FAILURE;
+    }
+    return EXIT_SUCCESS;
+}
+
+int get_param(char *phy, char *stat)
+{
+    char *filename = NULL;
+    FILE *f = NULL;
+    phy = basename(phy);
+    stat = basename(stat);
+    if (asprintf(&filename, "/sys/kernel/debug/ieee80211/%s/statistics/%s", phy, stat) > 0)
+        f = fopen(filename, "r");
+
+    if (f != NULL) {
+        char temp[256];
+        while (fgets(temp, 256, f) != NULL)
+            printf("%s",temp);
+
+        fclose(f);
+    } else {
+        perror("");
+        return EXIT_FAILURE;
+    }
+    free(filename);
+    return EXIT_SUCCESS;
+}
+
+int usage(char *name)
+{
+    fprintf(stderr, "Usage:\n");
+    fprintf(stderr, " %s discovery\n", name);
+    fprintf(stderr, " => print mac80211.phydiscovery discovery rule\n");
+    fprintf(stderr, " %s PHY STAT\n", name);
+    fprintf(stderr, " => cat /sys/kernel/debug/ieee80211/PHY/statistics/STAT as root\n");
+    return EXIT_FAILURE;
+}
+
+int main(int argc, char *argv[])
+{
+
+    switch (argc) {
+    case 2:
+        return discovery();
+    case 3:
+        return get_param(argv[1], argv[2]);
+    default:
+        return usage(argv[0]);
+    }
+}
diff --git a/trunk/package/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch b/trunk/package/admin/zabbix/patches/002-fix-res_send-on-uclibc.patch
new file mode 100644 (file)
index 0000000..cedad90
--- /dev/null
@@ -0,0 +1,35 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -152,6 +152,10 @@ if test "x$found_resolv" != "xyes"; then
+       AC_MSG_ERROR([Unable to do DNS lookups (libresolv check failed)])
+ fi
+ LIBS="${LIBS} ${RESOLV_LIBS}"
++AC_SEARCH_LIBS([res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
++AC_SEARCH_LIBS([__res_mkquery], [], [AC_DEFINE([HAVE_RES_MKQUERY], 1, [Define if res_mkquery exists])])
++AC_SEARCH_LIBS([res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])])
++AC_SEARCH_LIBS([__res_send], [], [AC_DEFINE([HAVE_RES_SEND], 1, [Define if res_send exists])]) 
+ dnl *****************************************************************
+ dnl *                                                               *
+--- a/src/libs/zbxsysinfo/common/net.c
++++ b/src/libs/zbxsysinfo/common/net.c
+@@ -450,6 +450,7 @@ static int dns_query(AGENT_REQUEST *requ
+               return SYSINFO_RET_FAIL;
+       }
++#if defined(HAVE_RES_MKQUERY) && defined(HAVE_RES_SEND) 
+       if (-1 == (res = res_mkquery(QUERY, zone, C_IN, type, NULL, 0, NULL, buf, sizeof(buf))))
+       {
+               SET_MSG_RESULT(result, zbx_dsprintf(NULL, "Cannot create DNS query: %s", zbx_strerror(errno)));
+@@ -480,6 +481,11 @@ static int        dns_query(AGENT_REQUEST *requ
+       _res.retry = retry;
+       res = res_send(buf, res, answer.buffer, sizeof(answer.buffer));
++#else /* defined(HAVE_RES_QUERY) && defined(HAVE_RES_SEND) */
++      /* retrand and retry are ignored */
++      if (-1 == (res = res_query(zone, C_IN, type, answer.buffer, sizeof(answer.buffer))))
++      return SYSINFO_RET_FAIL;
++#endif 
+       _res.retrans = saved_retrans;
+       _res.retry = saved_retry;
diff --git a/trunk/package/admin/zabbix/patches/002-uclibc_loadavg.patch b/trunk/package/admin/zabbix/patches/002-uclibc_loadavg.patch
new file mode 100644 (file)
index 0000000..191f1a1
--- /dev/null
@@ -0,0 +1,48 @@
+--- a/src/libs/zbxsysinfo/linux/cpu.c
++++ b/src/libs/zbxsysinfo/linux/cpu.c
+@@ -62,6 +62,45 @@ int SYSTEM_CPU_DISCOVERY(AGENT_REQUEST *
+       return SYSINFO_RET_OK;
+ }
++
++/* uclibc and dietlibc do not have this junk -ReneR */
++#if defined (__UCLIBC__) || defined (__dietlibc__)
++static int getloadavg (double loadavg[], int nelem)
++{
++  int fd;
++
++  fd = open ("/proc/loadavg", O_RDONLY);
++  if (fd < 0)
++    return -1;
++  else
++    {
++      char buf[65], *p;
++      ssize_t nread;
++      int i;
++
++      nread = read (fd, buf, sizeof buf - 1);
++      close (fd);
++      if (nread <= 0)
++      return -1;
++      buf[nread - 1] = '\0';
++
++      if (nelem > 3)
++      nelem = 3;
++      p = buf;
++      for (i = 0; i < nelem; ++i)
++      {
++        char *endp;
++        loadavg[i] = strtod (p, &endp);
++        if (endp == p)
++          return -1;
++        p = endp;
++      }
++
++      return i;
++    }
++}
++#endif
++
+ int   SYSTEM_CPU_NUM(AGENT_REQUEST *request, AGENT_RESULT *result)
+ {
+       char    *type;
diff --git a/trunk/package/admin/zabbix/patches/010-change-agentd-config.patch b/trunk/package/admin/zabbix/patches/010-change-agentd-config.patch
new file mode 100644 (file)
index 0000000..e4812f6
--- /dev/null
@@ -0,0 +1,62 @@
+--- a/conf/zabbix_agentd.conf
++++ b/conf/zabbix_agentd.conf
+@@ -3,12 +3,8 @@
+ ############ GENERAL PARAMETERS #################
+-### Option: PidFile
+-#     Name of PID file.
+-#
+-# Mandatory: no
+-# Default:
+-# PidFile=/tmp/zabbix_agentd.pid
++# We do not need PidFile with procd
++# PidFile=/var/run/zabbix_agentd.pid
+ ### Option: LogFile
+ #     Name of log file.
+@@ -18,8 +14,6 @@
+ # Default:
+ # LogFile=
+-LogFile=/tmp/zabbix_agentd.log
+-
+ ### Option: LogFileSize
+ #     Maximum size of log file in MB.
+ #     0 - disable automatic log rotation.
+@@ -104,6 +98,7 @@ Server=127.0.0.1
+ # Range: 0-100
+ # Default:
+ # StartAgents=3
++StartAgents=1
+ ##### Active checks related
+@@ -119,8 +114,6 @@ Server=127.0.0.1
+ # Default:
+ # ServerActive=
+-ServerActive=127.0.0.1
+-
+ ### Option: Hostname
+ #     Unique, case sensitive hostname.
+ #     Required for active checks and must match hostname as configured on the server.
+@@ -130,8 +123,6 @@ ServerActive=127.0.0.1
+ # Default:
+ # Hostname=
+-Hostname=Zabbix server
+-
+ ### Option: HostnameItem
+ #     Item used for generating Hostname if it is undefined. Ignored if Hostname is defined.
+ #     Does not support UserParameters or aliases.
+@@ -249,8 +240,8 @@ Hostname=Zabbix server
+ # Include=
+ # Include=/usr/local/etc/zabbix_agentd.userparams.conf
+-# Include=/usr/local/etc/zabbix_agentd.conf.d/
+ # Include=/usr/local/etc/zabbix_agentd.conf.d/*.conf
++Include=/etc/zabbix_agentd.conf.d/
+ ####### USER-DEFINED MONITORED PARAMETERS #######
diff --git a/trunk/package/admin/zabbix/patches/015-daemon-foreground.patch b/trunk/package/admin/zabbix/patches/015-daemon-foreground.patch
new file mode 100644 (file)
index 0000000..20e1306
--- /dev/null
@@ -0,0 +1,243 @@
+--- a/include/common.h
++++ b/include/common.h
+@@ -1081,4 +1081,7 @@ int      parse_serveractive_element(char *str
+ #define ZBX_SESSION_ACTIVE    0
+ #define ZBX_SESSION_PASSIVE   1
++#define ZBX_RUN_BACKGROUND      0
++#define ZBX_RUN_FOREGROUND      1
++
+ #endif
+--- a/include/daemon.h
++++ b/include/daemon.h
+@@ -28,7 +28,7 @@ extern char  *CONFIG_PID_FILE;
+ #include "threads.h"
+-int   daemon_start(int allow_root, const char *user);
++int   daemon_start(int allow_root, const char *user, int run_foreground);
+ void  daemon_stop();
+ int   zbx_sigusr_send(int flags);
+@@ -36,6 +36,6 @@ int  zbx_sigusr_send(int flags);
+ #define ZBX_IS_RUNNING()      1
+ #define ZBX_DO_EXIT()
+-#define START_MAIN_ZABBIX_ENTRY(a, u) daemon_start(a, u)
++#define START_MAIN_ZABBIX_ENTRY(a, u, f)      daemon_start(a, u, f)
+ #endif        /* ZABBIX_DAEMON_H */
+--- a/src/libs/zbxnix/daemon.c
++++ b/src/libs/zbxnix/daemon.c
+@@ -272,16 +272,17 @@ static void      set_daemon_signal_handlers()
+  *                                                                            *
+  * Purpose: init process as daemon                                            *
+  *                                                                            *
+- * Parameters: allow_root - allow root permission for application             *
+- *             user       - user on the system to which to drop the           *
+- *                          privileges                                        *
++ * Parameters: allow_root     - allow root permission for application         *
++ *             user           - user on the system to which to drop the       *
++ *                              privileges                                    *
++ *             run_foreground - should it close its controling tty            *
+  *                                                                            *
+  * Author: Alexei Vladishev                                                   *
+  *                                                                            *
+  * Comments: it doesn't allow running under 'root' if allow_root is zero      *
+  *                                                                            *
+  ******************************************************************************/
+-int   daemon_start(int allow_root, const char *user)
++int   daemon_start(int allow_root, const char *user, int run_foreground)
+ {
+       pid_t           pid;
+       struct passwd   *pwd;
+@@ -336,15 +337,22 @@ int      daemon_start(int allow_root, const c
+ #endif
+       }
+-      if (0 != (pid = zbx_fork()))
+-              exit(EXIT_SUCCESS);
++      if ( ZBX_RUN_FOREGROUND != run_foreground)
++              if (0 != (pid = zbx_fork()))
++                      exit(EXIT_SUCCESS);
+       setsid();
+       signal(SIGHUP, SIG_IGN);
+-      if (0 != (pid = zbx_fork()))
+-              exit(EXIT_SUCCESS);
++      if ( ZBX_RUN_FOREGROUND == run_foreground) {
++              zabbix_log(LOG_LEVEL_INFORMATION, "Running in foreground...");
++      } else {
++              if (0 != (pid = zbx_fork()))
++                      exit(EXIT_SUCCESS);
++      }
++
++
+       if (-1 == chdir("/"))   /* this is to eliminate warning: ignoring return value of chdir */
+               assert(0);
+--- a/src/zabbix_agent/zabbix_agentd.c
++++ b/src/zabbix_agent/zabbix_agentd.c
+@@ -62,6 +62,8 @@ const char   *progname = NULL;
+       static char     DEFAULT_CONFIG_FILE[]   = SYSCONFDIR "/zabbix_agentd.conf";
+ #endif
++int CONFIG_FOREGROUND = ZBX_RUN_BACKGROUND;
++
+ /* application TITLE */
+ const char    title_message[] = APPLICATION_NAME
+ #if defined(_WIN64)
+@@ -93,6 +95,7 @@ const char   usage_message[] =
+ const char    *help_message[] = {
+       "Options:",
+       "  -c --config <config-file>       Absolute path to the configuration file",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -p --print                      Print known items and exit",
+       "  -t --test <item key>            Test specified item and exit",
+       "  -h --help                       Display help information",
+@@ -127,6 +130,7 @@ const char *help_message[] = {
+ /* COMMAND LINE OPTIONS */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"help",                0,      NULL,   'h'},
+       {"version",             0,      NULL,   'V'},
+@@ -147,7 +151,7 @@ static struct zbx_option   longopts[] =
+ };
+ static char   shortopts[] =
+-      "c:hVpt:"
++      "c:hfVpt:"
+ #ifndef _WINDOWS
+       "R:"
+ #else
+@@ -241,6 +245,9 @@ static void        parse_commandline(int argc,
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = strdup(zbx_optarg);
+                               break;
+@@ -944,7 +951,7 @@ int        main(int argc, char **argv)
+                       break;
+       }
+-      START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      START_MAIN_ZABBIX_ENTRY(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+       exit(EXIT_SUCCESS);
+ }
+--- a/src/zabbix_proxy/proxy.c
++++ b/src/zabbix_proxy/proxy.c
+@@ -60,6 +60,7 @@ const char   usage_message[] = "[-hV] [-c
+ const char    *help_message[] = {
+       "Options:",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -c --config <file>              Absolute path to the configuration file",
+       "  -R --runtime-control <option>   Perform administrative functions",
+       "",
+@@ -84,6 +85,7 @@ const char   *help_message[] = {
+ /* long options */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"runtime-control",     1,      NULL,   'R'},
+       {"help",                0,      NULL,   'h'},
+@@ -92,7 +94,7 @@ static struct zbx_option     longopts[] =
+ };
+ /* short options */
+-static char   shortopts[] = "c:n:hVR:";
++static char   shortopts[] = "c:n:fhVR:";
+ /* end of COMMAND LINE OPTIONS */
+@@ -202,6 +204,7 @@ char       *CONFIG_LOAD_MODULE_PATH        = NULL;
+ char  **CONFIG_LOAD_MODULE            = NULL;
+ char  *CONFIG_USER                    = NULL;
++int   CONFIG_FOREGROUND               = ZBX_RUN_BACKGROUND;
+ /* web monitoring */
+ #ifdef HAVE_LIBCURL
+@@ -666,6 +669,9 @@ int        main(int argc, char **argv)
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
+                               break;
+@@ -705,7 +711,7 @@ int        main(int argc, char **argv)
+       init_ipmi_handler();
+ #endif
+-      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+ }
+ int   MAIN_ZABBIX_ENTRY()
+--- a/src/zabbix_server/server.c
++++ b/src/zabbix_server/server.c
+@@ -64,6 +64,7 @@ const char   usage_message[] = "[-hV] [-c
+ const char    *help_message[] = {
+       "Options:",
++      "  -f --foreground                 Run in foreground don't fork",
+       "  -c --config <file>              Absolute path to the configuration file",
+       "  -R --runtime-control <option>   Perform administrative functions",
+       "",
+@@ -88,6 +89,7 @@ const char   *help_message[] = {
+ /* long options */
+ static struct zbx_option      longopts[] =
+ {
++      {"foreground",          0,      NULL,   'f'},
+       {"config",              1,      NULL,   'c'},
+       {"runtime-control",     1,      NULL,   'R'},
+       {"help",                0,      NULL,   'h'},
+@@ -96,7 +98,7 @@ static struct zbx_option     longopts[] =
+ };
+ /* short options */
+-static char   shortopts[] = "c:n:hVR:";
++static char   shortopts[] = "c:n:fhVR:";
+ /* end of COMMAND LINE OPTIONS */
+@@ -197,6 +199,7 @@ char       *CONFIG_LOAD_MODULE_PATH        = NULL;
+ char  **CONFIG_LOAD_MODULE            = NULL;
+ char  *CONFIG_USER                    = NULL;
++int   CONFIG_FOREGROUND               = ZBX_RUN_BACKGROUND;
+ /* web monitoring */
+ #ifdef HAVE_LIBCURL
+@@ -631,6 +634,9 @@ int        main(int argc, char **argv)
+       {
+               switch (ch)
+               {
++                      case 'f':
++                              CONFIG_FOREGROUND = ZBX_RUN_FOREGROUND;
++                              break;
+                       case 'c':
+                               CONFIG_FILE = zbx_strdup(CONFIG_FILE, zbx_optarg);
+                               break;
+@@ -670,7 +676,7 @@ int        main(int argc, char **argv)
+       init_ipmi_handler();
+ #endif
+-      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER);
++      return daemon_start(CONFIG_ALLOW_ROOT, CONFIG_USER, CONFIG_FOREGROUND);
+ }
+ int   MAIN_ZABBIX_ENTRY()
diff --git a/trunk/package/admin/zabbix/patches/100-musl-compat.patch b/trunk/package/admin/zabbix/patches/100-musl-compat.patch
new file mode 100644 (file)
index 0000000..2b6fee6
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -51,7 +51,7 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string
+   syslog.h time.h errno.h sys/types.h sys/stat.h netinet/in.h \
+   math.h sys/socket.h dirent.h ctype.h \
+   mtent.h fcntl.h sys/param.h arpa/inet.h \
+-  sys/vfs.h sys/pstat.h sys/sysinfo.h sys/statvfs.h sys/statfs.h \
++  sys/vfs.h sys/pstat.h sys/statvfs.h sys/statfs.h \
+   sys/socket.h sys/loadavg.h arpa/inet.h \
+   sys/vmmeter.h strings.h vm/vm_param.h \
+   sys/time.h kstat.h sys/syscall.h sys/sysmacros.h \
+@@ -63,6 +63,11 @@ AC_CHECK_HEADERS(stdio.h stdlib.h string
+   sys/timeb.h Winber.h lber.h ws2tcpip.h inttypes.h sys/file.h grp.h \
+   execinfo.h libperfstat.h sys/systemcfg.h sys/mnttab.h mntent.h sys/times.h \
+   dlfcn.h sys/utsname.h)
++AC_CHECK_HEADERS(sys/sysinfo.h, [], [], [
++#ifdef HAVE_LINUX_KERNEL_H
++#  include <linux/kernel.h>
++#endif
++])
+ AC_CHECK_HEADERS(resolv.h, [], [], [
+ #ifdef HAVE_SYS_TYPES_H
+ #  include <sys/types.h>
diff --git a/trunk/package/devel/diffutils/Makefile b/trunk/package/devel/diffutils/Makefile
new file mode 100644 (file)
index 0000000..fb00a42
--- /dev/null
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2008-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:=diffutils
+PKG_VERSION:=3.3
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/diffutils
+PKG_MD5SUM:=99180208ec2a82ce71f55b0d7389f1b3
+PKG_MAINTAINER:=Roger D <rogerdammit@gmail.com>
+PKG_LICENSE:=GPL-3.0
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/diffutils
+  SECTION:=devel
+  CATEGORY:=Development
+  DEPENDS:=+USE_GLIBC:librt
+  TITLE:=diffutils
+  URL:=http://www.gnu.org/software/diffutils/
+endef
+
+define Package/diffutils/description
+  The Diffutils package contains programs that show the differences between
+  files or directories.
+endef
+
+CONFIGURE_VARS += \
+       ac_cv_func_mempcpy=n
+TARGET_CFLAGS += --std=gnu99
+
+define Package/diffutils/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/{sdiff,diff3,diff,cmp} $(1)/usr/bin/
+endef
+
+define Package/diffutils/preinst
+#!/bin/sh
+for x in sdiff diff3 diff cmp; do
+  [ -L "$${IPKG_INSTROOT}/usr/bin/$$x" ] && rm -f "$${IPKG_INSTROOT}/usr/bin/$$x"
+done
+exit 0
+endef
+
+define Package/diffutils/postrm
+#!/bin/sh
+for x in sdiff diff3 diff cmp; do
+  /bin/busybox $$x -h 2>&1 | grep -q BusyBox && ln -sf ../../bin/busybox /usr/bin/$$x
+done
+exit 0
+endef
+
+$(eval $(call BuildPackage,diffutils))
diff --git a/trunk/package/devel/gcc/Makefile b/trunk/package/devel/gcc/Makefile
new file mode 100644 (file)
index 0000000..1f3f0e3
--- /dev/null
@@ -0,0 +1,120 @@
+#
+# Copyright (C) 2008 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:=gcc
+PKG_VERSION:=4.8.3
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-$(PKG_VERSION) \
+     http://mirrors.rcn.net/pub/sourceware/gcc/releases/gcc-$(PKG_VERSION) \
+    ftp://ftp.gnu.org/gnu/gcc/releases/gcc-$(PKG_VERSION)
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=7c60f24fab389f77af203d2516ee110f
+PKG_INSTALL:=1
+PKG_FIXUP:=libtool
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_LANGUAGES:="c,c++"
+BUGURL=https://dev.openwrt.org/
+PKGVERSION=OpenWrt GCC $(PKG_VERSION)
+
+# not using sstrip here as this fucks up the .so's somehow
+STRIP:=$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)strip
+RSTRIP:= \
+       NM="$(TOOLCHAIN_DIR)/bin/$(TARGET_CROSS)nm" \
+       STRIP="$(STRIP)" \
+       STRIP_KMOD="$(STRIP) --strip-debug" \
+       $(SCRIPT_DIR)/rstrip.sh
+
+
+define Package/gcc
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=gcc
+  MAINTAINER:=Christian Beier <cb@shoutrlabs.com>
+  DEPENDS:= +binutils +libstdcpp
+endef
+
+define Package/gcc/description
+       build a native toolchain for compiling on target
+endef
+
+
+define Build/Prepare
+       $(PKG_UNPACK)
+#      we have to download additional stuff before patching
+       (cd $(PKG_BUILD_DIR) && ./contrib/download_prerequisites)
+       $(Build/Patch)
+#      poor man's fix for `none-openwrt-linux' not recognized when building with musl
+       cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpfr/
+       cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/gmp/
+       cp $(PKG_BUILD_DIR)/config.sub $(PKG_BUILD_DIR)/mpc/
+endef
+
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); rm -f config.cache; \
+               SHELL="$(BASH)" \
+               $(TARGET_CONFIGURE_OPTS) \
+               $(PKG_BUILD_DIR)/configure \
+                       $(CONFIGURE_ARGS) \
+                       --build=$(GNU_HOST_NAME) \
+                       --host=$(REAL_GNU_TARGET_NAME) \
+                       --target=$(REAL_GNU_TARGET_NAME) \
+                       --enable-languages=$(TARGET_LANGUAGES) \
+                       --with-bugurl=$(BUGURL) \
+                       --with-pkgversion="$(PKGVERSION)" \
+                       --enable-shared \
+                       --disable-__cxa_atexit \
+                       --enable-target-optspace \
+                       --with-gnu-ld \
+                       --disable-nls \
+                       --disable-libmudflap \
+                       --disable-multilib \
+                       --disable-libgomp \
+                       --disable-libquadmath \
+                       --disable-libssp \
+                       --disable-decimal-float \
+                       --disable-libstdcxx-pch \
+                       --with-host-libstdcxx=-lstdc++ \
+                       --prefix=/usr \
+                       --libexecdir=/usr/lib \
+                       $(SOFT_FLOAT_CONFIG_OPTION) \
+                       $(call qstrip,$(CONFIG_EXTRA_GCC_CONFIG_OPTIONS)) \
+                       $(if $(CONFIG_mips64)$(CONFIG_mips64el),--with-arch=mips64 \
+                       --with-abi=$(subst ",,$(CONFIG_MIPS64_ABI))) \
+       );
+endef
+
+define Build/Compile
+       export SHELL="$(BASH)"; $(MAKE_VARS) $(MAKE) -C $(PKG_BUILD_DIR) \
+                       DESTDIR="$(PKG_INSTALL_DIR)" $(MAKE_ARGS) all install
+endef
+
+define Package/gcc/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
+       cp -ar $(PKG_INSTALL_DIR)/usr/include $(1)/usr
+       cp -a $(PKG_INSTALL_DIR)/usr/bin/{$(REAL_GNU_TARGET_NAME)-{g++,gcc},cpp,gcov} $(1)/usr/bin
+       ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/c++
+       ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/g++
+       ln -s $(REAL_GNU_TARGET_NAME)-g++ $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-c++
+       ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/gcc
+       ln -s $(REAL_GNU_TARGET_NAME)-gcc $(1)/usr/bin/$(REAL_GNU_TARGET_NAME)-gcc-$(PKG_VERSION)
+       cp -ar $(PKG_INSTALL_DIR)/usr/lib/gcc $(1)/usr/lib
+       $(RM) $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/*.a
+       cp -ar $(TOOLCHAIN_DIR)/include $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
+       cp -a $(TOOLCHAIN_DIR)/lib/*.{o,so*} $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
+       cp -a $(TOOLCHAIN_DIR)/lib/*nonshared*.a  $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)
+       grep "GROUP.*-lgcc" $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgcc_s.so && cp -a $(PKG_INSTALL_DIR)/usr/lib/gcc/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/libgcc.a $(1)/usr/lib/$(PKG_NAME)/$(REAL_GNU_TARGET_NAME)/$(PKG_VERSION)/ ; true
+endef
+
+$(eval $(call BuildPackage,gcc))
diff --git a/trunk/package/devel/gcc/README b/trunk/package/devel/gcc/README
new file mode 100644 (file)
index 0000000..58db474
--- /dev/null
@@ -0,0 +1,10 @@
+Native GCC that runs on target.
+
+To save disk space, this GCC only supports dynamic linking on the target box,
+there are no static libraries shipped except libgcc.a on those architectures
+that need it.
+
+For now, this was only tested on arm (EABI) and mips targets. Others to be
+done...
+
+   Christian Beier <cb@shoutrlabs.com>
diff --git a/trunk/package/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch b/trunk/package/devel/gcc/patches/002-dont-choke-when-building-32bit-on-64bit.patch
new file mode 100644 (file)
index 0000000..8472960
--- /dev/null
@@ -0,0 +1,15 @@
+diff --git a/gcc/real.h b/gcc/real.h
+index 2ff84f6..fbb4b0e 100644
+--- a/gcc/real.h
++++ b/gcc/real.h
+@@ -72,8 +72,10 @@ struct GTY(()) real_value {
+    + (REAL_VALUE_TYPE_SIZE%HOST_BITS_PER_WIDE_INT ? 1 : 0)) /* round up */
+ /* Verify the guess.  */
++#ifndef __LP64__
+ extern char test_real_width
+   [sizeof(REAL_VALUE_TYPE) <= REAL_WIDTH*sizeof(HOST_WIDE_INT) ? 1 : -1];
++#endif
+ /* Calculate the format for CONST_DOUBLE.  We need as many slots as
+    are necessary to overlay a REAL_VALUE_TYPE on them.  This could be
diff --git a/trunk/package/devel/gcc/patches/003-mpfr-longlong-mips.patch b/trunk/package/devel/gcc/patches/003-mpfr-longlong-mips.patch
new file mode 100644 (file)
index 0000000..0ab9fe5
--- /dev/null
@@ -0,0 +1,38 @@
+diff -Naurd mpfr-2.4.2-a/mpfr-longlong.h mpfr-2.4.2-b/mpfr-longlong.h
+--- -a/mpfr-2.4.2/mpfr-longlong.h      2009-11-30 02:43:08.000000000 +0000
++++ -b/mpfr-2.4.2/mpfr-longlong.h      2009-12-18 12:04:29.000000000 +0000
+@@ -1011,7 +1011,15 @@
+ #endif /* __m88000__ */
+ #if defined (__mips) && W_TYPE_SIZE == 32
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    UDItype _r;                                                       \
++    _r = (UDItype) u * v;                                             \
++    (w1) = _r >> 32;                                                  \
++    (w0) = (USItype) _r;                                              \
++  } while (0)
++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("multu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+ #else
+@@ -1024,7 +1032,16 @@
+ #endif /* __mips */
+ #if (defined (__mips) && __mips >= 3) && W_TYPE_SIZE == 64
+-#if __GNUC__ > 2 || __GNUC_MINOR__ >= 7
++#if (__GNUC__ >= 5) || (__GNUC__ >= 4 && __GNUC_MINOR__ >= 4)
++typedef unsigned int UTItype __attribute__ ((mode (TI)));
++#define umul_ppmm(w1, w0, u, v) \
++  do {                                                                        \
++    UTItype _r;                                                       \
++    _r = (UTItype) u * v;                                             \
++    (w1) = _r >> 64;                                                  \
++    (w0) = (UDItype) _r;                                              \
++  } while (0)
++#elif __GNUC__ > 2 || __GNUC_MINOR__ >= 7
+ #define umul_ppmm(w1, w0, u, v) \
+   __asm__ ("dmultu %2,%3" : "=l" (w0), "=h" (w1) : "d" (u), "d" (v))
+ #else
diff --git a/trunk/package/devel/gcc/patches/010-documentation.patch b/trunk/package/devel/gcc/patches/010-documentation.patch
new file mode 100644 (file)
index 0000000..3f604ee
--- /dev/null
@@ -0,0 +1,23 @@
+--- a/gcc/Makefile.in
++++ b/gcc/Makefile.in
+@@ -4326,18 +4326,10 @@ doc/gcc.info: $(TEXI_GCC_FILES)
+ doc/gccint.info: $(TEXI_GCCINT_FILES)
+ doc/cppinternals.info: $(TEXI_CPPINT_FILES)
+-doc/%.info: %.texi
+-      if [ x$(BUILD_INFO) = xinfo ]; then \
+-              $(MAKEINFO) $(MAKEINFOFLAGS) -I . -I $(gcc_docdir) \
+-                      -I $(gcc_docdir)/include -o $@ $<; \
+-      fi
++doc/%.info:
+ # Duplicate entry to handle renaming of gccinstall.info
+-doc/gccinstall.info: $(TEXI_GCCINSTALL_FILES)
+-      if [ x$(BUILD_INFO) = xinfo ]; then \
+-              $(MAKEINFO) $(MAKEINFOFLAGS) -I $(gcc_docdir) \
+-                      -I $(gcc_docdir)/include -o $@ $<; \
+-      fi
++doc/gccinstall.info:
+ doc/cpp.dvi: $(TEXI_CPP_FILES)
+ doc/gcc.dvi: $(TEXI_GCC_FILES)
diff --git a/trunk/package/devel/gcc/patches/020-disable-check-for-sys-sdt-h.patch b/trunk/package/devel/gcc/patches/020-disable-check-for-sys-sdt-h.patch
new file mode 100644 (file)
index 0000000..afc5cfd
--- /dev/null
@@ -0,0 +1,45 @@
+diff --git a/gcc/configure b/gcc/configure
+index 3793681..bcda752 100755
+--- a/gcc/configure
++++ b/gcc/configure
+@@ -26876,19 +26876,6 @@ $as_echo "#define TARGET_LIBC_PROVIDES_SSP 1" >>confdefs.h
+ fi
+-# Test for <sys/sdt.h> on the target.
+-
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking sys/sdt.h in the target C library" >&5
+-$as_echo_n "checking sys/sdt.h in the target C library... " >&6; }
+-have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
+-
+-$as_echo "#define HAVE_SYS_SDT_H 1" >>confdefs.h
+-
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_sys_sdt_h" >&5
+-$as_echo "$have_sys_sdt_h" >&6; }
+ # Check if TFmode long double should be used by default or not.
+ # Some glibc targets used DFmode long double, but with glibc 2.4
+diff --git a/gcc/configure.ac b/gcc/configure.ac
+index 3ee1d67..e321218 100644
+--- a/gcc/configure.ac
++++ b/gcc/configure.ac
+@@ -4796,16 +4796,6 @@ if test x$gcc_cv_libc_provides_ssp = xyes; then
+           [Define if your target C library provides stack protector support])
+ fi
+-# Test for <sys/sdt.h> on the target.
+-GCC_TARGET_TEMPLATE([HAVE_SYS_SDT_H])
+-AC_MSG_CHECKING(sys/sdt.h in the target C library)
+-have_sys_sdt_h=no
+-if test -f $target_header_dir/sys/sdt.h; then
+-  have_sys_sdt_h=yes
+-  AC_DEFINE(HAVE_SYS_SDT_H, 1,
+-            [Define if your target C library provides sys/sdt.h])
+-fi
+-AC_MSG_RESULT($have_sys_sdt_h)
+ # Check if TFmode long double should be used by default or not.
+ # Some glibc targets used DFmode long double, but with glibc 2.4
diff --git a/trunk/package/devel/gcc/patches/100-uclibc-conf.patch b/trunk/package/devel/gcc/patches/100-uclibc-conf.patch
new file mode 100644 (file)
index 0000000..ff9ad94
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/contrib/regression/objs-gcc.sh
++++ b/contrib/regression/objs-gcc.sh
+@@ -106,6 +106,10 @@ if [ $H_REAL_TARGET = $H_REAL_HOST -a $H
+  then
+   make all-gdb all-dejagnu all-ld || exit 1
+   make install-gdb install-dejagnu install-ld || exit 1
++elif [ $H_REAL_TARGET = $H_REAL_HOST -a $H_REAL_TARGET = i686-pc-linux-uclibc ]
++ then
++  make all-gdb all-dejagnu all-ld || exit 1
++  make install-gdb install-dejagnu install-ld || exit 1
+ elif [ $H_REAL_TARGET = $H_REAL_HOST ] ; then
+   make bootstrap || exit 1
+   make install || exit 1
+--- a/libjava/classpath/ltconfig
++++ b/libjava/classpath/ltconfig
+@@ -603,7 +603,7 @@ host_os=`echo $host | sed 's/^\([^-]*\)-
+ # Transform linux* to *-*-linux-gnu*, to support old configure scripts.
+ case $host_os in
+-linux-gnu*) ;;
++linux-gnu*|linux-uclibc*) ;;
+ linux*) host=`echo $host | sed 's/^\(.*-.*-linux\)\(.*\)$/\1-gnu\2/'`
+ esac
+@@ -1247,7 +1247,7 @@ linux-gnuoldld* | linux-gnuaout* | linux
+   ;;
+ # This must be Linux ELF.
+-linux-gnu*)
++linux*)
+   version_type=linux
+   need_lib_prefix=no
+   need_version=no
diff --git a/trunk/package/devel/gcc/patches/200-musl.patch b/trunk/package/devel/gcc/patches/200-musl.patch
new file mode 100644 (file)
index 0000000..2e6df47
--- /dev/null
@@ -0,0 +1,321 @@
+--- a/gcc/config.gcc
++++ b/gcc/config.gcc
+@@ -549,7 +549,7 @@ case ${target} in
+ esac
+ # Common C libraries.
+-tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3"
++tm_defines="$tm_defines LIBC_GLIBC=1 LIBC_UCLIBC=2 LIBC_BIONIC=3 LIBC_MUSL=4"
+ # Common parts for widely ported systems.
+ case ${target} in
+@@ -652,6 +652,9 @@ case ${target} in
+     *-*-*uclibc*)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_UCLIBC"
+       ;;
++    *-*-*musl*)
++      tm_defines="$tm_defines DEFAULT_LIBC=LIBC_MUSL"
++      ;;
+     *)
+       tm_defines="$tm_defines DEFAULT_LIBC=LIBC_GLIBC"
+       ;;
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -77,6 +77,10 @@
+     %{mfloat-abi=soft*:" GLIBC_DYNAMIC_LINKER_SOFT_FLOAT "} \
+     %{!mfloat-abi=*:" GLIBC_DYNAMIC_LINKER_DEFAULT "}"
++/* musl has no "classic" (i.e. broken) mode */
++#undef  MUSL_DYNAMIC_LINKER
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+--- a/gcc/config/i386/linux.h
++++ b/gcc/config/i386/linux.h
+@@ -21,3 +21,4 @@ along with GCC; see the file COPYING3.
+ #define GNU_USER_LINK_EMULATION "elf_i386"
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-i386.so.1"
+--- a/gcc/config/i386/linux64.h
++++ b/gcc/config/i386/linux64.h
+@@ -30,3 +30,7 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux-x86-64.so.2"
+ #define GLIBC_DYNAMIC_LINKERX32 "/libx32/ld-linux-x32.so.2"
++
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-i386.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-x86_64.so.1"
++#define MUSL_DYNAMIC_LINKERX32 "/lib/ld-musl-x32.so.1"
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
+@@ -32,10 +32,12 @@ see the files COPYING3 and COPYING.RUNTI
+ #define OPTION_GLIBC  (DEFAULT_LIBC == LIBC_GLIBC)
+ #define OPTION_UCLIBC (DEFAULT_LIBC == LIBC_UCLIBC)
+ #define OPTION_BIONIC (DEFAULT_LIBC == LIBC_BIONIC)
++#define OPTION_MUSL   (DEFAULT_LIBC == LIBC_MUSL)
+ #else
+ #define OPTION_GLIBC  (linux_libc == LIBC_GLIBC)
+ #define OPTION_UCLIBC (linux_libc == LIBC_UCLIBC)
+ #define OPTION_BIONIC (linux_libc == LIBC_BIONIC)
++#define OPTION_MUSL   (linux_libc == LIBC_MUSL)
+ #endif
+ #define GNU_USER_TARGET_OS_CPP_BUILTINS()                     \
+@@ -53,18 +55,21 @@ see the files COPYING3 and COPYING.RUNTI
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+-#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LD1, LD2, LD3)    \
+-  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:" LD1 "}}"
++#define CHOOSE_DYNAMIC_LINKER1(LIBC1, LIBC2, LIBC3, LIBC4, LD1, LD2, LD3, LD4)        \
++  "%{" LIBC2 ":" LD2 ";:%{" LIBC3 ":" LD3 ";:%{" LIBC4 ":" LD4 ";:" LD1 "}}}"
+ #if DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", G, U, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mglibc", "muclibc", "mbionic", "mmusl", G, U, B, M)
+ #elif DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", U, G, B)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("muclibc", "mglibc", "mbionic", "mmusl", U, G, B, M)
+ #elif DEFAULT_LIBC == LIBC_BIONIC
+-#define CHOOSE_DYNAMIC_LINKER(G, U, B) \
+-  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", B, G, U)
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mbionic", "mglibc", "muclibc", "mmusl", B, G, U, M)
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, B, M) \
++  CHOOSE_DYNAMIC_LINKER1 ("mmusl", "mglibc", "muclibc", "mbionic", M, G, U, B)
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif /* DEFAULT_LIBC */
+@@ -84,16 +89,16 @@ see the files COPYING3 and COPYING.RUNTI
+ #define GNU_USER_DYNAMIC_LINKER                                               \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, \
+-                       BIONIC_DYNAMIC_LINKER)
++                       BIONIC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define GNU_USER_DYNAMIC_LINKER32                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, \
+-                       BIONIC_DYNAMIC_LINKER32)
++                       BIONIC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64                                     \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, \
+-                       BIONIC_DYNAMIC_LINKER64)
++                       BIONIC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define GNU_USER_DYNAMIC_LINKERX32                                    \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERX32, UCLIBC_DYNAMIC_LINKERX32, \
+-                       BIONIC_DYNAMIC_LINKERX32)
++                       BIONIC_DYNAMIC_LINKERX32, MUSL_DYNAMIC_LINKERX32)
+ /* Determine whether the entire c99 runtime
+    is present in the runtime library.  */
+--- a/gcc/config/linux.opt
++++ b/gcc/config/linux.opt
+@@ -30,3 +30,7 @@ Use GNU C library
+ muclibc
+ Target Report RejectNegative Var(linux_libc,LIBC_UCLIBC) Negative(mbionic)
+ Use uClibc C library
++
++mmusl
++Target Report RejectNegative Var(linux_libc,LIBC_MUSL) Negative(mglibc)
++Use musl C library
+--- a/gcc/config/mips/linux.h
++++ b/gcc/config/mips/linux.h
+@@ -18,3 +18,5 @@ along with GCC; see the file COPYING3.
+ <http://www.gnu.org/licenses/>.  */
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
++
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-mips.so.1"
+--- a/gcc/config/rs6000/linux64.h
++++ b/gcc/config/rs6000/linux64.h
+@@ -364,17 +364,21 @@ extern int dot_symbols;
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld64.so.1"
+ #define UCLIBC_DYNAMIC_LINKER32 "/lib/ld-uClibc.so.0"
+ #define UCLIBC_DYNAMIC_LINKER64 "/lib/ld64-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-powerpc.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-powerpc64.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
+ #elif DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER32 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER32, UCLIBC_DYNAMIC_LINKER32, MUSL_DYNAMIC_LINKER32)
+ #define GNU_USER_DYNAMIC_LINKER64 \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER64, UCLIBC_DYNAMIC_LINKER64, MUSL_DYNAMIC_LINKER64)
+ #define LINK_OS_LINUX_SPEC32 "-m elf32ppclinux %{!shared: %{!static: \
+--- a/gcc/config/rs6000/sysv4.h
++++ b/gcc/config/rs6000/sysv4.h
+@@ -789,15 +789,18 @@ extern int fixuplabelno;
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKER "/lib/ld-uClibc.so.0"
++#define MUSL_DYNAMIC_LINKER "/lib/ld-musl-powerpc.so.1"
+ #if DEFAULT_LIBC == LIBC_UCLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{mglibc:" G ";:" U "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{mmusl:" M ";:" U "}}"
++#elif DEFAULT_LIBC == LIBC_MUSL
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{mglibc:" G ";:%{muclibc:" U ";:" M "}}"
+ #elif !defined (DEFAULT_LIBC) || DEFAULT_LIBC == LIBC_GLIBC
+-#define CHOOSE_DYNAMIC_LINKER(G, U) "%{muclibc:" U ";:" G "}"
++#define CHOOSE_DYNAMIC_LINKER(G, U, M) "%{muclibc:" U ";:%{mmusl:" M ";:" G "}}"
+ #else
+ #error "Unsupported DEFAULT_LIBC"
+ #endif
+ #define GNU_USER_DYNAMIC_LINKER \
+-  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER)
++  CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKER, UCLIBC_DYNAMIC_LINKER, MUSL_DYNAMIC_LINKER)
+ #define LINK_OS_LINUX_SPEC "-m elf32ppclinux %{!shared: %{!static: \
+   %{rdynamic:-export-dynamic} \
+--- a/gcc/ginclude/stddef.h
++++ b/gcc/ginclude/stddef.h
+@@ -181,6 +181,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ #ifndef _GCC_SIZE_T
+ #ifndef _SIZET_
+ #ifndef __size_t
++#ifndef __DEFINED_size_t /* musl */
+ #define __size_t__    /* BeOS */
+ #define __SIZE_T__    /* Cray Unicos/Mk */
+ #define _SIZE_T
+@@ -197,6 +198,7 @@ typedef __PTRDIFF_TYPE__ ptrdiff_t;
+ #define ___int_size_t_h
+ #define _GCC_SIZE_T
+ #define _SIZET_
++#define __DEFINED_size_t /* musl */
+ #if (defined (__FreeBSD__) && (__FreeBSD__ >= 5)) \
+   || defined(__FreeBSD_kernel__)
+ /* __size_t is a typedef on FreeBSD 5, must not trash it. */
+@@ -214,6 +216,7 @@ typedef __SIZE_TYPE__ size_t;
+ typedef long ssize_t;
+ #endif /* __BEOS__ */
+ #endif /* !(defined (__GNUG__) && defined (size_t)) */
++#endif /* __DEFINED_size_t */
+ #endif /* __size_t */
+ #endif /* _SIZET_ */
+ #endif /* _GCC_SIZE_T */
+--- a/libgomp/config/posix/time.c
++++ b/libgomp/config/posix/time.c
+@@ -28,6 +28,8 @@
+    The following implementation uses the most simple POSIX routines.
+    If present, POSIX 4 clocks should be used instead.  */
++#define _POSIX_C_SOURCE 199309L /* for clocks */
++
+ #include "libgomp.h"
+ #include <unistd.h>
+ #if TIME_WITH_SYS_TIME
+--- a/libitm/config/arm/hwcap.cc
++++ b/libitm/config/arm/hwcap.cc
+@@ -40,7 +40,11 @@ int GTM_hwcap HIDDEN = 0
+ #ifdef __linux__
+ #include <unistd.h>
++#ifdef __GLIBC__
+ #include <sys/fcntl.h>
++#else
++#include <fcntl.h>
++#endif
+ #include <elf.h>
+ static void __attribute__((constructor))
+--- a/libitm/config/linux/x86/tls.h
++++ b/libitm/config/linux/x86/tls.h
+@@ -25,16 +25,19 @@
+ #ifndef LIBITM_X86_TLS_H
+ #define LIBITM_X86_TLS_H 1
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ /* Use slots in the TCB head rather than __thread lookups.
+    GLIBC has reserved words 10 through 13 for TM.  */
+ #define HAVE_ARCH_GTM_THREAD 1
+ #define HAVE_ARCH_GTM_THREAD_DISP 1
+ #endif
++#endif
+ #include "config/generic/tls.h"
+-#if defined(__GLIBC_PREREQ) && __GLIBC_PREREQ(2, 10)
++#if defined(__GLIBC_PREREQ)
++#if __GLIBC_PREREQ(2, 10)
+ namespace GTM HIDDEN {
+ #ifdef __x86_64__
+@@ -101,5 +104,6 @@ static inline void set_abi_disp(struct a
+ } // namespace GTM
+ #endif /* >= GLIBC 2.10 */
++#endif
+ #endif // LIBITM_X86_TLS_H
+--- a/libstdc++-v3/configure.host
++++ b/libstdc++-v3/configure.host
+@@ -264,6 +264,13 @@ case "${host_os}" in
+     os_include_dir="os/bsd/freebsd"
+     ;;
+   gnu* | linux* | kfreebsd*-gnu | knetbsd*-gnu)
++    # check for musl by target
++    case "${host_os}" in
++      *-musl*)
++        os_include_dir="os/generic"
++        ;;
++      *)
++
+     if [ "$uclibc" = "yes" ]; then
+       os_include_dir="os/uclibc"
+     elif [ "$bionic" = "yes" ]; then
+@@ -272,6 +279,9 @@ case "${host_os}" in
+       os_include_dir="os/gnu-linux"
+     fi
+     ;;
++
++    esac
++    ;;
+   hpux*)
+     os_include_dir="os/hpux"
+     ;;
+--- a/gcc/config/mips/linux64.h
++++ b/gcc/config/mips/linux64.h
+@@ -27,6 +27,9 @@ along with GCC; see the file COPYING3.
+ #define GLIBC_DYNAMIC_LINKERN32 "/lib32/ld.so.1"
+ #define UCLIBC_DYNAMIC_LINKERN32 "/lib32/ld-uClibc.so.0"
+ #define BIONIC_DYNAMIC_LINKERN32 "/system/bin/linker32"
++#define MUSL_DYNAMIC_LINKERN32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-mips.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-mips.so.1"
+ #define GNU_USER_DYNAMIC_LINKERN32 \
+   CHOOSE_DYNAMIC_LINKER (GLIBC_DYNAMIC_LINKERN32, UCLIBC_DYNAMIC_LINKERN32, \
+-                       BIONIC_DYNAMIC_LINKERN32)
++                       BIONIC_DYNAMIC_LINKERN32, MUSL_DYNAMIC_LINKERN32)
+--- a/gcc/config/sparc/linux64.h       2013-09-10 10:02:45.663973856 +0100
++++ b/gcc/config/sparc/linux64.h       2013-09-10 10:03:17.871972435 +0100
+@@ -104,6 +104,9 @@
+ #define GLIBC_DYNAMIC_LINKER32 "/lib/ld-linux.so.2"
+ #define GLIBC_DYNAMIC_LINKER64 "/lib64/ld-linux.so.2"
++#define MUSL_DYNAMIC_LINKER32 "/lib/ld-musl-sparc.so.1"
++#define MUSL_DYNAMIC_LINKER64 "/lib/ld-musl-sparc.so.1"
++
+ #ifdef SPARC_BI_ARCH
+ #undef SUBTARGET_EXTRA_SPECS
+
diff --git a/trunk/package/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch b/trunk/package/devel/gcc/patches/800-arm_v5te_no_ldrd_strd.patch
new file mode 100644 (file)
index 0000000..ae4f651
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/config/arm/arm.h
++++ b/gcc/config/arm/arm.h
+@@ -271,7 +271,7 @@ extern void (*arm_lang_output_object_att
+ /* Thumb-1 only.  */
+ #define TARGET_THUMB1_ONLY            (TARGET_THUMB1 && !arm_arch_notm)
+-#define TARGET_LDRD                   (arm_arch5e && ARM_DOUBLEWORD_ALIGN \
++#define TARGET_LDRD                   (arm_arch6 && ARM_DOUBLEWORD_ALIGN \
+                                          && !TARGET_THUMB1)
+ /* The following two macros concern the ability to execute coprocessor
diff --git a/trunk/package/devel/gcc/patches/810-arm-softfloat-libgcc.patch b/trunk/package/devel/gcc/patches/810-arm-softfloat-libgcc.patch
new file mode 100644 (file)
index 0000000..33cf8ad
--- /dev/null
@@ -0,0 +1,25 @@
+--- a/libgcc/config/arm/t-linux
++++ b/libgcc/config/arm/t-linux
+@@ -1,6 +1,10 @@
+ LIB1ASMSRC = arm/lib1funcs.S
+ LIB1ASMFUNCS = _udivsi3 _divsi3 _umodsi3 _modsi3 _dvmd_lnx _clzsi2 _clzdi2 \
+-      _ctzsi2 _arm_addsubdf3 _arm_addsubsf3
++      _ctzsi2 _arm_addsubdf3 _arm_addsubsf3 \
++      _arm_negdf2 _arm_muldivdf3 _arm_cmpdf2 _arm_unorddf2 \
++      _arm_fixdfsi _arm_fixunsdfsi _arm_truncdfsf2 \
++      _arm_negsf2 _arm_muldivsf3 _arm_cmpsf2 _arm_unordsf2 \
++      _arm_fixsfsi _arm_fixunssfsi
+ # Just for these, we omit the frame pointer since it makes such a big
+ # difference.
+--- a/gcc/config/arm/linux-elf.h
++++ b/gcc/config/arm/linux-elf.h
+@@ -55,8 +55,6 @@
+    %{shared:-lc} \
+    %{!shared:%{profile:-lc_p}%{!profile:-lc}}"
+-#define LIBGCC_SPEC "%{mfloat-abi=soft*:-lfloat} -lgcc"
+-
+ #define GLIBC_DYNAMIC_LINKER "/lib/ld-linux.so.2"
+ #define LINUX_TARGET_LINK_SPEC  "%{h*} \
diff --git a/trunk/package/devel/gcc/patches/820-libgcc_pic.patch b/trunk/package/devel/gcc/patches/820-libgcc_pic.patch
new file mode 100644 (file)
index 0000000..7a0ac73
--- /dev/null
@@ -0,0 +1,36 @@
+--- a/libgcc/Makefile.in
++++ b/libgcc/Makefile.in
+@@ -865,11 +865,12 @@ $(libgcov-objects): %$(objext): $(srcdir
+ # Static libraries.
+ libgcc.a: $(libgcc-objects)
++libgcc_pic.a: $(libgcc-s-objects)
+ libgcov.a: $(libgcov-objects)
+ libunwind.a: $(libunwind-objects)
+ libgcc_eh.a: $(libgcc-eh-objects)
+-libgcc.a libgcov.a libunwind.a libgcc_eh.a:
++libgcc.a libgcov.a libunwind.a libgcc_eh.a libgcc_pic.a:
+       -rm -f $@
+       objects="$(objects)";                                   \
+@@ -891,7 +892,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_E
+ endif
+ ifeq ($(enable_shared),yes)
+-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
++all: libgcc_eh.a libgcc_pic.a libgcc_s$(SHLIB_EXT)
+ ifneq ($(LIBUNWIND),)
+ all: libunwind$(SHLIB_EXT)
+ endif
+@@ -1058,6 +1059,10 @@ install-shared:
+       chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
+       $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
++      $(INSTALL_DATA) libgcc_pic.a $(mapfile) $(DESTDIR)$(inst_libdir)/
++      chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_pic.a
++      $(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_pic.a
++
+       $(subst @multilib_dir@,$(MULTIDIR),$(subst \
+               @shlib_base_name@,libgcc_s,$(subst \
+               @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
diff --git a/trunk/package/devel/gcc/patches/830-arm_unbreak_armv4t.patch b/trunk/package/devel/gcc/patches/830-arm_unbreak_armv4t.patch
new file mode 100644 (file)
index 0000000..37f8f2a
--- /dev/null
@@ -0,0 +1,13 @@
+http://sourceware.org/ml/crossgcc/2008-05/msg00009.html
+
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -45,7 +45,7 @@
+    The ARM10TDMI core is the default for armv5t, so set
+    SUBTARGET_CPU_DEFAULT to achieve this.  */
+ #undef  SUBTARGET_CPU_DEFAULT
+-#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm10tdmi
++#define SUBTARGET_CPU_DEFAULT TARGET_CPU_arm9tdmi
+ /* TARGET_BIG_ENDIAN_DEFAULT is set in
+    config.gcc for big endian configurations.  */
diff --git a/trunk/package/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch b/trunk/package/devel/gcc/patches/840-armv4_pass_fix-v4bx_to_ld.patch
new file mode 100644 (file)
index 0000000..e938905
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -81,10 +81,15 @@
+ #undef  MUSL_DYNAMIC_LINKER
+ #define MUSL_DYNAMIC_LINKER "/lib/ld-musl-arm.so.1"
++/* For armv4 we pass --fix-v4bx to linker to support EABI */
++#undef TARGET_FIX_V4BX_SPEC
++#define TARGET_FIX_V4BX_SPEC " %{mcpu=arm8|mcpu=arm810|mcpu=strongarm*"\
++  "|march=armv4|mcpu=fa526|mcpu=fa626:--fix-v4bx}"
++
+ /* At this point, bpabi.h will have clobbered LINK_SPEC.  We want to
+    use the GNU/Linux version, not the generic BPABI version.  */
+ #undef  LINK_SPEC
+-#define LINK_SPEC BE8_LINK_SPEC                                               \
++#define LINK_SPEC BE8_LINK_SPEC TARGET_FIX_V4BX_SPEC                  \
+   LINUX_OR_ANDROID_LD (LINUX_TARGET_LINK_SPEC,                                \
+                      LINUX_TARGET_LINK_SPEC " " ANDROID_LINK_SPEC)
diff --git a/trunk/package/devel/gcc/patches/850-use_shared_libgcc.patch b/trunk/package/devel/gcc/patches/850-use_shared_libgcc.patch
new file mode 100644 (file)
index 0000000..2c7369f
--- /dev/null
@@ -0,0 +1,47 @@
+--- a/gcc/config/arm/linux-eabi.h
++++ b/gcc/config/arm/linux-eabi.h
+@@ -114,10 +114,6 @@
+ #define ENDFILE_SPEC \
+   LINUX_OR_ANDROID_LD (GNU_USER_TARGET_ENDFILE_SPEC, ANDROID_ENDFILE_SPEC)
+-/* Use the default LIBGCC_SPEC, not the version in linux-elf.h, as we
+-   do not use -lfloat.  */
+-#undef LIBGCC_SPEC
+-
+ /* Clear the instruction cache from `beg' to `end'.  This is
+    implemented in lib1funcs.S, so ensure an error if this definition
+    is used.  */
+--- a/gcc/config/linux.h
++++ b/gcc/config/linux.h
+@@ -51,6 +51,10 @@ see the files COPYING3 and COPYING.RUNTI
+       builtin_assert ("system=posix");                        \
+     } while (0)
++#ifndef LIBGCC_SPEC
++#define LIBGCC_SPEC "%{static|static-libgcc:-lgcc}%{!static:%{!static-libgcc:-lgcc_s}}"
++#endif
++
+ /* Determine which dynamic linker to use depending on whether GLIBC or
+    uClibc or Bionic is the default C library and whether
+    -muclibc or -mglibc or -mbionic has been passed to change the default.  */
+--- a/libgcc/mkmap-symver.awk
++++ b/libgcc/mkmap-symver.awk
+@@ -132,5 +132,5 @@ function output(lib) {
+   else if (inherit[lib])
+     printf("} %s;\n", inherit[lib]);
+   else
+-    printf ("\n  local:\n\t*;\n};\n");
++    printf ("\n\t*;\n};\n");
+ }
+--- a/gcc/config/rs6000/linux.h
++++ b/gcc/config/rs6000/linux.h
+@@ -61,6 +61,9 @@
+ #undef  CPLUSPLUS_CPP_SPEC
+ #define CPLUSPLUS_CPP_SPEC "-D_GNU_SOURCE %(cpp)"
++#undef LIBGCC_SPEC
++#define LIBGCC_SPEC "%{!static:%{!static-libgcc:-lgcc_s}} -lgcc"
++
+ #undef  LINK_SHLIB_SPEC
+ #define LINK_SHLIB_SPEC "%{shared:-shared} %{!shared: %{static:-static}}"
diff --git a/trunk/package/devel/gcc/patches/860-uclibc_use_eh_frame.patch b/trunk/package/devel/gcc/patches/860-uclibc_use_eh_frame.patch
new file mode 100644 (file)
index 0000000..0464bd7
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/libgcc/crtstuff.c
++++ b/libgcc/crtstuff.c
+@@ -100,15 +100,20 @@ call_ ## FUNC (void)                                     \
+ #if defined(OBJECT_FORMAT_ELF) \
+     && !defined(OBJECT_FORMAT_FLAT) \
+     && defined(HAVE_LD_EH_FRAME_HDR) \
+-    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O) \
+-    && defined(__GLIBC__) && __GLIBC__ >= 2
++    && !defined(inhibit_libc) && !defined(CRTSTUFFT_O)
+ #include <link.h>
+ /* uClibc pretends to be glibc 2.2 and DT_CONFIG is defined in its link.h.
+    But it doesn't use PT_GNU_EH_FRAME ELF segment currently.  */
+-# if !defined(__UCLIBC__) \
+-     && (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
+-     || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
+-#  define USE_PT_GNU_EH_FRAME
++# if defined(__UCLIBC__)
++#  if (__UCLIBC_MAJOR__ > 0 || __UCLIBC_MINOR__ > 9 || \
++       (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ >= 33))
++#   define USE_PT_GNU_EH_FRAME
++#  endif
++# elif defined(__GLIBC__)
++#  if (__GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ > 2) \
++       || (__GLIBC__ == 2 && __GLIBC_MINOR__ == 2 && defined(DT_CONFIG)))
++#   define USE_PT_GNU_EH_FRAME
++#  endif
+ # endif
+ #endif
diff --git a/trunk/package/devel/gcc/patches/870-ppc_no_crtsavres.patch b/trunk/package/devel/gcc/patches/870-ppc_no_crtsavres.patch
new file mode 100644 (file)
index 0000000..d8c460a
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/config/rs6000/rs6000.c
++++ b/gcc/config/rs6000/rs6000.c
+@@ -17653,7 +17653,7 @@ rs6000_savres_strategy (rs6000_stack_t *
+   /* Define cutoff for using out-of-line functions to save registers.  */
+   if (DEFAULT_ABI == ABI_V4 || TARGET_ELF)
+     {
+-      if (!optimize_size)
++      if (1)
+       {
+         strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS;
+         strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS;
diff --git a/trunk/package/devel/gcc/patches/880-no_java_section.patch b/trunk/package/devel/gcc/patches/880-no_java_section.patch
new file mode 100644 (file)
index 0000000..def6c9f
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/gcc/defaults.h
++++ b/gcc/defaults.h
+@@ -380,7 +380,7 @@ see the files COPYING3 and COPYING.RUNTI
+ /* If we have named section and we support weak symbols, then use the
+    .jcr section for recording java classes which need to be registered
+    at program start-up time.  */
+-#if defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
++#if 0 && defined (TARGET_ASM_NAMED_SECTION) && SUPPORTS_WEAK
+ #ifndef JCR_SECTION_NAME
+ #define JCR_SECTION_NAME ".jcr"
+ #endif
diff --git a/trunk/package/devel/gcc/patches/900-bad-mips16-crt.patch b/trunk/package/devel/gcc/patches/900-bad-mips16-crt.patch
new file mode 100644 (file)
index 0000000..dd6e9dc
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/libgcc/config/mips/t-mips16
++++ b/libgcc/config/mips/t-mips16
+@@ -43,3 +43,6 @@ SYNC_CFLAGS = -mno-mips16
+ # Version these symbols if building libgcc.so.
+ SHLIB_MAPFILES += $(srcdir)/config/mips/libgcc-mips16.ver
++
++CRTSTUFF_T_CFLAGS += -mno-mips16
++CRTSTUFF_T_CFLAGS_S += -mno-mips16
diff --git a/trunk/package/devel/gcc/patches/910-mbsd_multi.patch b/trunk/package/devel/gcc/patches/910-mbsd_multi.patch
new file mode 100644 (file)
index 0000000..d04dc7d
--- /dev/null
@@ -0,0 +1,253 @@
+
+       This patch brings over a few features from MirBSD:
+       * -fhonour-copts
+         If this option is not given, it's warned (depending
+         on environment variables). This is to catch errors
+         of misbuilt packages which override CFLAGS themselves.
+       * -Werror-maybe-reset
+         Has the effect of -Wno-error if GCC_NO_WERROR is
+         set and not '0', a no-operation otherwise. This is
+         to be able to use -Werror in "make" but prevent
+         GNU autoconf generated configure scripts from
+         freaking out.
+       * Make -fno-strict-aliasing and -fno-delete-null-pointer-checks
+         the default for -O2/-Os, because they trigger gcc bugs
+         and can delete code with security implications.
+
+       This patch was authored by Thorsten Glaser <tg at mirbsd.de>
+       with copyright assignment to the FSF in effect.
+
+--- a/gcc/c-family/c-opts.c
++++ b/gcc/c-family/c-opts.c
+@@ -104,6 +104,9 @@ static size_t include_cursor;
+ /* Whether any standard preincluded header has been preincluded.  */
+ static bool done_preinclude;
++/* Check if a port honours COPTS.  */
++static int honour_copts = 0;
++
+ static void handle_OPT_d (const char *);
+ static void set_std_cxx98 (int);
+ static void set_std_cxx11 (int);
+@@ -383,6 +386,9 @@ c_common_handle_option (size_t scode, co
+       cpp_opts->warn_endif_labels = value;
+       break;
++    case OPT_Werror_maybe_reset:
++      break;
++
+     case OPT_Winvalid_pch:
+       cpp_opts->warn_invalid_pch = value;
+       break;
+@@ -491,6 +497,12 @@ c_common_handle_option (size_t scode, co
+       flag_no_builtin = !value;
+       break;
++    case OPT_fhonour_copts:
++      if (c_language == clk_c) {
++        honour_copts++;
++      }
++      break;
++
+     case OPT_fconstant_string_class_:
+       constant_string_class_name = arg;
+       break;
+@@ -1027,6 +1039,47 @@ c_common_init (void)
+       return false;
+     }
++  if (c_language == clk_c) {
++    char *ev = getenv ("GCC_HONOUR_COPTS");
++    int evv;
++    if (ev == NULL)
++      evv = -1;
++    else if ((*ev == '0') || (*ev == '\0'))
++      evv = 0;
++    else if (*ev == '1')
++      evv = 1;
++    else if (*ev == '2')
++      evv = 2;
++    else if (*ev == 's')
++      evv = -1;
++    else {
++      warning (0, "unknown GCC_HONOUR_COPTS value, assuming 1");
++      evv = 1; /* maybe depend this on something like MIRBSD_NATIVE?  */
++    }
++    if (evv == 1) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in lenient mode");
++        return false;
++      } else if (honour_copts != 1) {
++        warning (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++      }
++    } else if (evv == 2) {
++      if (honour_copts == 0) {
++        error ("someone does not honour COPTS at all in strict mode");
++        return false;
++      } else if (honour_copts != 1) {
++        error ("someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++        return false;
++      }
++    } else if (evv == 0) {
++      if (honour_copts != 1)
++        inform (0, "someone does not honour COPTS correctly, passed %d times",
++         honour_copts);
++    }
++  }
++
+   return true;
+ }
+--- a/gcc/c-family/c.opt
++++ b/gcc/c-family/c.opt
+@@ -379,6 +379,10 @@ Werror-implicit-function-declaration
+ C ObjC RejectNegative Warning Alias(Werror=, implicit-function-declaration)
+ This switch is deprecated; use -Werror=implicit-function-declaration instead
++Werror-maybe-reset
++C ObjC C++ ObjC++
++; Documented in common.opt
++
+ Wfloat-equal
+ C ObjC C++ ObjC++ Var(warn_float_equal) Warning
+ Warn if testing floating point numbers for equality
+@@ -949,6 +953,9 @@ C++ ObjC++ Optimization Alias(fexception
+ fhonor-std
+ C++ ObjC++ Ignore Warn(switch %qs is no longer supported)
++fhonour-copts
++C ObjC C++ ObjC++ RejectNegative
++
+ fhosted
+ C ObjC
+ Assume normal C execution environment
+--- a/gcc/common.opt
++++ b/gcc/common.opt
+@@ -541,6 +541,10 @@ Werror=
+ Common Joined
+ Treat specified warning as error
++Werror-maybe-reset
++Common
++If environment variable GCC_NO_WERROR is set, act as -Wno-error
++
+ Wextra
+ Common Var(extra_warnings) Warning
+ Print extra (possibly unwanted) warnings
+@@ -1242,6 +1246,9 @@ fguess-branch-probability
+ Common Report Var(flag_guess_branch_prob) Optimization
+ Enable guessing of branch probabilities
++fhonour-copts
++Common RejectNegative
++
+ ; Nonzero means ignore `#ident' directives.  0 means handle them.
+ ; Generate position-independent code for executables if possible
+ ; On SVR4 targets, it also controls whether or not to emit a
+--- a/gcc/opts.c
++++ b/gcc/opts.c
+@@ -468,8 +468,6 @@ static const struct default_options defa
+     { OPT_LEVELS_2_PLUS, OPT_fschedule_insns2, NULL, 1 },
+ #endif
+     { OPT_LEVELS_2_PLUS, OPT_fregmove, NULL, 1 },
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_aliasing, NULL, 1 },
+-    { OPT_LEVELS_2_PLUS, OPT_fstrict_overflow, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_freorder_blocks, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_freorder_functions, NULL, 1 },
+     { OPT_LEVELS_2_PLUS, OPT_ftree_vrp, NULL, 1 },
+@@ -488,6 +486,8 @@ static const struct default_options defa
+     { OPT_LEVELS_2_PLUS, OPT_fhoist_adjacent_loads, NULL, 1 },
+     /* -O3 optimizations.  */
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_aliasing, NULL, 1 },
++    { OPT_LEVELS_3_PLUS, OPT_fstrict_overflow, NULL, 1 },
+     { OPT_LEVELS_3_PLUS, OPT_ftree_loop_distribute_patterns, NULL, 1 },
+     { OPT_LEVELS_3_PLUS, OPT_fpredictive_commoning, NULL, 1 },
+     /* Inlining of functions reducing size is a good idea with -Os
+@@ -1423,6 +1423,17 @@ common_handle_option (struct gcc_options
+                              opts, opts_set, loc, dc);
+       break;
++    case OPT_Werror_maybe_reset:
++      {
++        char *ev = getenv ("GCC_NO_WERROR");
++        if ((ev != NULL) && (*ev != '0'))
++          warnings_are_errors = 0;
++      }
++      break;
++
++    case OPT_fhonour_copts:
++      break;
++
+     case OPT_Wlarger_than_:
+       opts->x_larger_than_size = value;
+       opts->x_warn_larger_than = value != -1;
+--- a/gcc/doc/cppopts.texi
++++ b/gcc/doc/cppopts.texi
+@@ -163,6 +163,11 @@ in older programs.  This warning is on b
+ Make all warnings into hard errors.  Source code which triggers warnings
+ will be rejected.
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
+ @item -Wsystem-headers
+ @opindex Wsystem-headers
+ Issue warnings for code in system headers.  These are normally unhelpful
+--- a/gcc/doc/invoke.texi
++++ b/gcc/doc/invoke.texi
+@@ -240,7 +240,7 @@ Objective-C and Objective-C++ Dialects}.
+ -Wconversion  -Wcoverage-mismatch  -Wno-cpp  -Wno-deprecated  @gol
+ -Wno-deprecated-declarations -Wdisabled-optimization  @gol
+ -Wno-div-by-zero -Wdouble-promotion -Wempty-body  -Wenum-compare @gol
+--Wno-endif-labels -Werror  -Werror=* @gol
++-Wno-endif-labels -Werror  -Werror=* -Werror-maybe-reset @gol
+ -Wfatal-errors  -Wfloat-equal  -Wformat  -Wformat=2 @gol
+ -Wno-format-contains-nul -Wno-format-extra-args -Wformat-nonliteral @gol
+ -Wformat-security  -Wformat-y2k @gol
+@@ -4808,6 +4808,22 @@ This option is only supported for C and
+ @option{-Wall} and by @option{-Wpedantic}, which can be disabled with
+ @option{-Wno-pointer-sign}.
++ at item -Werror-maybe-reset
++ at opindex Werror-maybe-reset
++Act like @samp{-Wno-error} if the @env{GCC_NO_WERROR} environment
++variable is set to anything other than 0 or empty.
++
++ at item -fhonour-copts
++ at opindex fhonour-copts
++If @env{GCC_HONOUR_COPTS} is set to 1, abort if this option is not
++given at least once, and warn if it is given more than once.
++If @env{GCC_HONOUR_COPTS} is set to 2, abort if this option is not
++given exactly once.
++If @env{GCC_HONOUR_COPTS} is set to 0 or unset, warn if this option
++is not given exactly once.
++The warning is quelled if @env{GCC_HONOUR_COPTS} is set to @samp{s}.
++This flag and environment variable only affect the C language.
++
+ @item -Wstack-protector
+ @opindex Wstack-protector
+ @opindex Wno-stack-protector
+@@ -6919,7 +6935,7 @@ so, the first branch is redirected to ei
+ second branch or a point immediately following it, depending on whether
+ the condition is known to be true or false.
+-Enabled at levels @option{-O2}, @option{-O3}, @option{-Os}.
++Enabled at levels @option{-O3}.
+ @item -fsplit-wide-types
+ @opindex fsplit-wide-types
+--- a/gcc/java/jvspec.c
++++ b/gcc/java/jvspec.c
+@@ -626,6 +626,7 @@ lang_specific_pre_link (void)
+      class name.  Append dummy `.c' that can be stripped by set_input so %b
+      is correct.  */ 
+   set_input (concat (main_class_name, "main.c", NULL));
++  putenv ("GCC_HONOUR_COPTS=s"); /* XXX hack!  */
+   err = do_spec (jvgenmain_spec);
+   if (err == 0)
+     {
diff --git a/trunk/package/devel/gcc/patches/920-specs_nonfatal_getenv.patch b/trunk/package/devel/gcc/patches/920-specs_nonfatal_getenv.patch
new file mode 100644 (file)
index 0000000..4baa966
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/gcc/gcc.c
++++ b/gcc/gcc.c
+@@ -8003,7 +8003,10 @@ getenv_spec_function (int argc, const ch
+   value = getenv (argv[0]);
+   if (!value)
+-    fatal_error ("environment variable %qs not defined", argv[0]);
++    {
++      warning (0, "environment variable %qs not defined", argv[0]);
++      value = "";
++    }
+   /* We have to escape every character of the environment variable so
+      they are not interpreted as active spec characters.  A
diff --git a/trunk/package/devel/lttng-modules/Makefile b/trunk/package/devel/lttng-modules/Makefile
new file mode 100644 (file)
index 0000000..99510a0
--- /dev/null
@@ -0,0 +1,45 @@
+#
+# Copyright (C) 2013-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:=lttng-modules
+PKG_VERSION:=2.6.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/
+PKG_MD5SUM:=ccfb50ad922cdaf54a809e2d9de23da4
+
+PKG_LICENSE:=LGPL-2.1 GPL-2.0 MIT
+PKG_LICENSE_FILES:=LICENSE
+PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
+
+include $(INCLUDE_DIR)/kernel.mk
+include $(INCLUDE_DIR)/package.mk
+
+define KernelPackage/lttng
+  SUBMENU:=Other modules
+  TITLE:=Linux Trace Toolkit: next generation (kernel modules)
+  URL:=https://lttng.org/
+  DEPENDS:= @!TARGET_uml @KERNEL_FTRACE_SYSCALLS
+  FILES:= \
+       $(PKG_BUILD_DIR)/lttng-*.$(LINUX_KMOD_SUFFIX) \
+       $(PKG_BUILD_DIR)/lib/lttng-*.$(LINUX_KMOD_SUFFIX) \
+       $(PKG_BUILD_DIR)/probes/lttng-*.$(LINUX_KMOD_SUFFIX)
+endef
+
+define Build/Compile
+       $(MAKE) -C "$(LINUX_DIR)" \
+               ARCH="$(LINUX_KARCH)" \
+               CROSS_COMPILE="$(TARGET_CROSS)" \
+               SUBDIRS="$(PKG_BUILD_DIR)" \
+               V="$(V)" \
+               modules
+endef
+
+$(eval $(call KernelPackage,lttng))
diff --git a/trunk/package/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch b/trunk/package/devel/lttng-modules/patches/001-mm_page_alloc_extfrag.patch
new file mode 100644 (file)
index 0000000..d8a0c62
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/instrumentation/events/lttng-module/kmem.h
++++ b/instrumentation/events/lttng-module/kmem.h
+@@ -287,6 +287,7 @@ LTTNG_TRACEPOINT_EVENT_INSTANCE_PRINT(mm
+ )
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,19,2)     \
++      || LTTNG_KERNEL_RANGE(3,18,10, 3,19,0)          \
+       || LTTNG_KERNEL_RANGE(3,14,36, 3,15,0)          \
+       || LTTNG_DEBIAN_KERNEL_RANGE(3,16,7,9,0,0, 3,17,0,0,0,0))
diff --git a/trunk/package/devel/lttng-tools/Makefile b/trunk/package/devel/lttng-tools/Makefile
new file mode 100644 (file)
index 0000000..6c902df
--- /dev/null
@@ -0,0 +1,60 @@
+#
+# Copyright (C) 2013-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:=lttng-tools
+PKG_VERSION:=2.6.0
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=https://lttng.org/files/$(PKG_NAME)/
+PKG_MD5SUM:=0478f60395f9564b4a19f45ce7b7f3df
+
+PKG_LICENSE:=LGPL-2.1 GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
+
+PKG_FIXUP:=autoreconf
+PKG_USE_MIPS16:=0
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lttng-tools
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=Linux Trace Toolkit: next generation (tools)
+  URL:=https://lttng.org/
+  DEPENDS:= +lttng-ust +libpopt +libxml2
+endef
+
+CONFIGURE_ARGS += --disable-kmod
+
+TARGET_LDFLAGS += -lurcu-bp
+
+MAKE_FLAGS += V="$(V)"
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/lttng $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lttng-ctl.pc $(1)/usr/lib/pkgconfig/
+endef
+
+define Package/lttng-tools/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/liblttng-ctl*.so.* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lttng $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/lttng* $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,lttng-tools))
diff --git a/trunk/package/devel/patch/Makefile b/trunk/package/devel/patch/Makefile
new file mode 100644 (file)
index 0000000..d705a30
--- /dev/null
@@ -0,0 +1,48 @@
+#
+# Copyright (C) 2008-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:=patch
+PKG_VERSION:=2.7.5
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/patch
+PKG_MD5SUM:=e3da7940431633fb65a01b91d3b7a27a
+PKG_LICENSE:=GPL-3.0+
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/patch
+  SECTION:=devel
+  CATEGORY:=Development
+  TITLE:=patch
+  URL:=http://www.gnu.org/
+  MAINTAINER:=Russell Senior <russell@personaltelco.net>
+endef
+
+define Package/patch/description
+  The Patch package contains a program for modifying or creating files
+  by applying a "patch" file typically created by the diff program.
+endef
+
+CONFIGURE_ARGS+= --disable-xattr
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               all install
+endef
+
+define Package/patch/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/patch $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,patch))
diff --git a/trunk/package/libs/libftdi/Makefile b/trunk/package/libs/libftdi/Makefile
new file mode 100644 (file)
index 0000000..058fd50
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2011-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:=libftdi
+PKG_VERSION:=0.20
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.intra2net.com/en/developer/libftdi/download/
+PKG_MD5SUM:=355d4474e3faa81b485d6a604b06951f
+PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
+
+PKG_LICENSE:=LGPL-2.0
+PKG_LICENSE_FILES:=COPYING.LIB
+
+PKG_INSTALL:=1
+PKG_USE_MIPS16:=0
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/cmake.mk
+
+define Package/libftdi
+  SECTION:=libs
+  CATEGORY:=Libraries
+  DEPENDS:=+libusb-compat
+  TITLE:=Library to talk to FTDI chips
+  URL:=http://www.intra2net.com/en/developer/libftdi/
+endef
+
+define Package/libftdi/description
+  libFTDI - FTDI USB driver with bitbang mode
+  libFTDI is an open source library to talk to FTDI chips: FT232BM, FT245BM, FT2232C, FT2232H, FT4232H, FT2232D and FT245R, including the popular bitbang mode. 
+  The library is linked with your program in userspace, no kernel driver required.
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ftdi.h $(1)/usr/include/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libftdi.{a,so*} $(1)/usr/lib/
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libftdi.pc $(1)/usr/lib/pkgconfig/libftdi.pc
+       $(SED) \
+               's,/usr/include,$$$${prefix}/include,g' \
+                $(1)/usr/lib/pkgconfig/libftdi.pc
+       $(SED) \
+               's,/usr/lib,$$$${prefix}/lib,g' \
+                $(1)/usr/lib/pkgconfig/libftdi.pc
+endef
+
+define Package/libftdi/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/libftdi-config $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libftdi.so.* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,libftdi))
diff --git a/trunk/package/libs/libftdi/patches/100-fix-x86_64-build.patch b/trunk/package/libs/libftdi/patches/100-fix-x86_64-build.patch
new file mode 100644 (file)
index 0000000..2460cb1
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -44,7 +44,7 @@ IF(CMAKE_SIZEOF_VOID_P EQUAL 4)
+     SET(LIB_SUFFIX "")
+     SET(PACK_ARCH "")
+   ELSE(CMAKE_SIZEOF_VOID_P EQUAL 8)
+-    SET(LIB_SUFFIX 64)
++    SET(LIB_SUFFIX "")
+     SET(PACK_ARCH .x86_64)
+ endif(CMAKE_SIZEOF_VOID_P EQUAL 4)
diff --git a/trunk/package/libs/libftdi/patches/101-fix-cmake-version-packagekit.patch b/trunk/package/libs/libftdi/patches/101-fix-cmake-version-packagekit.patch
new file mode 100644 (file)
index 0000000..e6861dc
--- /dev/null
@@ -0,0 +1,29 @@
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -1,9 +1,12 @@
+ # Project
+ project(libftdi)
++set(PACKAGE libftdi)
+ set(MAJOR_VERSION 0)
+ set(MINOR_VERSION 20)
++set(VERSION ${VERSION_STRING})
+ set(VERSION_STRING ${MAJOR_VERSION}.${MINOR_VERSION})
+-SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
++set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}")
++set(top_srcdir ${CMAKE_SOURCE_DIR})
+ # CMake
+ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
+@@ -98,12 +101,6 @@ option(DOCUMENTATION "Generate API docum
+ find_package(Doxygen)
+ if(DOCUMENTATION AND DOXYGEN_FOUND)
+-
+-   # Set variables
+-   set(PACKAGE libftdi)
+-   set(VERSION ${VERSION_STRING})
+-   set(top_srcdir ${CMAKE_SOURCE_DIR})
+-
+    # Find doxy config
+    message(STATUS "Doxygen found.")
+    set(DOXY_DIR "${CMAKE_SOURCE_DIR}/doc")
diff --git a/trunk/package/luci/applications/luci-app-lxc/Makefile b/trunk/package/luci/applications/luci-app-lxc/Makefile
new file mode 100644 (file)
index 0000000..f08d81e
--- /dev/null
@@ -0,0 +1,68 @@
+#
+# 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:=luci-app-lxc
+PKG_RELEASE:=20141012
+
+PKG_LICENSE:=Apache-2.0
+
+PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/luci-app-lxc
+  SECTION:=luci
+  CATEGORY:=LuCI
+  SUBMENU:=3. Applications
+  TITLE:=LXC management Web UI
+  DEPENDS:=+luci-mod-admin-full +lxc +lxc-create +liblxc +rpcd-mod-lxc
+  MAINTAINER:=Petar Koretic <petar.koretic@sartura.hr>
+endef
+
+define Package/luci-app-lxc/description
+ This package will install LXC management Web UI.
+endef
+
+define Build/Prepare
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+endef
+
+define Package/luci-app-lxc/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/controller/
+       $(INSTALL_BIN) \
+               ./files/controller/lxc.lua \
+               $(1)/usr/lib/lua/luci/controller/
+
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/view/
+       $(INSTALL_DATA) \
+               ./files/view/lxc.htm \
+               $(1)/usr/lib/lua/luci/view/
+
+       $(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/
+       $(INSTALL_BIN) \
+               ./files/model/cbi/lxc.lua \
+               $(1)/usr/lib/lua/luci/model/cbi/
+
+       $(INSTALL_DIR) $(1)/etc/config/
+       $(INSTALL_DATA) \
+               ./files/lxc.config \
+               $(1)/etc/config/lxc
+
+       $(INSTALL_DIR) $(1)/www
+       $(CP) -R \
+               ./files/www/* \
+               $(1)/www
+endef
+
+$(eval $(call BuildPackage,luci-app-lxc))
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/controller/lxc.lua b/trunk/package/luci/applications/luci-app-lxc/files/controller/lxc.lua
new file mode 100644 (file)
index 0000000..f3f5d07
--- /dev/null
@@ -0,0 +1,125 @@
+--[[
+
+LuCI LXC module
+
+Copyright (C) 2014, Cisco Systems, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+Author: Petar Koretic <petar.koretic@sartura.hr>
+
+]]--
+
+module("luci.controller.lxc", package.seeall)
+
+require "ubus"
+local conn = ubus.connect()
+if not conn then
+    error("Failed to connect to ubus")
+end
+
+
+function fork_exec(command)
+       local pid = nixio.fork()
+       if pid > 0 then
+               return
+       elseif pid == 0 then
+               -- change to root dir
+               nixio.chdir("/")
+
+               -- patch stdin, out, err to /dev/null
+               local null = nixio.open("/dev/null", "w+")
+               if null then
+                       nixio.dup(null, nixio.stderr)
+                       nixio.dup(null, nixio.stdout)
+                       nixio.dup(null, nixio.stdin)
+                       if null:fileno() > 2 then
+                               null:close()
+                       end
+               end
+
+               -- replace with target command
+               nixio.exec("/bin/sh", "-c", command)
+       end
+end
+
+function index()
+       page = node("admin", "services", "lxc")
+       page.target = cbi("lxc")
+       page.title = _("LXC Containers")
+       page.order = 70
+
+       page = entry({"admin", "services", "lxc_create"}, call("lxc_create"), nil)
+       page.leaf = true
+
+       page = entry({"admin", "services", "lxc_action"}, call("lxc_action"), nil)
+       page.leaf = true
+
+       page = entry({"admin", "services", "lxc_configuration_get"}, call("lxc_configuration_get"), nil)
+       page.leaf = true
+
+       page = entry({"admin", "services", "lxc_configuration_set"}, call("lxc_configuration_set"), nil)
+       page.leaf = true
+
+end
+
+function lxc_create(lxc_name, lxc_template)
+       luci.http.prepare_content("text/plain")
+
+       local uci = require("uci").cursor()
+
+       local url = uci:get("lxc", "lxc", "url")
+
+       if not pcall(dofile, "/etc/openwrt_release") then
+               return luci.http.write("1")
+       end
+
+       local target = _G.DISTRIB_TARGET:match('([^/]+)')
+
+       local data = conn:call("lxc", "create", { name = lxc_name, template = "download", args = { "--server", url,  "--no-validate", "--dist", lxc_template, "--release", "bb", "--arch", target } } )
+
+       luci.http.write(data)
+end
+
+function lxc_action(lxc_action, lxc_name)
+       luci.http.prepare_content("application/json")
+
+       local data, ec = conn:call("lxc", lxc_action, lxc_name and { name = lxc_name} or {} )
+
+       luci.http.write_json(ec and {} or data)
+end
+
+function lxc_configuration_get(lxc_name)
+       luci.http.prepare_content("text/plain")
+
+       local f = io.open("/lxc/" .. lxc_name .. "/config", "r")
+       local content = f:read("*all")
+       f:close()
+
+       luci.http.write(content)
+end
+
+function lxc_configuration_set(lxc_name)
+       luci.http.prepare_content("text/plain")
+
+       local lxc_configuration = luci.http.formvalue("lxc_configuration")
+
+       if lxc_configuration == nil then
+               return luci.http.write("1")
+       end
+
+       local f, err = io.open("/lxc/" .. lxc_name .. "/config","w+")
+       if not f then
+               return luci.http.write("2")
+       end
+
+       f:write(lxc_configuration)
+       f:close()
+
+       luci.http.write("0")
+end
+
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/lxc.config b/trunk/package/luci/applications/luci-app-lxc/files/lxc.config
new file mode 100644 (file)
index 0000000..5572c73
--- /dev/null
@@ -0,0 +1,6 @@
+#
+# lxc uci configuration
+#
+
+config lxc 'lxc'
+       option url 'virtualwrt.org/containers/'
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/model/cbi/lxc.lua b/trunk/package/luci/applications/luci-app-lxc/files/model/cbi/lxc.lua
new file mode 100644 (file)
index 0000000..ac0fdff
--- /dev/null
@@ -0,0 +1,31 @@
+--[[
+
+LuCI LXC module
+
+Copyright (C) 2014, Cisco Systems, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+Author: Petar Koretic <petar.koretic@sartura.hr>
+
+]]--
+
+local fs = require "nixio.fs"
+
+m = Map("lxc", translate("LXC Containers"))
+
+if fs.access("/etc/config/lxc") then
+       m:section(SimpleSection).template = "lxc"
+
+       s = m:section(TypedSection, "lxc", translate("Options"))
+       s.anonymous = true
+       s.addremove = false
+
+       s:option(Value, "url", translate("Containers URL"))
+end
+
+return m
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/view/lxc.htm b/trunk/package/luci/applications/luci-app-lxc/files/view/lxc.htm
new file mode 100644 (file)
index 0000000..1376968
--- /dev/null
@@ -0,0 +1,441 @@
+<%#
+
+LuCI LXC module
+
+Copyright (C) 2014, Cisco Systems, Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+Author: Petar Koretic <petar.koretic@sartura.hr>
+
+-%>
+
+<fieldset class="cbi-section">
+       <legend><%:Available Containers%></legend>
+       <div class="cbi-section-node">
+               <table id="t_lxc_list" class="cbi-section-table">
+                       <tr class="cbi-section-table-titles">
+                               <th class="cbi-section-table-cell"><%:Name%></th>
+                               <th class="cbi-section-table-cell"><%:Status%></th>
+                               <th class="cbi-section-table-cell"><%:Actions%></th>
+                       </tr>
+               </table>
+       </div>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <span id="lxc-list-output"></span>
+</fieldset>
+
+<hr/>
+<fieldset class="cbi-section">
+       <legend><%:Create New Container%></legend>
+       <div class="cbi-section-node">
+               <table id="t_lxc_create" class="cbi-section-table">
+                       <tr class="cbi-section-table-titles">
+                               <th class="cbi-section-table-cell"><%:Name%></th>
+                               <th class="cbi-section-table-cell"><%:Template%></th>
+                               <th class="cbi-section-table-cell"><%:Actions%></th>
+                       </tr>
+                       <tr id="tr_holder">
+                               <td>
+                                       <input type="text" id="tx_name" placeholder="<%:Enter new name%>" value='' />
+                               </td>
+                               <td>
+                                       <select id="s_template" class="cbi-input-select cbi-button">
+                                               <option value="openwrt">OpenWrt</option>
+                                       </select>
+                               </td>
+                               <td>
+                                       <input type="button" id="bt_create" value="<%:Create%>" onclick="lxc_create(tr_holder)" class="cbi-button cbi-button-add" />
+                                       <span id="lxc-add-loader" style="display:inline-block; width:16px; height:16px; margin:0 5px"></span>
+                               </td>
+                       </tr>
+               </table>
+       </div>
+</fieldset>
+
+<fieldset class="cbi-section">
+       <span id="lxc-add-output"></span>
+</fieldset>
+
+<hr/>
+
+<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
+<script type="text/javascript">//<![CDATA[
+
+       window.img = { "red" : "<%=resource%>/cbi/red.gif", "green" : "<%=resource%>/cbi/green.gif", "purple" : "<%=resource%>/cbi/purple.gif" }
+       window.states = {  "STOPPED" : "red", "RUNNING" : "green", "FROZEN" : "purple"}
+
+       var t_lxc_list = document.getElementById('t_lxc_list');
+       var loader_html = '<img src="<%=resource%>/icons/loading.gif" alt="<%:Loading%>" width="16" height="16" style="vertical-align:middle" /> ';
+       var timeout_msg = 0
+       var output_list = document.getElementById("lxc-list-output")
+       var output_add = document.getElementById("lxc-add-output")
+       var loader_add = document.getElementById("lxc-add-loader")
+
+       function lxc_create(tr)
+       {
+               var lxc_name = tr.querySelector("#tx_name").value.trim()
+               var lxc_template = tr.querySelector("#s_template").value
+               var bt_create = tr.querySelector("#bt_create")
+
+               if (t_lxc_list.querySelector("[data-id='" + lxc_name + "']") != null)
+                       return info_message(output_add, "Container with that name already exists!", 4000)
+
+               bt_create.disabled = true
+               output_add.innerHTML = ''
+
+               if (!lxc_name || !lxc_name.length)
+               {
+                       bt_create.disabled = false
+                       return info_message(output_add, "Name cannot be empty!", 4000)
+               }
+
+               loading(loader_add)
+
+               new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_create/' + '%h/%h'.format(lxc_name, lxc_template) , null,
+               function(x)
+               {
+                       bt_create.disabled = false
+                       loading(loader_add, 0)
+
+                       if (!x)
+                               info_message(output_add, "Container creation failed!")
+               })
+       }
+
+       function lxc_create_template(lxc_name, lxc_state)
+       {
+               var info_row = t_lxc_list.querySelector("#empty")
+               if (info_row)
+                       t_lxc_list.deleteRow(1)
+
+               var actions = ''
+               actions += '<input type="button" onclick="action_handler(this)" data-action="start" value="<%:Start%>" class="cbi-button cbi-button-apply" />'
+               actions+= '<input type="button" onclick="action_handler(this)" data-action="stop" value="<%:Stop%>" class="cbi-button cbi-button-reset" />'
+               actions+= '<input type="button" onclick="action_handler(this)" data-action="destroy" value="<%:Delete%>" class="cbi-button cbi-button-remove" />'
+               actions+= ' <select class="cbi-input-select cbi-button" onchange="action_more_handler(this)">\
+                                               <option selected disabled>more</option>\
+                                               <option>configure</option>\
+                                               <option>freeze</option>\
+                                               <option>unfreeze</option>\
+                                               <option>reboot</option>\
+                                       </select>'
+               actions+= '<span data-loader style="display:inline-block; width:16px; height:16px; margin:0 5px"></span>'
+
+               var row = t_lxc_list.insertRow(-1)
+               var cell = row.insertCell(-1)
+               cell.innerHTML = '%q%h%q'.format("<strong>", lxc_name, "</strong>")
+               cell.width = "30%"
+               cell.setAttribute("data-id", lxc_name)
+
+               cell = row.insertCell(-1)
+               cell.width = "20%"
+               cell.innerHTML = "<img src='"+window.img[lxc_state]+"'/>"
+
+               cell = row.insertCell(-1)
+               cell.width = "50%"
+               cell.innerHTML = actions
+       }
+
+       function action_handler(self)
+       {
+               var action = self.getAttribute("data-action");
+
+               var bt_action = self
+               var lxc_name = self.parentNode.parentNode.children[0].getAttribute('data-id')
+               var status_img = self.parentNode.parentNode.querySelector('img')
+               var loader = self.parentNode.querySelector('[data-loader]')
+
+               bt_action.disabled = true
+
+               if (action == "stop")
+               {
+                       loading(loader)
+
+                       new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(action, lxc_name), null,
+                       function(x, ec)
+                       {
+                               loading(loader, 0)
+                               bt_action.disabled = false
+
+                               if (!x || ec)
+                                       return info_message(output_list,"Action failed!")
+
+                               set_status(status_img, "red")
+
+                       });
+               }
+
+               else if (action == "start")
+               {
+                       loading(loader)
+
+                       new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(action, lxc_name), null,
+                       function(x, data)
+                       {
+                               loading(loader, 0)
+                               bt_action.disabled = false
+
+                               //FIXME: uncomment after fixing 'lxc-start'
+                               if (!x /*|| ec */)
+                                       return info_message(output_list,"Action failed!")
+
+                               //FIXME: uncomment after fixing 'lxc-start'
+                               //set_status(status_img, "green")
+                       });
+               }
+
+               else if (action == "destroy")
+               {
+                       if (!confirm("This will completely remove LXC container from the disk. Are you sure? (container will be stopped if running)"))
+                               return
+
+                       loading(loader)
+
+                       new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(action, lxc_name), null,
+                       function(x, ec)
+                       {
+                               loading(loader, 0)
+                               bt_action.disabled = false
+
+                               if (!x || ec)
+                                       return info_message(output_list,"Action failed!")
+
+                               var row = self.parentNode.parentNode
+                               row.parentNode.removeChild(row)
+
+                       });
+               }
+       }
+
+       function lxc_configure_handler(self)
+       {
+               var td = self.parentNode
+               var textarea = td.querySelector('[data-id]')
+               var lxc_name = textarea.getAttribute('data-id')
+               var lxc_configuration = textarea.value
+
+               new XHR().post('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_configuration_set/' + lxc_name, "lxc_configuration=" + encodeURIComponent(lxc_configuration) ,
+               function(x)
+               {
+                       if (!x || x.responseText != "0")
+                               return info_message(output_list,"Action failed!")
+
+                       info_message(output_list,"LXC configuration updated")
+                       var row = td.parentNode
+                       row.parentNode.removeChild(row)
+               })
+       }
+
+       function lxc_rename_template(lxc_name)
+       {
+               var h = '\
+                       <input data-id="'+ lxc_name + '" type="text" placeholder="Enter new name" /> \
+                       <input data-id="bt_confirm" onclick="lxc_rename_handler(this)" type="button" class="cbi-button" value="Confirm" />'
+
+               return h
+       }
+
+       function lxc_configure_template(lxc_name, lxc_configuration)
+       {
+               var h = '\
+                       <textarea data-id="'+ lxc_name + '" rows="20" style="width:100%">'+ lxc_configuration +'</textarea> \
+                       <input data-id="bt_confirm" onclick="lxc_configure_handler(this)" type="button" class="cbi-button" value="Confirm" />'
+
+               return h
+       }
+
+       function action_more_handler(self)
+       {
+               var lxc_name = self.parentNode.parentNode.querySelector('[data-id]').getAttribute('data-id')
+               var loader = self.parentNode.parentNode.querySelector('[data-loader]')
+
+               var option = self.options[self.selectedIndex].text
+
+               self.value = "more"
+
+               switch (option)
+               {
+                       case "configure":
+                               var tr = document.createElement('tr')
+                               var row = self.parentNode.parentNode
+                               var next_row = row.nextSibling
+                               if (next_row && next_row.getAttribute('data-action') !== null)
+                                       row.parentNode.removeChild(next_row)
+
+                               new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_configuration_get/' + lxc_name, null,
+                               function(x)
+                               {
+                                       tr.innerHTML="<td colspan='" + row.cells.length + "'>" + lxc_configure_template(lxc_name, x.responseText) + "</td>"
+                                       tr.setAttribute('data-action','')
+                                       row.parentNode.insertBefore(tr, row.nextSibling)
+                               })
+
+                       break
+
+                       case "freeze":
+                               var tr = self.parentNode.parentNode
+                               var img = tr.querySelector('img')
+                               if(img.getAttribute('src') != window.img["green"])
+                                       return info_message(output_list,"Container is not running!")
+
+                               loading(loader)
+                               new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(option, lxc_name), null,
+                               function(x, ec)
+                               {
+                                       loading(loader, 0)
+                                       if (!x || ec)
+                                               return info_message(output_list,"Action failed!")
+
+                                       set_status(img, "purple")
+                               })
+
+                       break
+
+                       case "unfreeze":
+                               var tr = self.parentNode.parentNode
+                               var img = tr.querySelector('img')
+
+                               if(img.getAttribute('src') != window.img["purple"])
+                                       return info_message(output_list,"Container is not frozen!")
+
+                               loading(loader)
+                               new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(option, lxc_name), null,
+                               function(x, ec)
+                               {
+                                       loading(loader, 0)
+                                       if (!x || ec)
+                                               return info_message(output_list,"Action failed!")
+
+                                       set_status(img, "green")
+                               })
+
+                       break
+
+                       case "reboot":
+                               var tr = self.parentNode.parentNode
+                               var img = tr.querySelector('img')
+                               if(img.getAttribute('src') != window.img["green"])
+                                       return info_message(output_list,"Container is not running!")
+
+                               if (!confirm("Are you sure?"))
+                                       return
+
+                               loading(loader)
+                               new XHR().get('<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/' + '%h/%h'.format(option, lxc_name), null,
+                               function(x, ec)
+                               {
+                                       loading(loader, 0)
+                                       if (!x || ec)
+                                               return info_message(output_list,"Action failed!")
+
+                                       info_message(output_list,"LXC rebooted")
+                               })
+                       break
+               }
+
+       }
+
+       function set_empty(t_lxc_list)
+       {
+               if (document.getElementById('empty') !== null)
+                       return
+
+               var row_count = t_lxc_list.rows.length;
+               while(--row_count) t_lxc_list.deleteRow(row_count);
+
+               var row = t_lxc_list.insertRow(-1);
+               row.id = 'empty'
+               var cell = row.insertCell(0);
+               cell.colSpan = 4;
+               cell.innerHTML = '<em><br />There are no containers available yet.</em>';
+       }
+
+       function lxc_list_update()
+       {
+               XHR.poll(4, '<%=luci.dispatcher.build_url("admin", "services")%>/lxc_action/list', null,
+               function(x, data)
+               {
+                       if (!x) return;
+
+                       var lxc_count = Object.keys(data).length
+                       if (!data || !lxc_count)
+                               return set_empty(t_lxc_list)
+
+                       if (document.getElementById('empty') !== null)
+                               t_lxc_list.deleteRow(1);
+
+                       var lxcs = t_lxc_list.querySelectorAll('td[data-id]')
+                       var lxc_name_table = {}
+                       for (var i = 0, len = lxcs.length; i < len; i++)
+                       {
+                               var lxc_name = lxcs[i].getAttribute('data-id')
+                               if (!(lxc_name in data))
+                               {
+                                       var row = t_lxc_list.querySelector("[data-id='" + lxc_name + "']").parentNode
+                                       row.parentNode.removeChild(row)
+                                       continue
+                               }
+
+                               lxc_name_table[lxc_name] = lxcs[i].parentNode.querySelector('img')
+                       }
+
+                       for(var key in data)
+                       {
+                               var lxc_name = key
+                               var state = window.states[data[key]]
+
+                               if (!(lxc_name in lxc_name_table))
+                                       lxc_create_template(lxc_name, state)
+
+                               else if (state != get_status(lxc_name_table[lxc_name]))
+                                       set_status(lxc_name_table[lxc_name], state)
+                       }
+
+               })
+       }
+
+       function loading(elem, state)
+       {
+               state = (typeof state === 'undefined') ? 1 : state
+
+               if (state === 1)
+                       elem.innerHTML = loader_html
+               else
+                       setTimeout(function() { elem.innerHTML = ''}, 1000)
+       }
+
+       function set_status(elem, state)
+       {
+               state = (typeof state === 'undefined') ? 1 : state
+
+               setTimeout(function() { elem.setAttribute('src', window.img[state])}, 300)
+       }
+
+       function get_status(elem)
+       {
+               var src = elem.getAttribute('src')
+
+               for (var i in img)
+               {
+                       if (img[i] == src)
+                               return i
+               }
+       }
+
+       function info_message(output, msg, timeout)
+       {
+               timeout = timeout || 3000
+               output.innerHTML = msg
+               clearTimeout(timeout_msg)
+               timeout_msg = setTimeout(function(){ output.innerHTML=""}, timeout);
+       }
+
+       lxc_list_update()
+//]]></script>
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif
new file mode 100644 (file)
index 0000000..d09febf
Binary files /dev/null and b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/green.gif differ
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/purple.gif b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/purple.gif
new file mode 100644 (file)
index 0000000..f0d68cc
Binary files /dev/null and b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/purple.gif differ
diff --git a/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/red.gif b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/red.gif
new file mode 100644 (file)
index 0000000..c1b39bb
Binary files /dev/null and b/trunk/package/luci/applications/luci-app-lxc/files/www/luci-static/resources/cbi/red.gif differ
diff --git a/trunk/package/luci/modules/luci-base/src/po2lmo b/trunk/package/luci/modules/luci-base/src/po2lmo
new file mode 100755 (executable)
index 0000000..611ff79
Binary files /dev/null and b/trunk/package/luci/modules/luci-base/src/po2lmo differ
diff --git a/trunk/package/luci/modules/luci-base/src/po2lmo.o b/trunk/package/luci/modules/luci-base/src/po2lmo.o
new file mode 100644 (file)
index 0000000..fc2b50c
Binary files /dev/null and b/trunk/package/luci/modules/luci-base/src/po2lmo.o differ
diff --git a/trunk/package/luci/modules/luci-base/src/template_lmo.o b/trunk/package/luci/modules/luci-base/src/template_lmo.o
new file mode 100644 (file)
index 0000000..1b2f558
Binary files /dev/null and b/trunk/package/luci/modules/luci-base/src/template_lmo.o differ
diff --git a/trunk/package/mail/alpine/Makefile b/trunk/package/mail/alpine/Makefile
new file mode 100644 (file)
index 0000000..cd32a62
--- /dev/null
@@ -0,0 +1,123 @@
+#
+# 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:=alpine
+PKG_VERSION:=2.20
+PKG_RELEASE:=2
+
+PKG_SOURCE_URL:=http://patches.freeiz.com/alpine/release/src/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_MD5SUM:=043b67666af73b26f9627ad97e2aaf92
+
+PKG_MAINTAINER:=Antti Seppälä <a.seppala@gmail.com>
+PKG_LICENSE:=Apache-2.0
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/alpine/Default
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl +libncurses +libpthread +libpam $(ICONV_DEPENDS) $(INTL_DEPENDS)
+  TITLE:=Alternatively Licensed Program for Internet News and Email
+  URL:=http://www.washington.edu/alpine
+endef
+
+define Package/alpine/Default/description
+ Alpine (Alternatively Licenced Program for Internet News and Email) is a
+ free software email client developed at the University of Washington.
+ It is suitable for both the inexperienced email user as well as for
+ the most demanding power user.
+endef
+
+define Package/alpine
+$(call Package/alpine/Default)
+  TITLE+= (with OpenSSL support)
+  DEPENDS+= +libopenssl
+  VARIANT:=ssl
+endef
+
+define Package/alpine/description
+$(call Package/alpine/Default/description)
+ This package is built with OpenSSL support.
+endef
+
+define Package/alpine-nossl
+$(call Package/alpine/Default)
+  TITLE+= (without OpenSSL support)
+  VARIANT:=nossl
+endef
+
+define Package/alpine-nossl/description
+$(call Package/alpine/Default/description)
+ This package is built without OpenSSL support.
+endef
+
+CONFIGURE_ARGS += \
+       --with-libiconv-prefix=$(ICONV_PREFIX) \
+       --with-libintl-prefix=$(INTL_PREFIX) \
+       --without-tcl \
+       --without-ldap \
+       --without-krb5 \
+       --with-system-pinerc=/etc/pine.conf \
+       --with-system-fixed-pinerc=/etc/pine.conf.fixed \
+       --with-supplied-regex \
+       --with-default-sshpath=/usr/bin/ssh \
+       --disable-debug \
+       --disable-mouse \
+       --with-c-client-target=slx \
+
+CONFIGURE_VARS += \
+       top_builddir=$(PKG_BUILD_DIR)
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-ssl-include-dir=$(STAGING_DIR)/usr/include/openssl/. \
+               --with-ssl-lib-dir=$(STAGING_DIR)/usr/lib
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --without-ssl
+endif
+
+ifeq ($(CONFIG_BUILD_NLS),y)
+  DISABLE_NLS:=
+endif
+
+ifeq ($(CONFIG_IPV6),y)
+  DISABLE_IPV6:=
+else
+  DISABLE_IPV6:=--without-ipv6
+endif
+
+define Build/Compile
+       ( cd $(PKG_BUILD_DIR)/pith ; \
+               $(HOSTCC) help_h_gen.c -c -o help_h_gen.o ; \
+               $(HOSTCC) help_h_gen.o -o help_h_gen ; \
+               $(HOSTCC) help_c_gen.c -c -o help_c_gen.o ; \
+               $(HOSTCC) help_c_gen.o -o help_c_gen ; \
+       )
+       $(call Build/Compile/Default)
+endef
+
+define Package/alpine/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/$(PKG_NAME)
+endef
+
+Package/alpine-nossl/install = $(Package/alpine/install)
+
+$(eval $(call BuildPackage,alpine))
+$(eval $(call BuildPackage,alpine-nossl))
diff --git a/trunk/package/mail/alpine/patches/100-no-openssl-check-cross-compile.patch b/trunk/package/mail/alpine/patches/100-no-openssl-check-cross-compile.patch
new file mode 100644 (file)
index 0000000..4043098
--- /dev/null
@@ -0,0 +1,29 @@
+diff -Nru alpine-2.20-orig/configure alpine-2.20/configure
+--- alpine-2.20-orig/configure 2015-01-18 09:00:42.100645053 +0200
++++ alpine-2.20/configure      2015-01-25 12:01:11.831015443 +0200
+@@ -17643,10 +17643,8 @@
+   { $as_echo "$as_me:${as_lineno-$LINENO}: checking Openssl library version >= 1.0.1c" >&5
+ $as_echo_n "checking Openssl library version >= 1.0.1c... " >&6; }
+   if test "$cross_compiling" = yes; then :
+-  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+-as_fn_error $? "cannot run test program while cross compiling
+-See \`config.log' for more details" "$LINENO" 5; }
++   { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cross compiling: not checking" >&5
++$as_echo "$as_me: WARNING: cross compiling: not checking" >&2;}
+ else
+   cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ /* end confdefs.h.  */
+diff -Nru alpine-2.20-orig/configure.ac alpine-2.20/configure.ac
+--- alpine-2.20-orig/configure.ac      2015-01-18 08:38:08.893495949 +0200
++++ alpine-2.20/configure.ac   2015-01-25 12:01:02.773015236 +0200
+@@ -1370,7 +1370,8 @@
+ }
+       ]])],
+       [ AC_MSG_RESULT(yes) ],
+-      [ alpine_SSLTYPE="none" ])
++      [ alpine_SSLTYPE="none" ],
++      [ AC_MSG_WARN([cross compiling: not checking])])
+     if test "x$alpine_SSLTYPE" = "xnone" ; then
+       AC_MSG_ERROR(Install openssl version >= 1.0.1c)
diff --git a/trunk/package/mail/bogofilter/Makefile b/trunk/package/mail/bogofilter/Makefile
new file mode 100644 (file)
index 0000000..d31dfa8
--- /dev/null
@@ -0,0 +1,58 @@
+#
+# 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:=bogofilter
+PKG_VERSION:=1.2.4
+PKG_RELEASE:=3
+
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=COPYING
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/bogofilter
+PKG_MD5SUM:=d0a5eebb3274b23ceabe766a6443a1c5
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/bogofilter
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libdb47
+  TITLE:=bogofilter
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+  URL:=http://bogofilter.sourceforge.net/
+endef
+
+define Package/bogofilter/description
+       Bogofilter is a fast Bayesian spam filter
+endef
+
+CONFIGURE_ARGS += \
+       --disable-unicode \
+       --with-libdb-prefix=$(STAGING_DIR) \
+       --with-included-gsl
+
+define Package/bogofilter/install
+       $(INSTALL_DIR)  $(1)/etc/ \
+                        $(1)/usr/bin \
+                        $(1)/usr/sbin
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/bogofilter.cf.example $(1)/etc/bogofilter.cf
+       $(INSTALL_BIN) ./files/postfix-bogofilter $(1)/usr/sbin/postfix-bogofilter
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bf_compact $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bf_copy $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bf_tar $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bogofilter $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bogolexer $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bogotune $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/bogoutil $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,bogofilter))
diff --git a/trunk/package/mail/bogofilter/files/postfix-bogofilter b/trunk/package/mail/bogofilter/files/postfix-bogofilter
new file mode 100755 (executable)
index 0000000..952d8cd
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+FILTER=/usr/bin/bogofilter
+FILTER_DIR=/mnt/sda1/var/spool/bogofilter
+# WARNING! The -i is crucial, else you may see
+# messages truncated at the first period that is alone on a line
+# (which can happen with several kinds of messages, particularly
+# quoted-printable)
+# -G is ignored before Postfix 2.3 and tells it that the message
+# does not originate on the local system (Gateway submission),
+# so Postfix avoids some of the local expansions that can leave
+# misleading traces in headers, such as local address
+# canonicalizations.
+POSTFIX="/usr/sbin/sendmail -G -i"
+export BOGOFILTER_DIR=/etc/bogofilter
+
+# Exit codes from <sysexits.h>
+EX_TEMPFAIL=75
+EX_UNAVAILABLE=69
+
+cd $FILTER_DIR || \
+    { echo $FILTER_DIR does not exist; exit $EX_TEMPFAIL; }
+
+# Clean up when done or when aborting.
+trap "rm -f msg.$$ ; exit $EX_TEMPFAIL" 0 1 2 3 15
+
+# bogofilter -e returns: 0 for OK, nonzero for error
+rm -f msg.$$ || exit $EX_TEMPFAIL
+$FILTER -p -e > msg.$$ || exit $EX_TEMPFAIL
+
+exec <msg.$$ || exit $EX_TEMPFAIL
+rm -f msg.$$ # safe, we hold the file descriptor
+exec $POSTFIX "$@"
+exit $EX_TEMPFAIL
diff --git a/trunk/package/mail/dovecot/Makefile b/trunk/package/mail/dovecot/Makefile
new file mode 100644 (file)
index 0000000..1032d97
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# 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:=dovecot
+PKG_VERSION:=2.2.15
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.dovecot.org/releases/2.2
+PKG_MD5SUM:=c6c176943bd832c780fbb5d2f8850952
+PKG_LICENSE:=LGPL-2.1 MIT BSD-3-Clause Unique
+PKG_LICENSE_FILES:=COPYING COPYING.LGPL COPYING.MIT
+
+PKG_BUILD_DEPENDS:=libiconv
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/dovecot
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+DOVECOT_LDAP:libopenldap +libopenssl +librt +zlib +libbz2 +libcap
+  TITLE:=An IMAP and POP3 daemon
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+  URL:=http://www.dovecot.org/
+  USERID:=dovecot=59:dovecot=59
+endef
+
+define Package/dovecot/description
+ Dovecot is a program which provides POP3 and IMAP services.
+endef
+
+define Package/dovecot/config
+        menu "Select dovecot build options"
+                depends on PACKAGE_dovecot
+                config DOVECOT_LDAP
+                        bool "LDAP support"
+                        default n
+                        help
+                          Implements LDAP support in dovecot.
+        endmenu
+endef
+
+CONFIGURE_ARGS += \
+       --without-gssapi \
+       --without-pam \
+       --with-moduledir=/usr/lib/dovecot/modules \
+       --with-notify=dnotify \
+       --without-lzma \
+       --without-lz4
+
+ifneq ($(strip $(CONFIG_DOVECOT_LDAP)),)
+  CONFIGURE_ARGS+= \
+       --with-ldap=yes
+else
+  CONFIGURE_ARGS+= \
+       --with-ldap=no
+endif
+
+CONFIGURE_VARS += \
+       RPCGEN= \
+       i_cv_signed_size_t=no \
+       i_cv_signed_time_t=no \
+       i_cv_gmtime_max_time_t=32 \
+       i_cv_mmap_plays_with_write=yes \
+       i_cv_fd_passing=yes \
+       i_cv_c99_vsnprintf=yes \
+       lib_cv_va_copy=yes \
+       lib_cv_va_copy=yes \
+       lib_cv___va_copy=yes \
+       lib_cv_va_val_copy=yes
+
+define Package/dovecot/install
+       $(INSTALL_DIR)  $(1)/etc/init.d \
+                       $(1)/etc/dovecot \
+                       $(1)/usr/share/doc/dovecot/example-config \
+                       $(1)/usr/lib/dovecot \
+                       $(1)/usr/bin \
+                       $(1)/usr/sbin
+       $(CP) $(PKG_INSTALL_DIR)/etc/dovecot/* $(1)/etc/dovecot/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/dovecot/* $(1)/usr/lib/dovecot/
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/doc/dovecot/example-config $(1)/usr/share/doc/dovecot/example-config
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/doveconf $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin/
+       $(INSTALL_BIN) ./files/dovecot.init $(1)/etc/init.d/dovecot
+       rm  $(1)/usr/lib/dovecot/dovecot-config
+       find $(1)/usr/lib/dovecot/ -name "*.a" -o -name "*.la" | xargs rm
+endef
+
+$(eval $(call BuildPackage,dovecot))
diff --git a/trunk/package/mail/dovecot/files/dovecot.init b/trunk/package/mail/dovecot/files/dovecot.init
new file mode 100644 (file)
index 0000000..1f83184
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2013 OpenWrt.org
+
+START=75
+STOP=75
+
+USE_PROCD=1
+
+start_service() {
+       mkdir -p -m 0755 /var/lib/dovecot
+       mkdir -p -m 0755 /var/run/dovecot
+       chmod 0750 /var/lib/dovecot
+       procd_open_instance
+       procd_set_param command /usr/sbin/dovecot -F
+       procd_close_instance
+}
diff --git a/trunk/package/mail/dovecot/patches/001-configure_in.patch b/trunk/package/mail/dovecot/patches/001-configure_in.patch
new file mode 100644 (file)
index 0000000..70642d6
--- /dev/null
@@ -0,0 +1,31 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -504,9 +504,9 @@ have_ioloop=no
+ if test "$ioloop" = "best" || test "$ioloop" = "epoll"; then
+   AC_CACHE_CHECK([whether we can use epoll],i_cv_epoll_works,[
+-    AC_TRY_RUN([
++    AC_TRY_LINK([
+       #include <sys/epoll.h>
+-  
++    ], [
+       int main()
+       {
+       return epoll_create(5) < 1;
+@@ -639,7 +639,7 @@ fi
+ dnl * Old glibcs have broken posix_fallocate(). Make sure not to use it.
+ dnl * It may also be broken in AIX.
+ AC_CACHE_CHECK([whether posix_fallocate() works],i_cv_posix_fallocate_works,[
+-  AC_TRY_RUN([
++  AC_TRY_LINK([
+     #define _XOPEN_SOURCE 600
+     #include <stdio.h>
+     #include <stdlib.h>
+@@ -648,6 +648,7 @@ AC_CACHE_CHECK([whether posix_fallocate(
+     #if defined(__GLIBC__) && (__GLIBC__ < 2 || __GLIBC_MINOR__ < 7)
+       possibly broken posix_fallocate
+     #endif
++  ], [
+     int main() {
+       int fd = creat("conftest.temp", 0600);
+       int ret;
diff --git a/trunk/package/mail/fdm/Config.in b/trunk/package/mail/fdm/Config.in
new file mode 100644 (file)
index 0000000..084695b
--- /dev/null
@@ -0,0 +1,10 @@
+menu "Configuration"
+       depends on PACKAGE_fdm
+
+config FDM_WITH_PCRE
+       bool
+       default y
+       select libpcre
+       prompt "Enable PCRE support (elsewhere POSIX regex)"
+
+endmenu
diff --git a/trunk/package/mail/fdm/Makefile b/trunk/package/mail/fdm/Makefile
new file mode 100644 (file)
index 0000000..49c02f1
--- /dev/null
@@ -0,0 +1,86 @@
+#
+# Copyright (C) 2007-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:=fdm
+PKG_VERSION:=1.7
+PKG_RELEASE:=1
+PKG_LICENSE:=BSD-2-Clause
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/fdm
+PKG_MD5SUM:=aea0421571e8f3ec8f747a5d72c84348
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/fdm
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=fetch mail and deliver
+  URL:=http://fdm.sourceforge.net/
+  MAINTAINER:=Dmitry V. Zimin <pfzim@mail.ru>
+  MENU:=1
+  DEPENDS:=+tdb +zlib +libopenssl +FDM_WITH_PCRE:libpcre
+  USERID:=_fdm=99:_fdm=99
+endef
+
+define Package/fdm/description
+  fdm is a simple, lightweight replacement for mail fetch, filter
+  and delivery programs such as fetchmail and procmail. It can
+  fetch using POP3 or IMAP (with SSL) or from stdin, and deliver
+  to a pipe, file, maildir, mbox or SMTP server, based on $(if $(CONFIG_FDM_WITH_PCRE),PCRE,POSIX regexp)
+endef
+
+MAKE_FLAGS += \
+       PREFIX="/usr"\
+       $(if $(CONFIG_FDM_WITH_PCRE),PCRE=1)
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(CP) ./src/compat/* $(PKG_BUILD_DIR)/
+endef
+
+define Package/fdm/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Package/fdm/conffiles
+/etc/fdm.conf
+endef
+
+define Package/fdm/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/etc/* $(1)/etc/
+       $(INSTALL_DIR) $(1)/opt/fdm
+       chmod a+rwx $(1)/opt/fdm
+endef
+
+define Package/fdm/postinst
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Creating cron job template for user _fdm..."
+       (crontab -l -u _fdm 2>/dev/null; echo "# */13 * * * * fdm -q fetch") | crontab -u _fdm -
+       echo "Please, edit file /etc/fdm.conf and enable cron job!"
+fi
+exit 0
+endef
+
+define Package/fdm/prerm
+#!/bin/sh
+if [ -z "$${IPKG_INSTROOT}" ]; then
+       echo "Don't forget disable cron job!"
+       echo "# crontab -r -u _fdm"
+fi
+exit 0
+endef
+
+$(eval $(call BuildPackage,fdm))
diff --git a/trunk/package/mail/fdm/files/etc/fdm.conf b/trunk/package/mail/fdm/files/etc/fdm.conf
new file mode 100644 (file)
index 0000000..56c9db4
--- /dev/null
@@ -0,0 +1,36 @@
+# /etc/fdm.conf example file
+# 1. Edit this file
+# 2. Test: fdm -vv fetch
+# 3. Enable cron job: crontab -e -u _fdm
+
+set maximum-size      3M
+set delete-oversized
+set queue-high        1
+set queue-low         0
+set purge-after       5
+set unmatched-mail    keep
+
+action "drop" drop
+action "keep" keep
+
+action "wakeup" exec "wol -h 192.168.0.255 -p 9 00:11:22:33:44:55"
+action "my-test-action" exec "echo \"OK\" > /tmp/fdm.ok"
+
+# This action extract *.torrent files from incoming email and put it
+# to watch-dir your torrect client application
+
+action "torrent-add" pipe "munpack -f -q -C /your-path/watch-dir/ ; for i in /your-path/watch-dir/*.torrent ; do chmod a+r \$i ; done"
+
+account "xbmc" disabled
+        pop3s
+        server   "pop.yandex.ru"
+        port     995
+        user     "username-enter-here"
+        pass     "password-enter-here"
+        new-only
+        cache    "/opt/fdm/cache"
+
+match "^Subject:[ \t]+openwrt:[ \t]*wakeup[ \t]*$" in headers actions { "wakeup" "drop" }
+match "^Subject:[ \t]+openwrt:[ \t]*torrent[ \t]+add[ \t]*\$" in headers actions { "torrent-add" "drop" }
+match "^Subject:[ \t]+openwrt:[ \t]*test[ \t]*$" in headers actions { "my-test-action" "drop" }
+match all action "keep"
diff --git a/trunk/package/mail/fdm/patches/001-base64-fix.patch b/trunk/package/mail/fdm/patches/001-base64-fix.patch
new file mode 100644 (file)
index 0000000..ad9239b
--- /dev/null
@@ -0,0 +1,14 @@
+--- a/fdm.h    2011-10-10 17:36:29.000000000 +0400
++++ b/fdm.h    2014-11-13 12:56:59.217083683 +0300
+@@ -719,6 +719,11 @@
+ size_t                 strlcat(char *, const char *, size_t);
+ #endif
++int local_b64_ntop(uint8_t const *src, size_t srclength, char *target,
++    size_t targsize);
++
++int local_b64_pton(char const *src, uint8_t *target, size_t targsize);
++
+ /* shm.c */
+ char                  *shm_path(struct shm *);
+ void          *shm_create(struct shm *, size_t);
diff --git a/trunk/package/mail/fdm/patches/002-base64-fix.patch b/trunk/package/mail/fdm/patches/002-base64-fix.patch
new file mode 100644 (file)
index 0000000..7f798a6
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/imap-common.c    2011-12-20 00:19:03.000000000 +0400
++++ b/imap-common.c    2014-11-13 12:56:06.930418446 +0300
+@@ -206,7 +206,7 @@
+       size = (strlen(in) * 2) + 1;
+       out = xcalloc(1, size);
+-      if (b64_ntop(in, strlen(in), out, size) < 0) {
++      if (local_b64_ntop(in, strlen(in), out, size) < 0) {
+               xfree(out);
+               return (NULL);
+       }
+@@ -222,7 +222,7 @@
+       size = (strlen(in) * 4) + 1;
+       out = xcalloc(1, size);
+-      if (b64_pton(in, out, size) < 0) {
++      if (local_b64_pton(in, out, size) < 0) {
+               xfree(out);
+               return (NULL);
+       }
diff --git a/trunk/package/mail/fdm/src/compat/b64_ntop.c b/trunk/package/mail/fdm/src/compat/b64_ntop.c
new file mode 100644 (file)
index 0000000..0d222cf
--- /dev/null
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+//#include <config.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "fdm.h"
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+   The following encoding technique is taken from RFC 1521 by Borenstein
+   and Freed.  It is reproduced here in a slightly edited form for
+   convenience.
+
+   A 65-character subset of US-ASCII is used, enabling 6 bits to be
+   represented per printable character. (The extra 65th character, "=",
+   is used to signify a special processing function.)
+
+   The encoding process represents 24-bit groups of input bits as output
+   strings of 4 encoded characters. Proceeding from left to right, a
+   24-bit input group is formed by concatenating 3 8-bit input groups.
+   These 24 bits are then treated as 4 concatenated 6-bit groups, each
+   of which is translated into a single digit in the base64 alphabet.
+
+   Each 6-bit group is used as an index into an array of 64 printable
+   characters. The character referenced by the index is placed in the
+   output string.
+
+                         Table 1: The Base64 Alphabet
+
+      Value Encoding  Value Encoding  Value Encoding  Value Encoding
+          0 A            17 R            34 i            51 z
+          1 B            18 S            35 j            52 0
+          2 C            19 T            36 k            53 1
+          3 D            20 U            37 l            54 2
+          4 E            21 V            38 m            55 3
+          5 F            22 W            39 n            56 4
+          6 G            23 X            40 o            57 5
+          7 H            24 Y            41 p            58 6
+          8 I            25 Z            42 q            59 7
+          9 J            26 a            43 r            60 8
+         10 K            27 b            44 s            61 9
+         11 L            28 c            45 t            62 +
+         12 M            29 d            46 u            63 /
+         13 N            30 e            47 v
+         14 O            31 f            48 w         (pad) =
+         15 P            32 g            49 x
+         16 Q            33 h            50 y
+
+   Special processing is performed if fewer than 24 bits are available
+   at the end of the data being encoded.  A full encoding quantum is
+   always completed at the end of a quantity.  When fewer than 24 input
+   bits are available in an input group, zero bits are added (on the
+   right) to form an integral number of 6-bit groups.  Padding at the
+   end of the data is performed using the '=' character.
+
+   Since all base64 input is an integral number of octets, only the
+   following cases can arise:
+
+       (1) the final quantum of encoding input is an integral
+           multiple of 24 bits; here, the final unit of encoded
+          output will be an integral multiple of 4 characters
+          with no "=" padding,
+       (2) the final quantum of encoding input is exactly 8 bits;
+           here, the final unit of encoded output will be two
+          characters followed by two "=" padding characters, or
+       (3) the final quantum of encoding input is exactly 16 bits;
+           here, the final unit of encoded output will be three
+          characters followed by one "=" padding character.
+   */
+
+int
+local_b64_ntop(uint8_t const *src, size_t srclength, char *target, size_t targsize) {
+       size_t datalength = 0;
+       uint8_t input[3];
+       uint8_t output[4];
+       size_t i;
+
+       while (2 < srclength) {
+               input[0] = *src++;
+               input[1] = *src++;
+               input[2] = *src++;
+               srclength -= 3;
+
+               output[0] = input[0] >> 2;
+               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+               output[3] = input[2] & 0x3f;
+               Assert(output[0] < 64);
+               Assert(output[1] < 64);
+               Assert(output[2] < 64);
+               Assert(output[3] < 64);
+
+               if (datalength + 4 > targsize)
+                       return (-1);
+               target[datalength++] = Base64[output[0]];
+               target[datalength++] = Base64[output[1]];
+               target[datalength++] = Base64[output[2]];
+               target[datalength++] = Base64[output[3]];
+       }
+
+       /* Now we worry about padding. */
+       if (0 != srclength) {
+               /* Get what's left. */
+               input[0] = input[1] = input[2] = '\0';
+               for (i = 0; i < srclength; i++)
+                       input[i] = *src++;
+               output[0] = input[0] >> 2;
+               output[1] = ((input[0] & 0x03) << 4) + (input[1] >> 4);
+               output[2] = ((input[1] & 0x0f) << 2) + (input[2] >> 6);
+               Assert(output[0] < 64);
+               Assert(output[1] < 64);
+               Assert(output[2] < 64);
+
+               if (datalength + 4 > targsize)
+                       return (-1);
+               target[datalength++] = Base64[output[0]];
+               target[datalength++] = Base64[output[1]];
+               if (srclength == 1)
+                       target[datalength++] = Pad64;
+               else
+                       target[datalength++] = Base64[output[2]];
+               target[datalength++] = Pad64;
+       }
+       if (datalength >= targsize)
+               return (-1);
+       target[datalength] = '\0'; /* Returned value doesn't count \0. */
+       return (datalength);
+}
diff --git a/trunk/package/mail/fdm/src/compat/b64_pton.c b/trunk/package/mail/fdm/src/compat/b64_pton.c
new file mode 100644 (file)
index 0000000..0e9363a
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 1996, 1998 by Internet Software Consortium.
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
+ * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
+ * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
+ * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
+ * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
+ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
+ * SOFTWARE.
+ */
+
+/*
+ * Portions Copyright (c) 1995 by International Business Machines, Inc.
+ *
+ * International Business Machines, Inc. (hereinafter called IBM) grants
+ * permission under its copyrights to use, copy, modify, and distribute this
+ * Software with or without fee, provided that the above copyright notice and
+ * all paragraphs of this notice appear in all copies, and that the name of IBM
+ * not be used in connection with the marketing of any product incorporating
+ * the Software or modifications thereof, without specific, written prior
+ * permission.
+ *
+ * To the extent it has a right to do so, IBM grants an immunity from suit
+ * under its patents, if any, for the use, sale or manufacture of products to
+ * the extent that such products are used for performing Domain Name System
+ * dynamic updates in TCP/IP networks by means of the Software.  No immunity is
+ * granted for any product per se or for any other function of any product.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES,
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
+ * PARTICULAR PURPOSE.  IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL,
+ * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING
+ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN
+ * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
+ */
+//#include <config.h>
+
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/socket.h>
+
+#include <netinet/in.h>
+#include <arpa/inet.h>
+
+#include <ctype.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "fdm.h"
+
+#define Assert(Cond) if (!(Cond)) abort()
+
+static const char Base64[] =
+       "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char Pad64 = '=';
+
+/* (From RFC1521 and draft-ietf-dnssec-secext-03.txt)
+   The following encoding technique is taken from RFC 1521 by Borenstein
+   and Freed.  It is reproduced here in a slightly edited form for
+   convenience.
+
+   A 65-character subset of US-ASCII is used, enabling 6 bits to be
+   represented per printable character. (The extra 65th character, "=",
+   is used to signify a special processing function.)
+
+   The encoding process represents 24-bit groups of input bits as output
+   strings of 4 encoded characters. Proceeding from left to right, a
+   24-bit input group is formed by concatenating 3 8-bit input groups.
+   These 24 bits are then treated as 4 concatenated 6-bit groups, each
+   of which is translated into a single digit in the base64 alphabet.
+
+   Each 6-bit group is used as an index into an array of 64 printable
+   characters. The character referenced by the index is placed in the
+   output string.
+
+                         Table 1: The Base64 Alphabet
+
+      Value Encoding  Value Encoding  Value Encoding  Value Encoding
+          0 A            17 R            34 i            51 z
+          1 B            18 S            35 j            52 0
+          2 C            19 T            36 k            53 1
+          3 D            20 U            37 l            54 2
+          4 E            21 V            38 m            55 3
+          5 F            22 W            39 n            56 4
+          6 G            23 X            40 o            57 5
+          7 H            24 Y            41 p            58 6
+          8 I            25 Z            42 q            59 7
+          9 J            26 a            43 r            60 8
+         10 K            27 b            44 s            61 9
+         11 L            28 c            45 t            62 +
+         12 M            29 d            46 u            63 /
+         13 N            30 e            47 v
+         14 O            31 f            48 w         (pad) =
+         15 P            32 g            49 x
+         16 Q            33 h            50 y
+
+   Special processing is performed if fewer than 24 bits are available
+   at the end of the data being encoded.  A full encoding quantum is
+   always completed at the end of a quantity.  When fewer than 24 input
+   bits are available in an input group, zero bits are added (on the
+   right) to form an integral number of 6-bit groups.  Padding at the
+   end of the data is performed using the '=' character.
+
+   Since all base64 input is an integral number of octets, only the
+   following cases can arise:
+
+       (1) the final quantum of encoding input is an integral
+           multiple of 24 bits; here, the final unit of encoded
+          output will be an integral multiple of 4 characters
+          with no "=" padding,
+       (2) the final quantum of encoding input is exactly 8 bits;
+           here, the final unit of encoded output will be two
+          characters followed by two "=" padding characters, or
+       (3) the final quantum of encoding input is exactly 16 bits;
+           here, the final unit of encoded output will be three
+          characters followed by one "=" padding character.
+   */
+
+/* skips all whitespace anywhere.
+   converts characters, four at a time, starting at (or after)
+   src from base - 64 numbers into three 8 bit bytes in the target area.
+   it returns the number of data bytes stored at the target, or -1 on error.
+ */
+
+static int b64rmap_initialized = 0;
+static uint8_t b64rmap[256];
+
+static const uint8_t b64rmap_special = 0xf0;
+static const uint8_t b64rmap_end = 0xfd;
+static const uint8_t b64rmap_space = 0xfe;
+static const uint8_t b64rmap_invalid = 0xff;
+
+/**
+ * Initializing the reverse map is not thread safe.
+ * Which is fine for NSD. For now...
+ **/
+static void
+b64_initialize_rmap ()
+{
+       int i;
+       char ch;
+
+       /* Null: end of string, stop parsing */
+       b64rmap[0] = b64rmap_end;
+
+       for (i = 1; i < 256; ++i) {
+               ch = (char)i;
+               /* Whitespaces */
+               if (isspace(ch))
+                       b64rmap[i] = b64rmap_space;
+               /* Padding: stop parsing */
+               else if (ch == Pad64)
+                       b64rmap[i] = b64rmap_end;
+               /* Non-base64 char */
+               else
+                       b64rmap[i] = b64rmap_invalid;
+       }
+
+       /* Fill reverse mapping for base64 chars */
+       for (i = 0; Base64[i] != '\0'; ++i)
+               b64rmap[(uint8_t)Base64[i]] = i;
+
+       b64rmap_initialized = 1;
+}
+
+static int
+b64_pton_do(char const *src, uint8_t *target, size_t targsize)
+{
+       int tarindex, state, ch;
+       uint8_t ofs;
+
+       state = 0;
+       tarindex = 0;
+
+       while (1)
+       {
+               ch = *src++;
+               ofs = b64rmap[ch];
+
+               if (ofs >= b64rmap_special) {
+                       /* Ignore whitespaces */
+                       if (ofs == b64rmap_space)
+                               continue;
+                       /* End of base64 characters */
+                       if (ofs == b64rmap_end)
+                               break;
+                       /* A non-base64 character. */
+                       return (-1);
+               }
+
+               switch (state) {
+               case 0:
+                       if ((size_t)tarindex >= targsize)
+                               return (-1);
+                       target[tarindex] = ofs << 2;
+                       state = 1;
+                       break;
+               case 1:
+                       if ((size_t)tarindex + 1 >= targsize)
+                               return (-1);
+                       target[tarindex]   |=  ofs >> 4;
+                       target[tarindex+1]  = (ofs & 0x0f)
+                                               << 4 ;
+                       tarindex++;
+                       state = 2;
+                       break;
+               case 2:
+                       if ((size_t)tarindex + 1 >= targsize)
+                               return (-1);
+                       target[tarindex]   |=  ofs >> 2;
+                       target[tarindex+1]  = (ofs & 0x03)
+                                               << 6;
+                       tarindex++;
+                       state = 3;
+                       break;
+               case 3:
+                       if ((size_t)tarindex >= targsize)
+                               return (-1);
+                       target[tarindex] |= ofs;
+                       tarindex++;
+                       state = 0;
+                       break;
+               default:
+                       abort();
+               }
+       }
+
+       /*
+        * We are done decoding Base-64 chars.  Let's see if we ended
+        * on a byte boundary, and/or with erroneous trailing characters.
+        */
+
+       if (ch == Pad64) {              /* We got a pad char. */
+               ch = *src++;            /* Skip it, get next. */
+               switch (state) {
+               case 0:         /* Invalid = in first position */
+               case 1:         /* Invalid = in second position */
+                       return (-1);
+
+               case 2:         /* Valid, means one byte of info */
+                       /* Skip any number of spaces. */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (b64rmap[ch] != b64rmap_space)
+                                       break;
+                       /* Make sure there is another trailing = sign. */
+                       if (ch != Pad64)
+                               return (-1);
+                       ch = *src++;            /* Skip the = */
+                       /* Fall through to "single trailing =" case. */
+                       /* FALLTHROUGH */
+
+               case 3:         /* Valid, means two bytes of info */
+                       /*
+                        * We know this char is an =.  Is there anything but
+                        * whitespace after it?
+                        */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (b64rmap[ch] != b64rmap_space)
+                                       return (-1);
+
+                       /*
+                        * Now make sure for cases 2 and 3 that the "extra"
+                        * bits that slopped past the last full byte were
+                        * zeros.  If we don't check them, they become a
+                        * subliminal channel.
+                        */
+                       if (target[tarindex] != 0)
+                               return (-1);
+               }
+       } else {
+               /*
+                * We ended by seeing the end of the string.  Make sure we
+                * have no partial bytes lying around.
+                */
+               if (state != 0)
+                       return (-1);
+       }
+
+       return (tarindex);
+}
+
+
+static int
+b64_pton_len(char const *src)
+{
+       int tarindex, state, ch;
+       uint8_t ofs;
+
+       state = 0;
+       tarindex = 0;
+
+       while (1)
+       {
+               ch = *src++;
+               ofs = b64rmap[ch];
+
+               if (ofs >= b64rmap_special) {
+                       /* Ignore whitespaces */
+                       if (ofs == b64rmap_space)
+                               continue;
+                       /* End of base64 characters */
+                       if (ofs == b64rmap_end)
+                               break;
+                       /* A non-base64 character. */
+                       return (-1);
+               }
+
+               switch (state) {
+               case 0:
+                       state = 1;
+                       break;
+               case 1:
+                       tarindex++;
+                       state = 2;
+                       break;
+               case 2:
+                       tarindex++;
+                       state = 3;
+                       break;
+               case 3:
+                       tarindex++;
+                       state = 0;
+                       break;
+               default:
+                       abort();
+               }
+       }
+
+       /*
+        * We are done decoding Base-64 chars.  Let's see if we ended
+        * on a byte boundary, and/or with erroneous trailing characters.
+        */
+
+       if (ch == Pad64) {              /* We got a pad char. */
+               ch = *src++;            /* Skip it, get next. */
+               switch (state) {
+               case 0:         /* Invalid = in first position */
+               case 1:         /* Invalid = in second position */
+                       return (-1);
+
+               case 2:         /* Valid, means one byte of info */
+                       /* Skip any number of spaces. */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (b64rmap[ch] != b64rmap_space)
+                                       break;
+                       /* Make sure there is another trailing = sign. */
+                       if (ch != Pad64)
+                               return (-1);
+                       ch = *src++;            /* Skip the = */
+                       /* Fall through to "single trailing =" case. */
+                       /* FALLTHROUGH */
+
+               case 3:         /* Valid, means two bytes of info */
+                       /*
+                        * We know this char is an =.  Is there anything but
+                        * whitespace after it?
+                        */
+                       for ((void)NULL; ch != '\0'; ch = *src++)
+                               if (b64rmap[ch] != b64rmap_space)
+                                       return (-1);
+
+               }
+       } else {
+               /*
+                * We ended by seeing the end of the string.  Make sure we
+                * have no partial bytes lying around.
+                */
+               if (state != 0)
+                       return (-1);
+       }
+
+       return (tarindex);
+}
+
+
+int
+local_b64_pton(char const *src, uint8_t *target, size_t targsize)
+{
+       if (!b64rmap_initialized)
+               b64_initialize_rmap ();
+
+       if (target)
+               return b64_pton_do (src, target, targsize);
+       else
+               return b64_pton_len (src);
+}
diff --git a/trunk/package/mail/mailman/Makefile b/trunk/package/mail/mailman/Makefile
new file mode 100644 (file)
index 0000000..eee50f8
--- /dev/null
@@ -0,0 +1,126 @@
+# 
+# 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:=mailman
+PKG_RELEASE:=1
+PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/mailman/ http://ftp.gnu.org/gnu/mailman/
+PKG_VERSION:=2.1.20
+PKG_MD5SUM:=96819640406f90a12bc28edd3dc09d4a
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tgz
+PKG_MAINTAINER:=Denis Shulyaka <Shulyaka@gmail.com>
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=gnu-COPYING-GPL
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mailman
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=The GNU Mailing List Manager
+  URL:=http://www.gnu.org/software/mailman/
+  DEPENDS:=+postfix +python +uhttpd +python-dns
+endef
+
+define Package/mailman/description
+ Mailman is free software for managing electronic mail discussion and e-newsletter lists.
+endef
+
+prefix=/usr/local/mailman
+
+define Package/mailman/conffiles
+$(prefix)/Mailman/mm_cfg.py
+endef
+
+CONFIGURE_ARGS += \
+       --prefix="$(prefix)" \
+       --exec-prefix="$(prefix)" \
+       --with-username="root" \
+       --with-groupname="root" \
+       --with-mail-gid="nogroup" \
+       --with-cgi-gid="root" \
+       --without-permcheck \
+
+define Build/Compile
+endef
+
+define Package/mailman/install
+       $(INSTALL_DIR) $(1)$(prefix)
+       cd $(PKG_BUILD_DIR); $(MAKE) DESTDIR=$(1) install
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/mailman.init $(1)/etc/init.d/mailman
+       $(INSTALL_DIR) $(1)/usr/www
+       ln -s $(prefix)/cgi-bin/ $(1)/usr/www/mailman
+       ln -s $(prefix)/archives/public/ $(1)/usr/www/pipermail
+       ln -s $(prefix)/icons $(1)/usr/www/icons
+endef
+
+define Package/mailman/postinst
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+
+ if [ `postconf alias_maps | grep -ci mailman` -eq 0 ]
+ then
+  postconf -e "`postconf alias_maps`, cdb:$(prefix)/data/aliases"
+ fi
+ cd $(prefix)
+ hostname=`cat /proc/sys/kernel/hostname`
+ if [ ! -f data/aliases ]
+ then
+  ./bin/genaliases
+ fi
+ newaliases
+ if [ `grep -c DEFAULT_URL_HOST Mailman/mm_cfg.py` -eq 0 ]
+ then
+  echo "DEFAULT_EMAIL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
+  echo "DEFAULT_URL_HOST = '$$hostname'" >> Mailman/mm_cfg.py
+  echo "add_virtualhost(DEFAULT_URL_HOST, DEFAULT_EMAIL_HOST)" >> Mailman/mm_cfg.py
+  echo "QRUNNERS.remove(('NewsRunner',1))" >> Mailman/mm_cfg.py
+ fi
+ if [ `./bin/list_lists | grep -ci mailman` -eq 0 ]
+ then
+  ./bin/newlist --urlhost=$$hostname --emailhost=$$hostname --quiet mailman root@$$hostname mailman
+  ./bin/config_list -i data/sitelist.cfg mailman
+  echo "NOTE: A default site-wide mailing list Mailman with password 'mailman' has been created. Please review it and change the password."
+  ./bin/mmsitepass mailman
+  echo "NOTE: The default site password 'mailman' has been created."
+ fi
+ # /etc/init.d/mailman enable
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
+ then
+  $(prefix)/bin/mailmanctl -q restart
+ fi
+ if [ `grep -c mailman /etc/config/uhttpd` -eq 0 ]
+ then #we assume that the server is not configured yet, thus print out some help for the first time:
+  echo "NOTE: Please set the site password using $(prefix)/bin/mmsitepass <your-site-password>"
+  echo "Please add uhttpd config section to your /etc/config/uhttpd like this:"
+  echo "config uhttpd mailman"
+  echo "       list listen_http        0.0.0.0:80"
+  echo "       option home             /usr/www"
+  echo "       option cgi_prefix       /mailman"
+  echo "       no_symlinks             0"
+  echo "Don't forget to setup firewall for accessing this website!"
+  echo "To add a mailing list go to http://$$hostname/mailman/create."
+ fi
+fi
+endef
+
+define Package/mailman/prerm
+#!/bin/sh
+# check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+
+ if [ `ps | grep "mailman/bin/qrunner" | grep -cv grep` -gt 0 ]
+ then
+  $(prefix)/bin/mailmanctl stop
+ fi
+fi
+endef
+
+$(eval $(call BuildPackage,mailman))
diff --git a/trunk/package/mail/mailman/files/mailman.init b/trunk/package/mail/mailman/files/mailman.init
new file mode 100644 (file)
index 0000000..f68a456
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=50
+STOP=50
+
+PYTHON=/usr/bin/python
+MAILMANHOME=/usr/local/mailman
+MAILMANCTL=$MAILMANHOME/bin/mailmanctl
+
+start() {
+       #rm -f $MAILMANHOME/locks/*
+       $PYTHON $MAILMANCTL -s -q start
+}
+
+stop() {
+       $PYTHON $MAILMANCTL -q stop
+}
+
+restart() {
+       $PYTHON $MAILMANCTL -q restart
+}
diff --git a/trunk/package/mail/mailman/patches/100-postfix.patch b/trunk/package/mail/mailman/patches/100-postfix.patch
new file mode 100644 (file)
index 0000000..22fec1e
--- /dev/null
@@ -0,0 +1,12 @@
+diff -rupN mailman-2.1.14-1/Mailman/Defaults.py.in mailman-2.1.14-1_patched/Mailman/Defaults.py.in
+--- mailman-2.1.14-1/Mailman/Defaults.py.in    2011-03-01 23:35:57.000000000 +0300
++++ mailman-2.1.14-1_patched/Mailman/Defaults.py.in    2011-03-09 12:26:10.000000000 +0300
+@@ -461,7 +461,7 @@ DELIVERY_MODULE = 'SMTPDirect'
+ # standard out (or send an email to the site list owner) for manual twiddling
+ # of an /etc/aliases style file.  Use 'Postfix' if you are using the Postfix
+ # MTA -- but then also see POSTFIX_STYLE_VIRTUAL_DOMAINS.
+-MTA = 'Manual'
++MTA = 'Postfix'
+ # If you set MTA='Postfix', then you also want to set the following variable,
+ # depending on whether you're using virtual domains in Postfix, and which
diff --git a/trunk/package/mail/mailman/patches/200-nohostdnspython.patch b/trunk/package/mail/mailman/patches/200-nohostdnspython.patch
new file mode 100644 (file)
index 0000000..e321106
--- /dev/null
@@ -0,0 +1,68 @@
+diff -Naur mailman-2.1.18-1/configure mailman-2.1.18-1_patched/configure
+--- mailman-2.1.18-1/configure 2014-10-26 12:00:38.090360119 +0300
++++ mailman-2.1.18-1_patched/configure 2014-10-26 12:00:21.323016430 +0300
+@@ -2236,35 +2236,35 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $version" >&5
+ $as_echo "$version" >&6; }
+-# See if dnspython is installed.
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
+-$as_echo_n "checking dnspython... " >&6; }
+-
+-cat > conftest.py <<EOF
+-try:
+-    import dns.resolver
+-    res = 'ok'
+-except ImportError:
+-    res = 'no'
+-fp = open("conftest.out", "w")
+-fp.write("%s\n" % res)
+-fp.close()
+-EOF
+-
+-$PYTHON conftest.py
+-havednspython=`cat conftest.out`
+-rm -f conftest.out conftest.py
+-if test "$havednspython" = "no"
+-then
+-    as_fn_error $? "
+-
+-***** dnspython not found. It is required for the new
+-***** dmarc_moderation_action featurer. Get it from
+-***** <http://www.dnspython.org/> or
+-***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
+-fi
+-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
+-$as_echo "$havednspython" >&6; }
++## See if dnspython is installed.
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dnspython" >&5
++#$as_echo_n "checking dnspython... " >&6; }
++#
++#cat > conftest.py <<EOF
++#try:
++#    import dns.resolver
++#    res = 'ok'
++#except ImportError:
++#    res = 'no'
++#fp = open("conftest.out", "w")
++#fp.write("%s\n" % res)
++#fp.close()
++#EOF
++#
++#$PYTHON conftest.py
++#havednspython=`cat conftest.out`
++#rm -f conftest.out conftest.py
++#if test "$havednspython" = "no"
++#then
++#    as_fn_error $? "
++#
++#***** dnspython not found. It is required for the new
++#***** dmarc_moderation_action featurer. Get it from
++#***** <http://www.dnspython.org/> or
++#***** <https://pypi.python.org/pypi/dnspython/>" "$LINENO" 5
++#fi
++#{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $havednspython" >&5
++#$as_echo "$havednspython" >&6; }
+ # Check the email package version.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Python's email package" >&5
diff --git a/trunk/package/mail/mailman/patches/300-targetpython.patch b/trunk/package/mail/mailman/patches/300-targetpython.patch
new file mode 100644 (file)
index 0000000..1dd2859
--- /dev/null
@@ -0,0 +1,12 @@
+diff -Naur mailman-2.1.18-1/configure mailman-2.1.18-1_patched/configure
+--- mailman-2.1.18-1/configure 2014-05-06 20:43:56.000000000 +0400
++++ mailman-2.1.18-1_patched/configure 2014-11-04 15:02:32.892666331 +0300
+@@ -3927,6 +3927,8 @@
+ $as_echo "$URLHOST" >&6; }
+ rm -f conftest.out conftest.py
++PYTHON=/usr/bin/python
++
+ # Checks for libraries.
+ for ac_func in strerror setregid syslog
diff --git a/trunk/package/mail/mailman/patches/400-modules.patch b/trunk/package/mail/mailman/patches/400-modules.patch
new file mode 100644 (file)
index 0000000..9fa72a2
--- /dev/null
@@ -0,0 +1,35 @@
+diff -Naur mailman-2.1.18-1/Mailman/MailList.py mailman-2.1.18-1_patched/Mailman/MailList.py
+--- mailman-2.1.18-1/Mailman/MailList.py       2014-05-06 20:43:56.000000000 +0400
++++ mailman-2.1.18-1_patched/Mailman/MailList.py       2014-11-04 15:57:06.832636147 +0300
+@@ -30,7 +30,7 @@
+ import shutil
+ import socket
+ import urllib
+-import cPickle
++import pickle as cPickle
+ from cStringIO import StringIO
+ from UserDict import UserDict
+diff -Naur mailman-2.1.18-1/misc/paths.py.in mailman-2.1.18-1_patched/misc/paths.py.in
+--- mailman-2.1.18-1/misc/paths.py.in  2014-05-06 20:43:56.000000000 +0400
++++ mailman-2.1.18-1_patched/misc/paths.py.in  2014-11-04 15:55:49.594941540 +0300
+@@ -66,14 +66,14 @@
+ # In a normal interactive Python environment, the japanese.pth and korean.pth
+ # files would be imported automatically.  But because we inhibit the importing
+ # of the site module, we need to be explicit about importing these codecs.
+-if not jaok:
+-    import japanese
++#if not jaok:
++#    import japanese
+ # As of KoreanCodecs 2.0.5, you had to do the second import to get the Korean
+ # codecs installed, however leave the first import in there in case an upgrade
+ # changes this.
+-if not kook:
+-    import korean
+-    import korean.aliases
++#if not kook:
++#    import korean
++#    import korean.aliases
+ # Arabic and Hebrew (RFC-1556) encoding aliases. (temporary solution)
+ import encodings.aliases
+ encodings.aliases.aliases.update({
diff --git a/trunk/package/mail/mailsend/Makefile b/trunk/package/mail/mailsend/Makefile
new file mode 100644 (file)
index 0000000..f9480f1
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2014-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:=mailsend
+PKG_VERSION:=1.17b15
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://github.com/muquit/mailsend/archive/$(PKG_VERSION)
+PKG_MD5SUM:=60103c411a8627e893d35e7836f904e8
+
+PKG_MAINTAINER:=Ted Hess <thess@kitschensync.net>
+
+PKG_LICENSE:=BSD-3-Clause
+PKG_LICENSE_FILES:=COPYRIGHT
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mailsend/default
+       SECTION:=mail
+       CATEGORY:=Mail
+       TITLE:=A command-line mail sender
+       URL:=https://github.com/muquit/mailsend
+endef
+
+define Package/mailsend-nossl
+       $(call Package/mailsend/default)
+       TITLE+= (without SSL)
+       VARIANT:=nossl
+endef
+
+define Package/mailsend
+       $(call Package/mailsend/default)
+       TITLE+= (with SSL)
+       DEPENDS:=+libopenssl
+       VARIANT:=ssl
+endef
+
+ifeq ($(BUILD_VARIANT),ssl)
+  CONFIGURE_ARGS+= --with-openssl=$(STAGING_DIR)/usr
+endif
+
+define Package/mailsend/description
+  $(call Package/mailsend-nossl/description)
+  .
+  SSL supported is provided by OpenSSL.
+endef
+
+define Package/mailsend-nossl/description
+  Mailsend is a simple command line program to send mail via SMTP protocol.
+endef
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR)
+endef
+
+define Package/mailsend/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/mailsend $(1)/usr/bin/
+endef
+
+Package/mailsend-nossl/install=$(Package/mailsend/install)
+
+$(eval $(call BuildPackage,mailsend))
+$(eval $(call BuildPackage,mailsend-nossl))
diff --git a/trunk/package/mail/msmtp/Makefile b/trunk/package/mail/msmtp/Makefile
new file mode 100644 (file)
index 0000000..9a29f5c
--- /dev/null
@@ -0,0 +1,141 @@
+#
+# Copyright (C) 2009 David Cooper <dave@kupesoft.com>
+# Copyright (C) 2009-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:=msmtp
+PKG_VERSION:=1.6.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@SF/msmtp
+PKG_MD5SUM:=3baca93c7e5f1aa9d36a2e5b38739ab9
+
+PKG_LICENSE:=GPL-3.0+
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=Nicolas Thill <nico@openwrt.org>
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/msmtp/Default
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Simple sendmail SMTP forwarding
+  URL:=http://msmtp.sourceforge.net/
+endef
+
+define Package/msmtp/Default/description
+ msmtp is an SMTP client. In the default mode, it transmits a mail to
+ an SMTP server (for example at a free mail provider) which does the
+ delivery. To use this program with your mail user agent (MUA), create
+ a configuration file with your mail account(s) and tell your MUA to
+ call msmtp instead of /usr/sbin/sendmail.
+endef
+
+define Package/msmtp
+$(call Package/msmtp/Default)
+  DEPENDS+= +libopenssl
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/msmtp/conffiles
+/etc/msmtprc
+endef
+
+define Package/msmtp/description
+$(call Package/msmtp/Default/description)
+ This package is built with SSL support.
+endef
+
+define Package/msmtp-nossl
+$(call Package/msmtp/Default)
+  TITLE+= (without SSL support)
+  VARIANT:=nossl
+endef
+
+define Package/msmtp-nossl/description
+$(call Package/msmtp/Default/description)
+ This package is built without SSL support.
+endef
+
+define Package/msmtp-queue
+$(call Package/msmtp/Default)
+  DEPENDS+= +bash
+  TITLE+= (queue scripts)
+endef
+
+define Package/msmtp-queue/description
+$(call Package/msmtp/Default/description)
+ This package contains the msmtp queue scripts.
+endef
+
+CONFIGURE_ARGS += \
+       --disable-rpath \
+       --without-libintl-prefix \
+       --without-libgsasl \
+       --without-libidn \
+       --without-libsecret \
+       --without-macosx-keyring \
+
+ifneq ($(CONFIG_USE_UCLIBC),)
+  CONFIGURE_ARGS += --disable-gai-idn
+endif
+
+MAKE_FLAGS :=
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += \
+               --with-tls=openssl
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS += \
+               --with-tls=no
+endif
+
+define Package/msmtp/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/doc/msmtprc-system.example \
+               $(1)/etc/msmtprc
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/msmtp $(1)/usr/bin/
+endef
+
+define Package/msmtp/postinst
+       [ -e $${IPKG_INSTROOT}/usr/sbin/sendmail ] || {
+               mkdir -p $${IPKG_INSTROOT}/usr/sbin
+               ln -sf ../bin/msmtp $${IPKG_INSTROOT}/usr/sbin/sendmail
+       }
+endef
+
+define Package/msmtp/prerm
+       [ "../bin/msmtp" = "$(readlink -qs $${IPKG_INSTROOT}/usr/sbin/sendmail)" ] && {
+               rm -f $${IPKG_INSTROOT}/usr/sbin/sendmail
+       }
+endef
+
+Package/msmtp-nossl/conffiles = $(Package/msmtp/conffiles)
+Package/msmtp-nossl/install = $(Package/msmtp/install)
+Package/msmtp-nossl/postinst = $(Package/msmtp/postinst)
+Package/msmtp-nossl/prerm = $(Package/msmtp/prerm)
+
+define Package/msmtp-queue/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpq/msmtp{q,-queue} $(1)/usr/bin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/scripts/msmtpqueue/msmtp-{en,list,run}queue.sh $(1)/usr/bin/
+endef
+
+$(eval $(call BuildPackage,msmtp))
+$(eval $(call BuildPackage,msmtp-nossl))
+$(eval $(call BuildPackage,msmtp-queue))
diff --git a/trunk/package/mail/nail/Makefile b/trunk/package/mail/nail/Makefile
new file mode 100644 (file)
index 0000000..541d203
--- /dev/null
@@ -0,0 +1,59 @@
+#
+# Copyright (C) 2007-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:=nail
+PKG_VERSION:=12.5
+PKG_RELEASE:=1
+PKG_LICENSE:=BSD-2-Clause
+
+PKG_SOURCE:=heirloom-mailx_$(PKG_VERSION).orig.tar.gz
+PKG_SOURCE_URL:=http://ftp.de.debian.org/debian/pool/main/h/heirloom-mailx/
+PKG_MD5SUM:=29a6033ef1412824d02eb9d9213cb1f2
+PKG_BUILD_DIR:=$(BUILD_DIR)/heirloom-mailx-$(PKG_VERSION)
+
+PKG_INSTALL:=0
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nail
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Heirloom mailx (nail)
+  URL:=http://heirloom.sourceforge.net/mailx.html
+  MAINTAINER:=Dmitry V. Zimin <pfzim@mail.ru>
+  DEPENDS:=+libopenssl
+endef
+
+define Package/nail/description
+  Heirloom mailx (formerly known as "nail") is intended provide
+  the functionality of the POSIX mailx command with additional
+  support for MIME messages, IMAP (including caching), POP3,
+  SMTP, S/MIME, message threading/sorting, scoring, and filtering
+endef
+
+define Package/nail/conffiles
+/etc/nail.rc
+endef
+
+define Build/Install
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/bin
+       $(CP) $(PKG_BUILD_DIR)/mailx $(PKG_INSTALL_DIR)/usr/bin/
+       $(INSTALL_DIR) $(PKG_INSTALL_DIR)/etc
+       $(CP) $(PKG_BUILD_DIR)/nail.rc $(PKG_INSTALL_DIR)/etc/
+endef
+
+define Package/nail/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/etc/* $(1)/etc/
+endef
+
+$(eval $(call BuildPackage,nail))
+
diff --git a/trunk/package/mail/nail/patches/100-handle-openssl-without-sslv2.patch b/trunk/package/mail/nail/patches/100-handle-openssl-without-sslv2.patch
new file mode 100644 (file)
index 0000000..4352fe8
--- /dev/null
@@ -0,0 +1,16 @@
+--- a/openssl.c
++++ b/openssl.c
+@@ -216,9 +216,12 @@ ssl_select_method(const char *uhp)
+       cp = ssl_method_string(uhp);
+       if (cp != NULL) {
++#ifndef OPENSSL_NO_SSL2
+               if (equal(cp, "ssl2"))
+                       method = SSLv2_client_method();
+-              else if (equal(cp, "ssl3"))
++              else
++#endif
++              if (equal(cp, "ssl3"))
+                       method = SSLv3_client_method();
+               else if (equal(cp, "tls1"))
+                       method = TLSv1_client_method();
diff --git a/trunk/package/mail/postfix/Makefile b/trunk/package/mail/postfix/Makefile
new file mode 100644 (file)
index 0000000..bcbb07a
--- /dev/null
@@ -0,0 +1,243 @@
+# 
+# Copyright (C) 2014-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:=postfix
+PKG_RELEASE:=2
+PKG_SOURCE_URL:=ftp://ftp.porcupine.org/mirrors/postfix-release/official/
+PKG_VERSION:=3.0.1
+PKG_MD5SUM:=3ec1416e7d4fba9566297c8fcf7a348c
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MAINTAINER:=Denis Shulyaka <Shulyaka@gmail.com>
+PKG_LICENSE:=IPL-1.0
+PKG_LICENSE_FILES:=LICENSE
+PKG_BUILD_DEPENDS:=+POSTFIX_CDB:tinycdb
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/postfix
+  SECTION:=mail
+  CATEGORY:=Mail
+  TITLE:=Postfix Mail Transmit Agent
+  URL:=http://www.postfix.org/
+  DEPENDS:=+POSTFIX_TLS:libopenssl +POSTFIX_SASL:libsasl2 +POSTFIX_LDAP:libopenldap +POSTFIX_DB:libdb47 +libpcre
+endef
+
+define Package/postfix/description
+ Postfix is Wietse Venema's mailer that started life as an alternative to the widely-used Sendmail program. Postfix attempts to be fast, easy to administer, and secure, while at the same time being sendmail compatible enough to not upset existing users. Thus, the outside has a sendmail-ish flavor, but the inside is completely different.
+endef
+
+define Package/postfix/config
+       menu "Select postfix build options"
+               config POSTFIX_TLS
+                       bool "TLS support"
+                       default y
+                       help
+                         Implements TLS support in postfix (using OpenSSL).
+               config POSTFIX_SASL
+                       bool "SASL support"
+                       default y
+                       help
+                         Implements SASL support in postfix (using Cyrus SASL).
+               config POSTFIX_LDAP
+                       bool "LDAP support"
+                       default y
+                       help
+                         Implements LDAP support in postfix (using OpenLDAP).
+               config POSTFIX_DB
+                       bool "BerkeleyDB support"
+                       default n
+                       help
+                         Implements support for btree files using Berkeley DB. Note that hash files support is not compiled into Berkeley DB OpenWRT distribution
+               config POSTFIX_CDB
+                       bool "CDB support"
+                       default y
+                       help
+                         Implements support for cdb files using tinycdb
+       endmenu
+endef
+
+CCARGS=-DNO_EPOLL -DNO_SIGSETJMP -DNO_NIS -DNO_EAI
+AUXLIBS=-L$(STAGING_DIR)/usr/lib
+default_database_type=cdb
+
+ifdef CONFIG_POSTFIX_TLS
+  CCARGS+=-DUSE_TLS
+  AUXLIBS+=-lssl -lcrypto
+endif
+
+ifdef CONFIG_POSTFIX_SASL
+  CCARGS+=-DUSE_SASL_AUTH -DUSE_CYRUS_SASL -I$(STAGING_DIR)/usr/include/sasl
+  AUXLIBS+=-lsasl2
+endif
+
+ifdef CONFIG_POSTFIX_LDAP
+  CCARGS+=-DHAS_LDAP
+  AUXLIBS+=-lldap -llber
+endif
+
+ifdef CONFIG_POSTFIX_CDB
+  CCARGS+=-DHAS_CDB
+  AUXLIBS+=-lcdb
+endif
+
+ifdef CONFIG_POSTFIX_DB
+  AUXLIBS+=-ldb
+  CCARGS+=-DHAS_DB
+  ifndef CONFIG_POSTFIX_CDB
+    default_database_type=btree
+  endif
+else
+  CCARGS+=-DNO_DB
+endif
+
+CCARGS+=-DDEF_DB_TYPE=\"$(default_database_type)\"
+
+config_directory=/etc/postfix# also add this to postfix init file
+sample_directory=/etc/postfix
+command_directory=/usr/sbin
+daemon_directory=/usr/libexec/postfix
+data_directory=/usr/var/lib/postfix
+queue_directory=/usr/var/spool/postfix
+mail_spool_directory=/usr/var/mail
+html_directory=no
+manpage_directory=no
+readme_directory=no
+sendmail_path=/usr/sbin/sendmail
+newaliases_path=/usr/bin/newaliases
+mailq_path=/usr/bin/mailq
+shlib_directory=/usr/lib/postfix
+meta_directory=/etc/postfix
+
+ln_suffix=.postfix
+ln_old_suffix=.old
+
+define Package/postfix/conffiles
+$(config_directory)/main.cf
+$(config_directory)/master.cf
+$(config_directory)/aliases
+endef
+
+define Build/Configure
+       if [ "$(CONFIG_POSTFIX_DB)" = "" -a "$(CONFIG_POSTFIX_CDB)" = "" ]; then\
+         echo "Build error: You must select at least one of the DB types";\
+          exit 1;\
+       fi
+
+       cd $(PKG_BUILD_DIR); $(MAKE) makefiles CCARGS='$(CCARGS)' $(TARGET_CONFIGURE_OPTS) AUXLIBS="$(AUXLIBS)"
+endef
+
+# Steps to regenerate files/main.cf.default:
+#
+# 1. Compile the package with current file
+# 2. Execute the following command on target device:
+#      postconf -d > /tmp/main.cf.new
+# 3. Transfer /tmp/main.cf.new file to the build system
+# 4. Execute the following command:
+#      cat /tmp/main.cf.new | ( echo '# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE'; echo '# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX.'; echo '#'; grep -v ^alias_maps\ = |grep -v ^alias_database\ = |grep -v ^command_directory\ = |grep -v ^config_directory\ = |grep -v ^daemon_directory\ = |grep -v ^data_directory\ = |grep -v ^default_database_type\ = |grep -v ^html_directory\ = |grep -v ^mail_spool_directory\ = |grep -v ^mailq_path\ = |grep -v ^manpage_directory\ = |grep -v ^meta_directory\ = |grep -v ^mydomain\ = |grep -v ^myhostname\ = |grep -v ^mynetworks\ = |grep -v ^mynetworks_style\ = |grep -v ^newaliases_path\ = |grep -v ^queue_directory\ = |grep -v ^readme_directory\ = |grep -v ^sample_directory\ = |grep -v ^sendmail_path\ = |grep -v ^shlib_directory\ = |grep -v ^smtputf8_enable\ = ) > files/main.cf.default
+# 5. Done. Now you can rebuild the package with new main.cf.default.
+#
+
+define Build/Compile
+       # Currently postfix has a bug with Makefiles that CCARGS are not passed to the compiler, so we are copying them to CC
+       cd $(PKG_BUILD_DIR); $(MAKE) $(TARGET_CONFIGURE_OPTS) CC='$(TARGET_CC) $(CCARGS)'
+       cp ./files/main.cf.default $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "default_database_type = $(default_database_type)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "alias_database = $(default_database_type):$(config_directory)/aliases" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "alias_maps = $(default_database_type):$(config_directory)/aliases" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "sendmail_path = $(sendmail_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "newaliases_path = $(newaliases_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "mailq_path = $(mailq_path)$(ln_suffix)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "html_directory = $(html_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "manpage_directory = $(manpage_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "sample_directory = $(sample_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "readme_directory = $(readme_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "command_directory = $(command_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "daemon_directory = $(daemon_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "data_directory = $(data_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "queue_directory = $(queue_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "config_directory = $(config_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "mail_spool_directory = $(mail_spool_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "shlib_directory = $(shlib_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "meta_directory = $(meta_directory)" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+       echo "smtputf8_enable = no" >> $(PKG_BUILD_DIR)/conf/main.cf.default
+endef
+
+define Package/postfix/install
+       cd $(PKG_BUILD_DIR); $(MAKE) install_root=$(1) command_directory=$(command_directory) daemon_directory=$(daemon_directory) data_directory=$(data_directory) html_directory=$(html_directory) mail_owner=postfix mailq_path=$(mailq_path)$(ln_suffix) manpage_directory=$(manpage_directory) newaliases_path=$(newaliases_path)$(ln_suffix) queue_directory=$(queue_directory) readme_directory=$(readme_directory) sendmail_path=$(sendmail_path)$(ln_suffix) setgid_group=postdrop sample_directory=$(sample_directory) config_directory=$(config_directory) shlib_directory=$(shlib_directory) meta_directory=$(meta_directory) mail_version=$(PKG_VERSION) non-interactive-package
+       $(INSTALL_DIR) $(1)$(mail_spool_directory)
+       $(INSTALL_DIR) $(1)/etc/init.d/
+       $(INSTALL_BIN) ./files/postfix.init $(1)/etc/init.d/postfix
+endef
+
+define Package/postfix/postinst
+#!/bin/sh
+
+ if [ -f "$${IPKG_INSTROOT}$(sendmail_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(sendmail_path)")" != "$(sendmail_path)$(ln_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(sendmail_path)" "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
+  echo "Warning: $${IPKG_INSTROOT}$(sendmail_path) saved as $${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
+ fi
+ if [ ! -f "$${IPKG_INSTROOT}$(sendmail_path)" ]; then
+  ln -s "$${IPKG_INSTROOT}$(sendmail_path)$(ln_suffix)" "$(sendmail_path)"
+ fi
+
+ if [ -f "$${IPKG_INSTROOT}$(newaliases_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(newaliases_path)")" != "$(newaliases_path)$(ln_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(newaliases_path)" "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
+  echo "Warning: $${IPKG_INSTROOT}$(newaliases_path) saved as $${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
+ fi
+ if [ ! -f "$${IPKG_INSTROOT}$(newaliases_path)" ]; then
+  ln -s "$${IPKG_INSTROOT}$(newaliases_path)$(ln_suffix)" "$(newaliases_path)"
+ fi
+
+ if [ -f "$${IPKG_INSTROOT}$(mailq_path)" -a "$$(readlink "$${IPKG_INSTROOT}$(mailq_path)")" != "$(mailq_path)$(ln_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(mailq_path)" "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
+  echo "Warning: $${IPKG_INSTROOT}$(mailq_path) saved as $${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
+ fi
+ if [ ! -f "$(mailq_path)" ]; then
+  ln -s "$${IPKG_INSTROOT}$(mailq_path)$(ln_suffix)" "$(mailq_path)"
+ fi
+
+ grep -qc main\.cf "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/main.cf" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
+ grep -qc master\.cf "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/master.cf" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
+ grep -qc aliases "$${IPKG_INSTROOT}"/etc/sysupgrade.conf >/dev/null || echo "$(config_directory)/aliases" >> "$${IPKG_INSTROOT}"/etc/sysupgrade.conf
+
+ touch "$${IPKG_INSTROOT}$(config_directory)"/opkg_postinst
+
+ if [ -z "$${IPKG_INSTROOT}" ]; then
+  ps | grep "postfix/master" | grep -cvq grep >/dev/null && /etc/init.d/postfix reload
+ fi
+
+endef
+
+define Package/postfix/prerm
+#!/bin/sh
+ ps | grep "postfix/master" | grep -cvq grep >/dev/null && postfix stop
+ /etc/init.d/postfix disable
+endef
+
+define Package/postfix/postrm
+#!/bin/sh
+ rm -f $${IPKG_INSTROOT}$(config_directory)/aliases.cdb $${IPKG_INSTROOT}$(config_directory)/aliases.db $${IPKG_INSTROOT}$(data_directory)/master.lock
+
+ rm -f "$${IPKG_INSTROOT}$(sendmail_path)" "$${IPKG_INSTROOT}$(newaliases_path)" "$${IPKG_INSTROOT}$(mailq_path)"
+
+ if [ -f "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(sendmail_path)"
+  echo "Warning: $${IPKG_INSTROOT}$(sendmail_path) restored from $${IPKG_INSTROOT}$(sendmail_path)$(ln_old_suffix)"
+ fi
+ if [ -f "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(newaliases_path)"
+  echo "Warning: $${IPKG_INSTROOT}$(newaliases_path) restored from $${IPKG_INSTROOT}$(newaliases_path)$(ln_old_suffix)"
+ fi
+ if [ -f "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)" ]; then
+  mv "$${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)" "$${IPKG_INSTROOT}$(mailq_path)"
+  echo "Warning: $${IPKG_INSTROOT}$(mailq_path) restored from $${IPKG_INSTROOT}$(mailq_path)$(ln_old_suffix)"
+ fi
+endef
+
+$(eval $(call BuildPackage,postfix))
diff --git a/trunk/package/mail/postfix/files/main.cf.default b/trunk/package/mail/postfix/files/main.cf.default
new file mode 100644 (file)
index 0000000..d9eec99
--- /dev/null
@@ -0,0 +1,840 @@
+# DO NOT EDIT THIS FILE. EDIT THE MAIN.CF FILE INSTEAD. THE
+# TEXT HERE JUST SHOWS DEFAULT SETTINGS BUILT INTO POSTFIX.
+#
+2bounce_notice_recipient = postmaster
+access_map_defer_code = 450
+access_map_reject_code = 554
+address_verify_cache_cleanup_interval = 12h
+address_verify_default_transport = $default_transport
+address_verify_local_transport = $local_transport
+address_verify_map = btree:$data_directory/verify_cache
+address_verify_negative_cache = yes
+address_verify_negative_expire_time = 3d
+address_verify_negative_refresh_time = 3h
+address_verify_poll_count = ${stress?{1}:{3}}
+address_verify_poll_delay = 3s
+address_verify_positive_expire_time = 31d
+address_verify_positive_refresh_time = 7d
+address_verify_relay_transport = $relay_transport
+address_verify_relayhost = $relayhost
+address_verify_sender = $double_bounce_sender
+address_verify_sender_dependent_default_transport_maps = $sender_dependent_default_transport_maps
+address_verify_sender_dependent_relayhost_maps = $sender_dependent_relayhost_maps
+address_verify_sender_ttl = 0s
+address_verify_service_name = verify
+address_verify_transport_maps = $transport_maps
+address_verify_virtual_transport = $virtual_transport
+allow_mail_to_commands = alias, forward
+allow_mail_to_files = alias, forward
+allow_min_user = no
+allow_percent_hack = yes
+allow_untrusted_routing = no
+alternate_config_directories =
+always_add_missing_headers = no
+always_bcc =
+anvil_rate_time_unit = 60s
+anvil_status_update_time = 600s
+append_at_myorigin = yes
+append_dot_mydomain = ${{$compatibility_level} < {1} ? {yes} : {no}}
+application_event_drain_time = 100s
+authorized_flush_users = static:anyone
+authorized_mailq_users = static:anyone
+authorized_submit_users = static:anyone
+backwards_bounce_logfile_compatibility = yes
+berkeley_db_create_buffer_size = 16777216
+berkeley_db_read_buffer_size = 131072
+best_mx_transport =
+biff = yes
+body_checks =
+body_checks_size_limit = 51200
+bounce_notice_recipient = postmaster
+bounce_queue_lifetime = 5d
+bounce_service_name = bounce
+bounce_size_limit = 50000
+bounce_template_file =
+broken_sasl_auth_clients = no
+canonical_classes = envelope_sender, envelope_recipient, header_sender, header_recipient
+canonical_maps =
+cleanup_service_name = cleanup
+command_execution_directory =
+command_expansion_filter = 1234567890!@%-_=+:,./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+command_time_limit = 1000s
+compatibility_level = 0
+confirm_delay_cleared = no
+connection_cache_protocol_timeout = 5s
+connection_cache_service_name = scache
+connection_cache_status_update_time = 600s
+connection_cache_ttl_limit = 2s
+content_filter =
+cyrus_sasl_config_path =
+daemon_table_open_error_is_fatal = no
+daemon_timeout = 18000s
+debug_peer_level = 2
+debug_peer_list =
+debugger_command =
+default_delivery_slot_cost = 5
+default_delivery_slot_discount = 50
+default_delivery_slot_loan = 3
+default_delivery_status_filter =
+default_destination_concurrency_failed_cohort_limit = 1
+default_destination_concurrency_limit = 20
+default_destination_concurrency_negative_feedback = 1
+default_destination_concurrency_positive_feedback = 1
+default_destination_rate_delay = 0s
+default_destination_recipient_limit = 50
+default_extra_recipient_limit = 1000
+default_filter_nexthop =
+default_minimum_delivery_slots = 3
+default_privs = nobody
+default_process_limit = 100
+default_rbl_reply = $rbl_code Service unavailable; $rbl_class [$rbl_what] blocked using $rbl_domain${rbl_reason?; $rbl_reason}
+default_recipient_limit = 20000
+default_recipient_refill_delay = 5s
+default_recipient_refill_limit = 100
+default_transport = smtp
+default_verp_delimiters = +=
+defer_code = 450
+defer_service_name = defer
+defer_transports =
+delay_logging_resolution_limit = 2
+delay_notice_recipient = postmaster
+delay_warning_time = 0h
+deliver_lock_attempts = 20
+deliver_lock_delay = 1s
+destination_concurrency_feedback_debug = no
+detect_8bit_encoding_header = yes
+disable_dns_lookups = no
+disable_mime_input_processing = no
+disable_mime_output_conversion = no
+disable_verp_bounces = no
+disable_vrfy_command = no
+dnsblog_reply_delay = 0s
+dnsblog_service_name = dnsblog
+dont_remove = 0
+double_bounce_sender = double-bounce
+duplicate_filter_limit = 1000
+empty_address_default_transport_maps_lookup_key = <>
+empty_address_recipient = MAILER-DAEMON
+empty_address_relayhost_maps_lookup_key = <>
+enable_long_queue_ids = no
+enable_original_recipient = yes
+error_delivery_slot_cost = $default_delivery_slot_cost
+error_delivery_slot_discount = $default_delivery_slot_discount
+error_delivery_slot_loan = $default_delivery_slot_loan
+error_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+error_destination_concurrency_limit = $default_destination_concurrency_limit
+error_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+error_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+error_destination_rate_delay = $default_destination_rate_delay
+error_destination_recipient_limit = $default_destination_recipient_limit
+error_extra_recipient_limit = $default_extra_recipient_limit
+error_initial_destination_concurrency = $initial_destination_concurrency
+error_minimum_delivery_slots = $default_minimum_delivery_slots
+error_notice_recipient = postmaster
+error_recipient_limit = $default_recipient_limit
+error_recipient_refill_delay = $default_recipient_refill_delay
+error_recipient_refill_limit = $default_recipient_refill_limit
+error_service_name = error
+execution_directory_expansion_filter = 1234567890!@%-_=+:,./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+expand_owner_alias = no
+export_environment = TZ MAIL_CONFIG LANG
+fallback_transport =
+fallback_transport_maps =
+fast_flush_domains = $relay_domains
+fast_flush_purge_time = 7d
+fast_flush_refresh_time = 12h
+fault_injection_code = 0
+flush_service_name = flush
+fork_attempts = 5
+fork_delay = 1s
+forward_expansion_filter = 1234567890!@%-_=+:,./abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ
+forward_path = $home/.forward${recipient_delimiter}${extension}, $home/.forward
+frozen_delivered_to = yes
+hash_queue_depth = 1
+hash_queue_names = deferred, defer
+header_address_token_limit = 10240
+header_checks =
+header_size_limit = 102400
+helpful_warnings = yes
+home_mailbox =
+hopcount_limit = 50
+ignore_mx_lookup_error = no
+import_environment = MAIL_CONFIG MAIL_DEBUG MAIL_LOGTAG TZ XAUTHORITY DISPLAY LANG=C
+in_flow_delay = 1s
+inet_interfaces = all
+inet_protocols = all
+initial_destination_concurrency = 5
+internal_mail_filter_classes =
+invalid_hostname_reject_code = 501
+ipc_idle = 5s
+ipc_timeout = 3600s
+ipc_ttl = 1000s
+line_length_limit = 2048
+lmdb_map_size = 16777216
+lmtp_address_preference = any
+lmtp_address_verify_target = rcpt
+lmtp_assume_final = no
+lmtp_bind_address =
+lmtp_bind_address6 =
+lmtp_body_checks =
+lmtp_cname_overrides_servername = no
+lmtp_connect_timeout = 0s
+lmtp_connection_cache_destinations =
+lmtp_connection_cache_on_demand = yes
+lmtp_connection_cache_time_limit = 2s
+lmtp_connection_reuse_count_limit = 0
+lmtp_connection_reuse_time_limit = 300s
+lmtp_data_done_timeout = 600s
+lmtp_data_init_timeout = 120s
+lmtp_data_xfer_timeout = 180s
+lmtp_defer_if_no_mx_address_found = no
+lmtp_delivery_slot_cost = $default_delivery_slot_cost
+lmtp_delivery_slot_discount = $default_delivery_slot_discount
+lmtp_delivery_slot_loan = $default_delivery_slot_loan
+lmtp_delivery_status_filter = $default_delivery_status_filter
+lmtp_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+lmtp_destination_concurrency_limit = $default_destination_concurrency_limit
+lmtp_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+lmtp_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+lmtp_destination_rate_delay = $default_destination_rate_delay
+lmtp_destination_recipient_limit = $default_destination_recipient_limit
+lmtp_discard_lhlo_keyword_address_maps =
+lmtp_discard_lhlo_keywords =
+lmtp_dns_reply_filter =
+lmtp_dns_resolver_options =
+lmtp_dns_support_level =
+lmtp_enforce_tls = no
+lmtp_extra_recipient_limit = $default_extra_recipient_limit
+lmtp_generic_maps =
+lmtp_header_checks =
+lmtp_host_lookup = dns
+lmtp_initial_destination_concurrency = $initial_destination_concurrency
+lmtp_lhlo_name = $myhostname
+lmtp_lhlo_timeout = 300s
+lmtp_line_length_limit = 998
+lmtp_mail_timeout = 300s
+lmtp_mime_header_checks =
+lmtp_minimum_delivery_slots = $default_minimum_delivery_slots
+lmtp_mx_address_limit = 5
+lmtp_mx_session_limit = 2
+lmtp_nested_header_checks =
+lmtp_per_record_deadline = no
+lmtp_pix_workaround_delay_time = 10s
+lmtp_pix_workaround_maps =
+lmtp_pix_workaround_threshold_time = 500s
+lmtp_pix_workarounds = disable_esmtp,delay_dotcrlf
+lmtp_quit_timeout = 300s
+lmtp_quote_rfc821_envelope = yes
+lmtp_randomize_addresses = yes
+lmtp_rcpt_timeout = 300s
+lmtp_recipient_limit = $default_recipient_limit
+lmtp_recipient_refill_delay = $default_recipient_refill_delay
+lmtp_recipient_refill_limit = $default_recipient_refill_limit
+lmtp_reply_filter =
+lmtp_rset_timeout = 20s
+lmtp_sasl_auth_cache_name =
+lmtp_sasl_auth_cache_time = 90d
+lmtp_sasl_auth_enable = no
+lmtp_sasl_auth_soft_bounce = yes
+lmtp_sasl_mechanism_filter =
+lmtp_sasl_password_maps =
+lmtp_sasl_path =
+lmtp_sasl_security_options = noplaintext, noanonymous
+lmtp_sasl_tls_security_options = $lmtp_sasl_security_options
+lmtp_sasl_tls_verified_security_options = $lmtp_sasl_tls_security_options
+lmtp_sasl_type = cyrus
+lmtp_send_dummy_mail_auth = no
+lmtp_send_xforward_command = no
+lmtp_sender_dependent_authentication = no
+lmtp_skip_5xx_greeting = yes
+lmtp_skip_quit_response = no
+lmtp_starttls_timeout = 300s
+lmtp_tcp_port = 24
+lmtp_tls_CAfile =
+lmtp_tls_CApath =
+lmtp_tls_block_early_mail_reply = no
+lmtp_tls_cert_file =
+lmtp_tls_ciphers = export
+lmtp_tls_dcert_file =
+lmtp_tls_dkey_file = $lmtp_tls_dcert_file
+lmtp_tls_eccert_file =
+lmtp_tls_eckey_file = $lmtp_tls_eccert_file
+lmtp_tls_enforce_peername = yes
+lmtp_tls_exclude_ciphers =
+lmtp_tls_fingerprint_cert_match =
+lmtp_tls_fingerprint_digest = md5
+lmtp_tls_force_insecure_host_tlsa_lookup = no
+lmtp_tls_key_file = $lmtp_tls_cert_file
+lmtp_tls_loglevel = 0
+lmtp_tls_mandatory_ciphers = medium
+lmtp_tls_mandatory_exclude_ciphers =
+lmtp_tls_mandatory_protocols = !SSLv2
+lmtp_tls_note_starttls_offer = no
+lmtp_tls_per_site =
+lmtp_tls_policy_maps =
+lmtp_tls_protocols = !SSLv2
+lmtp_tls_scert_verifydepth = 9
+lmtp_tls_secure_cert_match = nexthop
+lmtp_tls_security_level =
+lmtp_tls_session_cache_database =
+lmtp_tls_session_cache_timeout = 3600s
+lmtp_tls_trust_anchor_file =
+lmtp_tls_verify_cert_match = hostname
+lmtp_tls_wrappermode = no
+lmtp_use_tls = no
+lmtp_xforward_timeout = 300s
+local_command_shell =
+local_delivery_slot_cost = $default_delivery_slot_cost
+local_delivery_slot_discount = $default_delivery_slot_discount
+local_delivery_slot_loan = $default_delivery_slot_loan
+local_delivery_status_filter = $default_delivery_status_filter
+local_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+local_destination_concurrency_limit = 2
+local_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+local_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+local_destination_rate_delay = $default_destination_rate_delay
+local_destination_recipient_limit = 1
+local_extra_recipient_limit = $default_extra_recipient_limit
+local_header_rewrite_clients = permit_inet_interfaces
+local_initial_destination_concurrency = $initial_destination_concurrency
+local_minimum_delivery_slots = $default_minimum_delivery_slots
+local_recipient_limit = $default_recipient_limit
+local_recipient_maps = proxy:unix:passwd.byname $alias_maps
+local_recipient_refill_delay = $default_recipient_refill_delay
+local_recipient_refill_limit = $default_recipient_refill_limit
+local_transport = local:$myhostname
+luser_relay =
+mail_name = Postfix
+mail_owner = postfix
+mail_release_date = 20150208
+mail_version = 3.0.0
+mailbox_command =
+mailbox_command_maps =
+mailbox_delivery_lock = fcntl, dotlock
+mailbox_size_limit = 51200000
+mailbox_transport =
+mailbox_transport_maps =
+maps_rbl_domains =
+maps_rbl_reject_code = 554
+masquerade_classes = envelope_sender, header_sender, header_recipient
+masquerade_domains =
+masquerade_exceptions =
+master_service_disable =
+max_idle = 100s
+max_use = 100
+maximal_backoff_time = 4000s
+maximal_queue_lifetime = 5d
+message_drop_headers = bcc, content-length, resent-bcc, return-path
+message_reject_characters =
+message_size_limit = 10240000
+message_strip_characters =
+milter_command_timeout = 30s
+milter_connect_macros = j {daemon_name} v
+milter_connect_timeout = 30s
+milter_content_timeout = 300s
+milter_data_macros = i
+milter_default_action = tempfail
+milter_end_of_data_macros = i
+milter_end_of_header_macros = i
+milter_header_checks =
+milter_helo_macros = {tls_version} {cipher} {cipher_bits} {cert_subject} {cert_issuer}
+milter_macro_daemon_name = $myhostname
+milter_macro_v = $mail_name $mail_version
+milter_mail_macros = i {auth_type} {auth_authen} {auth_author} {mail_addr} {mail_host} {mail_mailer}
+milter_protocol = 6
+milter_rcpt_macros = i {rcpt_addr} {rcpt_host} {rcpt_mailer}
+milter_unknown_command_macros =
+mime_boundary_length_limit = 2048
+mime_header_checks = $header_checks
+mime_nesting_limit = 100
+minimal_backoff_time = 300s
+multi_instance_directories =
+multi_instance_enable = no
+multi_instance_group =
+multi_instance_name =
+multi_instance_wrapper =
+multi_recipient_bounce_reject_code = 550
+mydestination = $myhostname, localhost.$mydomain, localhost
+myorigin = $myhostname
+nested_header_checks = $header_checks
+non_fqdn_reject_code = 504
+non_smtpd_milters =
+notify_classes = resource, software
+owner_request_special = yes
+parent_domain_matches_subdomains = debug_peer_list,fast_flush_domains,mynetworks,permit_mx_backup_networks,qmqpd_authorized_clients,relay_domains,smtpd_access_maps
+permit_mx_backup_networks =
+pickup_service_name = pickup
+pipe_delivery_status_filter = $default_delivery_status_filter
+plaintext_reject_code = 450
+postmulti_control_commands = reload flush
+postmulti_start_commands = start
+postmulti_stop_commands = stop abort drain quick-stop
+postscreen_access_list = permit_mynetworks
+postscreen_bare_newline_action = ignore
+postscreen_bare_newline_enable = no
+postscreen_bare_newline_ttl = 30d
+postscreen_blacklist_action = ignore
+postscreen_cache_cleanup_interval = 12h
+postscreen_cache_map = btree:$data_directory/postscreen_cache
+postscreen_cache_retention_time = 7d
+postscreen_client_connection_count_limit = $smtpd_client_connection_count_limit
+postscreen_command_count_limit = 20
+postscreen_command_filter =
+postscreen_command_time_limit = ${stress?{10}:{300}}s
+postscreen_disable_vrfy_command = $disable_vrfy_command
+postscreen_discard_ehlo_keyword_address_maps = $smtpd_discard_ehlo_keyword_address_maps
+postscreen_discard_ehlo_keywords = $smtpd_discard_ehlo_keywords
+postscreen_dnsbl_action = ignore
+postscreen_dnsbl_reply_map =
+postscreen_dnsbl_sites =
+postscreen_dnsbl_threshold = 1
+postscreen_dnsbl_timeout = 10s
+postscreen_dnsbl_ttl = 1h
+postscreen_dnsbl_whitelist_threshold = 0
+postscreen_enforce_tls = $smtpd_enforce_tls
+postscreen_expansion_filter = $smtpd_expansion_filter
+postscreen_forbidden_commands = $smtpd_forbidden_commands
+postscreen_greet_action = ignore
+postscreen_greet_banner = $smtpd_banner
+postscreen_greet_ttl = 1d
+postscreen_greet_wait = ${stress?{2}:{6}}s
+postscreen_helo_required = $smtpd_helo_required
+postscreen_non_smtp_command_action = drop
+postscreen_non_smtp_command_enable = no
+postscreen_non_smtp_command_ttl = 30d
+postscreen_pipelining_action = enforce
+postscreen_pipelining_enable = no
+postscreen_pipelining_ttl = 30d
+postscreen_post_queue_limit = $default_process_limit
+postscreen_pre_queue_limit = $default_process_limit
+postscreen_reject_footer = $smtpd_reject_footer
+postscreen_tls_security_level = $smtpd_tls_security_level
+postscreen_upstream_proxy_protocol =
+postscreen_upstream_proxy_timeout = 5s
+postscreen_use_tls = $smtpd_use_tls
+postscreen_watchdog_timeout = 10s
+postscreen_whitelist_interfaces = static:all
+prepend_delivered_header = command, file, forward
+process_id = 25939
+process_id_directory = pid
+process_name = postconf
+propagate_unmatched_extensions = canonical, virtual
+proxy_interfaces =
+proxy_read_maps = $local_recipient_maps $mydestination $virtual_alias_maps $virtual_alias_domains $virtual_mailbox_maps $virtual_mailbox_domains $relay_recipient_maps $relay_domains $canonical_maps $sender_canonical_maps $recipient_canonical_maps $relocated_maps $transport_maps $mynetworks $smtpd_sender_login_maps $sender_bcc_maps $recipient_bcc_maps $smtp_generic_maps $lmtp_generic_maps $alias_maps $smtpd_client_restrictions $smtpd_helo_restrictions $smtpd_sender_restrictions $smtpd_relay_restrictions $smtpd_recipient_restrictions
+proxy_write_maps = $smtp_sasl_auth_cache_name $lmtp_sasl_auth_cache_name $address_verify_map $postscreen_cache_map
+proxymap_service_name = proxymap
+proxywrite_service_name = proxywrite
+qmgr_clog_warn_time = 300s
+qmgr_daemon_timeout = 1000s
+qmgr_fudge_factor = 100
+qmgr_ipc_timeout = 60s
+qmgr_message_active_limit = 20000
+qmgr_message_recipient_limit = 20000
+qmgr_message_recipient_minimum = 10
+qmqpd_authorized_clients =
+qmqpd_client_port_logging = no
+qmqpd_error_delay = 1s
+qmqpd_timeout = 300s
+queue_file_attribute_count_limit = 100
+queue_minfree = 0
+queue_run_delay = 300s
+queue_service_name = qmgr
+rbl_reply_maps =
+receive_override_options =
+recipient_bcc_maps =
+recipient_canonical_classes = envelope_recipient, header_recipient
+recipient_canonical_maps =
+recipient_delimiter =
+reject_code = 554
+reject_tempfail_action = defer_if_permit
+relay_clientcerts =
+relay_delivery_slot_cost = $default_delivery_slot_cost
+relay_delivery_slot_discount = $default_delivery_slot_discount
+relay_delivery_slot_loan = $default_delivery_slot_loan
+relay_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+relay_destination_concurrency_limit = $default_destination_concurrency_limit
+relay_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+relay_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+relay_destination_rate_delay = $default_destination_rate_delay
+relay_destination_recipient_limit = $default_destination_recipient_limit
+relay_domains = ${{$compatibility_level} < {2} ? {$mydestination} : {}}
+relay_domains_reject_code = 554
+relay_extra_recipient_limit = $default_extra_recipient_limit
+relay_initial_destination_concurrency = $initial_destination_concurrency
+relay_minimum_delivery_slots = $default_minimum_delivery_slots
+relay_recipient_limit = $default_recipient_limit
+relay_recipient_maps =
+relay_recipient_refill_delay = $default_recipient_refill_delay
+relay_recipient_refill_limit = $default_recipient_refill_limit
+relay_transport = relay
+relayhost =
+relocated_maps =
+remote_header_rewrite_domain =
+require_home_directory = no
+reset_owner_alias = no
+resolve_dequoted_address = yes
+resolve_null_domain = no
+resolve_numeric_domain = no
+retry_delivery_slot_cost = $default_delivery_slot_cost
+retry_delivery_slot_discount = $default_delivery_slot_discount
+retry_delivery_slot_loan = $default_delivery_slot_loan
+retry_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+retry_destination_concurrency_limit = $default_destination_concurrency_limit
+retry_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+retry_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+retry_destination_rate_delay = $default_destination_rate_delay
+retry_destination_recipient_limit = $default_destination_recipient_limit
+retry_extra_recipient_limit = $default_extra_recipient_limit
+retry_initial_destination_concurrency = $initial_destination_concurrency
+retry_minimum_delivery_slots = $default_minimum_delivery_slots
+retry_recipient_limit = $default_recipient_limit
+retry_recipient_refill_delay = $default_recipient_refill_delay
+retry_recipient_refill_limit = $default_recipient_refill_limit
+rewrite_service_name = rewrite
+send_cyrus_sasl_authzid = no
+sender_bcc_maps =
+sender_canonical_classes = envelope_sender, header_sender
+sender_canonical_maps =
+sender_dependent_default_transport_maps =
+sender_dependent_relayhost_maps =
+sendmail_fix_line_endings = always
+service_throttle_time = 60s
+setgid_group = postdrop
+show_user_unknown_table_name = yes
+showq_service_name = showq
+smtp_address_preference = any
+smtp_address_verify_target = rcpt
+smtp_always_send_ehlo = yes
+smtp_bind_address =
+smtp_bind_address6 =
+smtp_body_checks =
+smtp_cname_overrides_servername = no
+smtp_connect_timeout = 30s
+smtp_connection_cache_destinations =
+smtp_connection_cache_on_demand = yes
+smtp_connection_cache_time_limit = 2s
+smtp_connection_reuse_count_limit = 0
+smtp_connection_reuse_time_limit = 300s
+smtp_data_done_timeout = 600s
+smtp_data_init_timeout = 120s
+smtp_data_xfer_timeout = 180s
+smtp_defer_if_no_mx_address_found = no
+smtp_delivery_slot_cost = $default_delivery_slot_cost
+smtp_delivery_slot_discount = $default_delivery_slot_discount
+smtp_delivery_slot_loan = $default_delivery_slot_loan
+smtp_delivery_status_filter = $default_delivery_status_filter
+smtp_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+smtp_destination_concurrency_limit = $default_destination_concurrency_limit
+smtp_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+smtp_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+smtp_destination_rate_delay = $default_destination_rate_delay
+smtp_destination_recipient_limit = $default_destination_recipient_limit
+smtp_discard_ehlo_keyword_address_maps =
+smtp_discard_ehlo_keywords =
+smtp_dns_reply_filter =
+smtp_dns_resolver_options =
+smtp_dns_support_level =
+smtp_enforce_tls = no
+smtp_extra_recipient_limit = $default_extra_recipient_limit
+smtp_fallback_relay = $fallback_relay
+smtp_generic_maps =
+smtp_header_checks =
+smtp_helo_name = $myhostname
+smtp_helo_timeout = 300s
+smtp_host_lookup = dns
+smtp_initial_destination_concurrency = $initial_destination_concurrency
+smtp_line_length_limit = 998
+smtp_mail_timeout = 300s
+smtp_mime_header_checks =
+smtp_minimum_delivery_slots = $default_minimum_delivery_slots
+smtp_mx_address_limit = 5
+smtp_mx_session_limit = 2
+smtp_nested_header_checks =
+smtp_never_send_ehlo = no
+smtp_per_record_deadline = no
+smtp_pix_workaround_delay_time = 10s
+smtp_pix_workaround_maps =
+smtp_pix_workaround_threshold_time = 500s
+smtp_pix_workarounds = disable_esmtp,delay_dotcrlf
+smtp_quit_timeout = 300s
+smtp_quote_rfc821_envelope = yes
+smtp_randomize_addresses = yes
+smtp_rcpt_timeout = 300s
+smtp_recipient_limit = $default_recipient_limit
+smtp_recipient_refill_delay = $default_recipient_refill_delay
+smtp_recipient_refill_limit = $default_recipient_refill_limit
+smtp_reply_filter =
+smtp_rset_timeout = 20s
+smtp_sasl_auth_cache_name =
+smtp_sasl_auth_cache_time = 90d
+smtp_sasl_auth_enable = no
+smtp_sasl_auth_soft_bounce = yes
+smtp_sasl_mechanism_filter =
+smtp_sasl_password_maps =
+smtp_sasl_path =
+smtp_sasl_security_options = noplaintext, noanonymous
+smtp_sasl_tls_security_options = $smtp_sasl_security_options
+smtp_sasl_tls_verified_security_options = $smtp_sasl_tls_security_options
+smtp_sasl_type = cyrus
+smtp_send_dummy_mail_auth = no
+smtp_send_xforward_command = no
+smtp_sender_dependent_authentication = no
+smtp_skip_5xx_greeting = yes
+smtp_skip_quit_response = yes
+smtp_starttls_timeout = 300s
+smtp_tls_CAfile =
+smtp_tls_CApath =
+smtp_tls_block_early_mail_reply = no
+smtp_tls_cert_file =
+smtp_tls_ciphers = export
+smtp_tls_dcert_file =
+smtp_tls_dkey_file = $smtp_tls_dcert_file
+smtp_tls_eccert_file =
+smtp_tls_eckey_file = $smtp_tls_eccert_file
+smtp_tls_enforce_peername = yes
+smtp_tls_exclude_ciphers =
+smtp_tls_fingerprint_cert_match =
+smtp_tls_fingerprint_digest = md5
+smtp_tls_force_insecure_host_tlsa_lookup = no
+smtp_tls_key_file = $smtp_tls_cert_file
+smtp_tls_loglevel = 0
+smtp_tls_mandatory_ciphers = medium
+smtp_tls_mandatory_exclude_ciphers =
+smtp_tls_mandatory_protocols = !SSLv2
+smtp_tls_note_starttls_offer = no
+smtp_tls_per_site =
+smtp_tls_policy_maps =
+smtp_tls_protocols = !SSLv2
+smtp_tls_scert_verifydepth = 9
+smtp_tls_secure_cert_match = nexthop, dot-nexthop
+smtp_tls_security_level =
+smtp_tls_session_cache_database =
+smtp_tls_session_cache_timeout = 3600s
+smtp_tls_trust_anchor_file =
+smtp_tls_verify_cert_match = hostname
+smtp_tls_wrappermode = no
+smtp_use_tls = no
+smtp_xforward_timeout = 300s
+smtpd_authorized_verp_clients = $authorized_verp_clients
+smtpd_authorized_xclient_hosts =
+smtpd_authorized_xforward_hosts =
+smtpd_banner = $myhostname ESMTP $mail_name
+smtpd_client_connection_count_limit = 50
+smtpd_client_connection_rate_limit = 0
+smtpd_client_event_limit_exceptions = ${smtpd_client_connection_limit_exceptions:$mynetworks}
+smtpd_client_message_rate_limit = 0
+smtpd_client_new_tls_session_rate_limit = 0
+smtpd_client_port_logging = no
+smtpd_client_recipient_rate_limit = 0
+smtpd_client_restrictions =
+smtpd_command_filter =
+smtpd_data_restrictions =
+smtpd_delay_open_until_valid_rcpt = yes
+smtpd_delay_reject = yes
+smtpd_discard_ehlo_keyword_address_maps =
+smtpd_discard_ehlo_keywords =
+smtpd_dns_reply_filter =
+smtpd_end_of_data_restrictions =
+smtpd_enforce_tls = no
+smtpd_error_sleep_time = 1s
+smtpd_etrn_restrictions =
+smtpd_expansion_filter = \t\40!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
+smtpd_forbidden_commands = CONNECT GET POST
+smtpd_hard_error_limit = ${stress?{1}:{20}}
+smtpd_helo_required = no
+smtpd_helo_restrictions =
+smtpd_history_flush_threshold = 100
+smtpd_junk_command_limit = ${stress?{1}:{100}}
+smtpd_log_access_permit_actions =
+smtpd_milters =
+smtpd_noop_commands =
+smtpd_null_access_lookup_key = <>
+smtpd_peername_lookup = yes
+smtpd_per_record_deadline = ${stress?{yes}:{no}}
+smtpd_policy_service_default_action = 451 4.3.5 Server configuration problem
+smtpd_policy_service_max_idle = 300s
+smtpd_policy_service_max_ttl = 1000s
+smtpd_policy_service_request_limit = 0
+smtpd_policy_service_retry_delay = 1s
+smtpd_policy_service_timeout = 100s
+smtpd_policy_service_try_limit = 2
+smtpd_proxy_ehlo = $myhostname
+smtpd_proxy_filter =
+smtpd_proxy_options =
+smtpd_proxy_timeout = 100s
+smtpd_recipient_limit = 1000
+smtpd_recipient_overshoot_limit = 1000
+smtpd_recipient_restrictions =
+smtpd_reject_footer =
+smtpd_reject_unlisted_recipient = yes
+smtpd_reject_unlisted_sender = no
+smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, defer_unauth_destination
+smtpd_restriction_classes =
+smtpd_sasl_auth_enable = no
+smtpd_sasl_authenticated_header = no
+smtpd_sasl_exceptions_networks =
+smtpd_sasl_local_domain =
+smtpd_sasl_path = smtpd
+smtpd_sasl_security_options = noanonymous
+smtpd_sasl_service = smtp
+smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
+smtpd_sasl_type = cyrus
+smtpd_sender_login_maps =
+smtpd_sender_restrictions =
+smtpd_service_name = smtpd
+smtpd_soft_error_limit = 10
+smtpd_starttls_timeout = ${stress?{10}:{300}}s
+smtpd_timeout = ${stress?{10}:{300}}s
+smtpd_tls_CAfile =
+smtpd_tls_CApath =
+smtpd_tls_always_issue_session_ids = yes
+smtpd_tls_ask_ccert = no
+smtpd_tls_auth_only = no
+smtpd_tls_ccert_verifydepth = 9
+smtpd_tls_cert_file =
+smtpd_tls_ciphers = export
+smtpd_tls_dcert_file =
+smtpd_tls_dh1024_param_file =
+smtpd_tls_dh512_param_file =
+smtpd_tls_dkey_file = $smtpd_tls_dcert_file
+smtpd_tls_eccert_file =
+smtpd_tls_eckey_file = $smtpd_tls_eccert_file
+smtpd_tls_eecdh_grade = strong
+smtpd_tls_exclude_ciphers =
+smtpd_tls_fingerprint_digest = md5
+smtpd_tls_key_file = $smtpd_tls_cert_file
+smtpd_tls_loglevel = 0
+smtpd_tls_mandatory_ciphers = medium
+smtpd_tls_mandatory_exclude_ciphers =
+smtpd_tls_mandatory_protocols = !SSLv2
+smtpd_tls_protocols =
+smtpd_tls_received_header = no
+smtpd_tls_req_ccert = no
+smtpd_tls_security_level =
+smtpd_tls_session_cache_database =
+smtpd_tls_session_cache_timeout = 3600s
+smtpd_tls_wrappermode = no
+smtpd_upstream_proxy_protocol =
+smtpd_upstream_proxy_timeout = 5s
+smtpd_use_tls = no
+smtputf8_autodetect_classes = sendmail, verify
+soft_bounce = no
+stale_lock_time = 500s
+stress =
+strict_7bit_headers = no
+strict_8bitmime = no
+strict_8bitmime_body = no
+strict_mailbox_ownership = yes
+strict_mime_encoding_domain = no
+strict_rfc821_envelopes = no
+strict_smtputf8 = no
+sun_mailtool_compatibility = no
+swap_bangpath = yes
+syslog_facility = mail
+syslog_name = ${multi_instance_name?{$multi_instance_name}:{postfix}}
+tcp_windowsize = 0
+tls_append_default_CA = no
+tls_daemon_random_bytes = 32
+tls_dane_digest_agility = on
+tls_dane_digests = sha512 sha256
+tls_dane_trust_anchor_digest_enable = yes
+tls_disable_workarounds =
+tls_eecdh_strong_curve = prime256v1
+tls_eecdh_ultra_curve = secp384r1
+tls_export_cipherlist = aNULL:-aNULL:ALL:+RC4:@STRENGTH
+tls_high_cipherlist = aNULL:-aNULL:ALL:!EXPORT:!LOW:!MEDIUM:+RC4:@STRENGTH
+tls_legacy_public_key_fingerprints = no
+tls_low_cipherlist = aNULL:-aNULL:ALL:!EXPORT:+RC4:@STRENGTH
+tls_medium_cipherlist = aNULL:-aNULL:ALL:!EXPORT:!LOW:+RC4:@STRENGTH
+tls_null_cipherlist = eNULL:!aNULL
+tls_preempt_cipherlist = no
+tls_random_bytes = 32
+tls_random_exchange_name = ${data_directory}/prng_exch
+tls_random_prng_update_period = 3600s
+tls_random_reseed_period = 3600s
+tls_random_source = dev:/dev/urandom
+tls_session_ticket_cipher = aes-128-cbc
+tls_ssl_options =
+tls_wildcard_matches_multiple_labels = yes
+tlsmgr_service_name = tlsmgr
+tlsproxy_enforce_tls = $smtpd_enforce_tls
+tlsproxy_service_name = tlsproxy
+tlsproxy_tls_CAfile = $smtpd_tls_CAfile
+tlsproxy_tls_CApath = $smtpd_tls_CApath
+tlsproxy_tls_always_issue_session_ids = $smtpd_tls_always_issue_session_ids
+tlsproxy_tls_ask_ccert = $smtpd_tls_ask_ccert
+tlsproxy_tls_ccert_verifydepth = $smtpd_tls_ccert_verifydepth
+tlsproxy_tls_cert_file = $smtpd_tls_cert_file
+tlsproxy_tls_ciphers = $smtpd_tls_ciphers
+tlsproxy_tls_dcert_file = $smtpd_tls_dcert_file
+tlsproxy_tls_dh1024_param_file = $smtpd_tls_dh1024_param_file
+tlsproxy_tls_dh512_param_file = $smtpd_tls_dh512_param_file
+tlsproxy_tls_dkey_file = $smtpd_tls_dkey_file
+tlsproxy_tls_eccert_file = $smtpd_tls_eccert_file
+tlsproxy_tls_eckey_file = $smtpd_tls_eckey_file
+tlsproxy_tls_eecdh_grade = $smtpd_tls_eecdh_grade
+tlsproxy_tls_exclude_ciphers = $smtpd_tls_exclude_ciphers
+tlsproxy_tls_fingerprint_digest = $smtpd_tls_fingerprint_digest
+tlsproxy_tls_key_file = $smtpd_tls_key_file
+tlsproxy_tls_loglevel = $smtpd_tls_loglevel
+tlsproxy_tls_mandatory_ciphers = $smtpd_tls_mandatory_ciphers
+tlsproxy_tls_mandatory_exclude_ciphers = $smtpd_tls_mandatory_exclude_ciphers
+tlsproxy_tls_mandatory_protocols = $smtpd_tls_mandatory_protocols
+tlsproxy_tls_protocols = $smtpd_tls_protocols
+tlsproxy_tls_req_ccert = $smtpd_tls_req_ccert
+tlsproxy_tls_security_level = $smtpd_tls_security_level
+tlsproxy_use_tls = $smtpd_use_tls
+tlsproxy_watchdog_timeout = 10s
+trace_service_name = trace
+transport_maps =
+transport_retry_time = 60s
+trigger_timeout = 10s
+undisclosed_recipients_header =
+unknown_address_reject_code = 450
+unknown_address_tempfail_action = $reject_tempfail_action
+unknown_client_reject_code = 450
+unknown_helo_hostname_tempfail_action = $reject_tempfail_action
+unknown_hostname_reject_code = 450
+unknown_local_recipient_reject_code = 550
+unknown_relay_recipient_reject_code = 550
+unknown_virtual_alias_reject_code = 550
+unknown_virtual_mailbox_reject_code = 550
+unverified_recipient_defer_code = 450
+unverified_recipient_reject_code = 450
+unverified_recipient_reject_reason =
+unverified_recipient_tempfail_action = $reject_tempfail_action
+unverified_sender_defer_code = 450
+unverified_sender_reject_code = 450
+unverified_sender_reject_reason =
+unverified_sender_tempfail_action = $reject_tempfail_action
+verp_delimiter_filter = -=+
+virtual_alias_address_length_limit = 1000
+virtual_alias_domains = $virtual_alias_maps
+virtual_alias_expansion_limit = 1000
+virtual_alias_maps = $virtual_maps
+virtual_alias_recursion_limit = 1000
+virtual_delivery_slot_cost = $default_delivery_slot_cost
+virtual_delivery_slot_discount = $default_delivery_slot_discount
+virtual_delivery_slot_loan = $default_delivery_slot_loan
+virtual_delivery_status_filter = $default_delivery_status_filter
+virtual_destination_concurrency_failed_cohort_limit = $default_destination_concurrency_failed_cohort_limit
+virtual_destination_concurrency_limit = $default_destination_concurrency_limit
+virtual_destination_concurrency_negative_feedback = $default_destination_concurrency_negative_feedback
+virtual_destination_concurrency_positive_feedback = $default_destination_concurrency_positive_feedback
+virtual_destination_rate_delay = $default_destination_rate_delay
+virtual_destination_recipient_limit = $default_destination_recipient_limit
+virtual_extra_recipient_limit = $default_extra_recipient_limit
+virtual_gid_maps =
+virtual_initial_destination_concurrency = $initial_destination_concurrency
+virtual_mailbox_base =
+virtual_mailbox_domains = $virtual_mailbox_maps
+virtual_mailbox_limit = 51200000
+virtual_mailbox_lock = fcntl, dotlock
+virtual_mailbox_maps =
+virtual_minimum_delivery_slots = $default_minimum_delivery_slots
+virtual_minimum_uid = 100
+virtual_recipient_limit = $default_recipient_limit
+virtual_recipient_refill_delay = $default_recipient_refill_delay
+virtual_recipient_refill_limit = $default_recipient_refill_limit
+virtual_transport = virtual
+virtual_uid_maps =
diff --git a/trunk/package/mail/postfix/files/postfix.init b/trunk/package/mail/postfix/files/postfix.init
new file mode 100644 (file)
index 0000000..1f3bc5e
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2014 OpenWrt.org
+
+START=50
+STOP=50
+
+upgrade() {
+       config_directory="$IPKG_INSTROOT"/etc/postfix
+
+       if [ -f "$config_directory"/opkg_postinst ]; then
+               rm -f "$config_directory"/opkg_postinst
+
+               group_exists postfix || group_add postfix 87
+               user_exists postfix || user_add postfix 87
+               group_exists postdrop || group_add postdrop 88
+
+               echo "myhostname = $(uci get system.@system[0].hostname)" >> "$config_directory"/main.cf.default
+               echo "mydomain = $(uci get system.@system[0].hostname|sed -e "s/[^\.]*\.\(.*\)/\1/")" >> "$config_directory"/main.cf.default
+               ifconfig | grep "inet addr" | sed -e "s/.*inet addr:\([0-9.]*\).*Mask:/\1 /" | while read IP NETMASK; do eval "$(ipcalc.sh $IP $NETMASK)"; echo "$NETWORK/$PREFIX"; done | xargs echo "mynetworks =" >> "$config_directory"/main.cf.default
+               echo "mynetworks_style = subnet" >> "$config_directory"/main.cf.default
+
+               grep -qc "^sendmail_path[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^sendmail_path =" "$config_directory"/main.cf.default)"
+               grep -qc "^newaliases_path[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^newaliases_path =" "$config_directory"/main.cf.default)"
+               grep -qc "^mailq_path[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mailq_path =" "$config_directory"/main.cf.default)"
+               grep -qc "^html_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^html_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^manpage_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^manpage_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^sample_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^sample_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^readme_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^readme_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^command_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^command_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^daemon_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^daemon_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^data_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^data_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^queue_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^queue_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^config_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^config_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^mail_spool_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mail_spool_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^mail_owner[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mail_owner =" "$config_directory"/main.cf.default)"
+               grep -qc "^setgid_group[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^setgid_group =" "$config_directory"/main.cf.default)"
+               grep -qc "^myhostname[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^myhostname =" "$config_directory"/main.cf.default)"
+               grep -qc "^mydomain[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mydomain =" "$config_directory"/main.cf.default)"
+               grep -qc "^mynetworks[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mynetworks =" "$config_directory"/main.cf.default)"
+               grep -qc "^mynetworks_style[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^mynetworks_style =" "$config_directory"/main.cf.default)"
+               grep -qc "^shlib_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^shlib_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^meta_directory[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^meta_directory =" "$config_directory"/main.cf.default)"
+               grep -qc "^smtputf8_enable[^_]" "$config_directory"/main.cf >/dev/null || postconf -e "$(grep "^smtputf8_enable =" "$config_directory"/main.cf.default)"
+
+               postfix set-permissions
+               postfix post-install upgrade-source
+               postfix upgrade-configuration
+               newaliases
+       fi
+}
+
+start() {
+       upgrade
+       postfix start
+}
+
+stop() {
+       postfix stop
+}
+
+reload() {
+       upgrade
+       postfix reload
+}
diff --git a/trunk/package/mail/postfix/patches/100-fsstat.patch b/trunk/package/mail/postfix/patches/100-fsstat.patch
new file mode 100644 (file)
index 0000000..ca43025
--- /dev/null
@@ -0,0 +1,12 @@
+diff -rupN postfix-2.8.1/src/smtpd/smtpd_check.c postfix-2.8.1_patched/src/smtpd/smtpd_check.c
+--- postfix-2.8.1/src/smtpd/smtpd_check.c      2011-01-04 22:03:50.000000000 +0300
++++ postfix-2.8.1_patched/src/smtpd/smtpd_check.c      2011-03-06 19:35:39.000000000 +0300
+@@ -5277,7 +5277,7 @@ char   *smtpd_check_queue(SMTPD_STATE *s
+      */
+ #define BLOCKS(x)     ((x) / fsbuf.block_size)
+-    fsspace(".", &fsbuf);
++    fsspace("/overlay", &fsbuf);
+     if (msg_verbose)
+       msg_info("%s: blocks %lu avail %lu min_free %lu msg_size_limit %lu",
+                myname,
diff --git a/trunk/package/mail/postfix/patches/200-manpages.patch b/trunk/package/mail/postfix/patches/200-manpages.patch
new file mode 100644 (file)
index 0000000..6344e93
--- /dev/null
@@ -0,0 +1,80 @@
+diff -Naur postfix-2.10.2/conf/post-install postfix-2.10.2_patched/conf/post-install
+--- postfix-2.10.2/conf/post-install   2013-06-13 18:07:46.000000000 +0400
++++ postfix-2.10.2_patched/conf/post-install   2013-11-19 21:17:49.572820573 +0400
+@@ -359,10 +359,10 @@
+ # Sanity checks
+-case $manpage_directory in
+- no) echo $0: Error: manpage_directory no longer accepts \"no\" values. 1>&2
+-     echo Try again with \"$0 manpage_directory=/pathname ...\". 1>&2; exit 1;;
+-esac
++#case $manpage_directory in
++# no) echo $0: Error: manpage_directory no longer accepts \"no\" values. 1>&2
++#     echo Try again with \"$0 manpage_directory=/pathname ...\". 1>&2; exit 1;;
++#esac
+ case $setgid_group in
+  no) echo $0: Error: setgid_group no longer accepts \"no\" values. 1>&2
+@@ -370,7 +370,7 @@
+ esac
+ for path in "$daemon_directory" "$command_directory" "$queue_directory" \
+-    "$sendmail_path" "$newaliases_path" "$mailq_path" "$manpage_directory" \
++    "$sendmail_path" "$newaliases_path" "$mailq_path" \
+     "$meta_directory"
+ do
+    case "$path" in
+@@ -379,7 +379,7 @@
+    esac
+ done
+-for path in "$html_directory" "$readme_directory" "$shlib_directory"
++for path in "$html_directory" "$readme_directory" "$shlib_directory" "$manpage_directory"
+ do
+    case "$path" in
+    /*) ;;
+diff -Naur postfix-2.10.2/postfix-install postfix-2.10.2_patched/postfix-install
+--- postfix-2.10.2/postfix-install     2012-05-22 23:40:29.000000000 +0400
++++ postfix-2.10.2_patched/postfix-install     2013-11-19 21:12:20.694160734 +0400
+@@ -543,13 +543,13 @@
+      exit 1;;
+ esac
+-case "$manpage_directory" in
+- no) (echo $0: Error: the manpage_directory parameter no longer accepts 
+-     echo \"no\" values.  Try again with \"manpage_directory=/path/name\" 
+-     echo on the command line or execute \"make install\" and specify
+-     echo manpage_directory interactively.) | ${FMT} 1>&2
+-     exit 1;;
+-esac
++#case "$manpage_directory" in
++# no) (echo $0: Error: the manpage_directory parameter no longer accepts 
++#     echo \"no\" values.  Try again with \"manpage_directory=/path/name\" 
++#     echo on the command line or execute \"make install\" and specify
++#     echo manpage_directory interactively.) | ${FMT} 1>&2
++#     exit 1;;
++#esac
+ for path in "$html_directory" "$readme_directory" "$shlib_directory"
+ do
+@@ -562,7 +562,7 @@
+ done
+ for path in "$daemon_directory" "$data_directory" "$command_directory" "$queue_directory" \
+-    "$sendmail_path" "$newaliases_path" "$mailq_path" "$manpage_directory" \
++    "$sendmail_path" "$newaliases_path" "$mailq_path" \
+     "$meta_directory"
+ do
+    case "$path" in
+@@ -758,8 +758,8 @@
+               compare_or_replace $mode "$owner" "$group" html/$file \
+                   $HTML_DIRECTORY/$file || exit 1;;
+       '$manpage_directory')
+-          check_parent $MANPAGE_DIRECTORY/$file || exit 1
+-          compare_or_replace $mode "$owner" "$group" man/$file \
++          test "$manpage_directory" = "no" || check_parent $MANPAGE_DIRECTORY/$file || exit 1
++          test "$manpage_directory" = "no" || compare_or_replace $mode "$owner" "$group" man/$file \
+               $MANPAGE_DIRECTORY/$file || exit 1;;
+       '$readme_directory')
+           test "$readme_directory" = "no" ||
diff --git a/trunk/package/mail/postfix/patches/300-bdb_hash_segfault.patch b/trunk/package/mail/postfix/patches/300-bdb_hash_segfault.patch
new file mode 100644 (file)
index 0000000..1a9d8e9
--- /dev/null
@@ -0,0 +1,14 @@
+diff -Naur postfix-2.11.3/src/util/dict_db.c postfix-2.11.3_patched/src/util/dict_db.c
+--- postfix-2.11.3/src/util/dict_db.c  2012-01-25 04:41:08.000000000 +0400
++++ postfix-2.11.3_patched/src/util/dict_db.c  2014-11-01 12:36:44.287641712 +0300
+@@ -687,8 +687,8 @@
+       msg_panic("db_create null result");
+     if ((errno = db->set_cachesize(db, 0, dict_db_cache_size, 0)) != 0)
+       msg_fatal("set DB cache size %d: %m", dict_db_cache_size);
+-    if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
+-      msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
++//    if (type == DB_HASH && db->set_h_nelem(db, DICT_DB_NELM) != 0)
++//    msg_fatal("set DB hash element count %d: %m", DICT_DB_NELM);
+ #if DB_VERSION_MAJOR == 6 || DB_VERSION_MAJOR == 5 || \
+       (DB_VERSION_MAJOR == 4 && DB_VERSION_MINOR > 0)
+     if ((errno = db->open(db, 0, db_path, 0, type, db_flags, 0644)) != 0)
diff --git a/trunk/package/mail/postfix/patches/400-cdb.patch b/trunk/package/mail/postfix/patches/400-cdb.patch
new file mode 100644 (file)
index 0000000..8aeaea5
--- /dev/null
@@ -0,0 +1,14 @@
+diff -Naur postfix-2.11.1/src/util/sys_defs.h postfix-2.11.1.patched/src/util/sys_defs.h
+--- postfix-2.11.1/src/util/sys_defs.h 2013-09-30 00:51:55.000000000 +0400
++++ postfix-2.11.1.patched/src/util/sys_defs.h 2014-09-29 03:11:48.962277971 +0400
+@@ -768,9 +768,8 @@
+ #define INTERNAL_LOCK MYFLOCK_STYLE_FLOCK
+ #define DEF_MAILBOX_LOCK "fcntl, dotlock"     /* RedHat >= 4.x */
+ #define HAS_FSYNC
+-#define HAS_DB
+ #define NATIVE_DB_TYPE        "hash"
+-#define ALIAS_DB_MAP  DEF_DB_TYPE ":/etc/aliases"
++#define ALIAS_DB_MAP  DEF_DB_TYPE ":/etc/postfix/aliases"
+ #ifndef NO_NIS
+ #define HAS_NIS
+ #endif
diff --git a/trunk/package/mail/postfix/patches/500-crosscompile.patch b/trunk/package/mail/postfix/patches/500-crosscompile.patch
new file mode 100644 (file)
index 0000000..0366612
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/makedefs
++++ b/makedefs
+@@ -190,9 +190,9 @@ error() {
+ case $# in
+  # Officially supported usage.
+- 0) SYSTEM=`(uname -s) 2>/dev/null`
+-    RELEASE=`(uname -r) 2>/dev/null`
+-    VERSION=`(uname -v) 2>/dev/null`
++ 0) SYSTEM="Linux"
++    RELEASE="3.10.18"
++    VERSION="OpenWRT"
+     case "$VERSION" in
+      dcosx*) SYSTEM=$VERSION;;
+     esac;;
+@@ -522,9 +522,9 @@ EOF
+               esac
+               for name in nsl resolv
+               do
+-                  for lib in /usr/lib64 /lib64 /usr/lib /usr/lib/* /lib /lib/*
++                  for lib in /usr/lib64 /usr/lib64/* /usr/lib /usr/lib/* /lib /lib/*
+                   do
+-                      test -e $lib/lib$name.a -o -e $lib/lib$name.so && {
++                      test -e $STAGING_DIR/$lib/lib$name.a -o -e $STAGING_DIR/$lib/lib$name.so && {
+                           SYSLIBS="$SYSLIBS -l$name"
+                           break
+                       }
diff --git a/trunk/package/mail/postfix/patches/600-nopostconf.patch b/trunk/package/mail/postfix/patches/600-nopostconf.patch
new file mode 100644 (file)
index 0000000..6140e23
--- /dev/null
@@ -0,0 +1,44 @@
+diff -Naur postfix-2.11.1/postfix-install postfix-2.11.1.patched/postfix-install
+--- postfix-2.11.1/postfix-install     2014-10-05 20:43:58.598876904 +0400
++++ postfix-2.11.1.patched/postfix-install     2014-10-05 20:47:36.076700082 +0400
+@@ -830,23 +830,23 @@
+     esac
+ done
+-bin/postconf -c $CONFIG_DIRECTORY -e \
+-    "daemon_directory = $daemon_directory" \
+-    "data_directory = $data_directory" \
+-    "command_directory = $command_directory" \
+-    "queue_directory = $queue_directory" \
+-    "mail_owner = $mail_owner" \
+-    "setgid_group = $setgid_group" \
+-    "sendmail_path = $sendmail_path" \
+-    "mailq_path = $mailq_path" \
+-    "newaliases_path = $newaliases_path" \
+-    "html_directory = $html_directory" \
+-    "manpage_directory = $manpage_directory" \
+-    "sample_directory = $sample_directory" \
+-    "readme_directory = $readme_directory" \
+-    "shlib_directory = $shlib_directory" \
+-    "meta_directory = $meta_directory" \
+-|| exit 1
++#bin/postconf -c $CONFIG_DIRECTORY -e \
++#    "daemon_directory = $daemon_directory" \
++#    "data_directory = $data_directory" \
++#    "command_directory = $command_directory" \
++#    "queue_directory = $queue_directory" \
++#    "mail_owner = $mail_owner" \
++#    "setgid_group = $setgid_group" \
++#    "sendmail_path = $sendmail_path" \
++#    "mailq_path = $mailq_path" \
++#    "newaliases_path = $newaliases_path" \
++#    "html_directory = $html_directory" \
++#    "manpage_directory = $manpage_directory" \
++#    "sample_directory = $sample_directory" \
++#    "readme_directory = $readme_directory" \
++#    "shlib_directory = $shlib_directory" \
++#    "meta_directory = $meta_directory" \
++#|| exit 1
+ # If Postfix is being installed locally from source code, do the
+ # post-install processing now.
diff --git a/trunk/package/mail/postfix/patches/700-defaultconfig.patch b/trunk/package/mail/postfix/patches/700-defaultconfig.patch
new file mode 100644 (file)
index 0000000..99088d1
--- /dev/null
@@ -0,0 +1,93 @@
+diff -Naur postfix-2.11.1/conf/main.cf postfix-2.11.1.patched/conf/main.cf
+--- postfix-2.11.1/conf/main.cf        2013-12-24 18:57:25.000000000 +0400
++++ postfix-2.11.1.patched/conf/main.cf        2014-10-05 21:35:53.427534410 +0400
+@@ -40,43 +40,8 @@
+ #
+ #soft_bounce = no
+-# LOCAL PATHNAME INFORMATION
+-#
+-# The queue_directory specifies the location of the Postfix queue.
+-# This is also the root directory of Postfix daemons that run chrooted.
+-# See the files in examples/chroot-setup for setting up Postfix chroot
+-# environments on different UNIX systems.
+-#
+-queue_directory = /var/spool/postfix
+-
+-# The command_directory parameter specifies the location of all
+-# postXXX commands.
+-#
+-command_directory = /usr/sbin
+-
+-# The daemon_directory parameter specifies the location of all Postfix
+-# daemon programs (i.e. programs listed in the master.cf file). This
+-# directory must be owned by root.
+-#
+-daemon_directory = /usr/libexec/postfix
+-
+-# The data_directory parameter specifies the location of Postfix-writable
+-# data files (caches, random numbers). This directory must be owned
+-# by the mail_owner account (see below).
+-#
+-data_directory = /var/lib/postfix
+-
+ # QUEUE AND PROCESS OWNERSHIP
+ #
+-# The mail_owner parameter specifies the owner of the Postfix queue
+-# and of most Postfix daemon processes.  Specify the name of a user
+-# account THAT DOES NOT SHARE ITS USER OR GROUP ID WITH OTHER ACCOUNTS
+-# AND THAT OWNS NO OTHER FILES OR PROCESSES ON THE SYSTEM.  In
+-# particular, don't specify nobody or daemon. PLEASE USE A DEDICATED
+-# USER.
+-#
+-mail_owner = postfix
+-
+ # The default_privs parameter specifies the default rights used by
+ # the local delivery agent for delivery to external file or command.
+ # These rights are used in the absence of a recipient user context.
+@@ -632,45 +597,4 @@
+ #     -dmS $process_name gdb $daemon_directory/$process_name
+ #     $process_id & sleep 1
+-# INSTALL-TIME CONFIGURATION INFORMATION
+-#
+-# The following parameters are used when installing a new Postfix version.
+-# 
+-# sendmail_path: The full pathname of the Postfix sendmail command.
+-# This is the Sendmail-compatible mail posting interface.
+-# 
+-sendmail_path =
+-
+-# newaliases_path: The full pathname of the Postfix newaliases command.
+-# This is the Sendmail-compatible command to build alias databases.
+-#
+-newaliases_path =
+-
+-# mailq_path: The full pathname of the Postfix mailq command.  This
+-# is the Sendmail-compatible mail queue listing command.
+-# 
+-mailq_path =
+-
+-# setgid_group: The group for mail submission and queue management
+-# commands.  This must be a group name with a numerical group ID that
+-# is not shared with other accounts, not even with the Postfix account.
+-#
+-setgid_group =
+-
+-# html_directory: The location of the Postfix HTML documentation.
+-#
+-html_directory =
+-
+-# manpage_directory: The location of the Postfix on-line manual pages.
+-#
+-manpage_directory =
+-
+-# sample_directory: The location of the Postfix sample configuration files.
+-# This parameter is obsolete as of Postfix 2.1.
+-#
+-sample_directory =
+-
+-# readme_directory: The location of the Postfix README files.
+-#
+-readme_directory =
+ inet_protocols = ipv4
diff --git a/trunk/package/mail/postfix/patches/800-fmt.patch b/trunk/package/mail/postfix/patches/800-fmt.patch
new file mode 100644 (file)
index 0000000..97a165c
--- /dev/null
@@ -0,0 +1,12 @@
+diff -Naur postfix-2.11.1/conf/post-install postfix-2.11.1.patched/conf/post-install
+--- postfix-2.11.1/conf/post-install   2014-10-05 20:43:58.597876946 +0400
++++ postfix-2.11.1.patched/conf/post-install   2014-10-11 16:28:01.258874097 +0400
+@@ -319,7 +319,7 @@
+ case `uname -s` in
+ HP-UX*) FMT=cat;;
+ SunOS*) FMT=fake_fmt;;
+-     *) FMT=fmt;;
++     *) FMT="xargs echo";;
+ esac
+ # If a parameter is not set via the command line or environment,
diff --git a/trunk/package/mail/ssmtp/Makefile b/trunk/package/mail/ssmtp/Makefile
new file mode 100644 (file)
index 0000000..3d24394
--- /dev/null
@@ -0,0 +1,64 @@
+#
+# Copyright (C) 2007-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:=ssmtp
+PKG_VERSION:=2.64
+PKG_RELEASE:=1.1
+PKG_MAINTAINER:=Dirk Brenken <dibdot@gmail.com>
+PKG_LICENSE:=GPL-2.0+
+
+PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).orig.tar.bz2
+PKG_SOURCE_URL:=http://ftp.debian.org/debian/pool/main/s/ssmtp
+PKG_MD5SUM:=65b4e0df4934a6cd08c506cabcbe584f
+
+include $(INCLUDE_DIR)/package.mk
+
+TARGET_CFLAGS += $(TARGET_CPPFLAGS)
+
+define Package/ssmtp
+  SECTION:=mail
+  CATEGORY:=Mail
+  DEPENDS:=+libopenssl
+  TITLE:=A minimal and secure mail sender with ssl support
+  URL:=http://packages.debian.org/ssmtp
+endef
+
+define Package/ssmtp/description
+ A secure, effective and simple way of getting mail off a system to your
+ mail hub. It contains no suid-binaries or other dangerous things - no
+ mail spool to poke around in, and no daemons running in the background.
+ Mail is simply forwarded to the configured mailhost. Extremely easy
+ configuration.
+endef
+
+define Package/ssmtp/conffiles
+/etc/ssmtp/ssmtp.conf
+/etc/ssmtp/revaliases
+endef
+
+CONFIGURE_VARS += \
+       LIBS="$(TARGET_LDFLAGS) -lcrypto -lssl"
+
+CONFIGURE_ARGS += \
+       --enable-ssl
+
+define Package/ssmtp/install
+       $(INSTALL_DIR) $(1)/etc/ssmtp
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/ssmtp.conf $(1)/etc/ssmtp/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/revaliases $(1)/etc/ssmtp/
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/ssmtp $(1)/usr/sbin/
+endef
+
+define Package/ssmtp/postinst
+#!/bin/sh
+ln -sf ssmtp $${IPKG_INSTROOT}/usr/sbin/sendmail
+endef
+
+$(eval $(call BuildPackage,ssmtp))
diff --git a/trunk/package/mail/ssmtp/patches/002-fix_pointer.patch b/trunk/package/mail/ssmtp/patches/002-fix_pointer.patch
new file mode 100644 (file)
index 0000000..f22e3d6
--- /dev/null
@@ -0,0 +1,466 @@
+--- a/ssmtp.c
++++ b/ssmtp.c
+@@ -55,21 +55,21 @@ bool_t use_oldauth = False;                /* use old
+ #define ARPADATE_LENGTH 32            /* Current date in RFC format */
+ char arpadate[ARPADATE_LENGTH];
+-char *auth_user = (char)NULL;
+-char *auth_pass = (char)NULL;
+-char *auth_method = (char)NULL;               /* Mechanism for SMTP authentication */
+-char *mail_domain = (char)NULL;
+-char *from = (char)NULL;              /* Use this as the From: address */
++char *auth_user = NULL;
++char *auth_pass = NULL;
++char *auth_method = NULL;             /* Mechanism for SMTP authentication */
++char *mail_domain = NULL;
++char *from = NULL;            /* Use this as the From: address */
+ char *hostname;
+ char *mailhost = "mailhub";
+-char *minus_f = (char)NULL;
+-char *minus_F = (char)NULL;
++char *minus_f = NULL;
++char *minus_F = NULL;
+ char *gecos;
+-char *prog = (char)NULL;
++char *prog = NULL;
+ char *root = NULL;
+ char *tls_cert = "/etc/ssl/certs/ssmtp.pem";  /* Default Certificate */
+-char *uad = (char)NULL;
+-char *config_file = (char)NULL;               /* alternate configuration file */
++char *uad = NULL;
++char *config_file = NULL;             /* alternate configuration file */
+ headers_t headers, *ht;
+@@ -261,7 +261,7 @@ char *strip_post_ws(char *str)
+       p = (str + strlen(str));
+       while(isspace(*--p)) {
+-              *p = (char)NULL;
++              *p = '\0';
+       }
+       return(p);
+@@ -279,7 +279,7 @@ char *addr_parse(char *str)
+ #endif
+       /* Simple case with email address enclosed in <> */
+-      if((p = strdup(str)) == (char *)NULL) {
++      if((p = strdup(str)) == NULL) {
+               die("addr_parse(): strdup()");
+       }
+@@ -287,7 +287,7 @@ char *addr_parse(char *str)
+               q++;
+               if((p = strchr(q, '>'))) {
+-                      *p = (char)NULL;
++                      *p = '\0';
+               }
+ #if 0
+@@ -310,7 +310,7 @@ char *addr_parse(char *str)
+       q = strip_post_ws(p);
+       if(*q == ')') {
+               while((*--q != '('));
+-              *q = (char)NULL;
++              *q = '\0';
+       }
+       (void)strip_post_ws(p);
+@@ -349,7 +349,6 @@ standardise() -- Trim off '\n's and doub
+ */
+ bool_t standardise(char *str, bool_t *linestart)
+ {
+-      size_t sl;
+       char *p;
+       bool_t leadingdot = False;
+@@ -363,7 +362,7 @@ bool_t standardise(char *str, bool_t *li
+       *linestart = False;
+       if((p = strchr(str, '\n'))) {
+-              *p = (char)NULL;
++              *p = '\0';
+               *linestart = True;
+       }
+       return(leadingdot);
+@@ -384,7 +383,7 @@ void revaliases(struct passwd *pw)
+               while(fgets(buf, sizeof(buf), fp)) {
+                       /* Make comments invisible */
+                       if((p = strchr(buf, '#'))) {
+-                              *p = (char)NULL;
++                              *p = '\0';
+                       }
+                       /* Ignore malformed lines and comments */
+@@ -519,11 +518,11 @@ void rcpt_save(char *str)
+ #endif
+       /* Ignore missing usernames */
+-      if(*str == (char)NULL) {
++      if(*str == '\0') {
+               return;
+       }
+-      if((rt->string = strdup(str)) == (char *)NULL) {
++      if((rt->string = strdup(str)) == NULL) {
+               die("rcpt_save() -- strdup() failed");
+       }
+@@ -548,7 +547,7 @@ void rcpt_parse(char *str)
+       (void)fprintf(stderr, "*** rcpt_parse(): str = [%s]\n", str);
+ #endif
+-      if((p = strdup(str)) == (char *)NULL) {
++      if((p = strdup(str)) == NULL) {
+               die("rcpt_parse(): strdup() failed");
+       }
+       q = p;
+@@ -576,7 +575,7 @@ void rcpt_parse(char *str)
+               }
+               /* End of string? */
+-              if(*(q + 1) == (char)NULL) {
++              if(*(q + 1) == '\0') {
+                       got_addr = True;
+               }
+@@ -584,7 +583,7 @@ void rcpt_parse(char *str)
+               if((*q == ',') && (in_quotes == False)) {
+                       got_addr = True;
+-                      *q = (char)NULL;
++                      *q = '\0';
+               }
+               if(got_addr) {
+@@ -668,7 +667,7 @@ void header_save(char *str)
+       (void)fprintf(stderr, "header_save(): str = [%s]\n", str);
+ #endif
+-      if((p = strdup(str)) == (char *)NULL) {
++      if((p = strdup(str)) == NULL) {
+               die("header_save() -- strdup() failed");
+       }
+       ht->string = p;
+@@ -676,7 +675,7 @@ void header_save(char *str)
+       if(strncasecmp(ht->string, "From:", 5) == 0) {
+ #if 1
+               /* Hack check for NULL From: line */
+-              if(*(p + 6) == (char)NULL) {
++              if(*(p + 6) == '\0') {
+                       return;
+               }
+ #endif
+@@ -739,19 +738,19 @@ header_parse() -- Break headers into sep
+ void header_parse(FILE *stream)
+ {
+       size_t size = BUF_SZ, len = 0;
+-      char *p = (char *)NULL, *q;
++      char *p = NULL, *q;
+       bool_t in_header = True;
+-      char l = (char)NULL;
++      char l = '\0';
+       int c;
+       while(in_header && ((c = fgetc(stream)) != EOF)) {
+               /* Must have space for up to two more characters, since we
+                       may need to insert a '\r' */
+-              if((p == (char *)NULL) || (len >= (size - 1))) {
++              if((p == NULL) || (len >= (size - 1))) {
+                       size += BUF_SZ;
+                       p = (char *)realloc(p, (size * sizeof(char)));
+-                      if(p == (char *)NULL) {
++                      if(p == NULL) {
+                               die("header_parse() -- realloc() failed");
+                       }
+                       q = (p + len);
+@@ -776,9 +775,9 @@ void header_parse(FILE *stream)
+                                               in_header = False;
+                               default:
+-                                              *q = (char)NULL;
++                                              *q = '\0';
+                                               if((q = strrchr(p, '\n'))) {
+-                                                      *q = (char)NULL;
++                                                      *q = '\0';
+                                               }
+                                               header_save(p);
+@@ -809,9 +808,9 @@ void header_parse(FILE *stream)
+                                               in_header = False;
+                               default:
+-                                              *q = (char)NULL;
++                                              *q = '\0';
+                                               if((q = strrchr(p, '\n'))) {
+-                                                      *q = (char)NULL;
++                                                      *q = '\0';
+                                               }
+                                               header_save(p);
+@@ -876,11 +875,11 @@ bool_t read_config()
+               char *rightside;
+               /* Make comments invisible */
+               if((p = strchr(buf, '#'))) {
+-                      *p = (char)NULL;
++                      *p = '\0';
+               }
+               /* Ignore malformed lines and comments */
+-              if(strchr(buf, '=') == (char *)NULL) continue;
++              if(strchr(buf, '=') == NULL) continue;
+               /* Parse out keywords */
+               p=firsttok(&begin, "= \t\n");
+@@ -890,7 +889,7 @@ bool_t read_config()
+               }
+               if(p && q) {
+                       if(strcasecmp(p, "Root") == 0) {
+-                              if((root = strdup(q)) == (char *)NULL) {
++                              if((root = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -904,7 +903,7 @@ bool_t read_config()
+                                       port = atoi(r);
+                               }
+-                              if((mailhost = strdup(q)) == (char *)NULL) {
++                              if((mailhost = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -949,7 +948,7 @@ bool_t read_config()
+                                       mail_domain = strdup(q);
+                               }
+-                              if(mail_domain == (char *)NULL) {
++                              if(mail_domain == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+                               rewrite_domain = True;
+@@ -1025,7 +1024,7 @@ bool_t read_config()
+                               }
+                       }
+                       else if(strcasecmp(p, "TLSCert") == 0) {
+-                              if((tls_cert = strdup(q)) == (char *)NULL) {
++                              if((tls_cert = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -1036,7 +1035,7 @@ bool_t read_config()
+ #endif
+                       /* Command-line overrides these */
+                       else if(strcasecmp(p, "AuthUser") == 0 && !auth_user) {
+-                              if((auth_user = strdup(q)) == (char *)NULL) {
++                              if((auth_user = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -1045,7 +1044,7 @@ bool_t read_config()
+                               }
+                       }
+                       else if(strcasecmp(p, "AuthPass") == 0 && !auth_pass) {
+-                              if((auth_pass = strdup(q)) == (char *)NULL) {
++                              if((auth_pass = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -1054,7 +1053,7 @@ bool_t read_config()
+                               }
+                       }
+                       else if(strcasecmp(p, "AuthMethod") == 0 && !auth_method) {
+-                              if((auth_method = strdup(q)) == (char *)NULL) {
++                              if((auth_method = strdup(q)) == NULL) {
+                                       die("parse_config() -- strdup() failed");
+                               }
+@@ -1119,14 +1118,11 @@ int smtp_open(char *host, int port)
+       char buf[(BUF_SZ + 1)];
+       /* Init SSL stuff */
+-      SSL_CTX *ctx;
+-      SSL_METHOD *meth;
++      SSL_CTX *ctx = NULL;
+       X509 *server_cert;
+-
+       SSL_load_error_strings();
+       SSLeay_add_ssl_algorithms();
+-      meth=SSLv23_client_method();
+-      ctx = SSL_CTX_new(meth);
++      ctx = SSL_CTX_new(SSLv23_client_method());
+       if(!ctx) {
+               log_event(LOG_ERR, "No SSL support initiated\n");
+               return(-1);
+@@ -1310,7 +1306,7 @@ char *fd_gets(char *buf, int size, int f
+                       buf[i++] = c;
+               }
+       }
+-      buf[i] = (char)NULL;
++      buf[i] = '\0';
+       return(buf);
+ }
+@@ -1434,14 +1430,14 @@ int ssmtp(char *argv[])
+       }
+       if((p = strtok(pw->pw_gecos, ";,"))) {
+-              if((gecos = strdup(p)) == (char *)NULL) {
++              if((gecos = strdup(p)) == NULL) {
+                       die("ssmtp() -- strdup() failed");
+               }
+       }
+       revaliases(pw);
+       /* revaliases() may have defined this */
+-      if(uad == (char *)NULL) {
++      if(uad == NULL) {
+               uad = append_domain(pw->pw_name);
+       }
+@@ -1489,7 +1485,7 @@ int ssmtp(char *argv[])
+       /* Try to log in if username was supplied */
+       if(auth_user) {
+ #ifdef MD5AUTH
+-              if(auth_pass == (char *)NULL) {
++              if(auth_pass == NULL) {
+                       auth_pass = strdup("");
+               }
+@@ -1508,7 +1504,7 @@ int ssmtp(char *argv[])
+               else {
+ #endif
+               memset(buf, 0, bufsize);
+-              to64frombits(buf, auth_user, strlen(auth_user));
++              to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
+               if (use_oldauth) {
+                       outbytes += smtp_write(sock, "AUTH LOGIN %s", buf);
+               }
+@@ -1520,7 +1516,7 @@ int ssmtp(char *argv[])
+                       }
+                       /* we assume server asked us for Username */
+                       memset(buf, 0, bufsize);
+-                      to64frombits(buf, auth_user, strlen(auth_user));
++                      to64frombits(buf, (unsigned char *)auth_user, strlen(auth_user));
+                       outbytes += smtp_write(sock, buf);
+               }
+@@ -1530,7 +1526,7 @@ int ssmtp(char *argv[])
+               }
+               memset(buf, 0, bufsize);
+-              to64frombits(buf, auth_pass, strlen(auth_pass));
++              to64frombits(buf, (unsigned char *)auth_pass, strlen(auth_pass));
+ #ifdef MD5AUTH
+               }
+ #endif
+@@ -1737,7 +1733,7 @@ char **parse_options(int argc, char *arg
+               j = 0;
+               add = 1;
+-              while(argv[i][++j] != (char)NULL) {
++              while(argv[i][++j] != '\0') {
+                       switch(argv[i][j]) {
+ #ifdef INET6
+                       case '6':
+@@ -1755,14 +1751,14 @@ char **parse_options(int argc, char *arg
+                                       if((!argv[i][(j + 1)])
+                                               && argv[(i + 1)]) {
+                                               auth_user = strdup(argv[i+1]);
+-                                              if(auth_user == (char *)NULL) {
++                                              if(auth_user == NULL) {
+                                                       die("parse_options() -- strdup() failed");
+                                               }
+                                               add++;
+                                       }
+                                       else {
+                                               auth_user = strdup(argv[i]+j+1);
+-                                              if(auth_user == (char *)NULL) {
++                                              if(auth_user == NULL) {
+                                                       die("parse_options() -- strdup() failed");
+                                               }
+                                       }
+@@ -1772,14 +1768,14 @@ char **parse_options(int argc, char *arg
+                                       if((!argv[i][(j + 1)])
+                                               && argv[(i + 1)]) {
+                                               auth_pass = strdup(argv[i+1]);
+-                                              if(auth_pass == (char *)NULL) {
++                                              if(auth_pass == NULL) {
+                                                       die("parse_options() -- strdup() failed");
+                                               }
+                                               add++;
+                                       }
+                                       else {
+                                               auth_pass = strdup(argv[i]+j+1);
+-                                              if(auth_pass == (char *)NULL) {
++                                              if(auth_pass == NULL) {
+                                                       die("parse_options() -- strdup() failed");
+                                               }
+                                       }
+@@ -1870,14 +1866,14 @@ char **parse_options(int argc, char *arg
+                       case 'F':
+                               if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
+                                       minus_F = strdup(argv[(i + 1)]);
+-                                      if(minus_F == (char *)NULL) {
++                                      if(minus_F == NULL) {
+                                               die("parse_options() -- strdup() failed");
+                                       }
+                                       add++;
+                               }
+                               else {
+                                       minus_F = strdup(argv[i]+j+1);
+-                                      if(minus_F == (char *)NULL) {
++                                      if(minus_F == NULL) {
+                                               die("parse_options() -- strdup() failed");
+                                       }
+                               }
+@@ -1889,14 +1885,14 @@ char **parse_options(int argc, char *arg
+                       case 'r':
+                               if((!argv[i][(j + 1)]) && argv[(i + 1)]) {
+                                       minus_f = strdup(argv[(i + 1)]);
+-                                      if(minus_f == (char *)NULL) {
++                                      if(minus_f == NULL) {
+                                               die("parse_options() -- strdup() failed");
+                                       }
+                                       add++;
+                               }
+                               else {
+                                       minus_f = strdup(argv[i]+j+1);
+-                                      if(minus_f == (char *)NULL) {
++                                      if(minus_f == NULL) {
+                                               die("parse_options() -- strdup() failed");
+                                       }
+                               }
+--- a/base64.c
++++ b/base64.c
+@@ -31,7 +31,7 @@ static const char base64val[] = {
+ };
+ #define DECODE64(c)  (isascii(c) ? base64val[c] : BAD)
+-void to64frombits(unsigned char *out, const unsigned char *in, int inlen)
++void to64frombits(char *out, const unsigned char *in, int inlen)
+ /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
+ {
+     for (; inlen >= 3; inlen -= 3)
+@@ -57,7 +57,7 @@ void to64frombits(unsigned char *out, co
+     *out = '\0';
+ }
+-int from64tobits(char *out, const char *in)
++int from64tobits(unsigned char *out, const char *in)
+ /* base 64 to raw bytes in quasi-big-endian order, returning count of bytes */
+ {
+     int len = 0;
+--- a/ssmtp.h
++++ b/ssmtp.h
+@@ -41,5 +41,5 @@ typedef struct string_list rcpt_t;
+ void get_arpadate(char *);
+ /* base64.c */
+-void to64frombits(unsigned char *, const unsigned char *, int);
+-int from64tobits(char *, const char *);
++void to64frombits(char *, const unsigned char *, int);
++int from64tobits(unsigned char *, const char *);
diff --git a/trunk/package/network/services/git/Makefile b/trunk/package/network/services/git/Makefile
new file mode 100644 (file)
index 0000000..c088e72
--- /dev/null
@@ -0,0 +1,114 @@
+#
+# Copyright (C) 2009-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:=git
+PKG_VERSION:=2.4.2
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@KERNEL/software/scm/git/
+PKG_MD5SUM:=0b8dc818ed4766342978d744522aec49
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/git/Default
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Version Control Systems
+  DEPENDS:=+libopenssl +libpthread +librt
+  TITLE:=The fast version control system
+  URL:=http://git-scm.com
+  MAINTAINER:=Peter Wagner <tripolar@gmx.at>
+endef
+
+define Package/git
+$(call Package/git/Default)
+  DEPENDS:=+libopenssl +libpthread +librt
+  TITLE:=The fast version control system
+endef
+
+define Package/git/description
+ Git is a free & open source, distributed version control system
+ designed to handle everything from small to very large projects
+ with speed and efficiency.
+endef
+
+define Package/git-http
+$(call Package/git/Default)
+  DEPENDS:=git +libcurl +ca-certificates
+  TITLE:=Git HTTP commands
+endef
+
+define Package/git-http/description
+$(call Package/git/description)
+
+ This package allows git push/fetch over http(s) and ftp(s)
+endef
+
+MAKE_FLAGS := \
+       CC="$(TARGET_CC)" \
+       CFLAGS="$(TARGET_CFLAGS)" \
+       CPPFLAGS="$(TARGET_CPPFLAGS)" \
+       LDFLAGS="$(TARGET_LDFLAGS)" \
+       NO_EXPAT="YesPlease" \
+       NO_MKSTEMPS="YesPlease" \
+       NO_GETTEXT="YesPlease" \
+       NO_UNIX_SOCKETS="YesPlease" \
+       NO_IPV6="YesPlease" \
+       NO_ICONV="YesPlease" \
+       NO_NSEC="YesPlease" \
+       NO_PERL="YesPlease" \
+       NO_PYTHON="YesPlease" \
+       NO_TCLTK="YesPlease" \
+       NO_INSTALL_HARDLINKS="yes" \
+
+CONFIGURE_ARGS += \
+       --without-iconv \
+
+define Build/Configure
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               configure
+
+       $(call Build/Configure/Default,)
+endef
+
+define Package/git/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/git   $(1)/usr/bin
+       $(RM) $(PKG_INSTALL_DIR)/usr/bin/git-cvsserver
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/git-* $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/usr/lib/git-core
+       ( cd $(PKG_INSTALL_DIR); $(TAR) \
+               --exclude=usr/lib/git-core/git-http-backend \
+               --exclude=usr/lib/git-core/git-http-fetch \
+               --exclude=usr/lib/git-core/git-remote-ftp \
+               --exclude=usr/lib/git-core/git-remote-ftps \
+               --exclude=usr/lib/git-core/git-remote-http \
+               --exclude=usr/lib/git-core/git-remote-https \
+               -cf - \
+               usr/lib/git-core \
+       ) | ( cd $(1); $(TAR) -xf - )
+endef
+
+define Package/git-http/install
+       $(INSTALL_DIR) $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-http-backend $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-http-fetch $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-remote-ftp $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-remote-ftps $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-remote-http $(1)/usr/lib/git-core
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/git-core/git-remote-https $(1)/usr/lib/git-core
+endef
+
+$(eval $(call BuildPackage,git))
+$(eval $(call BuildPackage,git-http))
diff --git a/trunk/package/network/services/git/patches/100-convert_builtin.patch b/trunk/package/network/services/git/patches/100-convert_builtin.patch
new file mode 100644 (file)
index 0000000..e3d4200
--- /dev/null
@@ -0,0 +1,219 @@
+--- a/Makefile
++++ b/Makefile
+@@ -549,16 +549,7 @@ EXTRA_PROGRAMS =
+ # ... and all the rest that could be moved out of bindir to gitexecdir
+ PROGRAMS += $(EXTRA_PROGRAMS)
+-PROGRAM_OBJS += credential-store.o
+-PROGRAM_OBJS += daemon.o
+-PROGRAM_OBJS += fast-import.o
+ PROGRAM_OBJS += http-backend.o
+-PROGRAM_OBJS += imap-send.o
+-PROGRAM_OBJS += sh-i18n--envsubst.o
+-PROGRAM_OBJS += shell.o
+-PROGRAM_OBJS += show-index.o
+-PROGRAM_OBJS += upload-pack.o
+-PROGRAM_OBJS += remote-testsvn.o
+ # Binary suffix, set to .exe for Windows builds
+ X =
+@@ -907,6 +898,11 @@ BUILTIN_OBJS += builtin/verify-commit.o
+ BUILTIN_OBJS += builtin/verify-pack.o
+ BUILTIN_OBJS += builtin/verify-tag.o
+ BUILTIN_OBJS += builtin/write-tree.o
++BUILTIN_OBJS += builtin/daemon.o
++BUILTIN_OBJS += builtin/fast-import.o
++BUILTIN_OBJS += builtin/imap-send.o
++BUILTIN_OBJS += builtin/shell.o
++BUILTIN_OBJS += builtin/upload-pack.o
+ GITLIBS = $(LIB_FILE) $(XDIFF_LIB)
+ EXTLIBS =
+@@ -1089,7 +1085,7 @@ endif
+ EXTLIBS += -lz
+ ifndef NO_OPENSSL
+-      OPENSSL_LIBSSL = -lssl
++      EXTLIBS += -lssl
+       ifdef OPENSSLDIR
+               BASIC_CFLAGS += -I$(OPENSSLDIR)/include
+               OPENSSL_LINK = -L$(OPENSSLDIR)/$(lib) $(CC_LD_DYNPATH)$(OPENSSLDIR)/$(lib)
+@@ -1956,10 +1952,6 @@ endif
+ git-%$X: %.o GIT-LDFLAGS $(GITLIBS)
+       $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)
+-git-imap-send$X: imap-send.o $(IMAP_SEND_BUILDDEPS) GIT-LDFLAGS $(GITLIBS)
+-      $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+-              $(LIBS) $(IMAP_SEND_LDFLAGS)
+-
+ git-http-fetch$X: http.o http-walker.o http-fetch.o GIT-LDFLAGS $(GITLIBS)
+       $(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) \
+               $(LIBS) $(CURL_LIBCURL)
+@@ -2277,10 +2269,11 @@ endif
+       bindir=$$(cd '$(DESTDIR_SQ)$(bindir_SQ)' && pwd) && \
+       execdir=$$(cd '$(DESTDIR_SQ)$(gitexec_instdir_SQ)' && pwd) && \
+       { test "$$bindir/" = "$$execdir/" || \
+-        for p in git$X $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
++        for p in $(filter $(install_bindir_programs),$(ALL_PROGRAMS)); do \
+               $(RM) "$$execdir/$$p" && \
+               test -z "$(NO_INSTALL_HARDLINKS)$(NO_CROSS_DIRECTORY_HARDLINKS)" && \
+               ln "$$bindir/$$p" "$$execdir/$$p" 2>/dev/null || \
++              ln -s git "$$execdir/$$p" 2>/dev/null || \
+               cp "$$bindir/$$p" "$$execdir/$$p" || exit; \
+         done; \
+       } && \
+--- a/builtin.h
++++ b/builtin.h
+@@ -138,5 +138,10 @@ extern int cmd_verify_pack(int argc, con
+ extern int cmd_show_ref(int argc, const char **argv, const char *prefix);
+ extern int cmd_pack_refs(int argc, const char **argv, const char *prefix);
+ extern int cmd_replace(int argc, const char **argv, const char *prefix);
++extern int cmd_daemon(int argc, char **argv, const char *prefix);
++extern int cmd_fast_import(int argc, char **argv, const char *prefix);
++extern int cmd_imap_send(int argc, char **argv, const char *prefix);
++extern int cmd_shell(int argc, char **argv, const char *prefix);
++extern int cmd_upload_pack(int argc, char **argv, const char *prefix);
+ #endif
+--- /dev/null
++++ b/builtin/daemon.c
+@@ -0,0 +1 @@
++#include "../daemon.c"
+--- /dev/null
++++ b/builtin/fast-import.c
+@@ -0,0 +1 @@
++#include "../fast-import.c"
+--- /dev/null
++++ b/builtin/imap-send.c
+@@ -0,0 +1 @@
++#include "../imap-send.c"
+--- /dev/null
++++ b/builtin/shell.c
+@@ -0,0 +1 @@
++#include "../shell.c"
+--- /dev/null
++++ b/builtin/upload-pack.c
+@@ -0,0 +1 @@
++#include "../upload-pack.c"
+--- a/daemon.c
++++ b/daemon.c
+@@ -1192,7 +1192,7 @@ static int serve(struct string_list *lis
+       return service_loop(&socklist);
+ }
+-int main(int argc, char **argv)
++int cmd_daemon(int argc, char **argv, const char *prefix)
+ {
+       int listen_port = 0;
+       struct string_list listen_addr = STRING_LIST_INIT_NODUP;
+@@ -1388,12 +1388,13 @@ int main(int argc, char **argv)
+               store_pid(pid_file);
+       /* prepare argv for serving-processes */
+-      cld_argv = xmalloc(sizeof (char *) * (argc + 2));
+-      cld_argv[0] = argv[0];  /* git-daemon */
+-      cld_argv[1] = "--serve";
++      cld_argv = xmalloc(sizeof (char *) * (argc + 3));
++      cld_argv[0] = "git";
++      cld_argv[1] = argv[0];  /* daemon */
++      cld_argv[2] = "--serve";
+       for (i = 1; i < argc; ++i)
+-              cld_argv[i+1] = argv[i];
+-      cld_argv[argc+1] = NULL;
++              cld_argv[i+2] = argv[i];
++      cld_argv[argc+2] = NULL;
+       return serve(&listen_addr, listen_port, cred);
+ }
+--- a/fast-import.c
++++ b/fast-import.c
+@@ -3351,7 +3351,7 @@ static void parse_argv(void)
+               read_marks();
+ }
+-int main(int argc, char **argv)
++int cmd_fast_import(int argc, char **argv, const char *prefix)
+ {
+       unsigned int i;
+--- a/git.c
++++ b/git.c
+@@ -311,11 +311,11 @@ static int handle_alias(int *argcp, cons
+ struct cmd_struct {
+       const char *cmd;
+-      int (*fn)(int, const char **, const char *);
++      int (*fn)(int, char **, const char *);
+       int option;
+ };
+-static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
++static int run_builtin(struct cmd_struct *p, int argc, char **argv)
+ {
+       int status, help;
+       struct stat st;
+@@ -395,6 +395,7 @@ static struct cmd_struct commands[] = {
+       { "config", cmd_config, RUN_SETUP_GENTLY },
+       { "count-objects", cmd_count_objects, RUN_SETUP },
+       { "credential", cmd_credential, RUN_SETUP_GENTLY },
++      { "daemon", cmd_daemon },
+       { "describe", cmd_describe, RUN_SETUP },
+       { "diff", cmd_diff },
+       { "diff-files", cmd_diff_files, RUN_SETUP | NEED_WORK_TREE },
+@@ -413,6 +414,7 @@ static struct cmd_struct commands[] = {
+       { "grep", cmd_grep, RUN_SETUP_GENTLY },
+       { "hash-object", cmd_hash_object },
+       { "help", cmd_help },
++      { "imap-send", cmd_imap_send },
+       { "index-pack", cmd_index_pack, RUN_SETUP_GENTLY },
+       { "init", cmd_init_db, NO_SETUP },
+       { "init-db", cmd_init_db, NO_SETUP },
+@@ -461,6 +463,7 @@ static struct cmd_struct commands[] = {
+       { "revert", cmd_revert, RUN_SETUP | NEED_WORK_TREE },
+       { "rm", cmd_rm, RUN_SETUP },
+       { "send-pack", cmd_send_pack, RUN_SETUP },
++      { "shell", cmd_shell },
+       { "shortlog", cmd_shortlog, RUN_SETUP_GENTLY | USE_PAGER },
+       { "show", cmd_show, RUN_SETUP },
+       { "show-branch", cmd_show_branch, RUN_SETUP },
+@@ -477,6 +480,7 @@ static struct cmd_struct commands[] = {
+       { "update-server-info", cmd_update_server_info, RUN_SETUP },
+       { "upload-archive", cmd_upload_archive },
+       { "upload-archive--writer", cmd_upload_archive_writer },
++      { "upload-pack", cmd_upload_pack },
+       { "var", cmd_var, RUN_SETUP_GENTLY },
+       { "verify-commit", cmd_verify_commit, RUN_SETUP },
+       { "verify-pack", cmd_verify_pack },
+--- a/imap-send.c
++++ b/imap-send.c
+@@ -1492,7 +1492,7 @@ static int curl_append_msgs_to_imap(stru
+ }
+ #endif
+-int main(int argc, char **argv)
++int cmd_imap_send(int argc, char **argv, const char *prefix)
+ {
+       struct strbuf all_msgs = STRBUF_INIT;
+       int total;
+--- a/shell.c
++++ b/shell.c
+@@ -138,7 +138,7 @@ static struct commands {
+       { NULL },
+ };
+-int main(int argc, char **argv)
++int cmd_shell(int argc, char **argv, const char *prefix)
+ {
+       char *prog;
+       const char **user_argv;
+--- a/upload-pack.c
++++ b/upload-pack.c
+@@ -797,7 +797,7 @@ static int upload_pack_config(const char
+       return parse_hide_refs_config(var, value, "uploadpack");
+ }
+-int main(int argc, char **argv)
++int cmd_upload_pack(int argc, char **argv, const char *prefix)
+ {
+       char *dir;
+       int i;
diff --git a/trunk/package/network/services/git/patches/200-disable_fasthash.patch b/trunk/package/network/services/git/patches/200-disable_fasthash.patch
new file mode 100644 (file)
index 0000000..91f255f
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/config.mak.uname
++++ b/config.mak.uname
+@@ -17,9 +17,6 @@ endif
+ # because maintaining the nesting to match is a pain.  If
+ # we had "elif" things would have been much nicer...
+-ifeq ($(uname_M),x86_64)
+-      XDL_FAST_HASH = YesPlease
+-endif
+ ifeq ($(uname_S),OSF1)
+       # Need this for u_short definitions et al
+       BASIC_CFLAGS += -D_OSF_SOURCE
diff --git a/trunk/package/network/services/git/patches/300-configure_for_crosscompiling b/trunk/package/network/services/git/patches/300-configure_for_crosscompiling
new file mode 100644 (file)
index 0000000..0ccfaec
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -844,7 +844,8 @@ AC_RUN_IFELSE(
+               FILE *f = fopen(".", "r");
+               return f && fread(&c, 1, 1, f)]])],
+       [ac_cv_fread_reads_directories=no],
+-      [ac_cv_fread_reads_directories=yes])
++      [ac_cv_fread_reads_directories=yes],
++      [ac_cv_fread_reads_directories=no])
+ ])
+ if test $ac_cv_fread_reads_directories = yes; then
+       FREAD_READS_DIRECTORIES=UnfortunatelyYes
+@@ -878,7 +879,8 @@ AC_RUN_IFELSE(
+                 if (snprintf(buf, 3, "%s", "12345") != 5
+                     || strcmp(buf, "12")) return 1]])],
+       [ac_cv_snprintf_returns_bogus=no],
+-      [ac_cv_snprintf_returns_bogus=yes])
++      [ac_cv_snprintf_returns_bogus=yes],
++      [ac_cv_snprintf_returns_bogus=no])
+ ])
+ if test $ac_cv_snprintf_returns_bogus = yes; then
+       SNPRINTF_RETURNS_BOGUS=UnfortunatelyYes
+@@ -901,7 +903,8 @@ yippeeyeswehaveit
+ #endif
+ ]),
+       [ac_cv_sane_mode_bits=yes],
+-      [ac_cv_sane_mode_bits=no])
++      [ac_cv_sane_mode_bits=no],
++      [ac_cv_sane_mode_bits=yes])
+ ])
+ if test $ac_cv_sane_mode_bits = yes; then
+       NEEDS_MODE_TRANSLATION=
diff --git a/trunk/package/network/services/git/patches/400-imapsend_without_curl.patch b/trunk/package/network/services/git/patches/400-imapsend_without_curl.patch
new file mode 100644 (file)
index 0000000..e96330c
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1058,7 +1058,7 @@ else
+       endif
+       curl_check := $(shell (echo 072200; curl-config --vernum | sed -e '/^70[BC]/s/^/0/') 2>/dev/null | sort -r | sed -ne 2p)
+       ifeq "$(curl_check)" "072200"
+-              USE_CURL_FOR_IMAP_SEND = YesPlease
++#             USE_CURL_FOR_IMAP_SEND = YesPlease
+       endif
+       ifdef USE_CURL_FOR_IMAP_SEND
+               BASIC_CFLAGS += -DUSE_CURL_FOR_IMAP_SEND
diff --git a/trunk/package/network/services/gnunet/Makefile b/trunk/package/network/services/gnunet/Makefile
new file mode 100644 (file)
index 0000000..75c8e5d
--- /dev/null
@@ -0,0 +1,257 @@
+#
+# 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:=gnunet
+PKG_SOURCE_VERSION:=36094
+PKG_VERSION:=0.10.1-svn$(PKG_SOURCE_VERSION)
+PKG_RELEASE:=1
+
+# ToDo:
+#  - break-out {peer,name,data}store for each backend
+#  - package testing stuff
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_URL:=https://gnunet.org/svn/gnunet/
+PKG_SOURCE_PROTO:=svn
+
+PKG_LICENSE:=GPL-3.0
+PKG_LICENSE_FILES:=COPYING
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+
+PKG_BUILD_PARALLEL:=1
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+CONFIGURE_ARGS+= \
+       --with-ltdl \
+       $(if $(CONFIG_PACKAGE_$(PKG_NAME)-mysql),--with-mysql="$(STAGING_DIR)/usr",--without-mysql) \
+       $(if $(CONFIG_PACKAGE_$(PKG_NAME)-pgsql),--with-postgresql="$(STAGING_DIR)/usr/bin/pg_config",--without-postgresql) \
+       $(if $(CONFIG_PACKAGE_$(PKG_NAME)-sqlite),--with-sqlite="$(STAGING_DIR)/usr",--without-sqlite) \
+       --with-extractor=$(STAGING_DIR)/usr \
+       --with-gnutls=$(STAGING_DIR)/usr \
+       --with-libgnurl=$(STAGING_DIR)/usr \
+       --with-libunistring-prefix=$(STAGING_DIR)/usr \
+       --with-microhttpd=$(STAGING_DIR)/usr
+
+# ToDo: request upstream to provide --with-pulseaudio=...
+TARGET_LDFLAGS+= -Wl,-rpath-link=$(STAGING_DIR)/usr/lib/pulseaudio
+
+define Package/gnunet/Default
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=GNUnet
+  URL:=https://www.gnunet.org/
+endef
+
+define Package/gnunet
+$(call Package/gnunet/Default)
+  TITLE+= - a peer-to-peer framework focusing on security
+  DEPENDS:=+ca-certificates +libgnurl +libgnutls +libidn +libltdl \
+           +libmicrohttpd +libunistring +librt
+  USERID:=gnunet=400:gnunet=400
+  MENU:=1
+endef
+
+define Package/gnunet/description
+ GNUnet is a peer-to-peer framework focusing on security. The first and
+ primary application for GNUnet is anonymous file-sharing.  GNUnet is
+ currently developed by a worldwide group of independent free software
+ developers.  GNUnet is a GNU package (http://www.gnu.org/).
+
+ This is an ALPHA release.  There are known and significant bugs as
+ well as many missing features in this release.
+
+ This package provides the core components of GNUnet including the
+ CADET routing engine, a DHT implementation and basic transports as
+ well as their helpers.
+endef
+
+define BuildComponent
+  define Package/gnunet-$(1)
+    $$(call Package/gnunet/Default)
+    TITLE+= $(2)
+    DEPENDS:=gnunet $(DEPENDS_$(1))
+    $(if $(3),DEFAULT:=y if PACKAGE_gnunet)
+    $(if $(USERID_$(1)),USERID:=$(USERID_$(1)))
+  endef
+
+  define Package/gnunet-$(1)/install
+       ( if [ "$(BIN_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/bin ; \
+               for bin in $(BIN_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$$$$$bin $$(1)/usr/bin/ ; \
+               done \
+       fi )
+
+       ( if [ "$(LIB_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib ; \
+               for lib in $(LIB_$(1)); do \
+                       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$$$$$lib.so* $$(1)/usr/lib/ ; \
+               done \
+       fi )
+
+       ( if [ "$(PLUGIN_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet ; \
+               for plug in $(PLUGIN_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$$$$$plug*.so $$(1)/usr/lib/gnunet ; \
+               done \
+       fi )
+
+       ( if [ "$(LIBEXEC_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/lib/gnunet/libexec ; \
+               for lex in $(LIBEXEC_$(1)); do \
+                       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$$$$$lex $$(1)/usr/lib/gnunet/libexec ; \
+               done \
+       fi )
+
+       ( if [ "$(CONF_$(1))" ]; then \
+               $(INSTALL_DIR) $$(1)/usr/share/gnunet/config.d ; \
+               for conf in $(CONF_$(1)); do \
+               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$$$$$conf.conf $$(1)/usr/share/gnunet/config.d ; \
+               done \
+       fi )
+  endef
+
+  $$(eval $$(call BuildPackage,gnunet-$(1)))
+endef
+
+define Package/gnunet/install
+       $(INSTALL_DIR) $(1)/usr/bin $(1)/usr/lib/gnunet/libexec
+       $(INSTALL_DIR) $(1)/usr/share/gnunet/config.d $(1)/usr/share/gnunet/hellos
+
+       ( for bin in arm ats core config ecc identity nat-server nse \
+           peerinfo peerstore revocation scalarproduct statistics transport uri; do \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/gnunet-$$$$bin $(1)/usr/bin/ ; \
+       done )
+
+       ( for lib in arm ats block cadet core datacache dht \
+           dns dnsparser dnsstub fragmentation friends hello identity nat nse \
+           peerinfo peerstore regexblock regex revocation scalarproduct set \
+           statistics transport util; do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/libgnunet$$$$lib.so* $(1)/usr/lib/ ; \
+       done )
+
+       ( for plug in ats_proportional block_dht block_regex datacache_heap  \
+           transport_tcp transport_udp transport_unix; do \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libgnunet_plugin_$$$$plug*.so $(1)/usr/lib/gnunet ; \
+       done )
+
+       ( for lex in daemon-hostlist daemon-topology helper-nat-client \
+           helper-nat-server service-arm service-ats service-cadet \
+           service-core service-dht service-identity service-nse \
+           service-peerinfo service-peerstore service-regex \
+           service-revocation service-scalarproduct-alice \
+           service-scalarproduct-bob service-set service-statistics \
+           service-transport; do \
+               $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/lib/gnunet/libexec/gnunet-$$$$lex $(1)/usr/lib/gnunet/libexec ; \
+       done )
+
+       ( for conf in arm ats cadet core datacache dht hostlist identity \
+           nat nse peerinfo peerstore regex revocation scalarproduct \
+           set statistics topology transport util; do \
+               $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/config.d/$$$$conf.conf $(1)/usr/share/gnunet/config.d ; \
+       done )
+
+       $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/gnunet/hellos/* $(1)/usr/share/gnunet/hellos
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/gnunet.init $(1)/etc/init.d/gnunet
+       $(INSTALL_DIR) $(1)/lib/upgrade/keep.d
+       $(INSTALL_DATA) ./files/gnunet.upgrade $(1)/lib/upgrade/keep.d/gnunet
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/gnunet $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/*.{la,so}* $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/gnunet/*.h $(1)/usr/include/gnunet
+endef
+
+DEPENDS_conversation:=+gnunet-gns +libgst1app +libgst1audio +libgstreamer1 +glib2 +pulseaudio-daemon +libopus +libogg
+BIN_conversation:=conversation conversation-test
+LIB_conversation:=conversation microphone speaker
+PLUGIN_conversation:=gnsrecord_conversation
+LIBEXEC_conversation:=helper-audio-playback helper-audio-record
+CONF_conversation:=conversation
+
+DEPENDS_transport-http_client:=+libgnurl
+PLUGIN_transport-http_client:=transport_http_client transport_https_client
+
+DEPENDS_transport-http_server:=+libmicrohttpd
+PLUGIN_transport-http_server:=transport_http_server transport_https_server
+
+PLUGIN_transport-wifi:=transport_wlan
+LIBEXEC_transport-wifi:=helper-transport-wlan
+
+DEPENDS_experiments:=+libglpk
+PLUGIN_experiments:=ats_mlp ats_ril
+
+DEPENDS_fs:=+gnunet-datastore +libextractor
+BIN_fs:=auto-share directory download download-manager.scm fs publish unindex search
+LIB_fs:=fs
+PLUGIN_fs:=block_fs
+LIBEXEC_fs:=helper-fs-publish service-fs
+CONF_fs:=fs
+
+DEPENDS_gns:=+gnunet-vpn
+USERID_gns:=gnunetdns=401:gnunetdns=401
+BIN_gns:=gns gns-import.sh namecache namestore resolver
+LIB_gns:=gns gnsrecord namecache namestore
+PLUGIN_gns:=block_dns block_gns gnsrecord_dns gnsrecord_gns
+LIBEXEC_gns:=dns2gns gns-proxy helper-dns namestore-fcfsd service-dns service-gns service-namecache service-namestore service-resolver
+CONF_gns:=dns gns namecache namestore resolver
+
+DEPENDS_datastore:=+gnunet-gns +libsqlite3
+BIN_datastore:=datastore
+LIB_datastore:=datastore
+PLUGIN_datastore:=datastore_heap
+LIBEXEC_datastore:=daemon-latency-logger service-datastore
+CONF_datastore:=datastore
+
+DEPENDS_mysql:=+gnunet-gns +gnunet-datastore +libmysqlclient
+LIB_mysql:=mysql
+PLUGIN_mysql:=datastore_mysql
+
+DEPENDS_pgsql:=+gnunet-gns +gnunet-datastore +libpq
+LIB_pgsql:=postgres
+PLUGIN_pgsql:=datacache_postgres datastore_postgres namecache_postgres namestore_postgres
+
+DEPENDS_sqlite:=+gnunet-gns +gnunet-datastore +libsqlite3
+PLUGIN_sqlite:=datacache_sqlite datastore_sqlite namecache_sqlite namestore_sqlite peerstore_sqlite
+
+DEPENDS_transport-bluetooth:=+bluez-libs
+PLUGIN_transport-bluetooth:=transport_bluetooth
+LIBEXEC_transport-bluetooth:=helper-transport-bluetooth
+
+DEPENDS_utils:=+certtool +openssl-util
+BIN_utils:=gns-proxy-setup-ca transport-certificate-creation
+
+DEPENDS_vpn:=+kmod-tun
+BIN_vpn:=vpn
+LIB_vpn:=tun vpn
+LIBEXEC_vpn:=daemon-exit daemon-pt helper-exit helper-vpn service-vpn
+CONF_vpn:=exit pt vpn
+
+$(eval $(call BuildPackage,gnunet))
+$(eval $(call BuildComponent,conversation,conversation component,))
+$(eval $(call BuildComponent,experiments,experimental components,))
+$(eval $(call BuildComponent,fs,file-sharing components,))
+$(eval $(call BuildComponent,gns,name resolution components,y))
+$(eval $(call BuildComponent,datastore,storage components,))
+$(eval $(call BuildComponent,transport-bluetooth,bluetooth transport,))
+$(eval $(call BuildComponent,transport-http_client,HTTP/HTTPS client transport,y))
+$(eval $(call BuildComponent,transport-http_server,HTTP/HTTPS server transport,))
+$(eval $(call BuildComponent,transport-wlan,WLAN transport,))
+$(eval $(call BuildComponent,utils,administration utililties,))
+$(eval $(call BuildComponent,vpn,vpn components,y))
+$(eval $(call BuildComponent,mysql,mySQL datastore backend,))
+$(eval $(call BuildComponent,pgsql,PostgreSQL backends,))
+$(eval $(call BuildComponent,sqlite,libsqlite3 backends,y))
diff --git a/trunk/package/network/services/gnunet/files/gnunet.init b/trunk/package/network/services/gnunet/files/gnunet.init
new file mode 100644 (file)
index 0000000..c21bbd5
--- /dev/null
@@ -0,0 +1,86 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2015 OpenWrt.org
+
+START=50
+STOP=10
+
+USE_PROCD=1
+PROG=/usr/lib/gnunet/libexec/gnunet-service-arm
+
+GNUNET_HOME=/var/run/gnunet
+LOGFILE=$GNUNET_HOME/gnunet.log
+CONFIGFILE=$GNUNET_HOME/gnunet.conf
+SUID_ROOT_HELPERS="exit nat-server nat-client transport-bluetooth transport-wlan vpn"
+
+chmodown_execbin() {
+       execname=/usr/lib/gnunet/libexec/gnunet-$1
+       if [ -x $execname ]; then
+               chmod $2 $execname
+               [ "$3" ] && chown $3 $execname
+       fi
+}
+
+fix_libexec_permissions() {
+       [ -e /usr/share/gnunet/.permfix ] && return
+       for helper in $SUID_ROOT_HELPERS; do
+               chmodown_execbin helper-$helper u+s
+       done
+       chmodown_execbin helper-dns 4750 root:gnunetdns
+       chmodown_execbin service-dns 2750 root:gnunetdns
+
+       touch /usr/share/gnunet/.permfix
+}
+
+prepare_config() {
+       if [ ! -e "$GNUNET_HOME" ]; then
+               mkdir -p $GNUNET_HOME
+               chown gnunet:gnunet $GNUNET_HOME
+               chmod 0750 $GNUNET_HOME
+       fi
+       touch $CONFIGFILE
+       chown root:gnunet $CONFIGFILE
+       chmod 0640 $CONFIGFILE
+       gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_HOME -V $GNUNET_HOME
+
+       # minimal persistency in /etc/gnunet
+       [ ! -d /etc/gnunet ] && {
+               mkdir -p /etc/gnunet
+               chown gnunet:gnunet /etc/gnunet
+       }
+       gnunet-config -c $CONFIGFILE -s PATHS -o GNUNET_CONFIG_HOME -V /etc/gnunet
+       gnunet-config -c $CONFIGFILE -s PEER -o PRIVATE_KEY -V /etc/gnunet/private_key.ecc
+       gnunet-config -c $CONFIGFILE -s identity -o EGODIR -V /etc/gnunet/identity/egos
+       gnunet-config -c $CONFIGFILE -s revocation -o DATABASE -V /etc/gnunet/revocation.dat
+       gnunet-config -c $CONFIGFILE -s nse -o PROOFFILE -V /etc/gnunet/proof.dat
+       gnunet-config -c $CONFIGFILE -s namestore-sqlite -o FILENAME -V /etc/gnunet/namestore.sqlite
+
+       # minimal datastore (todo: make this configurable)
+       gnunet-config -c $CONFIGFILE -s datastore -o QUOTA -V "4 MB"
+
+       # limit dhtcache memory usage to 4 MB
+       gnunet-config -c $CONFIGFILE -s dhtcache -o QUOTA -V "4 MB"
+
+       # enable dns2gns
+       gnunet-config -c $CONFIGFILE -s dns2gns -o AUTOSTART -V YES
+
+       # enable all installed transport plugins
+       transport_plugins=$(gnunet-config -c $CONFIGFILE -s transport -o PLUGINS)
+       for transplug in /usr/lib/gnunet/libgnunet_plugin_transport_*.so; do
+               transplug=$( echo $transplug |
+                       sed -ne 's!^.*_transport_\(.*\)\.so$!\1!p' )
+               [ -n "$( echo $transport_plugins | grep $transplug )" ] ||
+                       transport_plugins="$transport_plugins $transplug"
+       done
+       gnunet-config -c $CONFIGFILE -s transport -o PLUGINS -V "$transport_plugins"
+}
+
+start_service() {
+       fix_libexec_permissions
+       prepare_config
+
+       procd_open_instance
+       procd_set_param user gnunet
+       procd_set_param command $PROG -c $CONFIGFILE -l $LOGFILE
+       procd_set_param respawn
+       procd_close_instance
+}
diff --git a/trunk/package/network/services/gnunet/files/gnunet.upgrade b/trunk/package/network/services/gnunet/files/gnunet.upgrade
new file mode 100644 (file)
index 0000000..f488957
--- /dev/null
@@ -0,0 +1 @@
+/etc/gnunet
diff --git a/trunk/package/network/services/lighttpd/Makefile b/trunk/package/network/services/lighttpd/Makefile
new file mode 100644 (file)
index 0000000..b42e2a8
--- /dev/null
@@ -0,0 +1,187 @@
+#
+# Copyright (C) 2006-2013 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:=lighttpd
+PKG_VERSION:=1.4.35
+PKG_RELEASE:=5
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=http://download.lighttpd.net/lighttpd/releases-1.4.x
+PKG_MD5SUM:=c7ae774eab4cb7ac85e41b712f4ee9ba
+
+PKG_LICENSE:=BSD-3c
+PKG_LICENSE_FILES:=COPYING
+
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lighttpd/Default
+  SUBMENU:=Web Servers/Proxies
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://www.lighttpd.net/
+  MAINTAINER:=W. Michael Petullo <mike@flyn.org>
+endef
+
+define Package/lighttpd
+  $(call Package/lighttpd/Default)
+  MENU:=1
+  DEPENDS:=+LIGHTTPD_SSL:libopenssl +libpcre +libpthread
+  TITLE:=A flexible and lightweight web server
+endef
+
+define Package/lighttpd/config
+config LIGHTTPD_SSL
+       bool "SSL support"
+       depends on PACKAGE_lighttpd
+       default y
+       help
+         Implements SSL support in lighttpd (using libopenssl). This
+         option is required if you enable the SSL engine in your
+         lighttpd confguration file.
+endef
+
+CONFIGURE_ARGS+= \
+       --libdir=/usr/lib/lighttpd \
+       --sysconfdir=/etc/lighttpd \
+       --enable-shared \
+       --enable-static \
+       --disable-rpath \
+       --without-attr \
+       --without-bzip2 \
+       --without-fam \
+       --without-gdbm \
+       --without-ldap \
+       --with-lua \
+       --without-memcache \
+       --with-pcre \
+       --without-valgrind \
+        $(call autoconf_bool,CONFIG_IPV6,ipv6)
+
+CONFIGURE_VARS+= \
+       PCRE_LIB="-lpcre" \
+
+ifneq ($(strip $(CONFIG_LIGHTTPD_SSL)),)
+  CONFIGURE_ARGS+= \
+       --with-openssl="$(STAGING_DIR)/usr"
+else
+  CONFIGURE_ARGS+= \
+       --without-openssl
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-mysql-vhost),)
+  CONFIGURE_ARGS+= \
+       --with-mysql
+else
+  CONFIGURE_ARGS+= \
+       --without-mysql
+endif
+
+ifneq ($(SDK)$(CONFIG_PACKAGE_lighttpd-mod-webdav),)
+  CONFIGURE_ARGS+= \
+       --with-webdav-locks \
+       --with-webdav-props
+  # XXX: needed by sqlite3 to prevent segfaults in mod_webdav.so
+  CONFIGURE_VARS+= \
+       LIBS="-lpthread"
+else
+  CONFIGURE_ARGS+= \
+       --without-webdav-locks \
+       --without-webdav-props
+endif
+
+define Build/Configure
+$(call Build/Configure/Default)
+       # XXX: override pcre (mis)detection by ./configure when cross-compiling
+       echo "#define HAVE_LIBPCRE 1" >>$(PKG_BUILD_DIR)/config.h
+       echo "#define HAVE_PCRE_H 1" >>$(PKG_BUILD_DIR)/config.h
+endef
+
+define Package/lighttpd/conffiles
+/etc/lighttpd/lighttpd.conf
+endef
+
+define Package/lighttpd/install
+       $(INSTALL_DIR) $(1)/etc/lighttpd
+       $(INSTALL_DATA) ./files/lighttpd.conf $(1)/etc/lighttpd/
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/doc/config/conf.d/mime.conf $(1)/etc/lighttpd/
+       $(INSTALL_DIR) $(1)/etc/lighttpd/conf.d
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/lighttpd.init $(1)/etc/init.d/lighttpd
+       $(INSTALL_DIR) $(1)/usr/lib/lighttpd
+       for m in dirlisting indexfile staticfile; do \
+               $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$$$${m}.so $(1)/usr/lib/lighttpd/ ; \
+       done
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/lighttpd $(1)/usr/sbin/
+endef
+
+define BuildPlugin
+  define Package/lighttpd-mod-$(1)
+    $(call Package/lighttpd/Default)
+    DEPENDS:=lighttpd
+    ifneq ($(3),)
+      DEPENDS+= $(3)
+    endif
+    TITLE:=$(2) module
+  endef
+
+  define Package/lighttpd-mod-$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/lib/lighttpd
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/lighttpd/mod_$(1).so $$(1)/usr/lib/lighttpd
+       $(INSTALL_DIR) $$(1)/etc/lighttpd/conf.d
+       if [ -f $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf ]; then \
+               $(CP) $(PKG_BUILD_DIR)/doc/config/conf.d/$(1).conf $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
+       else \
+               echo 'server.modules += ( "mod_$(1)" )' > $$(1)/etc/lighttpd/conf.d/$(4)-$(1).conf ; \
+       fi
+  endef
+
+  $$(eval $$(call BuildPackage,lighttpd-mod-$(1)))
+endef
+
+$(eval $(call BuildPackage,lighttpd))
+
+# First, permit redirect from HTTP to HTTPS.
+$(eval $(call BuildPlugin,redirect,URL redirection,+PACKAGE_lighttpd-mod-redirect:libpcre,10))
+
+# Next, permit authentication.
+$(eval $(call BuildPlugin,auth,Authentication,,20))
+
+# Finally, everything else.
+$(eval $(call BuildPlugin,access,Access restrictions,,30))
+$(eval $(call BuildPlugin,accesslog,Access logging,,30))
+$(eval $(call BuildPlugin,alias,Directory alias,,30))
+$(eval $(call BuildPlugin,cgi,CGI,,30))
+$(eval $(call BuildPlugin,cml,Cache Meta Language,+liblua,30))
+$(eval $(call BuildPlugin,compress,Compress output,+PACKAGE_lighttpd-mod-compress:zlib,30))
+$(eval $(call BuildPlugin,evasive,Evasive,,30))
+$(eval $(call BuildPlugin,evhost,Exnhanced Virtual-Hosting,,30))
+$(eval $(call BuildPlugin,expire,Expire,,30))
+$(eval $(call BuildPlugin,extforward,Extract client,,30))
+$(eval $(call BuildPlugin,fastcgi,FastCGI,,30))
+$(eval $(call BuildPlugin,flv_streaming,FLV streaming,,30))
+$(eval $(call BuildPlugin,magnet,Magnet,+liblua,30))
+$(eval $(call BuildPlugin,mysql_vhost,Mysql virtual hosting,+PACKAGE_lighttpd-mod-mysql_vhost:libmysqlclient,30))
+$(eval $(call BuildPlugin,proxy,Proxy,,30))
+$(eval $(call BuildPlugin,rewrite,URL rewriting,+PACKAGE_lighttpd-mod-rewrite:libpcre,30))
+$(eval $(call BuildPlugin,rrdtool,RRDtool,,30))
+$(eval $(call BuildPlugin,scgi,SCGI,,30))
+$(eval $(call BuildPlugin,secdownload,Secure and fast download,,30))
+$(eval $(call BuildPlugin,setenv,Environment variable setting,,30))
+$(eval $(call BuildPlugin,simple_vhost,Simple virtual hosting,,30))
+$(eval $(call BuildPlugin,ssi,SSI,+libpcre,30))
+$(eval $(call BuildPlugin,status,Server status display,,30))
+$(eval $(call BuildPlugin,trigger_b4_dl,Trigger before download,+PACKAGE_lighttpd-mod-trigger_b4_dl:libpcre,30))
+$(eval $(call BuildPlugin,userdir,User directory,,30))
+$(eval $(call BuildPlugin,usertrack,User tracking,,30))
+$(eval $(call BuildPlugin,webdav,WebDAV,+PACKAGE_lighttpd-mod-webdav:libsqlite3 +PACKAGE_lighttpd-mod-webdav:libuuid +PACKAGE_lighttpd-mod-webdav:libxml2,30))
+
diff --git a/trunk/package/network/services/lighttpd/files/lighttpd.conf b/trunk/package/network/services/lighttpd/files/lighttpd.conf
new file mode 100644 (file)
index 0000000..04b06bc
--- /dev/null
@@ -0,0 +1,32 @@
+server.modules = (
+)
+
+server.document-root        = "/www"
+server.upload-dirs          = ( "/tmp" )
+server.errorlog             = "/var/log/lighttpd/error.log"
+server.pid-file             = "/var/run/lighttpd.pid"
+server.username             = "http"
+server.groupname            = "www-data"
+
+index-file.names            = ( "index.php", "index.html",
+                                "index.htm", "default.htm",
+                                "index.lighttpd.html" )
+
+static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )
+
+### Options that are useful but not always necessary:
+#server.chroot               = "/"
+#server.port                 = 81
+#server.bind                 = "localhost"
+#server.tag                  = "lighttpd"
+#server.errorlog-use-syslog  = "enable"
+#server.network-backend      = "write"
+
+### Use IPv6 if available
+#include_shell "/usr/share/lighttpd/use-ipv6.pl"
+
+#dir-listing.encoding        = "utf-8"
+#server.dir-listing          = "enable"
+
+include       "/etc/lighttpd/mime.conf"
+include_shell "cat /etc/lighttpd/conf.d/*.conf"
diff --git a/trunk/package/network/services/lighttpd/files/lighttpd.init b/trunk/package/network/services/lighttpd/files/lighttpd.init
new file mode 100644 (file)
index 0000000..936c7f6
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+SERVICE_USE_PID=1
+
+START=50
+
+start() {
+       user_exists http || user_add http
+       [ -d /var/log/lighttpd ] || {
+               mkdir -m 0775 -p /var/log/lighttpd
+               chgrp www-data /var/log/lighttpd
+       }
+       service_start /usr/sbin/lighttpd -f /etc/lighttpd/lighttpd.conf
+}
+
+stop() {
+       service_stop /usr/sbin/lighttpd
+}
+
diff --git a/trunk/package/network/services/miniupnpc/Makefile b/trunk/package/network/services/miniupnpc/Makefile
new file mode 100644 (file)
index 0000000..fbf6222
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2010-2012 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:=miniupnpc
+PKG_VERSION:=1.9
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://miniupnp.free.fr/files
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_MD5SUM:=5ef3ba321e6df72d6519b728b292073e
+PKG_MAINTAINER:=Steven Barth <cyrus@openwrt.org>
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/miniupnpc/Default
+  TITLE:=Lightweight UPnP
+  URL:=http://miniupnp.tuxfamily.org/
+endef
+
+define Package/miniupnpc
+  $(call Package/miniupnpc/Default)
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Firewall
+  TITLE+= client
+  DEPENDS:=+libminiupnpc
+endef
+
+define Package/libminiupnpc
+  $(call Package/miniupnpc/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE+= library
+endef
+
+TARGET_CFLAGS += $(FPIC)
+
+MAKE_FLAGS += \
+       OS="Linux" \
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/miniupnpc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/miniupnpc/*.h \
+               $(1)/usr/include/miniupnpc/
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/*.{so*,a} \
+               $(1)/usr/lib/
+endef
+
+define Package/miniupnpc/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/upnpc $(1)/usr/bin/
+endef
+
+define Package/libminiupnpc/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)/usr/lib/libminiupnpc.so.* \
+               $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,miniupnpc))
+$(eval $(call BuildPackage,libminiupnpc))
diff --git a/trunk/package/network/services/miniupnpc/patches/100-no_minixml_test.patch b/trunk/package/network/services/miniupnpc/patches/100-no_minixml_test.patch
new file mode 100644 (file)
index 0000000..93f6772
--- /dev/null
@@ -0,0 +1,13 @@
+--- a/Makefile
++++ b/Makefile
+@@ -151,8 +151,8 @@ installpythonmodule3:      pythonmodule3
+       python3 setup.py install
+ validateminixml:      minixmlvalid
+-      @echo "minixml validation test"
+-      ./minixmlvalid
++      @echo "(skipping) minixml validation test"
++#     ./minixmlvalid
+       touch $@
+ validateminiwget:     testminiwget minihttptestserver testminiwget.sh
diff --git a/trunk/package/network/services/miniupnpc/patches/200-miniupnpc_desc.patch b/trunk/package/network/services/miniupnpc/patches/200-miniupnpc_desc.patch
new file mode 100644 (file)
index 0000000..320707e
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/upnpcommands.c
++++ b/upnpcommands.c
+@@ -367,7 +367,7 @@ UPNP_AddPortMapping(const char * control
+       AddPortMappingArgs[5].elt = "NewEnabled";
+       AddPortMappingArgs[5].val = "1";
+       AddPortMappingArgs[6].elt = "NewPortMappingDescription";
+-      AddPortMappingArgs[6].val = desc?desc:"libminiupnpc";
++      AddPortMappingArgs[6].val = desc?desc:"miniupnpc";
+       AddPortMappingArgs[7].elt = "NewLeaseDuration";
+       AddPortMappingArgs[7].val = leaseDuration?leaseDuration:"0";
+       if(!(buffer = simpleUPnPcommand(-1, controlURL, servicetype,
diff --git a/trunk/package/network/services/nginx/Config.in b/trunk/package/network/services/nginx/Config.in
new file mode 100644 (file)
index 0000000..b135e42
--- /dev/null
@@ -0,0 +1,192 @@
+#
+# Copyright (C) 2010-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+menu "Configuration"
+        depends on PACKAGE_nginx
+
+config NGINX_STUB_STATUS
+       bool
+       prompt "Enable stub status module"
+       help
+               Enable the stub status module which gives some status from the server.
+
+config NGINX_FLV
+       bool
+       prompt "Enable FLV module"
+       help
+               Provides the ability to seek within FLV (Flash) files using time-based offsets.
+
+config NGINX_SSL
+       bool
+       prompt "Enable SSL module"
+       help
+               Enable HTTPS/SSL support.
+
+config NGINX_DAV
+       bool
+       prompt "Enable WebDAV module"
+       help
+               Enable the HTTP and WebDAV methods PUT, DELETE, MKCOL, COPY and MOVE.
+
+config NGINX_LUA
+       bool
+       prompt "Enable LUA module"
+       help
+               Enable support for LUA scripts.
+
+config NGINX_PCRE
+       bool
+       prompt "Enable PCRE library usage"
+       default y
+
+config NGINX_HTTP_CACHE
+       bool
+       prompt "Enable HTTP cache"
+
+config NGINX_HTTP_CHARSET
+       bool
+       prompt "Enable HTTP charset module"
+       default y
+
+config NGINX_HTTP_GZIP
+       bool
+       prompt "Enable HTTP gzip module"
+       default y
+
+config NGINX_HTTP_SSI
+       bool
+       prompt "Enable HTTP ssi module"
+       default y
+
+config NGINX_HTTP_USERID
+       bool
+       prompt "Enable HTTP userid module"
+       default y
+
+config NGINX_HTTP_ACCESS
+       bool
+       prompt "Enable HTTP access module"
+       default y
+
+config NGINX_HTTP_AUTH_BASIC
+       bool
+       prompt "Enable HTTP auth basic"
+       default y
+
+config NGINX_HTTP_AUTOINDEX
+       bool
+       prompt "Enable HTTP autoindex module"
+       default y
+
+config NGINX_HTTP_GEO
+       bool
+       prompt "Enable HTTP geo module"
+       default y
+
+config NGINX_HTTP_MAP
+       bool
+       prompt "Enable HTTP map module"
+       default y
+
+config NGINX_HTTP_SPLIT_CLIENTS
+       bool
+       prompt "Enable HTTP split clients"
+       default y
+
+config NGINX_HTTP_REFERER
+       bool
+       prompt "Enable HTTP referer module"
+       default y
+
+config NGINX_HTTP_REWRITE
+       bool
+       prompt "Enable HTTP rewrite module"
+       select NGINX_PCRE
+       default y
+
+config NGINX_HTTP_PROXY
+       bool
+       prompt "Enable HTTP proxy module"
+       default y
+
+config NGINX_HTTP_FASTCGI
+       bool
+       prompt "Enable HTTP fastcgi module"
+       default y
+
+config NGINX_HTTP_UWSGI
+       bool
+       prompt "Enable HTTP uwsgi module"
+       default y
+
+config NGINX_HTTP_SCGI
+       bool
+       prompt "Enable HTTP scgi module"
+       default y
+
+config NGINX_HTTP_MEMCACHED
+       bool
+       prompt "Enable HTTP memcached module"
+       default y
+
+config NGINX_HTTP_LIMIT_CONN
+       bool
+       prompt "Enable HTTP limit conn"
+       default y
+
+config NGINX_HTTP_LIMIT_REQ
+       bool
+       prompt "Enable HTTP limit req"
+       default y
+
+config NGINX_HTTP_EMPTY_GIF
+       bool
+       prompt "Enable HTTP empty gif"
+       default y
+
+config NGINX_HTTP_BROWSER
+       bool
+       prompt "Enable HTTP browser module"
+       default y
+
+config NGINX_HTTP_UPSTREAM_IP_HASH
+       bool
+       prompt "Enable HTTP IP hash module"
+       default y
+
+config NGINX_NAXSI
+       bool
+       prompt "Enable NAXSI module"
+       select PACKAGE_nginx-naxsi
+       default y
+       help
+               Enable support for NAXSI WAF.
+
+config NGINX_PROXYPROTOCOL
+       bool
+       prompt "Enable HAProxy proxyprotocol"
+       select PACKAGE_nginx-proxyprotocol
+       select NGINX_SSL
+       default n
+       help
+               Enable support for PROXY PROTOCOL
+
+config NGINX_SYSLOG
+       bool
+       prompt "Enable Syslog module"
+       select PACKAGE_nginx-syslog
+       default y
+       help
+               Provides the ability log to a remote destination
+
+config NGINX_HTTP_UPSTREAM_CHECK
+       bool
+       select NGINX_SSL
+       prompt "Enable HTTP upstream check module"
+       default n
+
+endmenu
diff --git a/trunk/package/network/services/nginx/Makefile b/trunk/package/network/services/nginx/Makefile
new file mode 100644 (file)
index 0000000..667bacb
--- /dev/null
@@ -0,0 +1,334 @@
+#
+# Copyright (C) 2012-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:=nginx
+PKG_VERSION:=1.4.7
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://nginx.org/download/
+PKG_MD5SUM:=aee151d298dcbfeb88b3f7dd3e7a4d17
+PKG_MAINTAINER:=Thomas Heil <heil@terminal-consulting.de>
+PKG_LICENSE:=2-clause BSD-like license
+
+PKG_BUILD_PARALLEL:=1
+PKG_INSTALL:=1
+
+PKG_CONFIG_DEPENDS := \
+       CONFIG_NGINX_STUB_STATUS \
+       CONFIG_NGINX_FLV \
+       CONFIG_NGINX_SSL \
+       CONFIG_NGINX_DAV \
+       CONFIG_NGINX_LUA \
+       CONFIG_NGINX_PCRE \
+       CONFIG_NGINX_HTTP_CACHE \
+       CONFIG_NGINX_HTTP_CHARSET \
+       CONFIG_NGINX_HTTP_GZIP \
+       CONFIG_NGINX_HTTP_SSI \
+       CONFIG_NGINX_HTTP_USERID \
+       CONFIG_NGINX_HTTP_ACCESS \
+       CONFIG_NGINX_HTTP_AUTH_BASIC \
+       CONFIG_NGINX_HTTP_AUTOINDEX \
+       CONFIG_NGINX_HTTP_GEO \
+       CONFIG_NGINX_HTTP_MAP \
+       CONFIG_NGINX_HTTP_SPLIT_CLIENTS \
+       CONFIG_NGINX_HTTP_REFERER \
+       CONFIG_NGINX_HTTP_REWRITE \
+       CONFIG_NGINX_HTTP_PROXY \
+       CONFIG_NGINX_HTTP_FASTCGI \
+       CONFIG_NGINX_HTTP_UWSGI \
+       CONFIG_NGINX_HTTP_SCGI \
+       CONFIG_NGINX_HTTP_MEMCACHED \
+       CONFIG_NGINX_HTTP_LIMIT_CONN \
+       CONFIG_NGINX_HTTP_LIMIT_REQ \
+       CONFIG_NGINX_HTTP_EMPTY_GIF \
+       CONFIG_NGINX_HTTP_BROWSER \
+       CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/nginx
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=Web Servers/Proxies
+  TITLE:=Nginx web server
+  URL:=http://nginx.org/
+  DEPENDS:=+NGINX_PCRE:libpcre +(NGINX_SSL||NGINX_HTTP_CACHE||NGINX_HTTP_AUTH_BASIC):libopenssl +NGINX_HTTP_GZIP:zlib +libpthread +NGINX_LUA:liblua
+  MENU:=1
+endef
+
+define Package/nginx/description
+ nginx is an HTTP and reverse proxy server, as well as a mail proxy server,
+ written by Igor Sysoev.
+endef
+
+define Package/nginx/config
+  source "$(SOURCE)/Config.in"
+endef
+
+config_files=nginx.conf mime.types fastcgi_params koi-utf koi-win win-utf
+
+define Package/nginx/conffiles
+/etc/nginx/
+endef
+
+ADDITIONAL_MODULES:=
+ifeq ($(CONFIG_NGINX_NAXSI),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-naxsi/naxsi_src
+endif
+ifeq ($(CONFIG_IPV6),y)
+  ADDITIONAL_MODULES += --with-ipv6
+endif
+ifeq ($(CONFIG_NGINX_STUB_STATUS),y)
+  ADDITIONAL_MODULES += --with-http_stub_status_module
+endif
+ifeq ($(CONFIG_NGINX_FLV),y)
+  ADDITIONAL_MODULES += --with-http_flv_module
+endif
+ifeq ($(CONFIG_NGINX_SSL),y)
+  ADDITIONAL_MODULES += --with-http_ssl_module
+endif
+ifeq ($(CONFIG_NGINX_DAV),y)
+  ADDITIONAL_MODULES += --with-http_dav_module
+endif
+ifeq ($(CONFIG_NGINX_LUA),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/lua-nginx
+endif
+ifneq ($(CONFIG_NGINX_HTTP_CACHE),y)
+  ADDITIONAL_MODULES += --without-http-cache
+endif
+ifneq ($(CONFIG_NGINX_PCRE),y)
+  ADDITIONAL_MODULES += --without-pcre
+endif
+ifneq ($(CONFIG_NGINX_HTTP_CHARSET),y)
+  ADDITIONAL_MODULES += --without-http_charset_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_GZIP),y)
+  ADDITIONAL_MODULES += --without-http_gzip_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_SSI),y)
+  ADDITIONAL_MODULES += --without-http_ssi_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_USERID),y)
+  ADDITIONAL_MODULES += --without-http_userid_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_ACCESS),y)
+  ADDITIONAL_MODULES += --without-http_access_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_AUTH_BASIC),y)
+  ADDITIONAL_MODULES += --without-http_auth_basic_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_AUTOINDEX),y)
+  ADDITIONAL_MODULES += --without-http_autoindex_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_GEO),y)
+  ADDITIONAL_MODULES += --without-http_geo_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_MAP),y)
+  ADDITIONAL_MODULES += --without-http_map_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_SPLIT_CLIENTS),y)
+  ADDITIONAL_MODULES += --without-http_split_clients_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_REFERER),y)
+  ADDITIONAL_MODULES += --without-http_referer_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_REWRITE),y)
+  ADDITIONAL_MODULES += --without-http_rewrite_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_PROXY),y)
+  ADDITIONAL_MODULES += --without-http_proxy_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_FASTCGI),y)
+  ADDITIONAL_MODULES += --without-http_fastcgi_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_UWSGI),y)
+  ADDITIONAL_MODULES += --without-http_uwsgi_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_SCGI),y)
+  ADDITIONAL_MODULES += --without-http_scgi_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_MEMCACHED),y)
+  ADDITIONAL_MODULES += --without-http_memcached_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_LIMIT_CONN),y)
+  ADDITIONAL_MODULES += --without-http_limit_conn_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_LIMIT_REQ),y)
+  ADDITIONAL_MODULES += --without-http_limit_req_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_EMPTY_GIF),y)
+  ADDITIONAL_MODULES += --without-http_empty_gif_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_BROWSER),y)
+  ADDITIONAL_MODULES += --without-http_browser_module
+endif
+ifneq ($(CONFIG_NGINX_HTTP_UPSTREAM_IP_HASH),y)
+  ADDITIONAL_MODULES += --without-http_upstream_ip_hash_module
+endif
+ifeq ($(CONFIG_NGINX_PROXYPROTOCOL),y)
+  ADDITIONAL_MODULES += --with-proxy-protocol
+endif
+ifeq ($(CONFIG_NGINX_SYSLOG),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-syslog
+endif
+ifeq ($(CONFIG_NGINX_HTTP_UPSTREAM_CHECK),y)
+  ADDITIONAL_MODULES += --add-module=$(PKG_BUILD_DIR)/nginx-upstream-check
+endif
+
+define Build/Configure
+       # TODO: fix --crossbuild
+       (cd $(PKG_BUILD_DIR) ;\
+               $(if $(CONFIG_NGINX_LUA),LUA_INC=$(STAGING_DIR)/usr/include LUA_LIB=$(STAGING_DIR)/usr/lib) \
+               ./configure \
+                       --crossbuild=Linux::$(ARCH) \
+                       --prefix=/usr \
+                       --conf-path=/etc/nginx/nginx.conf \
+                       $(ADDITIONAL_MODULES) \
+                       --error-log-path=/var/log/nginx/error.log \
+                       --pid-path=/var/run/nginx.pid \
+                       --lock-path=/var/lock/nginx.lock \
+                       --http-log-path=/var/log/nginx/access.log \
+                       --http-client-body-temp-path=/var/lib/nginx/body \
+                       --http-proxy-temp-path=/var/lib/nginx/proxy \
+                       --http-fastcgi-temp-path=/var/lib/nginx/fastcgi \
+                       --with-cc="$(TARGET_CC)" \
+                       --with-cc-opt="$(TARGET_CPPFLAGS) $(TARGET_CFLAGS)" \
+                       --with-ld-opt="$(TARGET_LDFLAGS)" )
+endef
+
+define Package/nginx/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/nginx $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/nginx
+       $(INSTALL_DATA) $(addprefix $(PKG_INSTALL_DIR)/etc/nginx/,$(config_files)) $(1)/etc/nginx/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/nginx.init $(1)/etc/init.d/nginx
+endef
+
+define Build/Prepare
+       $(call Build/Prepare/Default)
+       $(if $(CONFIG_NGINX_LUA),$(call Prepare/lua-nginx))
+       $(if $(CONFIG_NGINX_NAXSI),$(call Prepare/nginx-naxsi))
+       $(if $(CONFIG_NGINX_SYSLOG),$(call Prepare/nginx-syslog))
+       $(if $(CONFIG_NGINX_HTTP_UPSTREAM_CHECK),$(call Prepare/nginx-upstream-check))
+endef
+
+define Download/lua-nginx
+       VERSION:=d3ab0edd45bffe1b9a36abdf5bff544de436ccee
+       SUBDIR:=lua-nginx
+       FILE:=lua-nginx-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+       URL:=https://github.com/chaoslawful/lua-nginx-module.git
+       PROTO:=git
+endef
+
+define  Prepare/lua-nginx
+       $(eval $(call Download,lua-nginx))
+       gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+       $(call PatchDir,$(PKG_BUILD_DIR),./patches-lua-nginx)
+endef
+
+define Download/nginx-upstream-check
+       VERSION:=d40b9f956d9d978005bb15616d2f283d4e3d2031
+       SUBDIR:=nginx-upstream-check
+       FILE:=nginx-upstream-check-$(PKG_VERSION)-$$(VERSION).tar.gz
+       URL:=https://github.com/yaoweibin/nginx_upstream_check_module.git
+       PROTO:=git
+endef
+
+define  Prepare/nginx-upstream-check
+       $(eval $(call Download,nginx-upstream-check))
+       gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+       $(call PatchDir,$(PKG_BUILD_DIR),./patches-nginx-upstream-check)
+endef
+
+
+define Package/nginx-naxsi
+        MENU:=1
+        $(call Package/nginx)
+        TITLE:=nginx-naxsi
+        DEPENDS:=nginx @NGINX_NAXSI
+endef
+
+define Package/nginx-naxsi/description
+        NGINX WAF NAXSI
+endef
+
+define Package/nginx-proxyprotocol
+        MENU:=1
+        $(call Package/nginx)
+        TITLE:=nginx 
+        DEPENDS:=nginx @NGINX_PROXYPROTOCOL
+endef
+
+define Package/nginx-proxyprotocol/description
+        IMPLEMENT Proxy Protocol
+endef
+
+define Package/nginx-syslog
+        MENU:=1
+        $(call Package/nginx)
+        TITLE:=nginx-syslog
+        DEPENDS:=nginx @NGINX_SYSLOG
+endef
+
+define Package/nginx-syslog/description
+        IMPLEMENT Syslog Protocol
+endef
+
+define Download/nginx-naxsi
+       VERSION:=34dcb45fe4fdcb144c5258d83672f8e1e1c8db2e
+       SUBDIR:=nginx-naxsi
+       FILE:=nginx-naxsi-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+       URL:=https://github.com/nbs-system/naxsi.git
+       PROTO:=git
+endef
+
+define  Prepare/nginx-naxsi
+       $(eval $(call Download,nginx-naxsi))
+       gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+endef
+
+define Package/nginx-naxsi/install
+       $(INSTALL_DIR) $(1)/etc/nginx
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/nginx-naxsi/naxsi_config/naxsi_core.rules $(1)/etc/nginx
+       chmod 0640 $(1)/etc/nginx/naxsi_core.rules
+endef
+
+define Download/nginx-syslog
+       VERSION:=7abf48e52552c40a21463e1a8c608e0e575261cd
+       SUBDIR:=nginx-syslog
+       FILE:=nginx-syslog-module-$(PKG_VERSION)-$$(VERSION).tar.gz
+       URL:=https://github.com/splitice/nginx_syslog_patch.git
+       PROTO:=git
+endef
+
+define  Prepare/nginx-syslog
+       $(eval $(call Download,nginx-syslog))
+       gzip -dc $(DL_DIR)/$(FILE) | tar -C $(PKG_BUILD_DIR) $(TAR_OPTIONS)
+endef
+
+define Package/nginx-proxyprotocol/install
+       $(INSTALL_DIR) $(1)/etc/nginx
+       $(INSTALL_BIN) ./files/nginx.proxyprotocol.example $(1)/etc/nginx/nginx.conf.proxyprotocol
+       chmod 0640 $(1)/etc/nginx/nginx.conf.proxyprotocol
+endef
+
+define Package/nginx-syslog/install
+       $(INSTALL_DIR) $(1)/etc/nginx
+       $(INSTALL_BIN) ./files/nginx.syslog.example $(1)/etc/nginx/nginx.conf.syslog
+       chmod 0640 $(1)/etc/nginx/nginx.conf.syslog
+endef
+
+
+$(eval $(call BuildPackage,nginx))
+$(eval $(call BuildPackage,nginx-naxsi))
+$(eval $(call BuildPackage,nginx-proxyprotocol))
+$(eval $(call BuildPackage,nginx-syslog))
+
diff --git a/trunk/package/network/services/nginx/files/nginx.init b/trunk/package/network/services/nginx/files/nginx.init
new file mode 100644 (file)
index 0000000..adf36b4
--- /dev/null
@@ -0,0 +1,24 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2009-2012 OpenWrt.org
+
+START=50
+NGINX_BIN=/usr/sbin/nginx
+
+start() {
+       mkdir -p /var/log/nginx
+       mkdir -p /var/lib/nginx
+       $NGINX_BIN
+}
+
+stop() {
+       $NGINX_BIN -s stop
+}
+
+reload() {
+       $NGINX_BIN -s reload
+}
+
+shutdown() {
+       $NGINX_BIN -s quit
+}
+
diff --git a/trunk/package/network/services/nginx/files/nginx.proxyprotocol.example b/trunk/package/network/services/nginx/files/nginx.proxyprotocol.example
new file mode 100644 (file)
index 0000000..ab4bad6
--- /dev/null
@@ -0,0 +1,40 @@
+worker_processes  1;
+pid /tmp/nginx.pid;
+daemon off;
+master_process off;
+error_log stderr debug_core;
+
+events {
+ debug_connection <YOUR IPv4>;
+ debug_connection <YOUR IPV6>;
+ worker_connections  1024;
+}
+
+http {
+ default_type  application/octet-stream;
+ client_body_temp_path /tmp/body 1;
+
+ access_log /tmp/nginx_access.log;
+
+ server {
+#  listen       8082 ssl;
+# proxy protocol configuration for nginx 1.4.x:
+  listen       8082 accept_proxy_protocol=on;
+# same with spdy enabled:
+#  listen       8082 spdy ssl accept_proxy_protocol=on;
+  listen       [::]:8082 ipv6only=on;
+  ssl_certificate /your/certificate;
+  ssl_certificate_key /your/key;
+  server_name  localhost;
+# proxy protocol configuration for nginx 1.2.x:
+#  accept_proxy_protocol on;
+  location / {
+   proxy_pass        http://127.0.0.1:8084;
+   proxy_set_header  X-Real-IP  $remote_addr;
+   proxy_connect_timeout 10s;
+   proxy_read_timeout 10s;
+   send_proxy_protocol on;
+  }
+ }
+}
diff --git a/trunk/package/network/services/nginx/files/nginx.syslog.example b/trunk/package/network/services/nginx/files/nginx.syslog.example
new file mode 100644 (file)
index 0000000..0594344
--- /dev/null
@@ -0,0 +1,59 @@
+worker_processes  1;
+
+syslog local6 nginx;
+
+events {
+        worker_connections  1024;
+}
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+
+    log_format  main  '$remote_addr - $remote_user [$time_local] $request '
+        '"$status" $body_bytes_sent "$http_referer" '
+        '"$http_user_agent" "$http_x_forwarded_for"';
+
+    server {
+        listen       80;
+        server_name  localhost;
+
+        #send the log to syslog and file.
+        access_log  syslog:notice|logs/host1.access.log main;
+
+        # pre 1.5.x
+        error_log syslog:notice|logs/host1.error.log;
+
+        location / {
+            root   html;
+            index  index.html index.htm;
+        }
+    }
+
+    server {
+        listen       80;
+        server_name  www.example.com;
+
+        access_log  syslog:warn|logs/host2.access.log main;
+        error_log syslog:warn|logs/host2.error.log;
+
+        location / {
+            root   html;
+            index  index.html index.htm;
+        }
+    }
+
+    server {
+        listen       80;
+        server_name  www.test.com;
+
+        #send the log just to syslog.
+        access_log  syslog:error main;
+        error_log syslog:error;
+
+        location / {
+            root   html;
+            index  index.html index.htm;
+        }
+    }
+}
diff --git a/trunk/package/network/services/nginx/patches-lua-nginx/300-ldl.patch b/trunk/package/network/services/nginx/patches-lua-nginx/300-ldl.patch
new file mode 100644 (file)
index 0000000..d826bcf
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/lua-nginx/config
++++ b/lua-nginx/config
+@@ -1,5 +1,5 @@
+ ngx_feature="Lua library"
+-ngx_feature_libs="-llua -lm"
++ngx_feature_libs="-llua -lm -ldl"
+ ngx_feature_name=
+ ngx_feature_run=no
+ ngx_feature_incs="#include <lauxlib.h>"
+@@ -47,9 +47,9 @@ else
+         ngx_feature="Lua library in $LUA_LIB and $LUA_INC (specified by the LUA_LIB and LUA_INC env)"
+         ngx_feature_path="$LUA_INC"
+         if [ $NGX_RPATH = YES ]; then
+-            ngx_feature_libs="-R$LUA_LIB -L$LUA_LIB -llua -lm"
++            ngx_feature_libs="-R$LUA_LIB -L$LUA_LIB -llua -lm -ldl"
+         else
+-            ngx_feature_libs="-L$LUA_LIB -llua -lm"
++            ngx_feature_libs="-L$LUA_LIB -llua -lm -ldl"
+         fi
+         . auto/feature
diff --git a/trunk/package/network/services/nginx/patches-nginx-upstream-check/check_1.2.6+.patch b/trunk/package/network/services/nginx/patches-nginx-upstream-check/check_1.2.6+.patch
new file mode 100644 (file)
index 0000000..3ab9134
--- /dev/null
@@ -0,0 +1,209 @@
+diff --git a/src/http/modules/ngx_http_upstream_ip_hash_module.c b/src/http/modules/ngx_http_upstream_ip_hash_module.c
+index 89ccc2b..a552044 100644
+--- a/src/http/modules/ngx_http_upstream_ip_hash_module.c
++++ b/src/http/modules/ngx_http_upstream_ip_hash_module.c
+@@ -9,6 +9,10 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
++
+ typedef struct {
+     /* the round robin data must be first */
+@@ -208,6 +212,12 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
+             if (!peer->down) {
++#if (NGX_UPSTREAM_CHECK_MODULE)
++                ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++                               "get ip_hash peer, check_index: %ui",
++                               peer->check_index);
++                if (!ngx_http_check_peer_down(peer->check_index)) {
++#endif
+                 if (peer->max_fails == 0 || peer->fails < peer->max_fails) {
+                     break;
+                 }
+@@ -216,6 +226,9 @@ ngx_http_upstream_get_ip_hash_peer(ngx_peer_connection_t *pc, void *data)
+                     peer->checked = now;
+                     break;
+                 }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++                }
++#endif
+             }
+             iphp->rrp.tried[n] |= m;
+diff --git a/src/http/modules/ngx_http_upstream_least_conn_module.c b/src/http/modules/ngx_http_upstream_least_conn_module.c
+index 21156ae..c57393d 100644
+--- a/src/http/modules/ngx_http_upstream_least_conn_module.c
++++ b/src/http/modules/ngx_http_upstream_least_conn_module.c
+@@ -9,6 +9,10 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
++
+ typedef struct {
+     ngx_uint_t                        *conns;
+@@ -203,6 +207,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
+             continue;
+         }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++        ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++                "get least_conn peer, check_index: %ui",
++                peer->check_index);
++
++        if (ngx_http_check_peer_down(peer->check_index)) {
++            continue;
++        }
++#endif
++
+         if (peer->max_fails
+             && peer->fails >= peer->max_fails
+             && now - peer->checked <= peer->fail_timeout)
+@@ -256,6 +270,16 @@ ngx_http_upstream_get_least_conn_peer(ngx_peer_connection_t *pc, void *data)
+                 continue;
+             }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++            ngx_log_debug1(NGX_LOG_DEBUG_HTTP, pc->log, 0,
++                    "get least_conn peer, check_index: %ui",
++                    peer->check_index);
++
++            if (ngx_http_check_peer_down(peer->check_index)) {
++                continue;
++            }
++#endif
++
+             if (lcp->conns[i] * best->weight != lcp->conns[p] * peer->weight) {
+                 continue;
+             }
+diff --git a/src/http/ngx_http_upstream_round_robin.c b/src/http/ngx_http_upstream_round_robin.c
+index 4b78cff..f077b46 100644
+--- a/src/http/ngx_http_upstream_round_robin.c
++++ b/src/http/ngx_http_upstream_round_robin.c
+@@ -9,6 +9,9 @@
+ #include <ngx_core.h>
+ #include <ngx_http.h>
++#if (NGX_UPSTREAM_CHECK_MODULE)
++#include "ngx_http_upstream_check_handler.h"
++#endif
+ static ngx_int_t ngx_http_upstream_cmp_servers(const void *one,
+     const void *two);
+@@ -87,7 +90,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+                 peers->peer[n].weight = server[i].weight;
+                 peers->peer[n].effective_weight = server[i].weight;
+                 peers->peer[n].current_weight = 0;
+-                n++;
++
++#if (NGX_UPSTREAM_CHECK_MODULE)
++                if (!server[i].down) {
++                    peers->peer[n].check_index =
++                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
++                }
++                else {
++                    peers->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
++                }
++#endif
++               n++;
+             }
+         }
+@@ -145,6 +158,17 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+                 backup->peer[n].max_fails = server[i].max_fails;
+                 backup->peer[n].fail_timeout = server[i].fail_timeout;
+                 backup->peer[n].down = server[i].down;
++
++#if (NGX_UPSTREAM_CHECK_MODULE)
++                if (!server[i].down) {
++                    backup->peer[n].check_index =
++                        ngx_http_check_add_peer(cf, us, &server[i].addrs[j]);
++                }
++                else {
++                    backup->peer[n].check_index = (ngx_uint_t) NGX_ERROR;
++                }
++#endif
++
+                 n++;
+             }
+         }
+@@ -206,6 +230,9 @@ ngx_http_upstream_init_round_robin(ngx_conf_t *cf,
+         peers->peer[i].current_weight = 0;
+         peers->peer[i].max_fails = 1;
+         peers->peer[i].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++        peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+     }
+     us->peer.data = peers;
+@@ -323,6 +350,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
+         peers->peer[0].current_weight = 0;
+         peers->peer[0].max_fails = 1;
+         peers->peer[0].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++        peers->peer[0].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+     } else {
+@@ -356,6 +386,9 @@ ngx_http_upstream_create_round_robin_peer(ngx_http_request_t *r,
+             peers->peer[i].current_weight = 0;
+             peers->peer[i].max_fails = 1;
+             peers->peer[i].fail_timeout = 10;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++            peers->peer[i].check_index = (ngx_uint_t) NGX_ERROR;
++#endif
+         }
+     }
+@@ -434,6 +467,12 @@ ngx_http_upstream_get_round_robin_peer(ngx_peer_connection_t *pc, void *data)
+             goto failed;
+         }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++        if (ngx_http_check_peer_down(peer->check_index)) {
++            goto failed;
++        }
++#endif
++
+     } else {
+         /* there are several peers */
+@@ -531,6 +570,12 @@ ngx_http_upstream_get_peer(ngx_http_upstream_rr_peer_data_t *rrp)
+             continue;
+         }
++#if (NGX_UPSTREAM_CHECK_MODULE)
++        if (ngx_http_check_peer_down(peer->check_index)) {
++            continue;
++        }
++#endif
++
+         if (peer->max_fails
+             && peer->fails >= peer->max_fails
+             && now - peer->checked <= peer->fail_timeout)
+diff --git a/src/http/ngx_http_upstream_round_robin.h b/src/http/ngx_http_upstream_round_robin.h
+index 3f8cbf8..1613168 100644
+--- a/src/http/ngx_http_upstream_round_robin.h
++++ b/src/http/ngx_http_upstream_round_robin.h
+@@ -30,6 +30,10 @@ typedef struct {
+     ngx_uint_t                      max_fails;
+     time_t                          fail_timeout;
++#if (NGX_UPSTREAM_CHECK_MODULE)
++    ngx_uint_t                      check_index;
++#endif
++
+     ngx_uint_t                      down;          /* unsigned  down:1; */
+ #if (NGX_HTTP_SSL)
diff --git a/trunk/package/network/services/nginx/patches/100-musl-no-sysctl.patch b/trunk/package/network/services/nginx/patches/100-musl-no-sysctl.patch
new file mode 100644 (file)
index 0000000..4e35bf6
--- /dev/null
@@ -0,0 +1,35 @@
+Index: nginx-1.4.7/src/os/unix/ngx_linux_config.h
+===================================================================
+--- nginx-1.4.7.orig/src/os/unix/ngx_linux_config.h
++++ nginx-1.4.7/src/os/unix/ngx_linux_config.h
+@@ -51,7 +51,6 @@
+ #include <malloc.h>             /* memalign() */
+ #include <limits.h>             /* IOV_MAX */
+ #include <sys/ioctl.h>
+-#include <sys/sysctl.h>
+ #include <crypt.h>
+ #include <sys/utsname.h>        /* uname() */
+
+--- nginx-1.2.7/src/os/unix/ngx_user.c
++++ nginx-1.2.7-patched/src/os/unix/ngx_user.c
+@@ -31,8 +31,6 @@
+     struct crypt_data   cd;
+     cd.initialized = 0;
+-    /* work around the glibc bug */
+-    cd.current_salt[0] = ~salt[0];
+     value = crypt_r((char *) key, (char *) salt, &cd);
+
+diff --git a/auto/lib/openssl/conf b/auto/lib/openssl/conf
+index 528ee17..73ef359 100644
+--- a/auto/lib/openssl/conf
++++ b/auto/lib/openssl/conf
+@@ -47,7 +47,7 @@ else
+         ngx_feature_run=no
+         ngx_feature_incs="#include <openssl/ssl.h>"
+         ngx_feature_path=
+-        ngx_feature_libs="-lssl -lcrypto"
++        ngx_feature_libs="-lssl -lcrypto -lz"
+         ngx_feature_test="SSL_library_init()"
+         . auto/feature
diff --git a/trunk/package/network/services/nginx/patches/101-feature_test_fix.patch b/trunk/package/network/services/nginx/patches/101-feature_test_fix.patch
new file mode 100644 (file)
index 0000000..8e15fe9
--- /dev/null
@@ -0,0 +1,107 @@
+--- a/auto/cc/name
++++ b/auto/cc/name
+@@ -7,7 +7,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     ngx_feature="C compiler"
+     ngx_feature_name=
+-    ngx_feature_run=yes
++    ngx_feature_run=
+     ngx_feature_incs=
+     ngx_feature_path=
+     ngx_feature_libs=
+--- a/auto/cc/conf
++++ b/auto/cc/conf
+@@ -155,7 +155,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     else
+         ngx_feature="C99 variadic macros"
+         ngx_feature_name="NGX_HAVE_C99_VARIADIC_MACROS"
+-        ngx_feature_run=yes
++        ngx_feature_run=no
+         ngx_feature_incs="#include <stdio.h>
+ #define var(dummy, ...)  sprintf(__VA_ARGS__)"
+         ngx_feature_path=
+@@ -169,7 +169,7 @@ if [ "$NGX_PLATFORM" != win32 ]; then
+     ngx_feature="gcc variadic macros"
+     ngx_feature_name="NGX_HAVE_GCC_VARIADIC_MACROS"
+-    ngx_feature_run=yes
++    ngx_feature_run=no
+     ngx_feature_incs="#include <stdio.h>
+ #define var(dummy, args...)  sprintf(args)"
+     ngx_feature_path=
+--- a/auto/os/linux
++++ b/auto/os/linux
+@@ -48,7 +48,7 @@ fi
+ ngx_feature="epoll"
+ ngx_feature_name="NGX_HAVE_EPOLL"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/epoll.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+@@ -73,7 +73,7 @@ fi
+ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE"
+ ngx_feature="sendfile()"
+ ngx_feature_name="NGX_HAVE_SENDFILE"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/sendfile.h>
+                   #include <errno.h>"
+ ngx_feature_path=
+@@ -94,7 +94,7 @@ fi
+ CC_AUX_FLAGS="$cc_aux_flags -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64"
+ ngx_feature="sendfile64()"
+ ngx_feature_name="NGX_HAVE_SENDFILE64"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/sendfile.h>
+                   #include <errno.h>"
+ ngx_feature_path=
+@@ -112,7 +112,7 @@ ngx_include="sys/prctl.h"; . auto/includ
+ ngx_feature="prctl(PR_SET_DUMPABLE)"
+ ngx_feature_name="NGX_HAVE_PR_SET_DUMPABLE"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/prctl.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+--- a/auto/unix
++++ b/auto/unix
+@@ -618,7 +618,7 @@ ngx_feature_test="void *p; p = memalign(
+ ngx_feature="mmap(MAP_ANON|MAP_SHARED)"
+ ngx_feature_name="NGX_HAVE_MAP_ANON"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/mman.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
+@@ -631,7 +631,7 @@ ngx_feature_test="void *p;
+ ngx_feature='mmap("/dev/zero", MAP_SHARED)'
+ ngx_feature_name="NGX_HAVE_MAP_DEVZERO"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/mman.h>
+                   #include <sys/stat.h>
+                   #include <fcntl.h>"
+@@ -646,7 +646,7 @@ ngx_feature_test='void *p; int  fd;
+ ngx_feature="System V shared memory"
+ ngx_feature_name="NGX_HAVE_SYSVSHM"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <sys/ipc.h>
+                   #include <sys/shm.h>"
+ ngx_feature_path=
+@@ -660,7 +660,7 @@ ngx_feature_test="int  id;
+ ngx_feature="POSIX semaphores"
+ ngx_feature_name="NGX_HAVE_POSIX_SEM"
+-ngx_feature_run=yes
++ngx_feature_run=no
+ ngx_feature_incs="#include <semaphore.h>"
+ ngx_feature_path=
+ ngx_feature_libs=
diff --git a/trunk/package/network/services/nginx/patches/102-sizeof_test_fix.patch b/trunk/package/network/services/nginx/patches/102-sizeof_test_fix.patch
new file mode 100644 (file)
index 0000000..0cd93cc
--- /dev/null
@@ -0,0 +1,26 @@
+--- a/auto/types/sizeof
++++ b/auto/types/sizeof
+@@ -25,8 +25,13 @@ $NGX_INCLUDE_UNISTD_H
+ $NGX_INCLUDE_INTTYPES_H
+ $NGX_INCLUDE_AUTO_CONFIG_H
++char object_code_block[] = {
++      '\n', 'e', '4', 'V', 'A',
++      '0', 'x', ('0' + sizeof($ngx_type)),
++      'Y', '3', 'p', 'M', '\n'
++};
++
+ int main() {
+-    printf("%d", (int) sizeof($ngx_type));
+     return 0;
+ }
+@@ -40,7 +45,7 @@ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&
+ if [ -x $NGX_AUTOTEST ]; then
+-    ngx_size=`$NGX_AUTOTEST`
++    ngx_size=`sed -ne 's/^e4VA0x\(.\)Y3pM$/\1/p' < $NGX_AUTOTEST`
+     echo " $ngx_size bytes"
+ fi
diff --git a/trunk/package/network/services/nginx/patches/103-sys_nerr.patch b/trunk/package/network/services/nginx/patches/103-sys_nerr.patch
new file mode 100644 (file)
index 0000000..5f5d106
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/src/os/unix/ngx_errno.c
++++ b/src/os/unix/ngx_errno.c
+@@ -8,6 +8,9 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
++#ifndef NGX_SYS_NERR
++#define NGX_SYS_NERR  128
++#endif
+ /*
+  * The strerror() messages are copied because:
diff --git a/trunk/package/network/services/nginx/patches/200-config.patch b/trunk/package/network/services/nginx/patches/200-config.patch
new file mode 100644 (file)
index 0000000..f350095
--- /dev/null
@@ -0,0 +1,18 @@
+--- a/conf/nginx.conf
++++ b/conf/nginx.conf
+@@ -1,5 +1,5 @@
+-#user  nobody;
++user nobody nogroup;
+ worker_processes  1;
+ #error_log  logs/error.log;
+@@ -16,7 +16,7 @@ events {
+ http {
+     include       mime.types;
+-    default_type  application/octet-stream;
++    #default_type  application/octet-stream;
+     #log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
+     #                  '$status $body_bytes_sent "$http_referer" '
diff --git a/trunk/package/network/services/nginx/patches/300-crosscompile_ccflags.patch b/trunk/package/network/services/nginx/patches/300-crosscompile_ccflags.patch
new file mode 100644 (file)
index 0000000..4a06a76
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/auto/endianness
++++ b/auto/endianness
+@@ -21,7 +21,7 @@ int main() {
+ END
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS \
++ngx_test="$CC $NGX_CC_OPT $CC_TEST_FLAGS $CC_AUX_FLAGS \
+           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_LD_OPT $ngx_feature_libs"
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
+--- a/auto/feature
++++ b/auto/feature
+@@ -39,7 +39,7 @@ int main() {
+ END
+-ngx_test="$CC $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
++ngx_test="$CC $NGX_CC_OPT $CC_TEST_FLAGS $CC_AUX_FLAGS $ngx_feature_inc_path \
+           -o $NGX_AUTOTEST $NGX_AUTOTEST.c $NGX_TEST_LD_OPT $ngx_feature_libs"
+ ngx_feature_inc_path=
+--- a/auto/include
++++ b/auto/include
+@@ -27,7 +27,7 @@ int main() {
+ END
+-ngx_test="$CC -o $NGX_AUTOTEST $NGX_AUTOTEST.c"
++ngx_test="$CC $NGX_CC_OPT -o $NGX_AUTOTEST $NGX_AUTOTEST.c"
+ eval "$ngx_test >> $NGX_AUTOCONF_ERR 2>&1"
diff --git a/trunk/package/network/services/nginx/patches/400-nginx-1.4.x_proxy_protocol_patch_v2.patch b/trunk/package/network/services/nginx/patches/400-nginx-1.4.x_proxy_protocol_patch_v2.patch
new file mode 100644 (file)
index 0000000..ba63834
--- /dev/null
@@ -0,0 +1,1183 @@
+Index: nginx-1.4.7/auto/modules
+===================================================================
+--- nginx-1.4.7.orig/auto/modules
++++ nginx-1.4.7/auto/modules
+@@ -297,6 +297,10 @@ if [ $HTTP_SSL = YES ]; then
+     HTTP_SRCS="$HTTP_SRCS $HTTP_SSL_SRCS"
+ fi
++if [ $PROXY_PROTOCOL = YES ]; then
++    have=NGX_PROXY_PROTOCOL . auto/have
++fi
++
+ if [ $HTTP_PROXY = YES ]; then
+     have=NGX_HTTP_X_FORWARDED_FOR . auto/have
+     #USE_MD5=YES
+Index: nginx-1.4.7/auto/options
+===================================================================
+--- nginx-1.4.7.orig/auto/options
++++ nginx-1.4.7/auto/options
+@@ -47,6 +47,8 @@ USE_THREADS=NO
+ NGX_FILE_AIO=NO
+ NGX_IPV6=NO
++PROXY_PROTOCOL=NO
++
+ HTTP=YES
+ NGX_HTTP_LOG_PATH=
+@@ -192,6 +194,8 @@ do
+         --with-file-aio)                 NGX_FILE_AIO=YES           ;;
+         --with-ipv6)                     NGX_IPV6=YES               ;;
++        --with-proxy-protocol)           PROXY_PROTOCOL=YES         ;;
++
+         --without-http)                  HTTP=NO                    ;;
+         --without-http-cache)            HTTP_CACHE=NO              ;;
+@@ -350,6 +354,8 @@ cat << END
+   --with-file-aio                    enable file AIO support
+   --with-ipv6                        enable IPv6 support
++  --with-proxy-protocol              enable proxy protocol support
++
+   --with-http_ssl_module             enable ngx_http_ssl_module
+   --with-http_spdy_module            enable ngx_http_spdy_module
+   --with-http_realip_module          enable ngx_http_realip_module
+Index: nginx-1.4.7/auto/sources
+===================================================================
+--- nginx-1.4.7.orig/auto/sources
++++ nginx-1.4.7/auto/sources
+@@ -36,7 +36,8 @@ CORE_DEPS="src/core/nginx.h \
+            src/core/ngx_conf_file.h \
+            src/core/ngx_resolver.h \
+            src/core/ngx_open_file_cache.h \
+-           src/core/ngx_crypt.h"
++           src/core/ngx_crypt.h \
++           src/core/ngx_proxy_protocol.h"
+ CORE_SRCS="src/core/nginx.c \
+@@ -67,7 +68,8 @@ CORE_SRCS="src/core/nginx.c \
+            src/core/ngx_conf_file.c \
+            src/core/ngx_resolver.c \
+            src/core/ngx_open_file_cache.c \
+-           src/core/ngx_crypt.c"
++           src/core/ngx_crypt.c \
++           src/core/ngx_proxy_protocol.c"
+ REGEX_MODULE=ngx_regex_module
+Index: nginx-1.4.7/src/core/ngx_connection.h
+===================================================================
+--- nginx-1.4.7.orig/src/core/ngx_connection.h
++++ nginx-1.4.7/src/core/ngx_connection.h
+@@ -63,6 +63,10 @@ struct ngx_listening_s {
+     unsigned            shared:1;    /* shared between threads or processes */
+     unsigned            addr_ntop:1;
++#if (NGX_PROXY_PROTOCOL)
++    unsigned            accept_proxy_protocol:2; /* proxy_protocol flag */
++#endif
++
+ #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+     unsigned            ipv6only:1;
+ #endif
+@@ -148,6 +152,10 @@ struct ngx_connection_s {
+     ngx_uint_t          requests;
++#if (NGX_PROXY_PROTOCOL)
++    ngx_uint_t          proxy_protocol;
++#endif
++
+     unsigned            buffered:8;
+     unsigned            log_error:3;     /* ngx_connection_log_error_e */
+Index: nginx-1.4.7/src/core/ngx_core.h
+===================================================================
+--- nginx-1.4.7.orig/src/core/ngx_core.h
++++ nginx-1.4.7/src/core/ngx_core.h
+@@ -77,6 +77,9 @@ typedef void (*ngx_connection_handler_pt
+ #include <ngx_open_file_cache.h>
+ #include <ngx_os.h>
+ #include <ngx_connection.h>
++#if (NGX_PROXY_PROTOCOL)
++#include <ngx_proxy_protocol.h>
++#endif
+ #define LF     (u_char) 10
+Index: nginx-1.4.7/src/core/ngx_proxy_protocol.c
+===================================================================
+--- /dev/null
++++ nginx-1.4.7/src/core/ngx_proxy_protocol.c
+@@ -0,0 +1,430 @@
++
++/*
++ * Copyright (C) Baptiste Assmann
++ * Copyright (C) Exceliance
++ */
++
++
++#include <ngx_config.h>
++#include <ngx_core.h>
++#include <ngx_event.h>
++
++#if (NGX_PROXY_PROTOCOL)
++
++int
++ngx_recv_proxy_protocol(ngx_connection_t *c, u_char *buf, ssize_t n)
++{
++    u_char *end, *p, *t;
++    size_t len;
++    ssize_t s;
++    int step = 0;
++    ngx_proxy_protocol_t pp;
++
++    ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "processing proxy protocol");
++
++    /* 16 is the minimal length of the proxy protocol string */
++    if (n < 18) {
++        step = 1;
++        goto fail;
++    }
++
++    s = n;
++    end = memchr(buf, '\n', n);
++    if (end == NULL) {
++        step = 2;
++        goto fail;
++    }
++
++    p = buf;
++    if (memcmp(p, "PROXY ", 6) != 0) {
++        ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0,
++            "incorrect proxy protocol header string");
++        step = 3;
++        goto fail;
++    }
++    p += 6;
++    s -= 6;
++    if (s <= 0) {
++        step = 4;
++        goto fail;
++    }
++
++    ngx_memzero(&pp, sizeof(ngx_proxy_protocol_t));
++
++    if (memcmp(p, "TCP4 ", 5) == 0) {
++        struct sockaddr_in *sin_src;
++        struct sockaddr_in *sin_dst;
++
++        pp.pp_proto = NGX_PP_PROTO_TCP4;
++        pp.pp_src3.ss_family = AF_INET;
++        pp.pp_dst3.ss_family = AF_INET;
++        sin_src = (struct sockaddr_in *) &pp.pp_src3;
++        sin_dst = (struct sockaddr_in *) &pp.pp_dst3;
++
++        p += 5;
++        s -= 5;
++        if (s <= 0) {
++            step = 5;
++            goto fail;
++        }
++
++        /* l3 source address */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 6;
++            goto fail;
++        }
++        len = t - p;
++        if ((sin_src->sin_addr.s_addr = ngx_inet_addr(p, len)) == INADDR_NONE) {
++            step = 7;
++            goto fail;
++        }
++        pp.pp_src3_text.data = ngx_pcalloc(c->pool, len + 1);
++        ngx_memcpy(pp.pp_src3_text.data, p, len);
++        pp.pp_src3_text.len = len;
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 8;
++            goto fail;
++        }
++
++        /* l3 destination address */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 9;
++            goto fail;
++        }
++        len = t - p;
++        if ((sin_dst->sin_addr.s_addr = ngx_inet_addr(p, len)) == INADDR_NONE) {
++            step = 10;
++            goto fail;
++        }
++// FIXME pointer shift ???
++        pp.pp_dst3_text.data = ngx_pcalloc(c->pool, len + 1);
++        ngx_memcpy(pp.pp_dst3_text.data, p, len);
++        pp.pp_dst3_text.len = len;
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 11;
++            goto fail;
++        }
++
++        /* l4 source port */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 12;
++            goto fail;
++        }
++        len = t - p;
++        pp.pp_src4 = ngx_atoi(p, len);
++        if ((pp.pp_src4 < 1024)
++                || (pp.pp_src4 > 65535)) {
++            step = 13;
++            goto fail;
++        }
++        sin_src->sin_port = htons(pp.pp_src4);
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 14;
++            goto fail;
++        }
++
++        /* l4 destination port */
++        if ( (t = (u_char *)memchr(p, '\r', s)) == NULL ) {
++            step = 15;
++            goto fail;
++        }
++        len = t - p;
++        pp.pp_dst4 = ngx_atoi(p, len);
++        if (pp.pp_dst4 > 65535) {
++            step = 16;
++            goto fail;
++        }
++        sin_dst->sin_port = htons(pp.pp_dst4);
++
++        if (p[len + 1] != '\n') {
++            step = 17;
++            goto fail;
++        }
++
++        p += (len + 2);
++        s -= (len + 2);
++
++
++        /* if we managed to get there, then we can safely replace the
++         * information in the connection structure
++         */
++
++        /* updating connection with source information provided by proxy protocol */
++        if (pp.pp_src3_text.len > c->addr_text.len) {
++            ngx_pfree(c->pool, c->addr_text.data);
++            c->addr_text.data = ngx_pcalloc(c->pool, pp.pp_src3_text.len);
++        } else {
++            ngx_memzero(c->addr_text.data, c->addr_text.len);
++        }
++        ngx_memcpy(c->addr_text.data, pp.pp_src3_text.data, pp.pp_src3_text.len);
++        c->addr_text.len = pp.pp_src3_text.len;
++
++        ngx_pfree(c->pool, c->sockaddr);
++        c->socklen = NGX_SOCKADDRLEN;
++        c->sockaddr = ngx_pcalloc(c->pool, c->socklen);
++        ngx_memcpy(c->sockaddr, sin_src, c->socklen);
++
++        if (c->sockaddr->sa_family != AF_INET) {
++            ngx_pfree(c->pool, c->sockaddr);
++            c->socklen = NGX_SOCKADDRLEN;
++            c->sockaddr = ngx_pcalloc(c->pool, c->socklen);
++        } else {
++            ngx_memzero(c->sockaddr, sizeof(struct sockaddr_in));
++            c->socklen = NGX_SOCKADDRLEN;
++        }
++        ngx_memcpy(c->sockaddr, sin_src, c->socklen);
++
++        /* updating connection with destination information provided by proxy protocol */
++        ngx_pfree(c->pool, c->local_sockaddr);
++        c->local_sockaddr = ngx_pcalloc(c->pool, NGX_SOCKADDRLEN);
++        ngx_memcpy(c->local_sockaddr, sin_dst, NGX_SOCKADDRLEN);
++
++    }
++
++#if (NGX_HAVE_INET6)
++
++     else if (memcmp(p, "TCP6 ", 5) == 0) {
++
++        struct sockaddr_in6 *sin6_src;
++        struct sockaddr_in6 *sin6_dst;
++
++        pp.pp_proto = NGX_PP_PROTO_TCP6;
++        pp.pp_src3.ss_family = AF_INET6;
++        pp.pp_dst3.ss_family = AF_INET6;
++        sin6_src = (struct sockaddr_in6 *) &pp.pp_src3;
++        sin6_dst = (struct sockaddr_in6 *) &pp.pp_dst3;
++
++        p += 5;
++        s -= 5;
++        if (s <= 0) {
++            step = 18;
++            goto fail;
++        }
++
++        /* l3 source address */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 19;
++            goto fail;
++        }
++        len = t - p;
++        if (ngx_inet6_addr(p, len, sin6_src->sin6_addr.s6_addr) != NGX_OK) {
++            step = 20;
++            goto fail;
++        }
++        pp.pp_src3_text.data = ngx_pcalloc(c->pool, len + 1);
++        ngx_memcpy(pp.pp_src3_text.data, p, len);
++        pp.pp_src3_text.len = len;
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 21;
++            goto fail;
++        }
++
++        /* l3 destination address */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 22;
++            goto fail;
++        }
++        len = t - p;
++        if (ngx_inet6_addr(p, len, sin6_dst->sin6_addr.s6_addr) != NGX_OK) {
++            step = 23;
++            goto fail;
++        }
++        pp.pp_dst3_text.data = ngx_pcalloc(c->pool, len + 1);
++        ngx_memcpy(pp.pp_dst3_text.data, p, len);
++        pp.pp_dst3_text.len = len;
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 24;
++            goto fail;
++        }
++
++        /* l4 source port */
++        if ( (t = (u_char *)memchr(p, ' ', s)) == NULL ) {
++            step = 25;
++            goto fail;
++        }
++        len = t - p;
++        pp.pp_src4 = ngx_atoi(p, len);
++        if ((pp.pp_src4 < 1024)
++                || (pp.pp_src4 > 65535)) {
++            step = 26;
++            goto fail;
++        }
++        sin6_src->sin6_port = htons(pp.pp_src4);
++
++        p += (len + 1);
++        s -= (len + 1);
++        if (s <= 0) {
++            step = 27;
++            goto fail;
++        }
++
++        /* l4 destination port */
++        if ( (t = (u_char *)memchr(p, '\r', s)) == NULL ) {
++            step = 28;
++            goto fail;
++        }
++        len = t - p;
++        pp.pp_dst4 = ngx_atoi(p, len);
++        if (pp.pp_dst4 > 65535) {
++            step = 29;
++            goto fail;
++        }
++        sin6_dst->sin6_port = htons(pp.pp_dst4);
++
++        if (p[len + 1] != '\n') {
++            step = 30;
++            goto fail;
++        }
++
++        p += (len + 2);
++        s -= (len + 2);
++
++        /* if we managed to get there, then we can safely replace the
++         * information in the connection structure
++         */
++
++        /* updating connection with source provided by proxy protocol */
++        if (pp.pp_src3_text.len > c->addr_text.len) {
++            ngx_pfree(c->pool, c->addr_text.data);
++            c->addr_text.data = ngx_pcalloc(c->pool, pp.pp_src3_text.len);
++        } else {
++            ngx_memzero(c->addr_text.data, c->addr_text.len);
++        }
++        ngx_memcpy(c->addr_text.data, pp.pp_src3_text.data, pp.pp_src3_text.len);
++        c->addr_text.len = pp.pp_src3_text.len;
++
++        ngx_pfree(c->pool, c->sockaddr);
++        c->socklen = NGX_SOCKADDRLEN;
++        c->sockaddr = ngx_pcalloc(c->pool, c->socklen);
++        ngx_memcpy(c->sockaddr, sin6_src, c->socklen);
++
++        /* updating connection with destination provided by proxy protocol */
++        if (c->sockaddr->sa_family != AF_INET6) {
++            ngx_pfree(c->pool, c->local_sockaddr);
++            c->local_sockaddr = ngx_pcalloc(c->pool, NGX_SOCKADDRLEN);
++        } else {
++            ngx_memzero(c->sockaddr, sizeof(struct sockaddr_in6));
++            c->socklen = NGX_SOCKADDRLEN;
++        }
++//        ngx_memcpy(c->local_sockaddr, sin6_dst, NGX_SOCKADDRLEN);
++//FIXME must be finished here
++
++    }
++
++#endif
++
++    else {
++        step = 31;
++        goto fail;
++    }
++
++    ngx_print_proxy_protocol(&pp, c->log);
++
++    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
++            "proxy_protocol, asking to remove %z chars",
++            end + 1 - buf);
++
++    return (end + 1 - buf);
++
++fail:
++    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, c->log, 0,
++            "proxy_protocol error at step: %d", step);
++
++    return 0;
++
++}
++
++
++void
++ngx_print_proxy_protocol(ngx_proxy_protocol_t *p, ngx_log_t *log)
++{
++    switch (p->pp_proto) {
++        case NGX_PP_PROTO_TCP4:
++           ngx_log_debug0(NGX_LOG_DEBUG_EVENT, log, 0,
++               "proxy_protocol, proto: TCP4");
++        break;
++        case NGX_PP_PROTO_TCP6:
++           ngx_log_debug0(NGX_LOG_DEBUG_EVENT, log, 0,
++               "proxy_protocol, proto: TCP6");
++       break;
++   }
++
++    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0,
++       "proxy_protocol, string length: %d", ngx_proxy_protocol_string_length(p));
++    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
++       "proxy_protocol, src3: %s, %d", p->pp_src3_text.data, p->pp_src3_text.len);
++    ngx_log_debug2(NGX_LOG_DEBUG_EVENT, log, 0,
++       "proxy_protocol, dst3: %s, %d", p->pp_dst3_text.data, p->pp_dst3_text.len);
++    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0,
++       "proxy_protocol, src4: %d", p->pp_src4);
++    ngx_log_debug1(NGX_LOG_DEBUG_EVENT, log, 0,
++       "proxy_protocol, dst4: %d", p->pp_dst4);
++}
++
++
++int
++ngx_proxy_protocol_string_length(ngx_proxy_protocol_t *p)
++{
++    int len = 0;
++
++    /* 'PROXY ' */
++    len += (sizeof("PROXY ") - 1);
++
++    /* protocol version (TCP4 or TCP6) + space */
++    len += (sizeof("TCP0 ") - 1);
++
++    /* src3 + space */
++    len += p->pp_src3_text.len;
++    len += 1;
++
++    /* dst3 + space */
++    len += p->pp_dst3_text.len;
++    len += 1;
++
++    /* src4 */
++    if (p->pp_src4 < 10000)
++        /* 4 digits + 1 space */
++        len += (sizeof("0000 ") - 1);
++    else
++        /* 5 digits + 1 space */
++        len += (sizeof("00000 ") - 1);
++
++    /* dst4 */
++    if (p->pp_dst4 >= 10000)
++        /* 5 digits */
++        len += (sizeof("00000 ") - 1);
++    else if (p->pp_dst4 >= 1000)
++        /* 4 digits */
++        len += (sizeof("0000 ") - 1);
++    else if (p->pp_dst4 >= 100)
++        /* 3 digits */
++        len += (sizeof("000 ") - 1);
++    else if (p->pp_dst4 >= 10)
++        /* 2 digits */
++        len += (sizeof("00 ") - 1);
++    else
++        /* 1 digit */
++        len += (sizeof("0 ") - 1);
++
++    /* CRLF */
++    len += (sizeof(CRLF) - 1);
++
++    return len - 1;
++}
++
++#endif
+Index: nginx-1.4.7/src/core/ngx_proxy_protocol.h
+===================================================================
+--- /dev/null
++++ nginx-1.4.7/src/core/ngx_proxy_protocol.h
+@@ -0,0 +1,45 @@
++
++/*
++ * Copyright (C) Baptiste Assmann
++ * Copyright (C) Exceliance
++ */
++
++
++#ifndef _NGX_PROXY_PROTOCOL_H_INCLUDED_
++#define _NGX_PROXY_PROTOCOL_H_INCLUDED_
++
++
++#include <ngx_config.h>
++#include <ngx_core.h>
++
++
++#if (NGX_PROXY_PROTOCOL)
++
++typedef struct ngx_proxy_protocol_s ngx_proxy_protocol_t;
++
++typedef enum {
++    NGX_PP_PROTO_TCP4 = 1,
++    NGX_PP_PROTO_TCP6
++} ngx_pp_proto;
++
++
++struct ngx_proxy_protocol_s {
++    unsigned int          pp_proto;   /* proxy protocol related information */
++    struct sockaddr_storage pp_src3;
++    ngx_str_t             pp_src3_text;
++    struct sockaddr_storage pp_dst3;
++    ngx_str_t             pp_dst3_text;
++    unsigned int          pp_src4;
++    unsigned int          pp_dst4;
++};
++
++
++int  ngx_recv_proxy_protocol(ngx_connection_t *, u_char *, ssize_t);
++void ngx_print_proxy_protocol(ngx_proxy_protocol_t *, ngx_log_t *);
++int  ngx_proxy_protocol_string_length(ngx_proxy_protocol_t *);
++
++
++#endif
++
++#endif /* _NGX_CONNECTION_H_INCLUDED_ */
++
+Index: nginx-1.4.7/src/http/modules/ngx_http_proxy_module.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/modules/ngx_http_proxy_module.c
++++ nginx-1.4.7/src/http/modules/ngx_http_proxy_module.c
+@@ -8,7 +8,9 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
+ #include <ngx_http.h>
+-
++#if (NGX_PROXY_PROTOCOL)
++#include <ngx_proxy_protocol.h>
++#endif
+ typedef struct ngx_http_proxy_rewrite_s  ngx_http_proxy_rewrite_t;
+@@ -365,6 +367,17 @@ static ngx_command_t  ngx_http_proxy_com
+       offsetof(ngx_http_proxy_loc_conf_t, upstream.busy_buffers_size_conf),
+       NULL },
++#if (NGX_PROXY_PROTOCOL)
++
++    { ngx_string("send_proxy_protocol"),
++      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_HTTP_LOC_CONF|NGX_CONF_FLAG,
++      ngx_conf_set_flag_slot,
++      NGX_HTTP_LOC_CONF_OFFSET,
++      offsetof(ngx_http_proxy_loc_conf_t, upstream.send_proxy_protocol),
++      NULL },
++
++#endif
++
+ #if (NGX_HTTP_CACHE)
+     { ngx_string("proxy_cache"),
+@@ -2420,6 +2433,11 @@ ngx_http_proxy_create_loc_conf(ngx_conf_
+     conf->upstream.pass_headers = NGX_CONF_UNSET_PTR;
+     conf->upstream.intercept_errors = NGX_CONF_UNSET;
++
++#if (NGX_PROXY_PROTOCOL)
++    conf->upstream.send_proxy_protocol = NGX_CONF_UNSET;
++#endif
++
+ #if (NGX_HTTP_SSL)
+     conf->upstream.ssl_session_reuse = NGX_CONF_UNSET;
+ #endif
+@@ -2695,6 +2713,11 @@ ngx_http_proxy_merge_loc_conf(ngx_conf_t
+     ngx_conf_merge_value(conf->upstream.intercept_errors,
+                               prev->upstream.intercept_errors, 0);
++#if (NGX_PROXY_PROTOCOL)
++    ngx_conf_merge_value(conf->upstream.send_proxy_protocol,
++                              prev->upstream.send_proxy_protocol, 0);
++#endif
++
+ #if (NGX_HTTP_SSL)
+     ngx_conf_merge_value(conf->upstream.ssl_session_reuse,
+                               prev->upstream.ssl_session_reuse, 1);
+Index: nginx-1.4.7/src/http/ngx_http.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http.c
++++ nginx-1.4.7/src/http/ngx_http.c
+@@ -1228,6 +1228,9 @@ ngx_http_add_addresses(ngx_conf_t *cf, n
+ #if (NGX_HTTP_SPDY)
+     ngx_uint_t             spdy;
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++    ngx_uint_t             accept_proxy_protocol;
++#endif
+     /*
+      * we cannot compare whole sockaddr struct's as kernel
+@@ -1283,6 +1286,10 @@ ngx_http_add_addresses(ngx_conf_t *cf, n
+ #if (NGX_HTTP_SPDY)
+         spdy = lsopt->spdy || addr[i].opt.spdy;
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++        accept_proxy_protocol = lsopt->accept_proxy_protocol
++                                || addr[i].opt.accept_proxy_protocol;
++#endif
+         if (lsopt->set) {
+@@ -1316,6 +1323,9 @@ ngx_http_add_addresses(ngx_conf_t *cf, n
+ #if (NGX_HTTP_SPDY)
+         addr[i].opt.spdy = spdy;
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++        addr[i].opt.accept_proxy_protocol = accept_proxy_protocol;
++#endif
+         return NGX_OK;
+     }
+@@ -1762,6 +1772,11 @@ ngx_http_add_listening(ngx_conf_t *cf, n
+     ls->pool_size = cscf->connection_pool_size;
+     ls->post_accept_timeout = cscf->client_header_timeout;
++#if (NGX_PROXY_PROTOCOL)
++// CLEANUP:    ls->accept_proxy_protocol = cscf->accept_proxy_protocol;
++    ls->accept_proxy_protocol = addr->opt.accept_proxy_protocol;
++#endif
++
+     clcf = cscf->ctx->loc_conf[ngx_http_core_module.ctx_index];
+     ls->logp = clcf->error_log;
+@@ -1840,6 +1855,9 @@ ngx_http_add_addrs(ngx_conf_t *cf, ngx_h
+ #if (NGX_HTTP_SPDY)
+         addrs[i].conf.spdy = addr[i].opt.spdy;
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++        addrs[i].conf.accept_proxy_protocol = addr[i].opt.accept_proxy_protocol;
++#endif
+         if (addr[i].hash.buckets == NULL
+             && (addr[i].wc_head == NULL
+@@ -1904,6 +1922,9 @@ ngx_http_add_addrs6(ngx_conf_t *cf, ngx_
+ #if (NGX_HTTP_SPDY)
+         addrs6[i].conf.spdy = addr[i].opt.spdy;
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++        addrs6[i].conf.accept_proxy_protocol = addr[i].opt.accept_proxy_protocol;
++#endif
+         if (addr[i].hash.buckets == NULL
+             && (addr[i].wc_head == NULL
+Index: nginx-1.4.7/src/http/ngx_http_core_module.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_core_module.c
++++ nginx-1.4.7/src/http/ngx_http_core_module.c
+@@ -4090,6 +4090,15 @@ ngx_http_core_listen(ngx_conf_t *cf, ngx
+             continue;
+         }
++#if (NGX_PROXY_PROTOCOL)
++        if (ngx_strncmp(value[n].data, "accept_proxy_protocol=on", 24) == 0) {
++            lsopt.accept_proxy_protocol = 1;
++            lsopt.set = 1;
++            lsopt.bind = 1;
++            continue;
++        }
++#endif
++
+         if (ngx_strncmp(value[n].data, "ipv6only=o", 10) == 0) {
+ #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+             struct sockaddr  *sa;
+Index: nginx-1.4.7/src/http/ngx_http_core_module.h
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_core_module.h
++++ nginx-1.4.7/src/http/ngx_http_core_module.h
+@@ -78,6 +78,11 @@ typedef struct {
+ #if (NGX_HTTP_SPDY)
+     unsigned                   spdy:1;
+ #endif
++
++#if (NGX_PROXY_PROTOCOL)
++    unsigned                   accept_proxy_protocol:2;
++#endif
++
+ #if (NGX_HAVE_INET6 && defined IPV6_V6ONLY)
+     unsigned                   ipv6only:1;
+ #endif
+@@ -234,6 +239,10 @@ struct ngx_http_addr_conf_s {
+     ngx_http_virtual_names_t  *virtual_names;
++#if (NGX_PROXY_PROTOCOL)
++    ngx_flag_t                  accept_proxy_protocol;
++#endif
++
+ #if (NGX_HTTP_SSL)
+     unsigned                   ssl:1;
+ #endif
+Index: nginx-1.4.7/src/http/ngx_http_request.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_request.c
++++ nginx-1.4.7/src/http/ngx_http_request.c
+@@ -63,6 +63,9 @@ static void ngx_http_ssl_handshake(ngx_e
+ static void ngx_http_ssl_handshake_handler(ngx_connection_t *c);
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++static void ngx_http_proxy_protocol(ngx_event_t *rev);
++#endif
+ static char *ngx_http_client_errors[] = {
+@@ -343,6 +346,14 @@ ngx_http_init_connection(ngx_connection_
+     }
+ #endif
++#if (NGX_PROXY_PROTOCOL)
++    {
++        if (hc->addr_conf->accept_proxy_protocol) {
++            rev->handler = ngx_http_proxy_protocol;
++        }
++    }
++#endif
++
+     if (rev->ready) {
+         /* the deferred accept(), rtsig, aio, iocp */
+@@ -364,7 +375,6 @@ ngx_http_init_connection(ngx_connection_
+     }
+ }
+-
+ static void
+ ngx_http_wait_request_handler(ngx_event_t *rev)
+ {
+@@ -469,6 +479,12 @@ ngx_http_wait_request_handler(ngx_event_
+     }
+     rev->handler = ngx_http_process_request_line;
++
++#if (NGX_PROXY_PROTOCOL)
++    if (hc->addr_conf->accept_proxy_protocol)
++        rev->handler = ngx_http_proxy_protocol;
++#endif
++
+     ngx_http_process_request_line(rev);
+ }
+@@ -582,6 +598,67 @@ ngx_http_create_request(ngx_connection_t
+     return r;
+ }
++#if (NGX_PROXY_PROTOCOL)
++
++static void
++ngx_http_proxy_protocol(ngx_event_t *rev)
++{
++    ssize_t                n;
++    size_t                 size = 1024;
++    u_char                 tmpbuf[size];
++    ngx_connection_t      *c;
++    ngx_http_connection_t *hc;
++
++    c = rev->data;
++    hc = c->data;
++    rev->handler = ngx_http_wait_request_handler;
++
++#if (NGX_HTTP_SPDY)
++    {
++        if (hc->addr_conf->spdy) {
++            rev->handler = ngx_http_spdy_init;
++        }
++    }
++#endif
++
++#if (NGX_HTTP_SSL)
++    {
++        if (hc->addr_conf->ssl) {
++            rev->handler = ngx_http_ssl_handshake;
++        }
++    }
++#endif
++
++    n = recv(c->fd, tmpbuf, size, MSG_PEEK);
++
++    if ((n <= 0) && (c->listening)
++            && (hc->addr_conf->accept_proxy_protocol)
++          && (!c->proxy_protocol)) {
++        ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "ngx_http_proxy_protocol: pp required but not found");
++        return;
++    }
++    if ((n > 0) && (c->listening)
++            && (hc->addr_conf->accept_proxy_protocol)
++          && (!c->proxy_protocol)) {
++        ssize_t m;
++        if (!(m = ngx_recv_proxy_protocol(c, tmpbuf, n))) {
++            ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "ngx_http_proxy_protocol: pp required but not found");
++            ngx_http_close_connection(c);
++            return;
++        }
++        ngx_log_debug0(NGX_LOG_DEBUG_EVENT, c->log, 0, "ngx_http_proxy_protocol: pp required and found");
++
++        c->proxy_protocol = 1;
++
++        /* strip the proxy protocol string from the buffer */
++        recv(c->fd, tmpbuf, m, 0);
++    }
++
++    rev->handler(rev);
++}
++
++#endif
++
+ #if (NGX_HTTP_SSL)
+Index: nginx-1.4.7/src/http/ngx_http_upstream.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_upstream.c
++++ nginx-1.4.7/src/http/ngx_http_upstream.c
+@@ -31,6 +31,10 @@ static ngx_int_t ngx_http_upstream_reini
+     ngx_http_upstream_t *u);
+ static void ngx_http_upstream_send_request(ngx_http_request_t *r,
+     ngx_http_upstream_t *u);
++#if (NGX_PROXY_PROTOCOL)
++static void ngx_http_upstream_send_proxy_protocol(ngx_http_request_t *r,
++    ngx_http_upstream_t *u);
++#endif
+ static void ngx_http_upstream_send_request_handler(ngx_http_request_t *r,
+     ngx_http_upstream_t *u);
+ static void ngx_http_upstream_process_header(ngx_http_request_t *r,
+@@ -1255,6 +1259,13 @@ ngx_http_upstream_connect(ngx_http_reque
+     u->request_sent = 0;
++#if (NGX_PROXY_PROTOCOL)
++    if (u->conf->send_proxy_protocol && !(u->ssl && c->ssl == NULL)) {
++        ngx_http_upstream_send_proxy_protocol(r, u);
++      return;
++    }
++#endif
++
+     if (rc == NGX_AGAIN) {
+         ngx_add_timer(c->write, u->conf->connect_timeout);
+         return;
+@@ -1498,6 +1509,228 @@ ngx_http_upstream_send_request(ngx_http_
+ }
++#if (NGX_PROXY_PROTOCOL)
++
++static void
++ngx_http_upstream_send_proxy_protocol(ngx_http_request_t *r, ngx_http_upstream_t *u)
++{
++    size_t                   len;
++    ngx_int_t                rc;
++    ngx_connection_t        *uc;
++    ngx_connection_t        *cc;
++    ngx_chain_t             *pp_string;
++    ngx_proxy_protocol_t     pp;
++    ngx_buf_t               *b;
++    char                     port[6];
++    u_char                  *addr;
++    struct sockaddr_storage  sa_src;
++    struct sockaddr_storage  sa_dst;
++    socklen_t                addrlen = NGX_SOCKADDRLEN;
++    struct sockaddr_in      *sin_src;
++    struct sockaddr_in      *sin_dst;
++
++#if (NGX_HAVE_INET6)
++
++    struct sockaddr_in6     *sin6_src;
++    struct sockaddr_in6     *sin6_dst;
++
++#endif
++
++
++    uc = u->peer.connection;
++    cc = r->connection;
++
++    if ( !(u->conf->send_proxy_protocol) ) {
++        return;
++    }
++
++    ngx_log_debug0(NGX_LOG_DEBUG_HTTP, uc->log, 0,
++                   "http upstream send proxy protocol");
++
++    if (!u->request_sent && ngx_http_upstream_test_connect(uc) != NGX_OK) {
++        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
++        return;
++    }
++
++    uc->log->action = "sending proxy protocol to upstream";
++
++    len = 0;
++
++    if (r->connection->proxy_protocol) {
++        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, uc->log, 0,
++                   "PP: got proxy-protocol from client connection");
++
++        switch (cc->sockaddr->sa_family) {
++
++#if (NGX_HAVE_INET6)
++
++            case AF_INET6:
++
++                pp.pp_proto = NGX_PP_PROTO_TCP6;
++                sin6_dst = (struct sockaddr_in6 *) cc->local_sockaddr;
++                sin6_src = (struct sockaddr_in6 *) cc->sockaddr;
++
++                break;
++
++#endif
++
++            default:
++                pp.pp_proto = NGX_PP_PROTO_TCP4;
++                sin_dst = (struct sockaddr_in *) cc->local_sockaddr;
++                sin_src = (struct sockaddr_in *) cc->sockaddr;
++
++        }
++
++    } else {
++
++        ngx_log_debug0(NGX_LOG_DEBUG_HTTP, uc->log, 0,
++                   "PP: collecting information from socket fd");
++
++        getsockname(cc->fd, (struct sockaddr *) &sa_dst, &addrlen);
++
++        switch (sa_dst.ss_family) {
++
++#if (NGX_HAVE_INET6)
++
++            case AF_INET6:
++
++                pp.pp_proto = NGX_PP_PROTO_TCP6;
++                sin6_dst = (struct sockaddr_in6 *) &sa_dst;
++
++                getpeername(cc->fd, (struct sockaddr *) &sa_src, &addrlen);
++                sin6_src = (struct sockaddr_in6 *) &sa_src;
++
++                break;
++
++#endif
++
++            default:
++
++                pp.pp_proto = NGX_PP_PROTO_TCP4;
++                sin_dst = (struct sockaddr_in *) &sa_dst;
++                getpeername(cc->fd, (struct sockaddr *) &sa_src, &addrlen);
++                sin_src = (struct sockaddr_in *) &sa_src;
++        }
++
++
++    }
++
++    switch (pp.pp_proto) {
++
++#if (NGX_HAVE_INET6)
++
++        case NGX_PP_PROTO_TCP6:
++
++            /* dst3 and dst4 */
++            addr = ngx_pcalloc(r->pool, NGX_INET6_ADDRSTRLEN);
++            ngx_inet_ntop(AF_INET6, &sin6_dst->sin6_addr, addr, NGX_INET6_ADDRSTRLEN);
++            pp.pp_dst3_text.data = ngx_pcalloc(r->pool, NGX_INET6_ADDRSTRLEN);
++            pp.pp_dst3_text.len = ngx_strlen(addr);
++            ngx_memcpy(pp.pp_dst3_text.data, addr, pp.pp_dst3_text.len);
++            pp.pp_dst4 = htons(sin6_dst->sin6_port);
++
++            ngx_memzero(addr, NGX_INET6_ADDRSTRLEN);
++
++            /* src3 and src4 */
++            ngx_inet_ntop(AF_INET6, &sin6_src->sin6_addr, addr, NGX_INET6_ADDRSTRLEN);
++            pp.pp_src3_text.data = ngx_pcalloc(r->pool, NGX_INET6_ADDRSTRLEN);
++            pp.pp_src3_text.len = ngx_strlen(addr);
++            ngx_memcpy(pp.pp_src3_text.data, addr, pp.pp_src3_text.len);
++            pp.pp_src4 = htons(sin6_src->sin6_port);
++
++        break;
++
++#endif
++
++        default:
++
++            /* dst3 and dst4 */
++            addr = ngx_pcalloc(r->pool, NGX_INET_ADDRSTRLEN);
++            ngx_inet_ntop(AF_INET, &sin_dst->sin_addr, addr, NGX_INET_ADDRSTRLEN);
++            pp.pp_dst3_text.data = ngx_pcalloc(r->pool, NGX_INET_ADDRSTRLEN);
++            pp.pp_dst3_text.len = ngx_strlen(addr);
++            ngx_memcpy(pp.pp_dst3_text.data, addr, pp.pp_dst3_text.len);
++            pp.pp_dst4 = htons(sin_dst->sin_port);
++
++            ngx_memzero(addr, NGX_INET_ADDRSTRLEN);
++
++            /* src3 and src4 */
++            ngx_inet_ntop(AF_INET, &sin_src->sin_addr, addr, NGX_INET_ADDRSTRLEN);
++            pp.pp_src3_text.data = ngx_pcalloc(r->pool, NGX_INET_ADDRSTRLEN);
++            pp.pp_src3_text.len = ngx_strlen(addr);
++            ngx_memcpy(pp.pp_src3_text.data, addr, pp.pp_src3_text.len);
++            pp.pp_src4 = htons(sin_src->sin_port);
++
++    }
++
++    len += ngx_proxy_protocol_string_length(&pp);
++
++    ngx_print_proxy_protocol(&pp, uc->log);
++
++    b = ngx_create_temp_buf(uc->pool, len);
++    if (b == NULL) {
++        return;
++    }
++
++    pp_string = ngx_alloc_chain_link(uc->pool);
++    if (pp_string == NULL) {
++        return;
++    }
++
++    pp_string->buf = b;
++    pp_string->next = NULL;
++
++    b->last = ngx_cpymem(b->last, "PROXY ", sizeof("PROXY ") - 1);
++
++    switch (pp.pp_proto) {
++        case NGX_PP_PROTO_TCP4:
++            b->last = ngx_cpymem(b->last, "TCP4 ", sizeof("TCP4 ") - 1);
++        break;
++        case NGX_PP_PROTO_TCP6:
++            b->last = ngx_cpymem(b->last, "TCP6 ", sizeof("TCP6 ") - 1);
++        break;
++    }
++
++    /* src3 */
++    b->last = ngx_cpymem(b->last, pp.pp_src3_text.data, pp.pp_src3_text.len);
++    b->last = ngx_cpymem(b->last, " ", 1);
++
++    /* dst3 */
++    b->last = ngx_cpymem(b->last, pp.pp_dst3_text.data, pp.pp_dst3_text.len);
++    b->last = ngx_cpymem(b->last, " ", 1);
++
++    /* src4 */
++    ngx_memzero(port, 6);
++    sprintf(port,"%d", pp.pp_src4);
++    b->last = ngx_cpymem(b->last, port, strlen(port));
++    b->last = ngx_cpymem(b->last, " ", 1);
++
++    /* dst4 */
++    ngx_memzero(port, 6);
++    sprintf(port,"%d", pp.pp_dst4);
++    b->last = ngx_cpymem(b->last, port, strlen(port));
++
++    /* CRLF */
++    b->last = ngx_cpymem(b->last, CRLF, sizeof(CRLF) - 1);
++
++    ngx_log_debug3(NGX_LOG_DEBUG_HTTP, uc->log, 0,
++            "http upstream send proxy protocol: %d -%*s-",
++            ngx_proxy_protocol_string_length(&pp),
++            ngx_proxy_protocol_string_length(&pp) - 2,
++            b->start);
++
++    rc = ngx_output_chain(&u->output, pp_string);
++
++    if (rc == NGX_ERROR) {
++        ngx_http_upstream_next(r, u, NGX_HTTP_UPSTREAM_FT_ERROR);
++        return;
++    }
++
++}
++
++#endif
++
++
+ static void
+ ngx_http_upstream_send_request_handler(ngx_http_request_t *r,
+     ngx_http_upstream_t *u)
+Index: nginx-1.4.7/src/http/ngx_http_upstream.h
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_upstream.h
++++ nginx-1.4.7/src/http/ngx_http_upstream.h
+@@ -188,6 +188,10 @@ typedef struct {
+     unsigned                         intercept_404:1;
+     unsigned                         change_buffering:1;
++#if (NGX_PROXY_PROTOCOL)
++    ngx_flag_t                       send_proxy_protocol;
++#endif
++
+ #if (NGX_HTTP_SSL)
+     ngx_ssl_t                       *ssl;
+     ngx_flag_t                       ssl_session_reuse;
+Index: nginx-1.4.7/auto/cc/gcc
+===================================================================
+--- nginx-1.4.7.orig/auto/cc/gcc
++++ nginx-1.4.7/auto/cc/gcc
+@@ -168,7 +168,7 @@ esac
+ # stop on warning
+-CFLAGS="$CFLAGS -Werror"
++CFLAGS="$CFLAGS"
+ # debug
+ CFLAGS="$CFLAGS -g"
+Index: nginx-1.4.7/auto/cc/icc
+===================================================================
+--- nginx-1.4.7.orig/auto/cc/icc
++++ nginx-1.4.7/auto/cc/icc
+@@ -115,7 +115,7 @@ case "$NGX_ICC_VER" in
+ esac
+ # stop on warning
+-CFLAGS="$CFLAGS -Werror"
++CFLAGS="$CFLAGS "
+ # debug
+ CFLAGS="$CFLAGS -g"
diff --git a/trunk/package/network/services/nginx/patches/401-nginx-1.4.0-syslog.patch b/trunk/package/network/services/nginx/patches/401-nginx-1.4.0-syslog.patch
new file mode 100644 (file)
index 0000000..941c79a
--- /dev/null
@@ -0,0 +1,698 @@
+Index: nginx-1.4.7/src/core/ngx_cycle.c
+===================================================================
+--- nginx-1.4.7.orig/src/core/ngx_cycle.c
++++ nginx-1.4.7/src/core/ngx_cycle.c
+@@ -85,6 +85,12 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
+     cycle->pool = pool;
+     cycle->log = log;
+     cycle->new_log.log_level = NGX_LOG_ERR;
++#if (NGX_ENABLE_SYSLOG)
++    cycle->new_log.facility = SYSLOG_FACILITY;
++    cycle->new_log.facility = ERR_SYSLOG_PRIORITY;
++    cycle->new_log.syslog_on = 0;
++    cycle->new_log.syslog_set = 0;
++#endif
+     cycle->old_cycle = old_cycle;
+     cycle->conf_prefix.len = old_cycle->conf_prefix.len;
+Index: nginx-1.4.7/src/core/ngx_log.c
+===================================================================
+--- nginx-1.4.7.orig/src/core/ngx_log.c
++++ nginx-1.4.7/src/core/ngx_log.c
+@@ -10,6 +10,15 @@
+ static char *ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
++#if (NGX_ENABLE_SYSLOG)
++static char *ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf);
++void log_exit(ngx_cycle_t *cycle);
++
++typedef struct{
++    ngx_str_t     name;
++    ngx_int_t     macro;
++} ngx_string_to_macro_t;
++#endif
+ static ngx_command_t  ngx_errlog_commands[] = {
+@@ -21,6 +30,15 @@ static ngx_command_t  ngx_errlog_command
+      0,
+      NULL},
++#if (NGX_ENABLE_SYSLOG)
++    {ngx_string("syslog"),
++     NGX_MAIN_CONF|NGX_CONF_TAKE12,
++     ngx_set_syslog,
++     0,
++     0,
++     NULL},
++#endif
++
+     ngx_null_command
+ };
+@@ -43,7 +61,11 @@ ngx_module_t  ngx_errlog_module = {
+     NULL,                                  /* init thread */
+     NULL,                                  /* exit thread */
+     NULL,                                  /* exit process */
+-    NULL,                                  /* exit master */
++#if (NGX_ENABLE_SYSLOG)
++    log_exit,                              /* exit master */
++#else
++    NULL,
++#endif
+     NGX_MODULE_V1_PADDING
+ };
+@@ -52,6 +74,48 @@ static ngx_log_t        ngx_log;
+ static ngx_open_file_t  ngx_log_file;
+ ngx_uint_t              ngx_use_stderr = 1;
++#if (NGX_ENABLE_SYSLOG)
++static ngx_string_to_macro_t ngx_syslog_facilities[] = {
++    {ngx_string("auth"),     LOG_AUTH},
++#if !(NGX_SOLARIS)
++    {ngx_string("authpriv"), LOG_AUTHPRIV},
++#endif
++    {ngx_string("cron"),     LOG_CRON},
++    {ngx_string("daemon"),   LOG_DAEMON},
++#if !(NGX_SOLARIS)
++    {ngx_string("ftp"),      LOG_FTP},
++#endif
++    {ngx_string("kern"),     LOG_KERN},
++    {ngx_string("local0"),   LOG_LOCAL0},
++    {ngx_string("local1"),   LOG_LOCAL1},
++    {ngx_string("local2"),   LOG_LOCAL2},
++    {ngx_string("local3"),   LOG_LOCAL3},
++    {ngx_string("local4"),   LOG_LOCAL4},
++    {ngx_string("local5"),   LOG_LOCAL5},
++    {ngx_string("local6"),   LOG_LOCAL6},
++    {ngx_string("local7"),   LOG_LOCAL7},
++    {ngx_string("lpr"),      LOG_LPR},
++    {ngx_string("mail"),     LOG_MAIL},
++    {ngx_string("news"),     LOG_NEWS},
++    {ngx_string("syslog"),   LOG_SYSLOG},
++    {ngx_string("user"),     LOG_USER},
++    {ngx_string("uucp"),     LOG_UUCP},
++    { ngx_null_string, 0}
++};
++
++static ngx_string_to_macro_t ngx_syslog_priorities[] = {
++    {ngx_string("emerg"), LOG_EMERG},
++    {ngx_string("alert"), LOG_ALERT},
++    {ngx_string("crit"),  LOG_CRIT},
++    {ngx_string("error"), LOG_ERR},
++    {ngx_string("err"),   LOG_ERR},
++    {ngx_string("warn"),  LOG_WARNING},
++    {ngx_string("notice"),LOG_NOTICE},
++    {ngx_string("info"),  LOG_INFO},
++    {ngx_string("debug"), LOG_DEBUG},
++    { ngx_null_string, 0}
++};
++#endif
+ static ngx_str_t err_levels[] = {
+     ngx_null_string,
+@@ -89,11 +153,16 @@ ngx_log_error_core(ngx_uint_t level, ngx
+     va_list  args;
+ #endif
+     u_char  *p, *last, *msg;
++#if (NGX_ENABLE_SYSLOG)
++    u_char *errstr_syslog;
++#endif
+     u_char   errstr[NGX_MAX_ERROR_STR];
++#if !(NGX_ENABLE_SYSLOG)
+     if (log->file->fd == NGX_INVALID_FILE) {
+         return;
+     }
++#endif
+     last = errstr + NGX_MAX_ERROR_STR;
+@@ -102,6 +171,10 @@ ngx_log_error_core(ngx_uint_t level, ngx
+     p = errstr + ngx_cached_err_log_time.len;
++#if (NGX_ENABLE_SYSLOG)
++    errstr_syslog = p;
++#endif
++
+     p = ngx_slprintf(p, last, " [%V] ", &err_levels[level]);
+     /* pid#tid */
+@@ -140,11 +213,27 @@ ngx_log_error_core(ngx_uint_t level, ngx
+     ngx_linefeed(p);
++#if (NGX_ENABLE_SYSLOG)
++    if (log->file != NULL && log->file->name.len != 0) {
+     (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
++    }
++
++    /* Don't send the debug level info to syslog */
++    if (log->syslog_on && level < NGX_LOG_DEBUG) {
++        /* write to syslog */
++        syslog(log->priority, "%.*s", (int)(p - errstr_syslog), errstr_syslog);
++    }
++#else
++    (void) ngx_write_fd(log->file->fd, errstr, p - errstr);
++#endif
+     if (!ngx_use_stderr
+         || level > NGX_LOG_WARN
++#if (NGX_ENABLE_SYSLOG)
++        || (log->file != NULL && log->file->fd == ngx_stderr))
++#else
+         || log->file->fd == ngx_stderr)
++#endif
+     {
+         return;
+     }
+@@ -367,6 +456,50 @@ ngx_log_create(ngx_cycle_t *cycle, ngx_s
+ }
++#if (NGX_ENABLE_SYSLOG)
++ngx_int_t
++ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority)
++{
++    ngx_int_t  p = 0;
++    ngx_uint_t n, match = 0;
++
++    for (n = 0; ngx_syslog_priorities[n].name.len != 0; n++) {
++        if (ngx_strncmp(priority->data, ngx_syslog_priorities[n].name.data, 
++                    ngx_syslog_priorities[n].name.len) == 0) {
++            p = ngx_syslog_priorities[n].macro;
++            match = 1;
++        }
++    }
++
++    if (!match) {
++        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++                "invalid syslog priority \"%V\"", priority);
++        return -1;
++    }
++
++    return p;
++}
++
++
++char *
++ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log)
++{
++    log->priority = ERR_SYSLOG_PRIORITY;
++
++    if (priority->len == 0) {
++        return NGX_CONF_OK;
++    }
++
++    log->priority = ngx_log_get_priority(cf, priority);
++    if (log->priority == (-1)) {
++        return NGX_CONF_ERROR;
++    }
++
++    return NGX_CONF_OK;
++}
++#endif
++
++
+ char *
+ ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log)
+ {
+@@ -429,6 +562,13 @@ static char *
+ ngx_error_log(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
+ {
+     ngx_str_t  *value, name;
++#if (NGX_ENABLE_SYSLOG)
++    u_char     *off = NULL;
++    ngx_str_t  priority;
++
++    ngx_str_null(&name);
++    ngx_str_null(&priority);
++#endif
+     if (cf->cycle->new_log.file) {
+         return "is duplicate";
+@@ -436,7 +576,44 @@ ngx_error_log(ngx_conf_t *cf, ngx_comman
+     value = cf->args->elts;
++#if (NGX_ENABLE_SYSLOG)
++    if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) {
++        if (!cf->cycle->new_log.syslog_set) {
++            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++                    "You must set the syslog directive and enable it first.");
++            return NGX_CONF_ERROR;
++        }
++
++        cf->cycle->new_log.syslog_on = 1;
++
++        if (value[1].data[sizeof("syslog") - 1] == ':') {
++            priority.len = value[1].len - sizeof("syslog");
++            priority.data = value[1].data + sizeof("syslog");
++
++            off = (u_char *)ngx_strchr(priority.data, (int) '|');
++            if (off != NULL) {
++                priority.len = off - priority.data;
++
++                off++;
++                name.len = value[1].data + value[1].len - off;
++                name.data = off;
++            }
++        }
++        else {
++            if (value[1].len > sizeof("syslog")) {
++                name.len = value[1].len - sizeof("syslog");
++                name.data = value[1].data + sizeof("syslog");
++            }
++        }
++
++        if (ngx_log_set_priority(cf, &priority, &cf->cycle->new_log) == NGX_CONF_ERROR) {
++            return NGX_CONF_ERROR;
++        }
++    }
++    else if (ngx_strcmp(value[1].data, "stderr") == 0) {
++#else
+     if (ngx_strcmp(value[1].data, "stderr") == 0) {
++#endif
+         ngx_str_null(&name);
+     } else {
+@@ -457,3 +634,63 @@ ngx_error_log(ngx_conf_t *cf, ngx_comman
+     return ngx_log_set_levels(cf, &cf->cycle->new_log);
+ }
++
++
++#if (NGX_ENABLE_SYSLOG)
++
++#define SYSLOG_IDENT_NAME "nginx"
++
++static char *
++ngx_set_syslog(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
++{
++    char       *program;
++    ngx_str_t  *value;
++    ngx_int_t   facility, match = 0;
++    ngx_uint_t  n;
++
++    value = cf->args->elts;
++
++    if (cf->cycle->new_log.syslog_set) {
++        return "is duplicate";
++    }
++
++    cf->cycle->new_log.syslog_set = 1;
++
++    for (n = 0; ngx_syslog_facilities[n].name.len != 0; n++) {
++        if (ngx_strncmp(value[1].data, ngx_syslog_facilities[n].name.data, 
++                    ngx_syslog_facilities[n].name.len) == 0) {
++            facility = ngx_syslog_facilities[n].macro;
++            match = 1;
++            break;
++        }
++    }
++
++    if (match) {
++        cf->cycle->new_log.facility = facility;
++        cf->cycle->new_log.priority = ERR_SYSLOG_PRIORITY;
++    }
++    else {
++        ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++                "invalid syslog facility \"%V\"", &value[1]);
++        return NGX_CONF_ERROR;
++    }
++
++    program = SYSLOG_IDENT_NAME; 
++    if (cf->args->nelts > 2) {
++        program = (char *) value[2].data;
++    }
++
++    openlog(program, LOG_ODELAY, facility);
++
++    return NGX_CONF_OK;
++}
++
++
++void log_exit(ngx_cycle_t *cycle)
++{
++    if (cycle->new_log.syslog_set) {
++        closelog();
++    }
++}
++#endif
++
+Index: nginx-1.4.7/src/core/ngx_log.h
+===================================================================
+--- nginx-1.4.7.orig/src/core/ngx_log.h
++++ nginx-1.4.7/src/core/ngx_log.h
+@@ -12,6 +12,13 @@
+ #include <ngx_config.h>
+ #include <ngx_core.h>
++#if (NGX_ENABLE_SYSLOG)
++#include <syslog.h>
++
++#define SYSLOG_FACILITY LOG_LOCAL5
++#define ERR_SYSLOG_PRIORITY LOG_ERR
++#endif
++
+ #define NGX_LOG_STDERR            0
+ #define NGX_LOG_EMERG             1
+@@ -61,6 +68,13 @@ struct ngx_log_s {
+      */
+     char                *action;
++
++#if (NGX_ENABLE_SYSLOG)
++    ngx_int_t           priority;
++    ngx_int_t           facility;
++    unsigned            syslog_on:1;      /* unsigned :1 syslog_on */
++    unsigned            syslog_set:1;      /*unsigned :1 syslog_set */
++#endif
+ };
+@@ -221,6 +235,10 @@ void ngx_cdecl ngx_log_debug_core(ngx_lo
+ ngx_log_t *ngx_log_init(u_char *prefix);
+ ngx_log_t *ngx_log_create(ngx_cycle_t *cycle, ngx_str_t *name);
++#if (NGX_ENABLE_SYSLOG)
++ngx_int_t ngx_log_get_priority(ngx_conf_t *cf, ngx_str_t *priority);
++char * ngx_log_set_priority(ngx_conf_t *cf, ngx_str_t *priority, ngx_log_t *log);
++#endif
+ char *ngx_log_set_levels(ngx_conf_t *cf, ngx_log_t *log);
+ void ngx_cdecl ngx_log_abort(ngx_err_t err, const char *fmt, ...);
+ void ngx_cdecl ngx_log_stderr(ngx_err_t err, const char *fmt, ...);
+Index: nginx-1.4.7/src/http/modules/ngx_http_log_module.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/modules/ngx_http_log_module.c
++++ nginx-1.4.7/src/http/modules/ngx_http_log_module.c
+@@ -13,6 +13,11 @@
+ #include <zlib.h>
+ #endif
++#if (NGX_ENABLE_SYSLOG)
++#include <syslog.h>
++
++#define HTTP_SYSLOG_PRIORITY LOG_NOTICE
++#endif
+ typedef struct ngx_http_log_op_s  ngx_http_log_op_t;
+@@ -67,6 +72,11 @@ typedef struct {
+     time_t                      disk_full_time;
+     time_t                      error_log_time;
+     ngx_http_log_fmt_t         *format;
++
++#if (NGX_ENABLE_SYSLOG)
++    ngx_int_t                   priority;
++    unsigned                    syslog_on:1;      /* unsigned :1 syslog_on */
++#endif
+ } ngx_http_log_t;
+@@ -348,6 +358,14 @@ ngx_http_log_write(ngx_http_request_t *r
+     time_t               now;
+     ssize_t              n;
+     ngx_err_t            err;
++
++#if (NGX_ENABLE_SYSLOG)
++    n = 0;
++    if (log->syslog_on) {
++        syslog(log->priority, "%.*s", (int)len, buf);
++    }
++#endif
++
+ #if (NGX_ZLIB)
+     ngx_http_log_buf_t  *buffer;
+ #endif
+@@ -355,6 +373,9 @@ ngx_http_log_write(ngx_http_request_t *r
+     if (log->script == NULL) {
+         name = log->file->name.data;
++#if (NGX_ENABLE_SYSLOG)
++        if (name != NULL) {
++#endif
+ #if (NGX_ZLIB)
+         buffer = log->file->data;
+@@ -367,7 +388,11 @@ ngx_http_log_write(ngx_http_request_t *r
+ #else
+         n = ngx_write_fd(log->file->fd, buf, len);
+ #endif
+-
++#if (NGX_ENABLE_SYSLOG)
++        } else {
++            n = len;
++        }
++#endif
+     } else {
+         name = NULL;
+         n = ngx_http_log_script_write(r, log->script, &name, buf, len);
+@@ -1068,6 +1093,10 @@ ngx_http_log_merge_loc_conf(ngx_conf_t *
+     log->script = NULL;
+     log->disk_full_time = 0;
+     log->error_log_time = 0;
++#if (NGX_ENABLE_SYSLOG)
++    log->priority = HTTP_SYSLOG_PRIORITY;
++    log->syslog_on = 0;
++#endif
+     lmcf = ngx_http_conf_get_module_main_conf(cf, ngx_http_log_module);
+     fmt = lmcf->formats.elts;
+@@ -1096,6 +1125,13 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
+     ngx_http_log_main_conf_t   *lmcf;
+     ngx_http_script_compile_t   sc;
++#if (NGX_ENABLE_SYSLOG)
++    u_char                     *off;
++    ngx_str_t                   priority;
++    ngx_uint_t                  syslog_on = 0;
++    name = priority = (ngx_str_t)ngx_null_string;
++#endif
++
+     value = cf->args->elts;
+     if (ngx_strcmp(value[1].data, "off") == 0) {
+@@ -1108,6 +1144,38 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
+                            "invalid parameter \"%V\"", &value[2]);
+         return NGX_CONF_ERROR;
+     }
++#if (NGX_ENABLE_SYSLOG)
++    else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) {
++        if (!cf->cycle->new_log.syslog_set) {
++            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++                               "You must set the syslog directive and enable it first.");
++            return NGX_CONF_ERROR;
++        }
++
++        syslog_on = 1;
++        if (value[1].data[sizeof("syslog") - 1] == ':') {
++            priority.len = value[1].len - sizeof("syslog");
++            priority.data = value[1].data + sizeof("syslog");
++
++            off = (u_char*) ngx_strchr(priority.data, '|'); 
++            if (off != NULL) {
++                priority.len = off - priority.data;
++                
++                off++;
++                name.len = value[1].data + value[1].len - off;
++                name.data = off;
++            }
++        }
++        else {
++            if (value[1].len > sizeof("syslog")) {
++                name.len = value[1].len - sizeof("syslog");
++                name.data = value[1].data + sizeof("syslog");
++            }
++        }
++    } else {
++        name = value[1];
++    }
++#endif
+     if (llcf->logs == NULL) {
+         llcf->logs = ngx_array_create(cf->pool, 2, sizeof(ngx_http_log_t));
+@@ -1125,6 +1193,52 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
+     ngx_memzero(log, sizeof(ngx_http_log_t));
++#if (NGX_ENABLE_SYSLOG)
++    log->syslog_on = syslog_on;
++
++    if (priority.len == 0) {
++        log->priority = HTTP_SYSLOG_PRIORITY;
++    }
++    else {
++        log->priority = ngx_log_get_priority(cf, &priority);
++    }
++
++    if (name.len != 0) {
++        n = ngx_http_script_variables_count(&name);
++
++        if (n == 0) {
++            log->file = ngx_conf_open_file(cf->cycle, &name);
++            if (log->file == NULL) {
++                return NGX_CONF_ERROR;
++            }
++        } else {
++            if (ngx_conf_full_name(cf->cycle, &name, 0) != NGX_OK) {
++                return NGX_CONF_ERROR;
++            }
++            log->script = ngx_pcalloc(cf->pool, sizeof(ngx_http_log_script_t));
++            if (log->script == NULL) {
++                return NGX_CONF_ERROR;
++            }
++            ngx_memzero(&sc, sizeof(ngx_http_script_compile_t));
++            sc.cf = cf;
++            sc.source = &name;
++            sc.lengths = &log->script->lengths;
++            sc.values = &log->script->values;
++            sc.variables = n;
++            sc.complete_lengths = 1;
++            sc.complete_values = 1;
++            if (ngx_http_script_compile(&sc) != NGX_OK) {
++                return NGX_CONF_ERROR;
++            }
++        }
++    }
++    else {
++        log->file = ngx_conf_open_file(cf->cycle, &name);
++        if (log->file == NULL) {
++            return NGX_CONF_ERROR;
++        }
++    }
++#else
+     n = ngx_http_script_variables_count(&value[1]);
+     if (n == 0) {
+@@ -1157,6 +1271,7 @@ ngx_http_log_set_log(ngx_conf_t *cf, ngx
+             return NGX_CONF_ERROR;
+         }
+     }
++#endif
+     if (cf->args->nelts >= 3) {
+         name = value[2];
+Index: nginx-1.4.7/src/http/ngx_http_core_module.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_core_module.c
++++ nginx-1.4.7/src/http/ngx_http_core_module.c
+@@ -1462,6 +1462,9 @@ ngx_http_update_location_config(ngx_http
+     if (r == r->main) {
+         ngx_http_set_connection_log(r->connection, clcf->error_log);
++#if (NGX_ENABLE_SYSLOG)
++        r->connection->log->priority = clcf->error_log->priority;
++#endif
+     }
+     if ((ngx_io.flags & NGX_IO_SENDFILE) && clcf->sendfile) {
+@@ -4901,6 +4904,15 @@ ngx_http_core_error_log(ngx_conf_t *cf,
+     ngx_str_t  *value, name;
++#if (NGX_ENABLE_SYSLOG)
++    u_char     *off = NULL;
++    ngx_int_t   syslog_on = 0;
++    ngx_str_t   priority;
++
++    name = priority = (ngx_str_t) ngx_null_string;
++#endif
++
++
+     if (clcf->error_log) {
+         return "is duplicate";
+     }
+@@ -4910,6 +4922,36 @@ ngx_http_core_error_log(ngx_conf_t *cf,
+     if (ngx_strcmp(value[1].data, "stderr") == 0) {
+         ngx_str_null(&name);
++#if (NGX_ENABLE_SYSLOG)
++    } else if (ngx_strncmp(value[1].data, "syslog", sizeof("syslog") - 1) == 0) {
++        if (!cf->cycle->new_log.syslog_set) {
++            ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
++                    "You must set the syslog directive and enable it first.");
++            return NGX_CONF_ERROR;
++        }
++
++        syslog_on = 1;
++
++        if (value[1].data[sizeof("syslog") - 1] == ':') {
++            priority.len = value[1].len - sizeof("syslog");
++            priority.data = value[1].data + sizeof("syslog");
++
++            off = (u_char*) ngx_strchr(priority.data, '|'); 
++            if (off != NULL) {
++                priority.len = off - priority.data;
++
++                off++;
++                name.len = value[1].data + value[1].len - off;
++                name.data = off;
++            }
++        }
++        else {
++            if (value[1].len > sizeof("syslog")) {
++                name.len = value[1].len - sizeof("syslog");
++                name.data = value[1].data + sizeof("syslog");
++            }
++        }
++#endif
+     } else {
+         name = value[1];
+     }
+@@ -4919,6 +4961,17 @@ ngx_http_core_error_log(ngx_conf_t *cf,
+         return NGX_CONF_ERROR;
+     }
++#if (NGX_ENABLE_SYSLOG)
++    if (syslog_on) {
++        clcf->error_log->syslog_on = 1;
++        if (ngx_log_set_priority(cf, &priority, clcf->error_log) == NGX_CONF_ERROR) {
++            return NGX_CONF_ERROR;
++        }
++    }
++
++    clcf->error_log->log_level = 0;
++#endif
++
+     if (cf->args->nelts == 2) {
+         clcf->error_log->log_level = NGX_LOG_ERR;
+         return NGX_CONF_OK;
+Index: nginx-1.4.7/src/http/ngx_http_request.c
+===================================================================
+--- nginx-1.4.7.orig/src/http/ngx_http_request.c
++++ nginx-1.4.7/src/http/ngx_http_request.c
+@@ -533,6 +533,9 @@ ngx_http_create_request(ngx_connection_t
+     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+     ngx_http_set_connection_log(r->connection, clcf->error_log);
++#if (NGX_ENABLE_SYSLOG)
++    c->log->priority = clcf->error_log->priority;
++#endif
+     r->header_in = hc->nbusy ? hc->busy[0] : c->buffer;
+@@ -872,6 +875,9 @@ ngx_http_ssl_servername(ngx_ssl_conn_t *
+     clcf = ngx_http_get_module_loc_conf(hc->conf_ctx, ngx_http_core_module);
+     ngx_http_set_connection_log(c, clcf->error_log);
++#if (NGX_ENABLE_SYSLOG)
++    c->log->priority = clcf->error_log->priority;
++#endif
+     sscf = ngx_http_get_module_srv_conf(hc->conf_ctx, ngx_http_ssl_module);
+@@ -2077,6 +2083,9 @@ ngx_http_set_virtual_server(ngx_http_req
+     clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
+     ngx_http_set_connection_log(r->connection, clcf->error_log);
++#if (NGX_ENABLE_SYSLOG)
++    r->connection->log->priority = clcf->error_log->priority;
++#endif
+     return NGX_OK;
+ }
diff --git a/trunk/package/network/services/opentracker/Makefile b/trunk/package/network/services/opentracker/Makefile
new file mode 100644 (file)
index 0000000..4422cd3
--- /dev/null
@@ -0,0 +1,98 @@
+#
+# 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:=opentracker
+PKG_VERSION:=20150427
+PKG_RELEASE:=1
+PKG_REV:=27499d7a55bde404f3273a23026f2495e96adf87
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=Beerware
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=git://erdgeist.org/opentracker
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE_PROTO:=git
+PKG_BUILD_DEPENDS:=libowfat
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/opentracker/Default
+  SUBMENU:=BitTorrent
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=opentracker
+  URL:=http://erdgeist.org/arts/software/opentracker/
+  DEPENDS:=+zlib +libpthread
+endef
+
+define Package/opentracker
+$(call Package/opentracker/Default)
+  VARIANT:=ipv4
+endef
+
+define Package/opentracker6
+$(call Package/opentracker/Default)
+  TITLE+= (IPv6 build)
+  VARIANT:=ipv6
+endef
+
+
+define Package/opentracker-default/description
+ opentracker - An open and free bittorrent tracker
+
+ opentracker is an open and free bittorrent tracker project.
+ It aims for minimal resource usage and is intended to run at your wlan router.
+ Currently it is deployed as an open and free tracker instance.
+ Read our free and open tracker blog and announce your torrents there
+ (but do not hesitate to setup your own free trackers!).
+endef
+
+define Package/opentracker/description
+ $(call Package/opentracker-default/description)
+
+ This package contains the IPv4-build of opentracker.
+
+endef
+
+define Package/opentracker6/description
+ $(call Package/opentracker-default/description)
+
+ This package contains the IPv6-build of opentracker.
+
+endef
+
+
+MAKE_FLAGS += PREFIX="$(STAGING_DIR)/usr"
+
+ifeq ($(BUILD_VARIANT),ipv6)
+  MAKE_FLAGS += FEATURES="-DWANT_V6"
+endif
+
+define Package/opentracker/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/opentracker $(1)/usr/bin
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/opentracker.conf.sample $(1)/etc/opentracker.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/opentracker.init $(1)/etc/init.d/opentracker
+endef
+
+define Package/opentracker6/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/opentracker $(1)/usr/bin/opentracker6
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) $(PKG_BUILD_DIR)/opentracker.conf.sample $(1)/etc/opentracker6.conf
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/opentracker6.init $(1)/etc/init.d/opentracker6
+endef
+
+$(eval $(call BuildPackage,opentracker))
+$(eval $(call BuildPackage,opentracker6))
diff --git a/trunk/package/network/services/opentracker/files/opentracker.init b/trunk/package/network/services/opentracker/files/opentracker.init
new file mode 100755 (executable)
index 0000000..91fb386
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+
+START=10
+STOP=15
+
+NAME="opentracker"
+PROG="/usr/bin/opentracker"
+OPTIONS="-f /etc/opentracker.conf"
+USE_PROCD=1
+
+start_service()
+{
+       procd_open_instance
+       procd_set_param command $PROG $OPTIONS
+       procd_close_instance
+}
diff --git a/trunk/package/network/services/opentracker/files/opentracker6.init b/trunk/package/network/services/opentracker/files/opentracker6.init
new file mode 100755 (executable)
index 0000000..02417f3
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh /etc/rc.common
+
+START=10
+STOP=15
+
+NAME="opentracker6"
+PROG="/usr/bin/opentracker6"
+OPTIONS="-f /etc/opentracker6.conf"
+USE_PROCD=1
+
+start_service()
+{
+       procd_open_instance
+       procd_set_param command $PROG $OPTIONS
+       procd_close_instance
+}
diff --git a/trunk/package/network/services/opentracker/patches/100-makefile.patch b/trunk/package/network/services/opentracker/patches/100-makefile.patch
new file mode 100644 (file)
index 0000000..bbaf8d9
--- /dev/null
@@ -0,0 +1,30 @@
+--- a/Makefile
++++ b/Makefile
+@@ -9,13 +9,13 @@ CC?=gcc
+ # BSD flavour
+ # PREFIX?=/usr/local
+-# LIBOWFAT_HEADERS=$(PREFIX)/include/libowfat
+-# LIBOWFAT_LIBRARY=$(PREFIX)/lib
++LIBOWFAT_HEADERS=$(PREFIX)/include/libowfat
++LIBOWFAT_LIBRARY=$(PREFIX)/lib
+ # Debug flavour
+-PREFIX?=..
+-LIBOWFAT_HEADERS=$(PREFIX)/libowfat
+-LIBOWFAT_LIBRARY=$(PREFIX)/libowfat
++# PREFIX?=..
++# LIBOWFAT_HEADERS=$(PREFIX)/libowfat
++# LIBOWFAT_LIBRARY=$(PREFIX)/libowfat
+ BINDIR?=$(PREFIX)/bin
+@@ -66,7 +66,7 @@ CFLAGS_debug = $(CFLAGS) $(OPTS_debug) $
+ $(BINARY): $(OBJECTS) $(HEADERS)
+       $(CC) -o $@ $(OBJECTS) $(LDFLAGS)
+-      strip $@
++      $(STRIP) $@
+ $(BINARY).debug: $(OBJECTS_debug) $(HEADERS)
+       $(CC) -o $@ $(OBJECTS_debug) $(LDFLAGS)
+ proxy: $(OBJECTS_proxy) $(HEADERS)
diff --git a/trunk/package/network/services/seafile-ccnet/Makefile b/trunk/package/network/services/seafile-ccnet/Makefile
new file mode 100644 (file)
index 0000000..6c7ae8d
--- /dev/null
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2007-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:=seafile-ccnet
+PKG_VERSION:=4.1.2
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+PKG_LICENSE:=GPL-3.0
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/haiwen/ccnet.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=a73109f09af4ecc49cdc4c57cdde51b38e15c31a
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/seafile-ccnet
+    SECTION:=net
+    CATEGORY:=Network
+    TITLE:=Seafile server - ccnet component
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+libsearpc +libevent2 +libopenssl \
+               +glib2 +python +libzdb +libuuid \
+               +libpthread +libsqlite3 +jansson $(ICONV_DEPENDS)
+endef
+
+define Package/seafile-ccnet/description
+   Ccnet is a framework for writing networked applications in C.
+endef
+
+CONFIGURE_ARGS += --disable-client \
+                   --enable-server \
+                   --disable-ldap \
+                   --disable-cluster \
+                   --enable-python \
+                   --disable-server-pkg \
+                   --disable-static-build \
+                   --disable-compile-demo \
+                   --disable-console
+
+PKG_BUILD_DEPENDS:=vala/host \
+                  libsearpc/host
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
+                   -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
+
+define Package/seafile-ccnet/install
+       $(INSTALL_DIR) $(1)/usr/{bin,lib}
+       $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/ccnet* $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/ccnet $(1)/usr/lib/python2.7/site-packages/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/ccnet* $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libccnet.pc $(1)/usr/lib/pkgconfig/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.a $(1)/usr/lib/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libccnet.so* $(1)/usr/lib/
+endef
+
+$(eval $(call BuildPackage,seafile-ccnet))
diff --git a/trunk/package/network/services/seafile-seahub/Makefile b/trunk/package/network/services/seafile-seahub/Makefile
new file mode 100644 (file)
index 0000000..cbedc5c
--- /dev/null
@@ -0,0 +1,159 @@
+#
+# Copyright (C) 2007-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:=seafile-seahub
+PKG_VERSION:=4.1.2
+PKG_RELEASE=$(PKG_SOURCE_VERSION)
+PKG_LICENSE:=Apache-2.0
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/haiwen/seahub.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=3fb1288f920de03a4e2e6a06b60671ce98971742
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/seafile-seahub
+    SECTION:=net
+    CATEGORY:=Network
+    TITLE:=Seafile server - seahub component
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+python +simplejson +python-imglib +python-setuptools
+endef
+
+define Package/seafile-seahub/description
+   The web end of seafile server.
+
+   NOTE: in order to have better performance, language support is turned off by default.
+   Please set 'USE_I18N = True' in seahub_settings.py to support multiple languages.
+endef
+
+PKG_BUILD_DEPENDS:=python-setuptools
+PYTHONPATH:=$(PYTHONPATH):$(PKG_BUILD_DIR)/thirdpart
+
+define Download/django
+   FILE=Django-1.5.8.tar.gz
+   URL=https://www.djangoproject.com/m/releases/1.5/
+   MD5SUM:=675fc736e2c29090f005e217ccf90b5b
+endef
+
+define Download/djblets
+   PROTO=git
+   URL=https://github.com/djblets/djblets.git
+   SUBDIR=djblets-0.6.14
+   FILE=djblets-0.6.14.tar.gz
+   VERSION=58c09bae9b71ac164f78c76746fd2e545aae6c68
+endef
+
+define Download/gunicorn
+   FILE=gunicorn-0.16.1.tar.gz
+   URL=https://pypi.python.org/packages/source/g/gunicorn/
+   MD5SUM:=d53d5d04d941f2a3089e814e753a218f
+endef
+
+define Download/six
+   FILE=six-1.4.1.tar.gz
+   URL=https://pypi.python.org/packages/source/s/six/
+   MD5SUM:=bdbb9e12d3336c198695aa4cf3a61d62
+endef
+
+define Download/chardet
+   FILE=chardet-2.1.1.tar.gz
+   URL=https://pypi.python.org/packages/source/c/chardet/
+   MD5SUM:=295367fd210d20f3febda615a88e1ef0
+endef
+
+define Download/flup
+   FILE=flup-1.0.2-py2.6.egg
+   URL=https://pypi.python.org/packages/2.6/f/flup/
+   MD5SUM:=93ec6e3baeee3e5649a8456105178d4e
+endef
+
+define Download/lockfile
+   FILE=lockfile-0.9.1.tar.gz
+   URL=https://pypi.python.org/packages/source/l/lockfile/
+   MD5SUM:=ce61468d4c1263e3005737bbed2641f0
+endef
+
+define Download/python-daemon
+   FILE=python-daemon-1.5.5.tar.gz
+   URL=https://pypi.python.org/packages/source/p/python-daemon/
+   MD5SUM:=1f6cd41473c2e201021a0aeef395b2b1
+endef
+
+define Download/python-dateutil
+   FILE=python-dateutil-1.5.tar.gz
+   URL=https://pypi.python.org/packages/source/p/python-dateutil/
+   MD5SUM:=0dcb1de5e5cad69490a3b6ab63f0cfa5
+endef
+
+define Build/Configure
+endef
+
+define Build/Compile
+       # Download python dependencies
+       $(eval $(call Download,django))
+       $(eval $(call Download,djblets))
+       $(eval $(call Download,gunicorn))
+       $(eval $(call Download,six))
+       $(eval $(call Download,chardet))
+       $(eval $(call Download,flup))
+       $(eval $(call Download,lockfile))
+       $(eval $(call Download,python-daemon))
+       $(eval $(call Download,python-dateutil))
+       # Install python dependencies
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/Django-1.5.8.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/djblets-0.6.14.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/gunicorn-0.16.1.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/six-1.4.1.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/chardet-2.1.1.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/flup-1.0.2-py2.6.egg)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/lockfile-0.9.1.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/python-daemon-1.5.5.tar.gz)
+       $(call HostPython,, \
+               $(STAGING_DIR_ROOT)/usr/bin/easy_install -d $(PKG_BUILD_DIR)/thirdpart -Z -N \
+               $(DL_DIR)/python-dateutil-1.5.tar.gz)
+endef
+
+define Package/seafile-seahub/install
+       $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/seahub
+       $(CP) $(PKG_BUILD_DIR)/{locale,media,fabfile,seahub,sql,tests,thirdpart,tools} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/*.{sh,template,py,txt} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/{CONTRIBUTORS,HACKING,README.markdown} $(1)/usr/share/seafile/seafile-server/seahub/
+       $(CP) $(PKG_BUILD_DIR)/pylintrc* $(1)/usr/share/seafile/seafile-server/seahub/
+       # fix python exec path in scripts
+       sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/chardetect.py
+       sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/django-admin.py
+       sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn
+       sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_django
+       sed -i 's/#!.*/#!\/usr\/bin\/python/g' $(1)/usr/share/seafile/seafile-server/seahub/thirdpart/gunicorn_paster
+       find $(1) -name "*\.pyc" -o -name "*\.pyo" | xargs rm -f
+       sed -i "s/\(SEAFILE_VERSION\s*=\s*\)'\([0-9]\.[0-9]\.[0-9]\)'/\1'$(PKG_VERSION)'/g" $(1)/usr/share/seafile/seafile-server/seahub/seahub/settings.py
+endef
+
+$(eval $(call BuildPackage,seafile-seahub))
diff --git a/trunk/package/network/services/seafile-seahub/patches/010-default-config.patch b/trunk/package/network/services/seafile-seahub/patches/010-default-config.patch
new file mode 100644 (file)
index 0000000..4168dc1
--- /dev/null
@@ -0,0 +1,30 @@
+diff -rupN seahub-3.1.7-server.orig/seahub/settings.py seahub-3.1.7-server/seahub/settings.py
+--- seahub-3.1.7-server.orig/seahub/settings.py        2014-10-20 09:32:35.000000000 +0200
++++ seahub-3.1.7-server/seahub/settings.py     2014-12-10 15:47:21.625104606 +0100
+@@ -46,7 +46,7 @@ SITE_ID = 1
+ # If you set this to False, Django will make some optimizations so as not
+ # to load the internationalization machinery.
+-USE_I18N = True
++USE_I18N = False
+ # If you set this to False, Django will not format dates, numbers and
+ # calendars according to the current locale.
+@@ -209,7 +209,7 @@ SHOW_REPO_DOWNLOAD_BUTTON = False
+ REPO_PASSWORD_MIN_LENGTH = 8
+ # mininum length for user's password
+-USER_PASSWORD_MIN_LENGTH = 6
++USER_PASSWORD_MIN_LENGTH = 8
+ # LEVEL based on four types of input:
+ # num, upper letter, lower letter, other symbols
+@@ -218,7 +218,7 @@ USER_PASSWORD_STRENGTH_LEVEL = 3
+ # default False, only check USER_PASSWORD_MIN_LENGTH
+ # when True, check password strength level, STRONG(or above) is allowed
+-USER_STRONG_PASSWORD_REQUIRED = False
++USER_STRONG_PASSWORD_REQUIRED = True
+ # Using server side crypto by default, otherwise, let user choose crypto method.
+ FORCE_SERVER_CRYPTO = True
diff --git a/trunk/package/network/services/seafile-server/Makefile b/trunk/package/network/services/seafile-server/Makefile
new file mode 100644 (file)
index 0000000..f671a79
--- /dev/null
@@ -0,0 +1,133 @@
+#
+# Copyright (C) 2007-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:=seafile-server
+PKG_VERSION:=4.1.2
+PKG_RELEASE=$(PKG_SOURCE_VERSION)-2
+PKG_LICENSE:=GPL-3.0
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/haiwen/seafile.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=c0166019c712e2e1d5e532fd5f7401b1b72db6d8
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
+PKG_FIXUP:=autoreconf
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include $(INCLUDE_DIR)/nls.mk
+
+define Package/seafile-server
+    SECTION:=net
+    CATEGORY:=Network
+    TITLE:=Seafile server
+    MAINTAINER:=Gergely Kiss <mail.gery@gmail.com>
+    URL:=http://seafile.com/
+    DEPENDS:=+shadow-useradd +libarchive +libopenssl +glib2 +libsearpc +seafile-ccnet +seafile-seahub \
+               +sqlite3-cli +python-mysql +jansson +libevent2 +libevent2-openssl +zlib +libzdb +libsqlite3 \
+               +libmysqlclient +libpthread +libuuid \
+               +bash +sudo +procps +procps-pkill $(ICONV_DEPENDS)
+    EXTRA_DEPENDS:=seafile-ccnet (=4.1.2-a73109f09af4ecc49cdc4c57cdde51b38e15c31a), seafile-seahub (=4.1.2-3fb1288f920de03a4e2e6a06b60671ce98971742)
+endef
+
+define Package/seafile-server/description
+   Open source cloud storage with advanced features on privacy protection and teamwork.
+endef
+
+define Package/seafile-server/conffiles
+/etc/config/seafile
+endef
+
+CONFIGURE_ARGS += --disable-riak \
+                   --disable-client \
+                   --disable-fuse \
+                   --enable-server \
+                   --enable-python \
+                   --disable-static-build \
+                   --disable-server-pkg \
+                   --disable-console
+
+PKG_BUILD_DEPENDS:=vala/host \
+                   libsearpc/host \
+                   libevhtp-1.1
+
+TARGET_LDFLAGS += -Wl,-rpath-link=$(STAGING_DIR)/usr/lib -liconv \
+                   -L$(STAGING_DIR)/usr/lib/mysql -lmysqlclient -lz
+
+define Package/seafile-server/install
+       $(INSTALL_DIR) $(1)/usr/{bin,lib}
+       $(INSTALL_DIR) $(1)/usr/lib/python2.7/site-packages
+       $(INSTALL_DIR) $(1)/usr/share/seafile/seafile-server/runtime
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_DIR) $(1)/etc/config
+       $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seafile/ $(1)/usr/lib/python2.7/site-packages/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/python2.7/site-packages/seaserv/ $(1)/usr/lib/python2.7/site-packages/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
+       $(CP) $(PKG_BUILD_DIR)/scripts/seaf-gc.sh $(1)/usr/share/seafile/seafile-server/
+       $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.py $(1)/usr/share/seafile/seafile-server/
+       $(CP) $(PKG_BUILD_DIR)/scripts/setup-seafile-mysql.sh $(1)/usr/share/seafile/seafile-server/
+       $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.py $(1)/usr/share/seafile/seafile-server/
+       $(CP) $(PKG_BUILD_DIR)/scripts/sqlite2mysql.sh $(1)/usr/share/seafile/seafile-server/
+       $(CP) $(PKG_BUILD_DIR)/scripts/upgrade/ $(1)/usr/share/seafile/seafile-server/
+       $(INSTALL_BIN) ./files/seafile.init $(1)/etc/init.d/seafile
+       $(CP) ./files/seafile.conf $(1)/etc/config/seafile
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) $(PKG_INSTALL_DIR)/usr/include/seafile/ $(1)/usr/include/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseafile.pc $(1)/usr/lib/pkgconfig/
+       $(CP) $(PKG_INSTALL_DIR)/usr/lib/libseafile.so* $(1)/usr/lib/
+endef
+
+define Package/seafile-server/postinst
+#!/bin/sh
+
+if ! id -u seafile >/dev/null 2>&1; then
+    useradd seafile -d "/usr/share/seafile" -s /bin/sh; fi
+
+chown -R seafile:seafile /usr/share/seafile/
+chmod -R o-rwx /usr/share/seafile/
+
+if [ ! -d "/usr/share/seafile/seafile-data" ]
+then
+   echo "*** Installation completed, running configuration script..."
+   /etc/init.d/seafile setup
+
+   if [ $$? -ne 0 ]
+   then
+      echo
+      echo "*** ERROR: Configuration failed. Please fix the issues if any and re-run the script using the command below:"
+      echo "*** \"/etc/init.d/seafile setup\""
+   fi
+
+   echo
+   echo "*** NOTE: you need to create an admin account before using Seafile."
+   echo "*** Please run \"/etc/init.d/seafile create_admin\" to do so."
+else
+   echo "*** WARNING: it seems you are upgrading from an older version."
+   echo "*** If so, please run the appropriate upgrade script before using the new version of Seafile."
+   echo "*** Upgrade scripts are located at \"/usr/share/seafile/seafile-server/upgrade\""
+   echo
+   echo "*** For more information, please read http://manual.seafile.com/deploy/upgrade.html"
+   exit
+fi
+
+/etc/init.d/seafile enable
+/etc/init.d/seafile restart
+endef
+
+define Package/seafile-server/prerm
+#!/bin/sh
+/etc/init.d/seafile stop
+endef
+
+$(eval $(call BuildPackage,seafile-server))
diff --git a/trunk/package/network/services/seafile-server/files/seafile.conf b/trunk/package/network/services/seafile-server/files/seafile.conf
new file mode 100644 (file)
index 0000000..fa8240e
--- /dev/null
@@ -0,0 +1,2 @@
+# Start Seahub in fastcgi mode - 1 = enable, 0 = disable
+SEAHUB_FASTCGI=0
diff --git a/trunk/package/network/services/seafile-server/files/seafile.init b/trunk/package/network/services/seafile-server/files/seafile.init
new file mode 100755 (executable)
index 0000000..42f98e2
--- /dev/null
@@ -0,0 +1,57 @@
+#!/bin/sh /etc/rc.common
+
+START=99
+APP=seafile
+EXTRA_HELP="   setup   Runs the setup script
+       create_admin    Creates the administrative login
+       reset_admin     Alias to create_admin"
+EXTRA_COMMANDS="setup create_admin reset_admin"
+
+SEAHUB_FASTCGI=0
+
+[ -f /etc/config/seafile ] && \
+    . /etc/config/seafile
+
+export PATH="/usr/share/seafile/seafile-server/seahub/thirdpart:${PATH}"
+export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:${PYTHONPATH}"
+
+start() {
+       if [ ! -d /var/run/seafile ]
+       then
+           mkdir /var/run/seafile
+           chown seafile:seafile /var/run/seafile
+           chmod o-rwx /var/run/seafile
+       fi
+
+       if [ ${SEAHUB_FASTCGI} -eq 1 ]; then
+           cd "/usr/share/seafile" && \
+               sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
+               "/usr/bin/seafile-admin" start --fastcgi
+       else
+           cd "/usr/share/seafile" && \
+               sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
+               "/usr/bin/seafile-admin" start
+       fi
+}
+
+stop() {
+       cd "/usr/share/seafile" && \
+           sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
+           "/usr/bin/seafile-admin" stop
+}
+
+setup() {
+       cd "/usr/share/seafile" && \
+           sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
+           "/usr/bin/seafile-admin" setup
+}
+
+create_admin() {
+       cd "/usr/share/seafile" && \
+           sudo PYTHONPATH="${PYTHONPATH}" -u seafile -E \
+           "/usr/bin/seafile-admin" create-admin
+}
+
+reset_admin() {
+       create_admin
+}
diff --git a/trunk/package/network/services/seafile-server/patches/020-script-patches.patch b/trunk/package/network/services/seafile-server/patches/020-script-patches.patch
new file mode 100644 (file)
index 0000000..8bb7ae7
--- /dev/null
@@ -0,0 +1,40 @@
+diff -rupN seafile-3.1.7-server.orig/scripts/seaf-gc.sh seafile-3.1.7-server/scripts/seaf-gc.sh
+--- seafile-3.1.7-server.orig/scripts/seaf-gc.sh       2014-10-16 05:30:04.000000000 +0200
++++ seafile-3.1.7-server/scripts/seaf-gc.sh    2014-12-13 00:51:12.919136978 +0100
+@@ -6,11 +6,10 @@ SCRIPT=$(readlink -f "$0")
+ INSTALLPATH=$(dirname "${SCRIPT}")
+ TOPDIR=$(dirname "${INSTALLPATH}")
+ default_ccnet_conf_dir=${TOPDIR}/ccnet
+-seaf_gc=${INSTALLPATH}/seafile/bin/seafserv-gc
++seaf_gc=/usr/bin/seafserv-gc
+ seaf_gc_opts=""
+-export PATH=${INSTALLPATH}/seafile/bin:$PATH
+-export SEAFILE_LD_LIBRARY_PATH=${INSTALLPATH}/seafile/lib/:${INSTALLPATH}/seafile/lib64:${LD_LIBRARY_PATH}
++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
+ script_name=$0
+ function usage () {
+@@ -78,9 +77,7 @@ function run_seaf_gc () {
+     echo "Starting seafserv-gc, please wait ..."
+-    LD_LIBRARY_PATH=$SEAFILE_LD_LIBRARY_PATH ${seaf_gc} \
+-        -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" \
+-        ${seaf_gc_opts}
++    ${seaf_gc} -c "${default_ccnet_conf_dir}" -d "${seafile_data_dir}" ${seaf_gc_opts}
+     echo "seafserv-gc run done"
+     echo
+diff -rupN seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh seafile-3.1.7-server/scripts/setup-seafile-mysql.sh
+--- seafile-3.1.7-server.orig/scripts/setup-seafile-mysql.sh   2014-10-16 05:30:04.000000000 +0200
++++ seafile-3.1.7-server/scripts/setup-seafile-mysql.sh        2014-12-13 00:51:49.242172631 +0100
+@@ -9,6 +9,8 @@ set -e
+ SCRIPT=$(readlink -f "$0")
+ INSTALLPATH=$(dirname "${SCRIPT}")
++export PYTHONPATH="/usr/share/seafile/seafile-server/seahub/thirdpart:$PYTHONPATH"
++
+ cd "$INSTALLPATH"
+ python_script=setup-seafile-mysql.py
diff --git a/trunk/package/network/services/seafile-server/patches/030-pidfiles-in-same-directory.patch b/trunk/package/network/services/seafile-server/patches/030-pidfiles-in-same-directory.patch
new file mode 100644 (file)
index 0000000..4338f17
--- /dev/null
@@ -0,0 +1,24 @@
+diff -rupN seafile-3.1.7-server.orig/controller/seafile-controller.c seafile-3.1.7-server/controller/seafile-controller.c
+--- seafile-3.1.7-server.orig/controller/seafile-controller.c  2014-10-16 05:30:04.000000000 +0200
++++ seafile-3.1.7-server/controller/seafile-controller.c       2014-11-28 16:50:24.053674057 +0100
+@@ -21,7 +21,7 @@
+ SeafileController *ctl;
+-static char *controller_pidfile = NULL;
++static char *controller_pidfile = "/var/run/seafile/seafile-controller.pid";
+ char *bin_dir = NULL;
+ char *installpath = NULL;
+@@ -614,9 +614,9 @@ stop_ccnet_server ()
+ static void
+ init_pidfile_path (SeafileController *ctl)
+ {
+-    char *pid_dir = g_build_filename (topdir, "pids", NULL);
++    char *pid_dir = g_path_get_dirname (controller_pidfile);
+     if (!g_file_test(pid_dir, G_FILE_TEST_EXISTS)) {
+-        if (g_mkdir(pid_dir, 0777) < 0) {
++        if (g_mkdir(pid_dir, 0755) < 0) {
+             seaf_warning("failed to create pid dir %s: %s", pid_dir, strerror(errno));
+             controller_exit(1);
+         }
diff --git a/trunk/package/network/services/seafile-server/patches/040-seafile-admin.patch b/trunk/package/network/services/seafile-server/patches/040-seafile-admin.patch
new file mode 100644 (file)
index 0000000..1948c73
--- /dev/null
@@ -0,0 +1,68 @@
+diff -rupN seafile-3.1.7-server.orig/tools/seafile-admin seafile-3.1.7-server/tools/seafile-admin
+--- seafile-3.1.7-server.orig/tools/seafile-admin      2014-10-16 05:30:04.000000000 +0200
++++ seafile-3.1.7-server/tools/seafile-admin   2014-12-22 21:52:25.929781054 +0100
+@@ -416,13 +416,13 @@ def create_gunicorn_conf():
+     content = '''\
+ import os
+ daemon = True
+-workers = 3
++workers = 1
++threads = 3
+ # Logging
+ runtime_dir = os.path.dirname(__file__)
+-pidfile = os.path.join(runtime_dir, 'seahub.pid')
++pidfile = '/var/run/seafile/seahub.pid'
+ errorlog = os.path.join(runtime_dir, 'error.log')
+-accesslog = os.path.join(runtime_dir, 'access.log')
+ '''
+     try:
+         with open(confpath, 'w') as fp:
+@@ -607,6 +607,7 @@ def start_seahub_gunicorn():
+         'gunicorn_django',
+         '-c', conf[CONF_SEAHUB_CONF],
+         '-b', '0.0.0.0:%s' % conf[CONF_SEAHUB_PORT],
++        '-t', '120',
+     ]
+     info('Starting seahub...')
+@@ -625,6 +626,7 @@ def start_seahub_fastcgi():
+         'pidfile=%(pidfile)s',
+         'outlog=%(outlog)s',
+         'errlog=%(errlog)s',
++        'method=threaded',
+     ]
+     cmdline = ' '.join(argv) % \
+@@ -693,7 +695,7 @@ def check_layout(args):
+     conf[CONF_SEAFILE_DIR]      = seafile_data_dir
+     conf[CONF_SEAHUB_DIR]       = seahub_dir
+     conf[CONF_SEAHUB_CONF]      = seahub_conf
+-    conf[CONF_SEAHUB_PIDFILE]   = os.path.join(runtime_dir, 'seahub.pid')
++    conf[CONF_SEAHUB_PIDFILE]   = '/var/run/seafile/seahub.pid'
+     conf[CONF_SEAHUB_OUTLOG]    = os.path.join(runtime_dir, 'access.log')
+     conf[CONF_SEAHUB_ERRLOG]    = os.path.join(runtime_dir, 'error.log')
+@@ -738,10 +740,9 @@ def setup_seafile(args):
+     print '-----------------------------------------------------------------'
+     print '-----------------------------------------------------------------'
+     print
+-    print 'To start/stop seafile server:'
++    print 'To start, stop or restart seafile server, please run as root:'
+     print
+-    print highlight('         $ cd %s' % cwd)
+-    print highlight('         $ %s { start | stop }' % SCRIPT_NAME)
++    print highlight('         # /etc/init.d/seafile { start | stop | restart }')
+     print
+     print 'If you have any problem, refer to\n'
+     print
+@@ -802,8 +803,7 @@ def start_seafile(args):
+ def stop_seafile(dummy):
+     info('Stopping seafile server')
+     pkill('seafile-controller')
+-    runtime_dir = os.path.join(cwd, 'seafile-server', 'runtime')
+-    pidfile = os.path.join(runtime_dir, 'seahub.pid')
++    pidfile = '/var/run/seafile/seahub.pid'
+     try:
+         with open(pidfile, 'r') as fp:
+             pid = fp.read().strip('\n ')
diff --git a/trunk/package/network/services/seafile-server/patches/050-libevhtp-search-path-fix.patch b/trunk/package/network/services/seafile-server/patches/050-libevhtp-search-path-fix.patch
new file mode 100644 (file)
index 0000000..cb7e545
--- /dev/null
@@ -0,0 +1,17 @@
+diff -rupN seafile-server-4.1.2.orig/server/Makefile.am seafile-server-4.1.2/server/Makefile.am
+--- seafile-server-4.1.2.orig/server/Makefile.am       2015-05-02 11:04:11.000000000 +0200
++++ seafile-server-4.1.2/server/Makefile.am    2015-06-14 01:28:55.924834806 +0200
+@@ -4,6 +4,7 @@ AM_CFLAGS = -DPKGDATADIR=\"$(pkgdatadir)
+       -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\" \
+       -DSEAFILE_SERVER \
+       -DFULL_FEATURE \
++      -I$(STAGING_DIR)/usr/include/libevhtp-1.1 \
+       -I$(top_srcdir)/include \
+       -I$(top_srcdir)/lib \
+       -I$(top_builddir)/lib \
+@@ -122,4 +123,4 @@ seaf_server_LDADD = @CCNET_LIBS@ \
+       @SEARPC_LIBS@ @JANSSON_LIBS@ @ZDB_LIBS@ @CURL_LIBS@ ${LIB_WS32} @ZLIB_LIBS@ \
+       @LIBARCHIVE_LIBS@
+-seaf_server_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@
++seaf_server_LDFLAGS = @STATIC_COMPILE@ @SERVER_PKG_RPATH@ -L$(STAGING_DIR)/usr/lib/libevhtp-1.1
diff --git a/trunk/package/network/services/tor/Makefile b/trunk/package/network/services/tor/Makefile
new file mode 100644 (file)
index 0000000..d042ffb
--- /dev/null
@@ -0,0 +1,122 @@
+#
+# Copyright (C) 2008-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:=tor
+PKG_VERSION:=0.2.5.12
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=https://www.torproject.org/dist \
+       https://archive.torproject.org/tor-package-archive
+PKG_MD5SUM:=89745069a7efb7aafd01ae263bd0fe5c
+PKG_MAINTAINER:=Hauke Mehrtens <hauke@hauke-m.de>
+PKG_LICENSE_FILES:=LICENSE
+
+PKG_BUILD_DEPENDS:=libminiupnpc libnatpmp
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor/Default
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=https://www.torproject.org/
+  USERID:=tor=52:tor=52
+endef
+
+define Package/tor/Default/description
+ Tor is a toolset for a wide range of organizations and people that want to
+ improve their safety and security on the Internet. Using Tor can help you
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and
+ more. Tor also provides a platform on which software developers can build
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor
+$(call Package/tor/Default)
+  TITLE:=An anonymous Internet communication system
+  DEPENDS:=+libevent2 +libopenssl +libpthread +librt
+endef
+
+define Package/tor/description
+$(call Package/tor/Default/description)
+ This package contains the tor daemon.
+endef
+
+define Package/tor-fw-helper
+$(call Package/tor/Default)
+  TITLE:=Firewall helper for tor
+  DEPENDS:=+tor +libminiupnpc +libnatpmp
+endef
+
+define Package/tor-fw-helper/description
+$(call Package/tor/Default/description)
+ This package contains a helper for automatically configuring port forwarding.
+endef
+
+define Package/tor-geoip
+$(call Package/tor/Default)
+  TITLE:=GeoIP db for tor
+  DEPENDS:=+tor
+endef
+
+define Package/tor-geoip/description
+$(call Package/tor/Default/description)
+ This package contains a GeoIP database mapping IP addresses to countries.
+endef
+
+define Package/tor/conffiles
+/etc/tor/torrc
+endef
+
+CONFIGURE_ARGS += \
+       --with-libevent-dir="$(STAGING_DIR)/usr" \
+       --with-ssl-dir="$(STAGING_DIR)/usr" \
+       --enable-upnp \
+       --with-libminiupnpc-dir="$(STAGING_DIR)/usr" \
+       --enable-nat-pmp \
+       --with-libnatpmp-dir="$(STAGING_DIR)/usr" \
+       --disable-asciidoc \
+       --disable-seccomp
+
+ifneq ($(CONFIG_SSP_SUPPORT),y)
+       CONFIGURE_ARGS += \
+               --disable-gcc-hardening
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS)"
+else
+       MAKE_FLAGS += \
+               CFLAGS="$(TARGET_CFLAGS) -fPIC" 
+endif
+
+CONFIGURE_VARS += \
+       CROSS_COMPILE="yes"
+
+define Package/tor/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+       $(INSTALL_DIR) $(1)/etc/tor
+       $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/tor/torrc.sample $(1)/etc/tor/torrc
+endef
+
+define Package/tor-fw-helper/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/tor-fw-helper $(1)/usr/bin/
+endef
+
+define Package/tor-geoip/install
+       $(INSTALL_DIR) $(1)/usr/share/tor
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/tor/geoip $(1)/usr/share/tor/
+endef
+
+$(eval $(call BuildPackage,tor))
+$(eval $(call BuildPackage,tor-fw-helper))
+$(eval $(call BuildPackage,tor-geoip))
diff --git a/trunk/package/network/services/tor/files/tor.init b/trunk/package/network/services/tor/files/tor.init
new file mode 100644 (file)
index 0000000..6974057
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+STOP=50
+
+USE_PROCD=1
+
+start_service() {
+       [ -f /var/run/tor.pid ] || {
+               touch /var/run/tor.pid
+               chown tor:tor /var/run/tor.pid
+       }
+       [ -d /var/lib/tor ] || {
+               mkdir -m 0755 -p /var/lib/tor
+               chmod 0700 /var/lib/tor
+               chown tor:tor /var/lib/tor
+       }
+       [ -d /var/log/tor ] || {
+               mkdir -m 0755 -p /var/log/tor
+               chown tor:tor /var/log/tor
+       }
+       procd_open_instance
+       procd_set_param command /usr/sbin/tor --runasdaemon 0
+       procd_close_instance
+}
diff --git a/trunk/package/network/services/tor/patches/001-torrc.patch b/trunk/package/network/services/tor/patches/001-torrc.patch
new file mode 100644 (file)
index 0000000..e295219
--- /dev/null
@@ -0,0 +1,21 @@
+--- a/src/config/torrc.sample.in
++++ b/src/config/torrc.sample.in
+@@ -45,11 +45,11 @@
+ ## Uncomment this to start the process in the background... or use
+ ## --runasdaemon 1 on the command line. This is ignored on Windows;
+ ## see the FAQ entry if you want Tor to run as an NT service.
+-#RunAsDaemon 1
++RunAsDaemon 1
+ ## The directory for keeping all the keys/etc. By default, we store
+ ## things in $HOME/.tor on Unix, and in Application Data\tor on Windows.
+-#DataDirectory @LOCALSTATEDIR@/lib/tor
++DataDirectory @LOCALSTATEDIR@/lib/tor
+ ## The port on which Tor will listen for local connections from Tor
+ ## controller applications, as documented in control-spec.txt.
+@@ -190,3 +190,4 @@
+ ## address manually to your friends, uncomment this line:
+ #PublishServerDescriptor 0
++User tor
diff --git a/trunk/package/network/services/xinetd/Makefile b/trunk/package/network/services/xinetd/Makefile
new file mode 100644 (file)
index 0000000..c1586b7
--- /dev/null
@@ -0,0 +1,66 @@
+#
+# Copyright (C) 2006-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:=xinetd
+PKG_VERSION:=2.3.15
+PKG_RELEASE:=4
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.xinetd.org
+PKG_MD5SUM:=77358478fd58efa6366accae99b8b04c
+PKG_LICENSE:=xinetd
+PKG_LICENSE_FILES:=COPYRIGHT
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/xinetd
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A powerful and secure super-server
+  URL:=http://www.xinetd.org/
+  PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
+endef
+
+define Package/xinetd/description
+       xinetd has access control mechanisms, extensive logging capabilities,
+       the ability to make services available based on time, can place limits
+       on the number of servers that can be started, and has deployable
+       defence mechanisms to protect against port scanners, among other
+       things.
+endef
+
+define Package/xinetd/conffiles
+/etc/xinetd.conf
+endef
+
+TARGET_CFLAGS += -DNO_RPC
+TARGET_CPPFLAGS += -DHAVE_RLIM_T
+
+CONFIGURE_ARGS += \
+       --without-libwrap \
+       --with-loadavg
+
+CONFIGURE_VARS += \
+       ac_cv_header_rpc_pmap_clnt_h=no \
+       ac_cv_header_rpc_rpc_h=no \
+       ac_cv_header_rpc_rpcent_h=no
+
+define Package/xinetd/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/xinetd $(1)/usr/sbin/
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/xinetd.conf $(1)/etc/xinetd.conf
+       $(INSTALL_DIR) $(1)/etc/xinetd.d
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/xinetd.init $(1)/etc/init.d/xinetd
+endef
+
+$(eval $(call BuildPackage,xinetd))
diff --git a/trunk/package/network/services/xinetd/files/xinetd.conf b/trunk/package/network/services/xinetd/files/xinetd.conf
new file mode 100644 (file)
index 0000000..bd473ed
--- /dev/null
@@ -0,0 +1,6 @@
+defaults
+{
+
+}
+
+includedir /etc/xinetd.d
diff --git a/trunk/package/network/services/xinetd/files/xinetd.init b/trunk/package/network/services/xinetd/files/xinetd.init
new file mode 100644 (file)
index 0000000..1437f58
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2006-2011 OpenWrt.org
+
+START=50
+
+SERVICE_USE_PID=1
+
+start() {
+       service_start /usr/sbin/xinetd -pidfile /var/run/xinetd.pid
+}
+
+stop() {
+       service_stop /usr/sbin/xinetd
+}
+
diff --git a/trunk/package/network/services/xinetd/patches/001-ar.patch b/trunk/package/network/services/xinetd/patches/001-ar.patch
new file mode 100644 (file)
index 0000000..4d961ba
--- /dev/null
@@ -0,0 +1,66 @@
+--- a/libs/src/misc/Makefile.in
++++ b/libs/src/misc/Makefile.in
+@@ -62,7 +62,7 @@ libopt: clean
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ install: $(LIBNAME)
+--- a/libs/src/portable/Makefile.in
++++ b/libs/src/portable/Makefile.in
+@@ -57,7 +57,7 @@ libopt: clean
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ install: $(LIBNAME)
+--- a/libs/src/pset/Makefile.in
++++ b/libs/src/pset/Makefile.in
+@@ -53,7 +53,7 @@ libopt: clean
+       mv $(LIBNAME) $(LIBDIR)/optimized
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ install: $(LIBNAME)
+--- a/libs/src/sio/Makefile.in
++++ b/libs/src/sio/Makefile.in
+@@ -52,7 +52,7 @@ libopt: clean
+       $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)/optimized
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ install: $(LIBNAME)
+--- a/libs/src/str/Makefile.in
++++ b/libs/src/str/Makefile.in
+@@ -63,7 +63,7 @@ libopt: clean
+       $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)-O
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ LINT_IGNORE=possible pointer alignment|RCSid unused
+--- a/libs/src/xlog/Makefile.in
++++ b/libs/src/xlog/Makefile.in
+@@ -58,7 +58,7 @@ libopt: clean
+       $(INSTALL) $(FMODE) $(LIBNAME) $(LIBDIR)/optimized
+ $(LIBNAME): $(OBJECTS)
+-      ar r $@ $?
++      $(AR) r $@ $?
+       $(RANLIB) $@
+ install: $(LIBNAME)
diff --git a/trunk/package/network/services/xinetd/patches/002-destdir.patch b/trunk/package/network/services/xinetd/patches/002-destdir.patch
new file mode 100644 (file)
index 0000000..89075c8
--- /dev/null
@@ -0,0 +1,27 @@
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -75,15 +75,15 @@ dlibxlog: dlibsio dlibstr
+ install: build
+       for i in $(DAEMONDIR) $(BINDIR) $(MANDIR)/man5 $(MANDIR)/man8 ; do \
+-         test -d $$i || mkdir -p $$i ; done
+-      $(INSTALL_CMD) -m 755 xinetd/xinetd $(DAEMONDIR)
+-      $(INSTALL_CMD) -m 755 xinetd/itox $(DAEMONDIR)
+-      $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DAEMONDIR)
+-      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(MANDIR)/man5/xinetd.conf.5
+-      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(MANDIR)/man8/xinetd.log.8
+-      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(MANDIR)/man8/xinetd.8
+-      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(MANDIR)/man8/itox.8
+-      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(MANDIR)/man8/xconv.pl.8
++         test -d $(DESTDIR)$$i || mkdir -p $(DESTDIR)$$i ; done
++      $(INSTALL_CMD) -m 755 xinetd/xinetd $(DESTDIR)$(DAEMONDIR)
++      $(INSTALL_CMD) -m 755 xinetd/itox $(DESTDIR)$(DAEMONDIR)
++      $(INSTALL_CMD) -m 755 $(SRCDIR)/xinetd/xconv.pl $(DESTDIR)$(DAEMONDIR)
++      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.conf.man $(DESTDIR)$(MANDIR)/man5/xinetd.conf.5
++      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.log.man $(DESTDIR)$(MANDIR)/man8/xinetd.log.8
++      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xinetd.man $(DESTDIR)$(MANDIR)/man8/xinetd.8
++      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/itox.8 $(DESTDIR)$(MANDIR)/man8/itox.8
++      $(INSTALL_CMD) -m 644 $(SRCDIR)/xinetd/xconv.pl.8 $(DESTDIR)$(MANDIR)/man8/xconv.pl.8
+       @echo "You must put your xinetd.conf in /etc/xinetd.conf"
+       @echo "There is a sample config file in xinetd/sample.conf and you can"
+       @echo "use xconv.pl to convert your old inetd.conf file to an xinetd format"
diff --git a/trunk/package/network/services/xinetd/patches/003-rpc_fix.patch b/trunk/package/network/services/xinetd/patches/003-rpc_fix.patch
new file mode 100644 (file)
index 0000000..11f47e7
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/xinetd/confparse.c
++++ b/xinetd/confparse.c
+@@ -745,7 +745,7 @@ static status_e check_entry( struct serv
+          }
+    }
+-/* #ifndef NO_RPC */
++#ifndef NO_RPC
+ #if defined(HAVE_RPC_RPCENT_H) || defined(HAVE_NETDB_H)
+    if ( SC_IS_RPC( scp ) && !SC_IS_UNLISTED( scp ) )
+    {
+@@ -759,6 +759,7 @@ static status_e check_entry( struct serv
+       SC_RPCDATA( scp )->rd_program_number = rep->r_number ;
+    }
+    else
++#endif
+ #endif   /* ! NO_RPC */
+    {
+        if ( !SC_IS_UNLISTED( scp ) ) 
diff --git a/trunk/package/network/services/xinetd/patches/004-ident-bind.patch b/trunk/package/network/services/xinetd/patches/004-ident-bind.patch
new file mode 100644 (file)
index 0000000..0da0148
--- /dev/null
@@ -0,0 +1,42 @@
+xinetd: socket bind: Invalid argument (errno = 22) when using USERID on ipv6
+
+Use right size of addresses in bind() call. Also use getpeername addresses when
+connecting to ident service to prevent address family mismatch between socket(),
+bind() and connect() calls.
+
+Author: Jan Safranek <jsafrane@redhat.com>
+Reviewed-By: Adam Tkac <atkac@redhat.com>
+
+#diff -up xinetd-2.3.14/xinetd/ident.c.orig xinetd-2.3.14/xinetd/ident.c
+--- a/xinetd/ident.c
++++ b/xinetd/ident.c
+@@ -97,7 +97,13 @@ idresult_e log_remote_user( const struct
+    }
+    CLEAR( sin_contact );
+-   sin_remote = *CONN_XADDRESS( SERVER_CONNECTION( serp ) ) ;
++
++   sin_len = sizeof( sin_remote );
++   if ( getpeername( SERVER_FD( serp ), &sin_remote.sa, &sin_len ) == -1 )
++   {
++      msg( LOG_ERR, func, "(%d) getpeername: %m", getpid() ) ;
++      return( IDR_ERROR ) ;
++   }
+    sin_contact = sin_remote;
+    memcpy( &sin_bind, &sin_local, sizeof(sin_bind) ) ;
+    local_port = 0;
+@@ -127,7 +133,13 @@ idresult_e log_remote_user( const struct
+       msg( LOG_ERR, func, "socket creation: %m" ) ;
+       return( IDR_ERROR ) ;
+    }
+-   if ( bind(sd, &sin_bind.sa, sizeof(sin_bind.sa)) == -1 )
++
++   if ( sin_bind.sa.sa_family == AF_INET ) 
++      sin_len = sizeof( sin_bind.sa_in ) ;
++   else
++      sin_len = sizeof( sin_bind.sa_in6 ) ;
++
++   if ( bind(sd, &sin_bind.sa, sin_len) == -1 )
+    { 
+       msg( LOG_ERR, func, "socket bind: %m" ) ;
+       (void) Sclose( sd ) ;
diff --git a/trunk/package/network/utils/mtr/Makefile b/trunk/package/network/utils/mtr/Makefile
new file mode 100644 (file)
index 0000000..f3ca9ba
--- /dev/null
@@ -0,0 +1,73 @@
+#
+# Copyright (C) 2006-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:=mtr
+PKG_REV:=dd2b750
+PKG_VERSION:=0.85+newdns-$(PKG_REV)
+PKG_RELEASE:=2
+
+PKG_SOURCE_PROTO:=git
+PKG_SOURCE_URL:=https://github.com/traviscross/mtr.git
+PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
+PKG_SOURCE_VERSION:=$(PKG_REV)
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_SOURCE_VERSION).tar.gz
+
+PKG_LICENSE:=GPL-2.0+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/mtr
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libncurses
+  TITLE:=Full screen ncurses traceroute tool
+  URL:=http://www.bitwizard.nl/mtr/
+  PKG_MAINTAINER:=Jonathan McCrohan <jmccrohan@gmail.com>
+endef
+
+define Package/mtr/description
+       mtr combines the functionality of the 'traceroute' and 'ping' programs
+       in a single network diagnostic tool.
+       As mtr starts, it investigates the network connection between the host
+       mtr runs on and a user-specified destination host. After it
+       determines the address of each network hop between the machines,
+       it sends a sequence ICMP ECHO requests to each one to determine the
+       quality of the link to each machine. As it does this, it prints
+       running statistics about each machine.
+endef
+
+CONFIGURE_ARGS += \
+       --without-gtk \
+       --without-glib \
+       $(call autoconf_bool,CONFIG_IPV6,ipv6)
+
+define Build/Configure
+       (cd $(PKG_BUILD_DIR); touch \
+               configure.in \
+               aclocal.m4 \
+               Makefile.in \
+               img/Makefile.in \
+               stamp-h.in \
+               config.h.in \
+               configure \
+       );
+       $(call Build/Configure/Default)
+endef
+
+define Package/mtr/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/mtr $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,mtr))
diff --git a/trunk/package/network/utils/mtr/patches/100-disabled-ipv6-fix.patch b/trunk/package/network/utils/mtr/patches/100-disabled-ipv6-fix.patch
new file mode 100644 (file)
index 0000000..5ef9984
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/net.c
++++ b/net.c
+@@ -307,9 +307,11 @@ void net_send_tcp(int index)
+   struct sockaddr_storage local;
+   struct sockaddr_storage remote;
+   struct sockaddr_in *local4 = (struct sockaddr_in *) &local;
+-  struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+   struct sockaddr_in *remote4 = (struct sockaddr_in *) &remote;
++#ifdef ENABLE_IPV6
++  struct sockaddr_in6 *local6 = (struct sockaddr_in6 *) &local;
+   struct sockaddr_in6 *remote6 = (struct sockaddr_in6 *) &remote;
++#endif
+   socklen_t len;
+   ttl = index + 1;
+@@ -566,8 +568,10 @@ void net_send_query(int index)
+   /* sendto() assumes packet length includes the IPv4 header but not the 
+      IPv6 header. */
+-  spacketsize = abs(packetsize)       -
+-              ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
++  spacketsize = abs(packetsize);
++#ifdef ENABLE_IPV6
++  spacketsize -= ( ( af == AF_INET ) ? 0 : sizeof (struct ip6_hdr) );
++#endif
+   rv = sendto(sendsock, packet, spacketsize, 0, remotesockaddr, salen);
+   if (first && (rv < 0) && ((errno == EINVAL) || (errno == EMSGSIZE))) {
+     /* Try the first packet again using host byte order. */
+--- a/dns.c
++++ b/dns.c
+@@ -49,7 +49,7 @@
+ #include <unistd.h>
+ #include <fcntl.h>
+ //#include <ctype.h>
+-//#include <string.h>
++#include <string.h>
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <signal.h>
+--- a/net.h
++++ b/net.h
+@@ -20,6 +20,7 @@
+ #include <netdb.h>
+ #include <arpa/inet.h>
+ #include <netinet/in.h>
++#include <sys/select.h>
+ #include <sys/socket.h>
+ #ifdef ENABLE_IPV6
+ #include <netinet/ip6.h>
diff --git a/trunk/package/network/utils/netcat/Makefile b/trunk/package/network/utils/netcat/Makefile
new file mode 100644 (file)
index 0000000..0248f0d
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# 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:=netcat
+PKG_VERSION:=0.7.1
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=@SF/$(PKG_NAME)
+PKG_MD5SUM:=0a29eff1736ddb5effd0b1ec1f6fe0ef
+PKG_MAINTAINER:=Adam Gensler <openwrt@a.gnslr.us>
+PKG_LICENSE:=GPL-2.0
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/netcat
+  SECTION:=net
+  CATEGORY:=Network
+  TITLE:=A feature-rich network debugging and exploration tool.
+  URL:=http://netcat.sourceforge.net/
+endef
+
+define Package/netcat/description
+               Netcat is a featured networking utility which reads and writes data across network connections, using the TCP/IP protocol.
+       It is designed to be a reliable "back-end" tool that can be used directly or easily driven by other programs and scripts. At the same time, it is a feature-rich network debugging and exploration tool, since it can create almost any kind of connection you would need and has several interesting built-in capabilities.
+endef
+
+define Build/Configure
+       $(call Build/Configure/Default, \
+               --disable-rpath \
+               --with-included-getopt \
+       )
+endef
+
+define Package/netcat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/netcat \
+               $(1)/usr/bin
+endef
+
+define Package/netcat/postinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/nc ]; then
+  rm -rf $${IPKG_INSTROOT}/usr/bin/nc;
+fi
+ln -s ./netcat $${IPKG_INSTROOT}/usr/bin/nc
+endef
+
+define Package/netcat/postrm
+#!/bin/sh
+rm $${IPKG_INSTROOT}/usr/bin/nc
+ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/nc
+$${IPKG_INSTROOT}/usr/bin/nc 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/nc
+exit 0
+endef
+
+
+$(eval $(call BuildPackage,netcat))
diff --git a/trunk/package/network/utils/netcat/patches/001-netcat_flag_count.patch b/trunk/package/network/utils/netcat/patches/001-netcat_flag_count.patch
new file mode 100644 (file)
index 0000000..44ee9e1
--- /dev/null
@@ -0,0 +1,22 @@
+Index: netcat-0.7.1/src/flagset.c
+===================================================================
+--- netcat-0.7.1.orig/src/flagset.c    2009-02-06 19:56:01.000000000 +0100
++++ netcat-0.7.1/src/flagset.c 2009-02-06 19:56:13.000000000 +0100
+@@ -134,7 +134,7 @@
+ int netcat_flag_count(void)
+ {
+-  register char c;
++  register unsigned char c;
+   register int i;
+   int ret = 0;
+@@ -154,7 +154,7 @@
+       Assumed that the bit number 1 is the sign, and that we will shift the
+       bit 1 (or the bit that takes its place later) until the the most right,
+       WHY it has to keep the wrong sign? */
+-      ret -= (c >> 7);
++      ret += (c >> 7);
+       c <<= 1;
+     }
+   }
diff --git a/trunk/package/network/utils/nmap/Makefile b/trunk/package/network/utils/nmap/Makefile
new file mode 100644 (file)
index 0000000..251b91e
--- /dev/null
@@ -0,0 +1,143 @@
+#
+# Copyright (C) 2006-2014 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+
+#TODO
+#
+# * uClibcpp not supported, performance +100x slower. libstdcpp is being used. https://bugs.busybox.net/show_bug.cgi?id=2545
+# * liblua is still not recognized/blindly accepted. Impossible to compile with support
+#
+
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=nmap
+PKG_VERSION:=6.47
+PKG_RELEASE:=2
+PKG_MAINTAINER=Nuno Goncalves <nunojpg@gmail.com>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://nmap.org/dist/
+PKG_MD5SUM:=edfe81f6763223c0a29bfa15a8526e2a
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+NMAP_DEPENDS:=+libpcap +libstdcpp
+NCAT_DEPENDS:=+libpcap
+NPING_DEPENDS:=+libpcap +libpthread +libstdcpp
+NDIFF_DEPENDS:=+python
+
+define Package/nmap/default
+  SUBMENU:=NMAP Suite
+  SECTION:=net
+  CATEGORY:=Network
+  URL:=http://nmap.org/
+endef
+
+define Package/nmap
+$(call Package/nmap/default)
+  DEPENDS:=$(NMAP_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Utility for network exploration or security auditing
+endef
+
+define Package/nmap-ssl
+$(call Package/nmap/default)
+  DEPENDS:=$(NMAP_DEPENDS) +libopenssl
+  VARIANT:=ssl
+  TITLE:=Nmap (with OpenSSL support)
+endef
+
+define Package/ncat
+$(call Package/nmap/default)
+  DEPENDS:=$(NCAT_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Much-improved reimplementation of Netcat
+endef
+
+define Package/ncat-ssl
+$(call Package/nmap/default)
+  DEPENDS:=$(NCAT_DEPENDS) +libopenssl
+  VARIANT:=ssl
+  TITLE:=Ncat (with OpenSSL support)
+endef
+
+define Package/nping
+$(call Package/nmap/default)
+  DEPENDS:=$(NPING_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Network packet generation tool / ping utility
+endef
+
+define Package/ndiff
+$(call Package/nmap/default)
+  DEPENDS:=$(NDIFF_DEPENDS)
+  VARIANT:=nossl
+  TITLE:=Utility to compare the results of Nmap scans
+endef
+
+CONFIGURE_ARGS += \
+       --with-libdnet=included \
+       --with-libpcre=included \
+       --with-libpcap="$(STAGING_DIR)/usr" \
+       --without-liblua \
+       --without-zenmap
+
+CONFIGURE_VARS += CXXFLAGS="$$$$CXXFLAGS -fno-builtin"
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS += --with-openssl="$(STAGING_DIR)/usr"
+else
+       CONFIGURE_ARGS += --without-openssl
+endif
+
+define Package/nmap/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/nmap
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
+endef
+
+define Package/nmap-ssl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nmap $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/nmap
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/nmap/* $(1)/usr/share/nmap/
+endef
+
+define Package/ncat/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/
+endef
+
+define Package/ncat-ssl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ncat $(1)/usr/bin/
+       $(INSTALL_DIR) $(1)/usr/share/ncat
+       $(CP) $(PKG_INSTALL_DIR)/usr/share/ncat/ca-bundle.crt $(1)/usr/share/ncat/
+endef
+
+define Package/ndiff/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ndiff $(1)/usr/bin/
+endef
+
+define Package/nping/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/nping $(1)/usr/bin/
+endef
+
+
+$(eval $(call BuildPackage,nmap))
+$(eval $(call BuildPackage,nmap-ssl))
+$(eval $(call BuildPackage,ncat))
+$(eval $(call BuildPackage,ncat-ssl))
+$(eval $(call BuildPackage,nping))
+$(eval $(call BuildPackage,ndiff))
diff --git a/trunk/package/network/utils/rsync/Config.in b/trunk/package/network/utils/rsync/Config.in
new file mode 100644 (file)
index 0000000..dfbfdf1
--- /dev/null
@@ -0,0 +1,25 @@
+if PACKAGE_rsync
+
+       config RSYNC_xattr
+               bool
+               prompt "Enable xattr support"
+               default n
+
+       config RSYNC_acl
+               bool
+               prompt "Enable ACL support"
+               default n
+
+       config RSYNC_zlib
+               bool
+               prompt "Enable system zlib"
+               help 
+                       Use the system's zlib library instead of rsync's internal copy. Enabling
+                       this may create compatibility errors when using compression  with older
+                       clients, or those using the current default of the bundled zlib.
+
+                       rsync's upstream default is to use their bundled zlib. OpenWrt uses the
+                       system zlib for space reasons. The system zlib will eventually become 
+                       default for upstream as well.
+               default y
+endif
diff --git a/trunk/package/network/utils/rsync/Makefile b/trunk/package/network/utils/rsync/Makefile
new file mode 100644 (file)
index 0000000..f4419d3
--- /dev/null
@@ -0,0 +1,104 @@
+#
+# Copyright (C) 2007-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:=rsync
+PKG_VERSION:=3.1.1
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://rsync.samba.org/ftp/rsync/src
+PKG_MD5SUM:=43bd6676f0b404326eee2d63be3cdcfe
+PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
+PKG_LICENSE:=GPL-3.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/rsync
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=Fast remote file copy program (like rcp)
+  DEPENDS:=+libpopt +RSYNC_xattr:libattr +RSYNC_acl:libacl +RSYNC_zlib:zlib
+  URL:=http://rsync.samba.org/
+  MENU:=1
+endef
+
+define Package/rsync/config
+       source "$(SOURCE)/Config.in"
+endef
+
+CONFIGURE_ARGS += \
+       --with-included-popt=no \
+       --disable-debug \
+       --disable-locale \
+
+ifeq ($(CONFIG_RSYNC_xattr),y)
+       CONFIGURE_ARGS+= --enable-xattr-support
+else
+       CONFIGURE_ARGS+= --disable-xattr-support
+endif
+
+ifeq ($(CONFIG_RSYNC_acl),y)
+       CONFIGURE_ARGS+= --enable-acl-support
+else
+       CONFIGURE_ARGS+= --disable-acl-support
+endif
+
+ifeq ($(CONFIG_RSYNC_zlib),y)
+       CONFIGURE_ARGS+= --with-included-zlib=no
+else
+       CONFIGURE_ARGS+= --with-included-zlib=yes
+endif
+
+define Package/rsyncd
+  SECTION:=net
+  CATEGORY:=Network
+  SUBMENU:=File Transfer
+  TITLE:=Rsync daemon
+  DEPENDS:=+rsync
+  URL:=http://rsync.samba.org/
+endef
+
+define Package/rsync/description
+ rsync is a program that allows files to be copied to and from remote machines
+ in much the same way as rcp. It has many more options than rcp, and uses the
+ rsync remote-update protocol to greatly speed up file transfers when the
+ destination file already exists.
+
+ The rsync remote-update protocol allows rsync to transfer just the differences
+ between two sets of files across the network link.
+endef
+
+define Package/rsync/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
+endef
+
+define Package/rsyncd/description
+ rsyncd is a configuration file and initscript to utilize rsync as a daemon. It
+ uses the same binary as rsync.
+endef
+
+define Package/rsyncd/conffiles
+/etc/rsyncd.conf
+endef
+
+define Package/rsyncd/install
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_DATA) ./files/rsyncd.conf $(1)/etc/
+       $(INSTALL_DIR) $(1)/etc/init.d
+       $(INSTALL_BIN) ./files/rsyncd.init $(1)/etc/init.d/rsyncd
+endef
+
+$(eval $(call BuildPackage,rsync))
+$(eval $(call BuildPackage,rsyncd))
diff --git a/trunk/package/network/utils/rsync/files/rsyncd.conf b/trunk/package/network/utils/rsync/files/rsyncd.conf
new file mode 100644 (file)
index 0000000..2f4cd9e
--- /dev/null
@@ -0,0 +1,16 @@
+# /etc/rsyncd.conf
+# Minimal configuration for rsync daemon
+
+# Next line required for init script
+pid file = /var/run/rsyncd.pid
+log file = /var/log/rsyncd.log
+use chroot = yes
+uid = nobody
+gid = nogroup
+read only = yes
+
+# Simple example to configure server
+#[openwrt-etc]
+#path = /etc
+#comment = OpenWrt Configuration Files
+#exclude = /init.d
diff --git a/trunk/package/network/utils/rsync/files/rsyncd.init b/trunk/package/network/utils/rsync/files/rsyncd.init
new file mode 100644 (file)
index 0000000..d226d0f
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2011-2014 OpenWrt.org
+
+START=90
+STOP=10
+
+USE_PROCD=1
+PROG=/usr/bin/rsync
+
+start_service() {
+       procd_open_instance
+       procd_set_param command "$PROG" --daemon --no-detach
+       procd_close_instance
+}
diff --git a/trunk/package/network/utils/rsync/patches/000-CVE-2014-9512.patch b/trunk/package/network/utils/rsync/patches/000-CVE-2014-9512.patch
new file mode 100644 (file)
index 0000000..aaefbad
--- /dev/null
@@ -0,0 +1,106 @@
+From: Wayne Davison <wayned@samba.org>
+Date: Wed, 31 Dec 2014 20:41:03 +0000 (-0800)
+Subject: Complain if an inc-recursive path is not right for its dir.
+X-Git-Url: https://git.samba.org/?p=rsync.git;a=commitdiff_plain;h=962f8b90045ab331fc04c9e65f80f1a53e68243b
+
+Complain if an inc-recursive path is not right for its dir.
+This ensures that a malicious sender can't use a just-sent
+symlink as a trasnfer path.
+---
+
+diff --git a/flist.c b/flist.c
+index c24672e..92e4b65 100644
+--- a/flist.c
++++ b/flist.c
+@@ -2435,8 +2435,9 @@ struct file_list *send_file_list(int f, int argc, char *argv[])
+       return flist;
+ }
+-struct file_list *recv_file_list(int f)
++struct file_list *recv_file_list(int f, int dir_ndx)
+ {
++      const char *good_dirname = NULL;
+       struct file_list *flist;
+       int dstart, flags;
+       int64 start_read;
+@@ -2492,6 +2493,23 @@ struct file_list *recv_file_list(int f)
+               flist_expand(flist, 1);
+               file = recv_file_entry(f, flist, flags);
++              if (inc_recurse) {
++                      static const char empty_dir[] = "\0";
++                      const char *cur_dir = file->dirname ? file->dirname : empty_dir;
++                      if (relative_paths && *cur_dir == '/')
++                              cur_dir++;
++                      if (cur_dir != good_dirname) {
++                              const char *d = dir_ndx >= 0 ? f_name(dir_flist->files[dir_ndx], NULL) : empty_dir;
++                              if (strcmp(cur_dir, d) != 0) {
++                                      rprintf(FERROR,
++                                              "ABORTING due to invalid dir prefix from sender: %s (should be: %s)\n",
++                                              cur_dir, d);
++                                      exit_cleanup(RERR_PROTOCOL);
++                              }
++                              good_dirname = cur_dir;
++                      }
++              }
++
+               if (S_ISREG(file->mode)) {
+                       /* Already counted */
+               } else if (S_ISDIR(file->mode)) {
+@@ -2615,7 +2633,7 @@ void recv_additional_file_list(int f)
+                       rprintf(FINFO, "[%s] receiving flist for dir %d\n",
+                               who_am_i(), ndx);
+               }
+-              flist = recv_file_list(f);
++              flist = recv_file_list(f, ndx);
+               flist->parent_ndx = ndx;
+       }
+ }
+diff --git a/io.c b/io.c
+index b9a9bd0..a868fa9 100644
+--- a/io.c
++++ b/io.c
+@@ -1685,7 +1685,7 @@ void wait_for_receiver(void)
+                               rprintf(FINFO, "[%s] receiving flist for dir %d\n",
+                                       who_am_i(), ndx);
+                       }
+-                      flist = recv_file_list(iobuf.in_fd);
++                      flist = recv_file_list(iobuf.in_fd, ndx);
+                       flist->parent_ndx = ndx;
+ #ifdef SUPPORT_HARD_LINKS
+                       if (preserve_hard_links)
+diff --git a/main.c b/main.c
+index e7a13f7..713b818 100644
+--- a/main.c
++++ b/main.c
+@@ -1009,7 +1009,7 @@ static void do_server_recv(int f_in, int f_out, int argc, char *argv[])
+               filesfrom_fd = -1;
+       }
+-      flist = recv_file_list(f_in);
++      flist = recv_file_list(f_in, -1);
+       if (!flist) {
+               rprintf(FERROR,"server_recv: recv_file_list error\n");
+               exit_cleanup(RERR_FILESELECT);
+@@ -1183,7 +1183,7 @@ int client_run(int f_in, int f_out, pid_t pid, int argc, char *argv[])
+       if (write_batch && !am_server)
+               start_write_batch(f_in);
+-      flist = recv_file_list(f_in);
++      flist = recv_file_list(f_in, -1);
+       if (inc_recurse && file_total == 1)
+               recv_additional_file_list(f_in);
+diff --git a/rsync.c b/rsync.c
+index 68ff6b1..c3ecc51 100644
+--- a/rsync.c
++++ b/rsync.c
+@@ -364,7 +364,7 @@ int read_ndx_and_attrs(int f_in, int f_out, int *iflag_ptr, uchar *type_ptr,
+               }
+               /* Send all the data we read for this flist to the generator. */
+               start_flist_forward(ndx);
+-              flist = recv_file_list(f_in);
++              flist = recv_file_list(f_in, ndx);
+               flist->parent_ndx = ndx;
+               stop_flist_forward();
+       }
diff --git a/trunk/package/network/utils/wget/Makefile b/trunk/package/network/utils/wget/Makefile
new file mode 100644 (file)
index 0000000..a146a01
--- /dev/null
@@ -0,0 +1,134 @@
+#
+# Copyright (C) 2007-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:=wget
+PKG_VERSION:=1.16.3
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
+PKG_MD5SUM:=d2e4455781a70140ae83b54ca594ce21
+PKG_MAINTAINER:=Maxim Storchak <m.storchak@gmail.com>
+PKG_LICENSE:=GPL-3.0+
+PKG_LICENSE_FILES:=COPYING
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/wget/Default
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libpcre
+  SUBMENU:=File Transfer
+  TITLE:=Non-interactive network downloader
+  URL:=http://www.gnu.org/software/wget/index.html
+endef
+
+define Package/wget/Default/description
+ Wget is a network utility to retrieve files from the Web using http
+ and ftp, the two most widely used Internet protocols. It works
+ non-interactively, so it will work in the background, after having
+ logged off. The program supports recursive retrieval of web-authoring
+ pages as well as ftp sites -- you can use wget to make mirrors of
+ archives and home pages or to travel the Web like a WWW robot.
+endef
+
+define Package/wget
+$(call Package/wget/Default)
+  DEPENDS+= +libopenssl +librt
+  TITLE+= (with SSL support)
+  VARIANT:=ssl
+endef
+
+define Package/wget/description
+$(call Package/wget/Default/description)
+ This package is built with SSL support.
+endef
+
+define Package/wget-nossl
+$(call Package/wget/Default)
+  TITLE+= (without SSL support)
+  DEPENDS+= +zlib
+  VARIANT:=nossl
+endef
+
+define Package/wget-nossl/description
+$(call Package/wget/Default/description)
+ This package is built without SSL support.
+endef
+
+CONFIGURE_ARGS+= \
+       --disable-rpath \
+       --disable-iri \
+       --without-libuuid
+
+CONFIGURE_VARS += \
+       ac_cv_header_uuid_uuid_h=no
+
+ifeq ($(BUILD_VARIANT),ssl)
+       CONFIGURE_ARGS+= \
+               --with-ssl=openssl \
+               --with-libssl-prefix="$(STAGING_DIR)/usr"
+endif
+
+ifeq ($(BUILD_VARIANT),nossl)
+       CONFIGURE_ARGS+= \
+               --disable-ntlm \
+               --without-ssl
+endif
+
+define Package/wget/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-ssl
+endef
+
+define Package/wget-nossl/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/wget $(1)/usr/bin/wget-nossl
+endef
+
+define Package/wget/postinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then
+  rm -rf $${IPKG_INSTROOT}/usr/bin/wget;
+fi
+ln -sf ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget
+endef
+
+define Package/wget/postrm
+#!/bin/sh
+rm $${IPKG_INSTROOT}/usr/bin/wget
+[ -x $${IPKG_INSTROOT}/usr/bin/wget-nossl ] && ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget || {
+  ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget
+  $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget
+}
+exit 0
+endef
+
+define Package/wget-nossl/postinst
+#!/bin/sh
+if [ -e $${IPKG_INSTROOT}/usr/bin/wget ]; then
+  rm -rf $${IPKG_INSTROOT}/usr/bin/wget;
+fi
+ln -s ./wget-nossl $${IPKG_INSTROOT}/usr/bin/wget
+endef
+
+define Package/wget-nossl/postrm
+#!/bin/sh
+rm $${IPKG_INSTROOT}/usr/bin/wget
+[ -x $${IPKG_INSTROOT}/usr/bin/wget-ssl ] && ln -s ./wget-ssl $${IPKG_INSTROOT}/usr/bin/wget || {
+  ln -s ../../bin/busybox $${IPKG_INSTROOT}/usr/bin/wget
+  $${IPKG_INSTROOT}/usr/bin/wget 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/usr/bin/wget
+}
+exit 0
+endef
+
+$(eval $(call BuildPackage,wget))
+$(eval $(call BuildPackage,wget-nossl))
diff --git a/trunk/package/utils/ccrypt/Makefile b/trunk/package/utils/ccrypt/Makefile
new file mode 100644 (file)
index 0000000..2419ab7
--- /dev/null
@@ -0,0 +1,39 @@
+#
+# Copyright (C) 2009-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:=ccrypt
+PKG_VERSION:=1.10
+PKG_RELEASE:=2
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=@SF/ccrypt
+PKG_MD5SUM:=44ddd763465c254df83f5d38851d04d7
+PKG_MAINTAINER:=Hannu Nyman <hannu.nyman@iki.fi>
+PKG_LICENSE:=GPLv2+
+
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/ccrypt
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=ccrypt is a utility for encrypting and decrypting files and streams
+  URL:=http://ccrypt.sourceforge.net/
+endef
+
+define Package/ccrypt/install
+       $(INSTALL_DIR) $(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/ccrypt $(1)/usr/bin/
+       ln -s ccrypt $(1)/usr/bin/ccencrypt
+       ln -s ccrypt $(1)/usr/bin/ccdecrypt
+       ln -s ccrypt $(1)/usr/bin/ccat
+endef
+
+$(eval $(call BuildPackage,ccrypt))
diff --git a/trunk/package/utils/ccrypt/patches/001-no-intl.patch b/trunk/package/utils/ccrypt/patches/001-no-intl.patch
new file mode 100644 (file)
index 0000000..4ac9abb
--- /dev/null
@@ -0,0 +1,89 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -123,17 +123,6 @@ AC_MSG_RESULT($UINT32_TYPE)
+ AC_DEFINE_UNQUOTED(UINT32_TYPE,$UINT32_TYPE,unsigned 32 bit integer type)
+ dnl ----------------------------------------------------------------------
+-dnl Internationalization
+-
+-GETTEXT_PACKAGE=ccrypt
+-AC_SUBST(GETTEXT_PACKAGE)
+-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [Package name for gettext])
+-
+-AM_GNU_GETTEXT
+-AM_GNU_GETTEXT_VERSION([0.14.3])
+-IT_PO_SUBDIR(po)
+-
+-dnl ----------------------------------------------------------------------
+ dnl Libtool (needed by intl/)
+ LT_INIT
+@@ -153,9 +142,7 @@ AC_SUBST(TAR)
+ dnl ----------------------------------------------------------------------
+ AC_CONFIG_FILES([doc/ccrypt.1
+          doc/ccguess.1
+-         po/Makefile.in 
+          m4/Makefile 
+-         intl/Makefile 
+          Makefile 
+          src/Makefile 
+          emacs/Makefile
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -4,7 +4,7 @@
+ ## Process this file with automake to produce Makefile.in
+-SUBDIRS = m4 po intl src emacs doc check
++SUBDIRS = m4 src emacs doc check
+ EXTRA_DIST = m4/ChangeLog config.rpath README-WIN
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -36,7 +36,7 @@ host_triplet = @host@
+ subdir = .
+ DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+       $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+-      $(top_srcdir)/configure $(top_srcdir)/intl/Makefile.in \
++      $(top_srcdir)/configure \
+       ABOUT-NLS AUTHORS COPYING ChangeLog INSTALL NEWS config.guess \
+       config.rpath config.sub depcomp elisp-comp install-sh \
+       ltmain.sh missing mkinstalldirs
+@@ -66,7 +66,7 @@ am__CONFIG_DISTCLEAN_FILES = config.stat
+  configure.lineno config.status.lineno
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+ CONFIG_HEADER = config.h
+-CONFIG_CLEAN_FILES = intl/Makefile
++CONFIG_CLEAN_FILES =
+ CONFIG_CLEAN_VPATH_FILES =
+ SOURCES =
+ DIST_SOURCES =
+@@ -277,7 +277,7 @@ target_alias = @target_alias@
+ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+-SUBDIRS = m4 po intl src emacs doc check
++SUBDIRS = m4 src emacs doc check
+ EXTRA_DIST = m4/ChangeLog config.rpath README-WIN
+ ACLOCAL_AMFLAGS = -I m4
+ all: config.h
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -56,4 +56,4 @@ uninstall-local:
+ # internationalization stuff
+ localedir = $(datadir)/locale
+ INCLUDES = -I../intl -I$(top_srcdir)/intl -DLOCALEDIR=\"$(localedir)\"
+-LIBS = @LIBINTL@ @LIBS@
++LIBS = @LIBS@
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -159,7 +159,7 @@ LDFLAGS = @LDFLAGS@
+ LIBICONV = @LIBICONV@
+ LIBINTL = @LIBINTL@
+ LIBOBJS = @LIBOBJS@
+-LIBS = @LIBINTL@ @LIBS@
++LIBS = @LIBS@
+ LIBTOOL = @LIBTOOL@
+ LIPO = @LIPO@
+ LN_S = @LN_S@
diff --git a/trunk/package/utils/coreutils/Makefile b/trunk/package/utils/coreutils/Makefile
new file mode 100644 (file)
index 0000000..3b9f17d
--- /dev/null
@@ -0,0 +1,116 @@
+#
+# Copyright (C) 2008-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:=coreutils
+PKG_VERSION:=8.23
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
+PKG_SOURCE_URL:=@GNU/coreutils
+PKG_MD5SUM:=abed135279f87ad6762ce57ff6d89c41
+PKG_BUILD_DEPENDS:=libpthread
+PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
+
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+COREUTILS_APPLETS := \
+       base64 basename cat chcon chgrp chmod chown chroot cksum comm cp csplit \
+       cut date dd dir dircolors dirname du echo env expand expr factor        \
+       false fmt fold groups head hostid id install join kill link ln logname  \
+       ls md5sum mkdir mkfifo mknod mktemp mv nice nl nohup nproc od paste     \
+       pathchk pinky pr printenv printf ptx pwd readlink realpath rm rmdir     \
+       runcon seq sha1sum sha224sum sha256sum sha384sum sha512sum shred        \
+       shuf sleep sort split stat stdbuf stty sum sync tac tail tee test       \
+       timeout touch tr true truncate tsort tty uname unexpand uniq unlink     \
+       uptime users vdir wc who whoami yes
+
+DEPENDS_sort = +libpthread
+DEPENDS_timeout = +librt
+DEPENDS_expr = +libgmp
+DEPENDS_factor = +libgmp
+DEPENDS_cp = +libacl
+DEPENDS_dir = +libacl
+DEPENDS_install = +libacl
+DEPENDS_ls = +libacl
+DEPENDS_mv = +libacl
+DEPENDS_vdir = +libacl
+
+define Package/coreutils/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=The GNU core utilities
+  URL:=http://www.gnu.org/software/coreutils/
+endef
+
+define Package/coreutils
+  $(call Package/coreutils/Default)
+  TITLE:=The GNU core utilities
+  MENU:=1
+endef
+
+define Package/coreutils/description
+ Full versions of standard GNU utilities. Normally, you would not use this
+ package, since the functionality in BusyBox is more than sufficient and
+ smaller.
+endef
+
+define GenPlugin
+ define Package/$(1)
+   $(call Package/coreutils/Default)
+   DEPENDS:=coreutils $(DEPENDS_$(2))
+   TITLE:=Utility $(2) from the GNU core utilities
+ endef
+
+ define Package/$(1)/description
+  Full version of standard GNU $(2) utility. Normally, you would not use this
+  package, since the functionality in BusyBox is more than sufficient.
+ endef
+endef
+
+$(foreach a,$(COREUTILS_APPLETS),$(eval $(call GenPlugin,coreutils-$(a),$(a))))
+
+CONFIGURE_VARS += \
+       gl_cv_func_mbrtowc_incomplete_state=yes \
+       gl_cv_func_mbrtowc_retval=yes \
+       gl_cv_func_wcrtomb_retval=yes
+
+ifneq ($(CONFIG_USE_UCLIBC),)
+  CONFIGURE_VARS += \
+       ac_cv_type_pthread_spinlock_t=$(if $(filter 0.9.30% 0.9.2% 0.9.31%,$(call qstrip,$(CONFIG_UCLIBC_VERSION))),no,yes)
+endif
+
+CONFIGURE_ARGS += \
+       --disable-xattr \
+       --enable-install-program=su
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               DESTDIR="$(PKG_INSTALL_DIR)" \
+               SHELL="/bin/bash" \
+               all install
+endef
+
+define Package/coreutils/install
+       true
+endef
+
+define BuildPlugin
+  define Package/$(1)/install
+       $(INSTALL_DIR) $$(1)/usr/bin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(2) $$(1)/usr/bin/
+  endef
+
+  $$(eval $$(call BuildPackage,$(1)))
+endef
+
+$(eval $(call BuildPackage,coreutils))
+
+$(foreach a,$(COREUTILS_APPLETS),$(eval $(call BuildPlugin,coreutils-$(a),$(a))))
diff --git a/trunk/package/utils/coreutils/patches/001-no_docs_man_tests.patch b/trunk/package/utils/coreutils/patches/001-no_docs_man_tests.patch
new file mode 100644 (file)
index 0000000..60f2df2
--- /dev/null
@@ -0,0 +1,89 @@
+--- a/Makefile.am
++++ b/Makefile.am
+@@ -17,7 +17,7 @@
+ ALL_RECURSIVE_TARGETS =
+-SUBDIRS = po . gnulib-tests
++SUBDIRS = po
+ changelog_etc =                               \
+   ChangeLog-2005                      \
+@@ -213,6 +213,4 @@ AM_CPPFLAGS = -Ilib -I$(top_srcdir)/lib
+ include $(top_srcdir)/lib/local.mk
+ include $(top_srcdir)/src/local.mk
+-include $(top_srcdir)/doc/local.mk
+-include $(top_srcdir)/man/local.mk
+-include $(top_srcdir)/tests/local.mk
++
+--- a/Makefile.in
++++ b/Makefile.in
+@@ -159,8 +159,7 @@ build_triplet = @build@
+ host_triplet = @host@
+ DIST_COMMON = $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk \
+       $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk \
+-      $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk \
+-      $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk \
++      $(top_srcdir)/src/single-binary.mk \
+       INSTALL NEWS README AUTHORS ChangeLog $(srcdir)/Makefile.in \
+       $(srcdir)/Makefile.am $(top_srcdir)/configure \
+       $(am__configure_deps) $(top_srcdir)/lib/config.hin ABOUT-NLS \
+@@ -2276,11 +2275,7 @@ RECURSIVE_TARGETS = all-recursive check-
+       install-ps-recursive install-recursive installcheck-recursive \
+       installdirs-recursive pdf-recursive ps-recursive \
+       tags-recursive uninstall-recursive
+-am__can_run_installinfo = \
+-  case $$AM_UPDATE_INFO_DIR in \
+-    n|no|NO) false;; \
+-    *) (install-info --version) >/dev/null 2>&1;; \
+-  esac
++am__can_run_installinfo = false
+ am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+ am__vpath_adj = case $$p in \
+     $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+@@ -2606,7 +2601,7 @@ EOVERFLOW_HIDDEN = @EOVERFLOW_HIDDEN@
+ EOVERFLOW_VALUE = @EOVERFLOW_VALUE@
+ ERRNO_H = @ERRNO_H@
+ EXEEXT = @EXEEXT@
+-EXTRA_MANS = @EXTRA_MANS@
++EXTRA_MANS = 
+ FLOAT_H = @FLOAT_H@
+ FNMATCH_H = @FNMATCH_H@
+ GETADDRINFO_LIB = @GETADDRINFO_LIB@
+@@ -3820,7 +3815,7 @@ libexecdir = @libexecdir@
+ lispdir = @lispdir@
+ localedir = @localedir@
+ localstatedir = @localstatedir@
+-man1_MANS = @man1_MANS@
++man1_MANS = 
+ mandir = @mandir@
+ mkdir_p = @mkdir_p@
+ oldincludedir = @oldincludedir@
+@@ -3843,7 +3838,7 @@ top_build_prefix = @top_build_prefix@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ ALL_RECURSIVE_TARGETS = distcheck-hook check-root
+-SUBDIRS = po . gnulib-tests
++SUBDIRS = po
+ changelog_etc = \
+   ChangeLog-2005                      \
+   ChangeLog-2006                      \
+@@ -5767,7 +5762,7 @@ all: $(BUILT_SOURCES)
+ .SUFFIXES: .1 .c .dvi .log .o .obj .pl .pl$(EXEEXT) .ps .sed .sh .sh$(EXEEXT) .sin .trs .x .xpl .xpl$(EXEEXT) .y
+ am--refresh: Makefile
+       @:
+-$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk $(am__configure_deps)
++$(srcdir)/Makefile.in:  $(srcdir)/Makefile.am $(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(am__configure_deps)
+       @for dep in $?; do \
+         case '$(am__configure_deps)' in \
+           *$$dep*) \
+@@ -5790,7 +5785,7 @@ Makefile: $(srcdir)/Makefile.in $(top_bu
+           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+       esac;
+-$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk $(top_srcdir)/doc/local.mk $(top_srcdir)/man/local.mk $(top_srcdir)/tests/local.mk:
++$(top_srcdir)/lib/local.mk $(srcdir)/lib/gnulib.mk $(top_srcdir)/src/local.mk $(srcdir)/src/cu-progs.mk $(top_srcdir)/src/single-binary.mk:
+ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+       $(SHELL) ./config.status --recheck
diff --git a/trunk/package/utils/coreutils/patches/002-fix_compile_with_uclibc.patch b/trunk/package/utils/coreutils/patches/002-fix_compile_with_uclibc.patch
new file mode 100644 (file)
index 0000000..94187e4
--- /dev/null
@@ -0,0 +1,12 @@
+--- a/lib/pthread.in.h
++++ b/lib/pthread.in.h
+@@ -252,6 +252,9 @@ pthread_mutex_unlock (pthread_mutex_t *m
+ /* Approximate spinlocks with mutexes.  */
++#ifdef __UCLIBC__
++#define pthread_spinlock_t original_pthread_spinlock_t
++#endif
+ typedef pthread_mutex_t pthread_spinlock_t;
+ _GL_PTHREAD_INLINE int
diff --git a/trunk/package/utils/flashrom/Config.in b/trunk/package/utils/flashrom/Config.in
new file mode 100644 (file)
index 0000000..552001a
--- /dev/null
@@ -0,0 +1,279 @@
+menu "Flashrom configuration"
+       depends on PACKAGE_flashrom
+
+       choice
+               prompt "Default Programmer"
+               default DEFPROG_INTERNAL if FLASHROM_PCI
+               default DEFPROG_LINUX_SPI
+
+               config DEFPROG_INTERNAL
+                       depends on FRPROG_INTERNAL
+                       bool "Internal"
+
+               config DEFPROG_LINUX_SPI
+                       depends on FRPROG_LINUX_SPI
+                       bool "Linux SPI"
+
+               config DEFPROG_SERPROG
+                       depends on FRPROG_SERPROG
+                       bool "Serial"
+
+               config DEFPROG_RAYER_SPI
+                       depends on FRPROG_RAYER_SPI
+                       bool "Rayer SPI"
+
+               config DEFPROG_PONY_SPI
+                       depends on FRPROG_PONY_SPI
+                       bool "Pony SPI"
+
+               config DEFPROG_NIC3COM
+                       depends on FRPROG_NIC3COM
+                       bool "NIC3Com"
+
+               config DEFPROG_GFXNVIDIA
+                       depends on FRPROG_GFXNVIDIA
+                       bool "GFX Nvidia"
+
+               config DEFPROG_SATASII
+                       depends on FRPROG_SATASII
+                       bool "SATASII"
+
+#              config DEFPROG_ATAHPT
+#                      depends on FRPROG_ATAHPT
+#                      bool "Highpoint (HPT) ATA/RAID"
+
+               config DEFPROG_ATAVIA
+                       depends on FRPROG_ATAVIA
+                       bool "ATAVIA"
+
+               config DEFPROG_FT2232_SPI
+                       depends on FRPROG_FT2232_SPI
+                       bool "FT2232 SPI"
+
+               config DEFPROG_USBBLASTER_SPI
+                       depends on FRPROG_USBBLASTER_SPI
+                       bool "USBBlaster SPI"
+
+#              config DEFPROG_MSTARDDC_SPI
+#                      depends on FRPROG_MSTARDDC_SPI
+#                      bool "MSTAR DDC SPI"
+
+               config DEFPROG_PICKIT2_SPI
+                       depends on FRPROG_PICKIT2_SPI
+                       bool "PICkit2 SPI"
+
+               config DEFPROG_DUMMY
+                       depends on FRPROG_DUMMY
+                       bool "Dummy"
+
+               config DEFPROG_DRKAISER
+                       depends on FRPROG_DRKAISER
+                       bool "Dr. Kaiser"
+
+               config DEFPROG_NICREALTEK
+                       depends on FRPROG_NICREALTEK
+                       bool "Realtek NICs"
+
+#              config DEFPROG_NICNATSEMI
+#                      depends on FRPROG_NICNATSEMI
+#                      bool "National Semiconductor NICs"
+
+               config DEFPROG_NICINTEL
+                       depends on FRPROG_NICINTEL
+                       bool "Intel NICs"
+
+               config DEFPROG_NICINTEL_SPI
+                       depends on FRPROG_NICINTEL_SPI
+                       bool "Intel NICs SPI"
+
+               config DEFPROG_NICINTEL_EEPROM
+                       depends on FRPROG_NICINTEL_EEPROM
+                       bool "Intel NICs EEPROM"
+
+               config DEFPROG_OGP_SPI
+                       depends on FRPROG_OGP_SPI
+                       bool "OGP SPI"
+
+               config DEFPROG_BUSPIRATE_SPI
+                       depends on FRPROG_BUSPIRATE_SPI
+                       bool "SPI BUS Pirate"
+
+#              config DEFPROG_DEDIPROG
+#                      depends on FRPROG_DEDIPROG
+#                      bool "Dediprog SF100"
+
+               config DEFPROG_SATAMV
+                       depends on FRPROG_SATAMV
+                       bool "Marvell SATA"
+
+               config DEFPROG_IT8212
+                       depends on FRPROG_IT8212
+                       bool "ITE IT8212F PATA"
+       endchoice
+
+
+       menu "Misc Programmers"
+               config FRPROG_LINUX_SPI
+                       bool "Linux SPI"
+                       default y
+
+#              config FRPROG_MSTARDDC_SPI
+#                      bool "MSTAR DDC"
+#                      default n
+
+               config FRPROG_DUMMY
+                       bool "Dummy"
+                       default y
+       endmenu
+
+
+       config FLASHROM_FTDI
+               bool "FTDI Support"
+               default y
+
+       menu "FTDI Programmers"
+               depends on FLASHROM_FTDI
+
+               config FRPROG_FT2232_SPI
+                       depends on FLASHROM_FTDI
+                       bool "FT2232 SPI"
+                       default y
+
+               config FRPROG_USBBLASTER_SPI
+                       depends on FLASHROM_FTDI
+                       bool "USBBlaster SPI"
+                       default y
+       endmenu
+
+
+       config FLASHROM_PCI
+               bool "PCI Support"
+               default y if (TARGET_x86||TARGET_x86_64)
+
+       menu "PCI Programmers"
+               depends on FLASHROM_PCI
+
+               config FRPROG_INTERNAL
+                       depends on FLASHROM_PCI
+                       bool "Internal"
+                       default y
+
+               config FRPROG_RAYER_SPI
+                       depends on FLASHROM_PCI
+                       bool "Rayer SPI"
+                       default y
+
+               config FRPROG_NIC3COM
+                       depends on FLASHROM_PCI
+                       bool "NIC3Com"
+                       default y
+
+               config FRPROG_GFXNVIDIA
+                       depends on FLASHROM_PCI
+                       bool "GFX Nvidia"
+                       default y
+
+               config FRPROG_SATASII
+                       depends on FLASHROM_PCI
+                       bool "SATASII"
+                       default y
+
+#              config FRPROG_ATAHPT
+#                      depends on FLASHROM_PCI
+#                      bool "Highpoint (HPT) ATA/RAID"
+#                      default n
+
+               config FRPROG_ATAVIA
+                       depends on FLASHROM_PCI
+                       bool "ATAVIA"
+                       default y
+
+               config FRPROG_IT8212
+                       depends on FLASHROM_PCI
+                       bool "ITE IT8212F PATA"
+                       default y
+
+               config FRPROG_DRKAISER
+                       depends on FLASHROM_PCI
+                       bool "Dr. Kaiser"
+                       default y
+
+               config FRPROG_NICREALTEK
+                       depends on FLASHROM_PCI
+                       bool "Realtek NICs"
+                       default y
+
+#              config FRPROG_NICNATSEMI
+#                      depends on FLASHROM_PCI
+#                      bool "National Semiconductor NICs"
+#                      default n
+
+               config FRPROG_NICINTEL
+                       depends on FLASHROM_PCI
+                       bool "Intel NICs"
+                       default y
+
+               config FRPROG_NICINTEL_SPI
+                       depends on FLASHROM_PCI
+                       bool "Intel NICs SPI"
+                       default y
+
+               config FRPROG_NICINTEL_EEPROM
+                       depends on FLASHROM_PCI
+                       bool "Intel NICs EEPROM"
+                       default y
+
+               config FRPROG_OGP_SPI
+                       depends on FLASHROM_PCI
+                       bool "OGP SPI"
+                       default y
+
+               config FRPROG_SATAMV
+                       depends on FLASHROM_PCI
+                       bool "Marvell SATA"
+                       default y
+       endmenu
+
+
+       config FLASHROM_SERIAL
+               bool "Serial Support"
+               default y
+
+       menu "Serial Programmers"
+               depends on FLASHROM_SERIAL
+
+               config FRPROG_SERPROG
+                       depends on FLASHROM_SERIAL
+                       bool "Serial"
+                       default y
+
+               config FRPROG_PONY_SPI
+                       depends on FLASHROM_SERIAL
+                       bool "Pony SPI"
+                       default y
+
+               config FRPROG_BUSPIRATE_SPI
+                       depends on FLASHROM_SERIAL
+                       bool "SPI BUS Pirate"
+                       default y
+       endmenu
+
+
+       config FLASHROM_USB
+               bool "USB Support"
+               default y
+
+       menu "USB Programmers"
+               depends on FLASHROM_USB
+
+               config FRPROG_PICKIT2_SPI
+                       depends on FLASHROM_USB
+                       bool "PICkit2 SPI"
+                       default y
+
+#              config FRPROG_DEDIPROG
+#                      depends on FLASHROM_USB
+#                      bool "Dediprog SF100"
+#                      default n
+       endmenu
+endmenu
diff --git a/trunk/package/utils/flashrom/Makefile b/trunk/package/utils/flashrom/Makefile
new file mode 100644 (file)
index 0000000..af7b5e1
--- /dev/null
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2010-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:=flashrom
+PKG_VERSION:=0.9.8
+PKG_RELEASE:=3
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://download.flashrom.org/releases
+PKG_MD5SUM:=ac513076b63ab7eb411a7694bb8f6fda
+PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
+
+PKG_LICENSE:=GPL-2.0
+PKG_LICENSE_FILES:=COPYING
+
+PKG_INSTALL:=1
+
+include $(INCLUDE_DIR)/package.mk
+include flashrom.mk
+
+define Package/flashrom
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=FlashROM Utility
+  URL:=http://www.flashrom.org/
+  DEPENDS:=\
+       +(TARGET_x86||TARGET_x86_64):dmidecode \
+       +FLASHROM_FTDI:libftdi \
+       +FLASHROM_PCI:pciutils \
+       +FLASHROM_USB:libusb-compat
+endef
+
+define Package/flashrom/config
+       source "$(SOURCE)/Config.in"
+endef
+
+define Package/flashrom/description
+ flashrom is an utility for identifying, reading, writing, verifying
+ and erasing flash chips. It's often used to flash BIOS/EFI/coreboot
+ /firmware images.
+endef
+
+MAKE_FLAGS += \
+       PREFIX="/usr"
+
+define Package/flashrom/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/flashrom $(1)/usr/sbin/
+endef
+
+$(eval $(call BuildPackage,flashrom))
diff --git a/trunk/package/utils/flashrom/flashrom.mk b/trunk/package/utils/flashrom/flashrom.mk
new file mode 100644 (file)
index 0000000..14fc5d8
--- /dev/null
@@ -0,0 +1,54 @@
+# Flashrom configuration
+define DefineConfig
+  ifeq ($(CONFIG_FLASHROM_$(1)),)
+    MAKE_FLAGS += NEED_$(1)=0
+  endif
+endef
+define DefineProgrammer
+  ifeq ($(CONFIG_FRPROG_$(1)),)
+    MAKE_FLAGS += CONFIG_$(1)=0
+  endif
+  ifneq ($(CONFIG_DEFPROG_$(1)),)
+    MAKE_FLAGS += CONFIG_DEFAULT_PROGRAMMER=CONFIG_$(1)
+  endif
+endef
+
+# Misc
+$(eval $(call DefineProgrammer,LINUX_SPI))
+#$(eval $(call DefineProgrammer,MSTARDDC_SPI))
+$(eval $(call DefineProgrammer,DUMMY))
+
+# FTDI
+$(eval $(call DefineConfig,FTDI))
+$(eval $(call DefineProgrammer,FT2232_SPI))
+$(eval $(call DefineProgrammer,USBBLASTER_SPI))
+
+# PCI
+$(eval $(call DefineConfig,PCI))
+$(eval $(call DefineProgrammer,INTERNAL))
+$(eval $(call DefineProgrammer,RAYER_SPI))
+$(eval $(call DefineProgrammer,NIC3COM))
+$(eval $(call DefineProgrammer,GFXNVIDIA))
+$(eval $(call DefineProgrammer,SATASII))
+#$(eval $(call DefineProgrammer,ATAHPT))
+$(eval $(call DefineProgrammer,ATAVIA))
+$(eval $(call DefineProgrammer,IT8212))
+$(eval $(call DefineProgrammer,DRKAISER))
+$(eval $(call DefineProgrammer,NICREALTEK))
+#$(eval $(call DefineProgrammer,NICNATSEMI))
+$(eval $(call DefineProgrammer,NICINTEL))
+$(eval $(call DefineProgrammer,NICINTEL_SPI))
+$(eval $(call DefineProgrammer,NICINTEL_EEPROM))
+$(eval $(call DefineProgrammer,OGP_SPI))
+$(eval $(call DefineProgrammer,SATAMV))
+
+# Serial
+$(eval $(call DefineConfig,SERIAL))
+$(eval $(call DefineProgrammer,SERPROG))
+$(eval $(call DefineProgrammer,PONY_SPI))
+$(eval $(call DefineProgrammer,BUSPIRATE_SPI))
+
+# USB
+$(eval $(call DefineConfig,USB))
+$(eval $(call DefineProgrammer,PICKIT2_SPI))
+#$(eval $(call DefineProgrammer,DEDIPROG))
diff --git a/trunk/package/utils/flashrom/patches/0001-fix_internal_bitbang.patch b/trunk/package/utils/flashrom/patches/0001-fix_internal_bitbang.patch
new file mode 100644 (file)
index 0000000..376d6b2
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/programmer.h
++++ b/programmer.h
+@@ -557,7 +557,7 @@ enum spi_controller {
+ #if CONFIG_DEDIPROG == 1
+       SPI_CONTROLLER_DEDIPROG,
+ #endif
+-#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || (CONFIG_INTERNAL == 1 && (defined(__i386__) || defined(__x86_64__)))
++#if CONFIG_OGP_SPI == 1 || CONFIG_NICINTEL_SPI == 1 || CONFIG_RAYER_SPI == 1 || CONFIG_PONY_SPI == 1 || CONFIG_INTERNAL == 1
+       SPI_CONTROLLER_BITBANG,
+ #endif
+ #if CONFIG_LINUX_SPI == 1
diff --git a/trunk/package/utils/flashrom/patches/0002-fix-musl-compatibility.patch b/trunk/package/utils/flashrom/patches/0002-fix-musl-compatibility.patch
new file mode 100644 (file)
index 0000000..b52f8b2
--- /dev/null
@@ -0,0 +1,12 @@
+diff -uprN a/linux_spi.c b/linux_spi.c
+--- a/linux_spi.c      2015-06-17 20:50:36.492963100 +0200
++++ b/linux_spi.c      2015-06-17 20:50:00.444860800 +0200
+@@ -22,7 +22,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <stdlib.h>
+-#include <sys/fcntl.h>
++#include <fcntl.h>
+ #include <errno.h>
+ #include <ctype.h>
+ #include <unistd.h>
diff --git a/trunk/package/utils/i2c-tools/Makefile b/trunk/package/utils/i2c-tools/Makefile
new file mode 100644 (file)
index 0000000..d77dbd5
--- /dev/null
@@ -0,0 +1,93 @@
+#
+# Copyright (C) 2007-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:=i2c-tools
+PKG_VERSION:=3.1.2
+PKG_RELEASE:=1
+
+PKG_SOURCE_URL:=http://dl.lm-sensors.org/i2c-tools/releases/
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
+PKG_MD5SUM:=7104a1043d11a5e2c7b131614eb1b962
+
+PKG_BUILD_PARALLEL:=1
+PKG_BUILD_DEPENDS:=PACKAGE_python-smbus:python
+
+PKG_MAINTAINER:=Daniel Golle <daniel@makrotopia.org>
+PKG_LICENSE:=GPLv2
+PKG_LICENSE_FILES:=COPYING
+
+include $(INCLUDE_DIR)/package.mk
+$(call include_mk, python-package.mk)
+
+define Package/i2c/Default
+  URL:=http://lm-sensors.org/wiki/I2CTools
+  TITLE:=I2C
+endef
+
+define Package/i2c-tools
+  $(call Package/i2c/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE+=tools for Linux
+endef
+
+define Package/python-smbus
+  $(call Package/i2c/Default)
+  SUBMENU:=Python
+  SECTION:=lang
+  CATEGORY:=Languages
+  TITLE:=Python bindings for the SMBUS
+  DEPENDS:=+python-light
+endef
+
+define Package/i2c-tools/description
+ This package contains an heterogeneous set of I2C tools for Linux. These tools
+ were originally part of the lm-sensors package.
+endef
+
+define Package/python-smbus/description
+ This package contain the python bindings for Linux SMBus access through i2c-dev.
+endef
+
+TARGET_CPPFLAGS += -I$(PKG_BUILD_DIR)/include
+
+ifdef CONFIG_PACKAGE_python-smbus
+  define Build/Compile/python-smbus
+       $(if $(Build/Compile/PyMod),,@echo Python packaging code not found.; false)
+       $(call Build/Compile/PyMod,./py-smbus/, \
+               install --prefix="$(PKG_INSTALL_DIR)/usr", \
+       )
+  endef
+endif
+
+define Build/Compile
+       $(MAKE) -C $(PKG_BUILD_DIR) \
+               LINUX="$(LINUX_DIR)" \
+               CC="$(TARGET_CC)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               LDFLAGS="$(TARGET_LDFLAGS)" \
+               CFLAGS="$(TARGET_CFLAGS)"
+       $(Build/Compile/python-smbus)
+endef
+
+define Package/i2c-tools/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdetect $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cdump $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cset $(1)/usr/sbin/
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/tools/i2cget $(1)/usr/sbin/
+endef
+
+define PyPackage/python-smbus/filespec
++|$(PYTHON_PKG_DIR)/smbus.so
+endef
+
+$(eval $(call BuildPackage,i2c-tools))
+$(eval $(call PyPackage,python-smbus))
+$(eval $(call BuildPackage,python-smbus))
diff --git a/trunk/package/utils/lm-sensors/Makefile b/trunk/package/utils/lm-sensors/Makefile
new file mode 100644 (file)
index 0000000..4dcea0c
--- /dev/null
@@ -0,0 +1,116 @@
+#
+# Copyright (C) 2006-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:=lm-sensors
+PKG_VERSION:=3.3.5
+PKG_RELEASE:=2
+
+PKG_SOURCE:=lm_sensors-$(PKG_VERSION).tar.bz2
+PKG_SOURCE_URL:=http://dl.lm-sensors.org/lm-sensors/releases
+PKG_MD5SUM:=da506dedceb41822e64865f6ba34828a
+PKG_MAINTAINER:=Jo-Philipp Wich <jow@openwrt.org>
+PKG_LICENSE:=GPL-2.0+ LGPL-2.1+
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/lm_sensors-$(PKG_VERSION)
+PKG_BUILD_PARALLEL:=1
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/lm-sensors/Default
+  DEPENDS:=+sysfsutils
+  URL:=http://www.lm-sensors.org/
+endef
+
+define Package/lm-sensors
+  $(call Package/lm-sensors/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=lm-sensors
+  DEPENDS+=+libsensors
+endef
+
+define Package/lm-sensors-detect
+  $(call Package/lm-sensors/Default)
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=lm-sensors-detect
+  DEPENDS+=+lm-sensors +perl +perlbase-essential +perlbase-fcntl +perlbase-file +perlbase-xsloader
+endef
+
+define Package/libsensors
+  $(call Package/lm-sensors/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=libsensors
+endef
+
+define Package/lm-sensors/description
+ utility to read hardware sensor data
+endef
+
+define Package/lm-sensors-detect/description
+ script to autodetect sensor hardware
+endef
+
+define Package/libsensors/description
+ lm-sensors libraries
+endef
+
+define Package/lm-sensors/conffiles
+/etc/sensors.conf
+endef
+
+define Build/Compile
+       +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
+               $(TARGET_CONFIGURE_OPTS) \
+               KERNELVERSION="$(LINUX_VERSION)" \
+               LINUX="$(LINUX_DIR)" \
+               CC="$(TARGET_CC)" \
+               CFLAGS="$(TARGET_CFLAGS)" \
+               CPPFLAGS="$(TARGET_CPPFLAGS)" \
+               STAGING_DIR="$(STAGING_DIR)" \
+               PREFIX="/usr" \
+               MACHINE="$(ARCH)" \
+               EXLDFLAGS="" \
+               user
+endef
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/sensors
+       $(CP) \
+               $(PKG_BUILD_DIR)/lib/sensors.h \
+               $(1)/usr/include/sensors
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_BUILD_DIR)/lib/libsensors.{a,so*} \
+               $(1)/usr/lib
+endef
+
+define Package/lm-sensors/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/prog/sensors/sensors $(1)/usr/sbin
+ifeq ($(ARCH),i386)
+       $(INSTALL_DIR) $(1)/etc
+       $(INSTALL_CONF) ./files/sensors.conf $(1)/etc/sensors.conf
+endif
+endef
+
+define Package/lm-sensors-detect/install
+       $(INSTALL_DIR) $(1)/usr/sbin
+       $(INSTALL_BIN) $(PKG_BUILD_DIR)/prog/detect/sensors-detect $(1)/usr/sbin
+endef
+
+define Package/libsensors/install
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(INSTALL_DATA) $(PKG_BUILD_DIR)/lib/libsensors.so* $(1)/usr/lib
+endef
+
+$(eval $(call BuildPackage,lm-sensors))
+$(eval $(call BuildPackage,lm-sensors-detect))
+$(eval $(call BuildPackage,libsensors))
diff --git a/trunk/package/utils/lm-sensors/files/sensors.conf b/trunk/package/utils/lm-sensors/files/sensors.conf
new file mode 100644 (file)
index 0000000..505b9d9
--- /dev/null
@@ -0,0 +1,117 @@
+chip "pc87366-*"
+
+# Soekris net4801 configuration
+
+# Written by Henrik Brix Andersen <henrik@brixandersen.dk>
+# Latest version can be found at http://www.brixandersen.dk/
+
+# The configuration is partly based on the PC87366 datasheet and
+# partly borrowed from the env4801 utility by Poul-Henning
+# Kamp <phk@phk.freebsd.dk>
+
+# Datasheet: http://www.winbond.com/PDF/APCsheet/PC87366.pdf
+# env4801:   http://phk.freebsd.dk/soekris/env4801/
+
+
+# Voltage inputs
+  ignore vid
+
+  # Unknown
+  # label in0     "avi0"
+  ignore in0
+
+
+  # Core Voltage, +2.0V
+  label in1     "VCORE"
+  set in1_min   1.9
+  set in1_max   2.1
+
+
+  # VCC, +5.0V
+  label in2     "VCC"
+  compute in2   @*2, @/2
+
+
+  # Power Supply Input, +6.0V - +28.0V
+  label in3     "VPWR"
+  compute in3   @*20.1, @/20.1
+  set in3_min    6.0
+  set in3_max   28.0
+
+
+  # +12V
+  label in4     "+12V"
+  compute in4   @*4.83, @/4.83
+  set in4_min   11
+  set in4_max   13
+
+
+  # -12V
+  label in5     "-12V"
+  # If in10 on your net4801 doesn't have the 3.3V reference, use this
+  # compute line instead:
+  # compute in5   (@-3.3)*19.2+3.3, (@-3.3)/19.2+3.3
+  compute in5   (@-in10)*19.2+in10, (@-in10)/19.2+in10
+  set in5_min   -13
+  set in5_max   -11
+
+
+  # GND, 0V
+  label in6     "GND"
+  set in6_min   0
+  set in6_max   0
+
+
+  # Standby Voltage, +3.3V
+  # Internally divided by 2
+  label in7     "Vsb"
+  compute in7   @*2, @/2
+  set in7_min    3.0
+  set in7_max    3.6
+
+
+  # Supply Voltage, +3.3V
+  # Internally divided by 2
+  label in8     "Vdd"
+  compute in8   @*2, @/2
+  set in8_min    3.0
+  set in8_max    3.6
+
+
+  # Battery Backup Supply Voltage, +3.0V
+  label in9     "Vbat"
+  set in9_min    2.4
+  set in9_max    3.6
+
+
+  # Analog Supply Voltage, +3.3V
+  # Internally divided by 2
+  label in10    "AVdd"
+  compute in10  @*2, @/2
+  set in10_min   3.0
+  set in10_max   3.6
+
+
+# Temperature inputs
+  ignore temp1
+  ignore temp2
+
+  # PC87366 Internal Temperature
+  # PC87366 Recommended Operating Conditions: 0 - 70C
+  # SC1100  Recommended Operating Conditions: 0 - 85C
+  label temp3       "Temp"
+  label temp3_crit  "Critical"
+  set temp3_min      0
+  set temp3_max     70
+  set temp3_crit    85
+
+
+  ignore temp4
+  ignore temp5
+  ignore temp6
+
+
+# Fan inputs
+  ignore fan1
+  ignore fan2
+  ignore fan3
diff --git a/trunk/package/utils/lm-sensors/patches/100-musl-compat.patch b/trunk/package/utils/lm-sensors/patches/100-musl-compat.patch
new file mode 100644 (file)
index 0000000..1cd82ab
--- /dev/null
@@ -0,0 +1,44 @@
+--- a/prog/dump/isadump.c
++++ b/prog/dump/isadump.c
+@@ -38,7 +38,7 @@
+ /* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
++#if !defined(__UCLIBC__)
+ #include <sys/io.h>
+ #else
+ #include <asm/io.h>
+--- a/prog/dump/isaset.c
++++ b/prog/dump/isaset.c
+@@ -34,7 +34,7 @@
+ /* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
++#if !defined(__UCLIBC__)
+ #include <sys/io.h>
+ #else
+ #include <asm/io.h>
+--- a/prog/dump/superio.c
++++ b/prog/dump/superio.c
+@@ -21,7 +21,7 @@
+ #include <stdlib.h>
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
++#if !defined(__UCLIBC__)
+ #include <sys/io.h>
+ #else
+ #include <asm/io.h>
+--- a/prog/dump/util.c
++++ b/prog/dump/util.c
+@@ -12,7 +12,7 @@
+ #include "util.h"
+ /* To keep glibc2 happy */
+-#if defined(__GLIBC__) && __GLIBC__ == 2 && __GLIBC_MINOR__ >= 0
++#if !defined(__UCLIBC__)
+ #include <sys/io.h>
+ #else
+ #include <asm/io.h>
diff --git a/trunk/package/utils/lxc/Config.in b/trunk/package/utils/lxc/Config.in
new file mode 100644 (file)
index 0000000..618fde0
--- /dev/null
@@ -0,0 +1,37 @@
+menu "Configuration"
+        depends on PACKAGE_lxc
+
+config LXC_KERNEL_OPTIONS
+       bool "Enable kernel support for LXC"
+       default n
+       select KERNEL_CGROUPS
+       select KERNEL_NAMESPACES
+       select KERNEL_LXC_MISC
+       help
+         Select needed kernel options for LXC related utilities. Options
+         include cgroups, namespaces and other miscellaneous options. These
+         options unfortunately can not be installed as a module.
+
+config LXC_BUSYBOX_OPTIONS
+       bool "Enable busybox support for lxc-create tool"
+       default n
+       select BUSYBOX_CUSTOM
+       select BUSYBOX_CONFIG_HAVE_DOT_CONFIG
+       select BUSYBOX_CONFIG_FEATURE_SEAMLESS_XZ
+       select BUSYBOX_CONFIG_FEATURE_TAR_LONG_OPTIONS
+       select BUSYBOX_CONFIG_UNXZ
+       select BUSYBOX_CONFIG_XZ
+       select BUSYBOX_CONFIG_GETOPT
+       select BUSYBOX_CONFIG_FEATURE_GETOPT_LONG
+       help
+         Select needed busybox options for lxc-create utility. This include XZ tar
+         compression, long option support for tar and built-in getopt support.
+
+config LXC_SECCOMP
+       bool "Enable support for seccomp in LXC"
+       default KERNEL_SECCOMP
+       help
+         Build LXC with support for seccomp filters.
+         Select libseccomp which also pulls-in the needed kernel features.
+
+endmenu
diff --git a/trunk/package/utils/lxc/Makefile b/trunk/package/utils/lxc/Makefile
new file mode 100644 (file)
index 0000000..868e100
--- /dev/null
@@ -0,0 +1,255 @@
+#
+# Copyright (C) 2013-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:=lxc
+PKG_VERSION:=1.1.2
+PKG_RELEASE:=2
+
+PKG_LICENSE:=LGPL-2.1+ BSD-2-Clause GPL-2.0
+PKG_MAINTAINER:=Luka Perkov <luka@openwrt.org>
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://linuxcontainers.org/downloads/lxc/
+PKG_MD5SUM:=3ebadacf5fe8bfe689fd7a09812b682c
+
+PKG_BUILD_DEPENDS:=lua
+PKG_BUILD_PARALLEL:=1
+
+PKG_INSTALL:=1
+PKG_FIXUP:=autoreconf
+
+include $(INCLUDE_DIR)/package.mk
+
+LXC_APPLETS_BIN += \
+       attach autostart cgroup clone config console create destroy device \
+       execute freeze info monitor snapshot start stop unfreeze unshare \
+       usernsexec wait
+
+LXC_APPLETS_LIB += \
+       monitord user-nic
+
+LXC_SCRIPTS += \
+       checkconfig ls top
+
+DEPENDS_APPLETS = +libpthread +libcap +liblxc
+
+DEPENDS_create = +lxc-configs +lxc-hooks +lxc-templates
+DEPENDS_ls = +lxc-config
+DEPENDS_top = +lxc-lua +luafilesystem @BROKEN
+
+
+define Package/lxc/Default
+  SECTION:=utils
+  CATEGORY:=Utilities
+  TITLE:=LXC userspace tools
+  URL:=http://lxc.sourceforge.net/
+endef
+
+define Package/lxc
+  $(call Package/lxc/Default)
+  MENU:=1
+endef
+
+define Package/lxc/config
+  source "$(SOURCE)/Config.in"
+endef
+
+define Package/lxc/description
+ LXC is the userspace control package for Linux Containers, a lightweight
+ virtual system mechanism sometimes described as "chroot on steroids".
+endef
+
+define Package/lxc-common
+  $(call Package/lxc/Default)
+  TITLE:=LXC common files
+  DEPENDS:= lxc
+endef
+
+define Package/lxc-hooks
+  $(call Package/lxc/Default)
+  TITLE:=LXC virtual machine hooks
+  DEPENDS:= lxc
+endef
+
+define Package/lxc-templates
+  $(call Package/lxc/Default)
+  TITLE:=LXC virtual machine templates
+  DEPENDS:= lxc
+endef
+
+define Package/lxc-configs
+  $(call Package/lxc/Default)
+  TITLE:=LXC virtual machine common config files
+  DEPENDS:= lxc
+endef
+
+define Package/liblxc
+  $(call Package/lxc/Default)
+  SECTION:=libs
+  CATEGORY:=Libraries
+  TITLE:=LXC userspace library
+  DEPENDS:= lxc +libcap +libpthread +LXC_SECCOMP:libseccomp
+endef
+
+define Package/lxc-lua
+  $(call Package/lxc/Default)
+  TITLE:=LXC Lua bindings
+  DEPENDS:= lxc +liblua +liblxc +luafilesystem
+endef
+
+define Package/lxc-init
+  $(call Package/lxc/Default)
+  TITLE:=LXC Lua bindings
+  DEPENDS:= lxc +liblxc
+endef
+
+CONFIGURE_ARGS += \
+       --disable-apparmor \
+       --disable-doc \
+       --disable-examples \
+       --enable-lua=yes \
+       --with-lua-pc="$(STAGING_DIR)/usr/lib/pkgconfig/lua.pc"
+
+ifeq ($(CONFIG_LXC_SECCOMP),y)
+CONFIGURE_ARGS += --enable-seccomp
+else
+CONFIGURE_ARGS += --disable-seccomp
+endif
+
+MAKE_FLAGS += \
+       LUA_INSTALL_CMOD="/usr/lib/lua" \
+       LUA_INSTALL_LMOD="/usr/lib/lua"
+
+
+define Build/InstallDev
+       $(INSTALL_DIR) $(1)/usr/include/lxc/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/include/lxc/* \
+               $(1)/usr/include/lxc/
+
+       $(INSTALL_DIR) $(1)/usr/lib
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
+               $(1)/usr/lib/
+
+       $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/lxc.pc \
+               $(1)/usr/lib/pkgconfig/
+endef
+
+
+define Package/lxc/install
+       true
+endef
+
+define Package/lxc-common/conffiles
+/etc/lxc/default.conf
+/etc/lxc/lxc.conf
+endef
+
+define Package/lxc-common/install
+       $(INSTALL_DIR) $(1)/usr/lib/lxc/rootfs
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/lxc/rootfs/README \
+               $(1)/usr/lib/lxc/rootfs/
+
+       $(INSTALL_DIR) $(1)/usr/share/lxc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/lxc.functions \
+               $(1)/usr/share/lxc/
+
+       $(INSTALL_DIR) $(1)/etc/lxc/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/etc/lxc/default.conf \
+               $(1)/etc/lxc/default.conf
+
+       $(INSTALL_DIR) $(1)/etc/lxc/
+       $(CP) \
+               ./files/lxc.conf \
+               $(1)/etc/lxc/lxc.conf
+
+       $(INSTALL_DIR) $(1)/lxc/
+endef
+
+define Package/lxc-hooks/install
+       $(INSTALL_DIR) $(1)/usr/share/lxc/hooks
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/hooks/* \
+               $(1)/usr/share/lxc/hooks/
+endef
+
+define Package/lxc-templates/install
+       $(INSTALL_DIR) $(1)/usr/share/lxc/templates/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/templates/lxc-* \
+               $(1)/usr/share/lxc/templates/
+endef
+
+define Package/lxc-configs/install
+       $(INSTALL_DIR) $(1)/usr/share/lxc/config/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lxc/config/* \
+               $(1)/usr/share/lxc/config/
+endef
+
+define Package/liblxc/install
+       $(INSTALL_DIR) $(1)/usr/lib/
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/liblxc.so* \
+               $(1)/usr/lib/
+endef
+
+define Package/lxc-lua/install
+       $(INSTALL_DIR) $(1)/usr/lib/lua
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/share/lua/5.1/lxc.lua \
+               $(1)/usr/lib/lua/
+       $(INSTALL_DIR) $(1)/usr/lib/lua/lxc
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/lib/lua/5.1/lxc/core.so \
+               $(1)/usr/lib/lua/lxc/
+endef
+
+define Package/lxc-init/install
+       $(INSTALL_DIR) $(1)/sbin
+       $(CP) \
+               $(PKG_INSTALL_DIR)/usr/sbin/init.lxc \
+               $(1)/sbin/
+endef
+
+define GenPlugin
+  define Package/lxc-$(1)
+    $(call Package/lxc/Default)
+    TITLE:=Utility lxc-$(1) from the LXC userspace tools
+    DEPENDS:= lxc +lxc-common $(2) $(DEPENDS_$(1))
+  endef
+
+  define Package/lxc-$(1)/install
+       $(INSTALL_DIR) $$(1)$(3)
+       $(INSTALL_BIN) \
+               $(PKG_INSTALL_DIR)$(3)/lxc-$(1) \
+               $$(1)$(3)/
+  endef
+
+  $$(eval $$(call BuildPackage,lxc-$(1)))
+endef
+
+
+$(eval $(call BuildPackage,lxc))
+$(eval $(call BuildPackage,lxc-common))
+$(eval $(call BuildPackage,lxc-hooks))
+$(eval $(call BuildPackage,lxc-configs))
+$(eval $(call BuildPackage,lxc-templates))
+$(eval $(call BuildPackage,liblxc))
+$(eval $(call BuildPackage,lxc-lua))
+$(eval $(call BuildPackage,lxc-init))
+$(foreach u,$(LXC_APPLETS_BIN),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/bin")))
+$(foreach u,$(LXC_APPLETS_LIB),$(eval $(call GenPlugin,$(u),$(DEPENDS_APPLETS),"/usr/lib/lxc")))
+$(foreach u,$(LXC_SCRIPTS),$(eval $(call GenPlugin,$(u),,"/usr/bin")))
diff --git a/trunk/package/utils/lxc/files/lxc.conf b/trunk/package/utils/lxc/files/lxc.conf
new file mode 100644 (file)
index 0000000..3b77baa
--- /dev/null
@@ -0,0 +1 @@
+lxc.lxcpath = /lxc
diff --git a/trunk/package/utils/lxc/patches/010-compile.patch b/trunk/package/utils/lxc/patches/010-compile.patch
new file mode 100644 (file)
index 0000000..6f12c38
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/configure.ac
++++ b/configure.ac
+@@ -31,30 +31,6 @@ AC_CANONICAL_HOST
+ AM_PROG_CC_C_O
+ AC_GNU_SOURCE
+-# Detect the distribution. This is used for the default configuration and
+-# for some distro-specific build options.
+-AC_MSG_CHECKING([host distribution])
+-AC_ARG_WITH(distro, AS_HELP_STRING([--with-distro=DISTRO], [Specify the Linux distribution to target: One of redhat, oracle, centos, fedora, suse, gentoo, debian, arch, slackware, paldo, openmandriva or pardus.]))
+-if type lsb_release >/dev/null 2>&1 && test "z$with_distro" = "z"; then
+-      with_distro=`lsb_release -is`
+-fi
+-if test "z$with_distro" = "z"; then
+-      AC_CHECK_FILE(/etc/redhat-release,with_distro="redhat")
+-      AC_CHECK_FILE(/etc/oracle-release,with_distro="oracle")
+-      AC_CHECK_FILE(/etc/centos-release,with_distro="centos")
+-      AC_CHECK_FILE(/etc/fedora-release,with_distro="fedora")
+-      AC_CHECK_FILE(/etc/SuSE-release,with_distro="suse")
+-      AC_CHECK_FILE(/etc/gentoo-release,with_distro="gentoo")
+-      AC_CHECK_FILE(/etc/debian_version,with_distro="debian")
+-      AC_CHECK_FILE(/etc/arch-release,with_distro="arch")
+-      AC_CHECK_FILE(/etc/slackware-version,with_distro="slackware")
+-      AC_CHECK_FILE(/etc/frugalware-release,with_distro="frugalware")
+-      AC_CHECK_FILE(/etc/mandrakelinux-release, with_distro="openmandriva")
+-      AC_CHECK_FILE(/etc/mandriva-release,with_distro="openmandriva")
+-      AC_CHECK_FILE(/etc/pardus-release,with_distro="pardus")
+-fi
+-with_distro=`echo ${with_distro} | tr '[[:upper:]]' '[[:lower:]]'`
+-
+ if test "z$with_distro" = "z"; then
+       with_distro="unknown"
+ fi
diff --git a/trunk/package/utils/lxc/patches/015-getline.patch b/trunk/package/utils/lxc/patches/015-getline.patch
new file mode 100644 (file)
index 0000000..e2f002a
--- /dev/null
@@ -0,0 +1,15 @@
+--- a/src/lxc/utils.h
++++ b/src/lxc/utils.h
+@@ -44,11 +44,7 @@ extern char *get_rundir(void);
+ extern const char *lxc_global_config_value(const char *option_name);
+ /* Define getline() if missing from the C library */
+-#ifndef HAVE_GETLINE
+-#ifdef HAVE_FGETLN
+-#include <../include/getline.h>
+-#endif
+-#endif
++#include "../include/getline.h"
+ /* Define setns() if missing from the C library */
+ #ifndef HAVE_SETNS
diff --git a/trunk/package/utils/lxc/patches/016-uninitialized-ret-in-monitor.patch b/trunk/package/utils/lxc/patches/016-uninitialized-ret-in-monitor.patch
new file mode 100644 (file)
index 0000000..7eca2ea
--- /dev/null
@@ -0,0 +1,11 @@
+--- a/src/lxc/monitor.c
++++ b/src/lxc/monitor.c
+@@ -181,7 +181,7 @@ int lxc_monitor_sock_name(const char *lx
+ int lxc_monitor_open(const char *lxcpath)
+ {
+       struct sockaddr_un addr;
+-      int fd,ret;
++      int fd,ret = 0;
+       int retry,backoff_ms[] = {10, 50, 100};
+       size_t len;
diff --git a/trunk/package/utils/lxc/patches/020-lxc-checkconfig.patch b/trunk/package/utils/lxc/patches/020-lxc-checkconfig.patch
new file mode 100644 (file)
index 0000000..272f76b
--- /dev/null
@@ -0,0 +1,20 @@
+--- a/src/lxc/lxc-checkconfig.in
++++ b/src/lxc/lxc-checkconfig.in
+@@ -4,6 +4,17 @@
+ : ${CONFIG:=/proc/config.gz}
+ : ${GREP:=zgrep}
+ : ${MODNAME:=configs}
++: ${ZGREP:=zgrep}
++: ${GUNZIP:=gunzip}
++
++if [ -z $(which $ZGREP) ] && ! [ -z $(which $GUNZIP) ] && [ -x $(which $GUNZIP) ] &&  [ -f $CONFIG ] && [ "$CONFIG" == "/proc/config.gz" ] ; then
++
++      CONFIG_NEW="/tmp/config-$(uname -r)"
++      $GUNZIP -c $CONFIG > $CONFIG_NEW
++      CONFIG=$CONFIG_NEW
++
++      GREP=grep
++fi
+ SETCOLOR_SUCCESS="printf \\033[1;32m"
+ SETCOLOR_FAILURE="printf \\033[1;31m"
diff --git a/trunk/package/utils/lxc/patches/025-remove-unsupported-option.patch b/trunk/package/utils/lxc/patches/025-remove-unsupported-option.patch
new file mode 100644 (file)
index 0000000..cb0a9f0
--- /dev/null
@@ -0,0 +1,19 @@
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -494,15 +494,7 @@ fi
+ # Unpack the rootfs
+ echo "Unpacking the rootfs"
+-EXCLUDES=""
+-excludelist=$(relevant_file excludes)
+-if [ -f "${excludelist}" ]; then
+-    while read line; do
+-        EXCLUDES="$EXCLUDES --exclude=$line"
+-    done < $excludelist
+-fi
+-
+-tar  --anchored ${EXCLUDES} --numeric-owner -xpJf \
++tar --numeric-owner -xpJf \
+     ${LXC_CACHE_PATH}/rootfs.tar.xz -C ${LXC_ROOTFS}
+ mkdir -p ${LXC_ROOTFS}/dev/pts/
diff --git a/trunk/package/utils/lxc/patches/030-lxc-download.patch b/trunk/package/utils/lxc/patches/030-lxc-download.patch
new file mode 100644 (file)
index 0000000..295bae0
--- /dev/null
@@ -0,0 +1,43 @@
+--- a/templates/lxc-download.in
++++ b/templates/lxc-download.in
+@@ -39,7 +39,7 @@ DOWNLOAD_LIST_IMAGES="false"
+ DOWNLOAD_MODE="system"
+ DOWNLOAD_READY_GPG="false"
+ DOWNLOAD_RELEASE=
+-DOWNLOAD_SERVER="images.linuxcontainers.org"
++DOWNLOAD_SERVER="virtualwrt.org/containers/"
+ DOWNLOAD_SHOW_GPG_WARNING="true"
+ DOWNLOAD_SHOW_HTTP_WARNING="true"
+ DOWNLOAD_TARGET="system"
+@@ -257,14 +257,6 @@ for bin in tar xz wget; do
+     fi
+ done
+-# Check for GPG
+-if [ "$DOWNLOAD_VALIDATE" = "true" ]; then
+-    if ! type gpg >/dev/null 2>&1; then
+-        echo "ERROR: Missing recommended tool: gpg" 1>&2
+-        echo "You can workaround this by using --no-validate." 1>&2
+-        exit 1
+-    fi
+-fi
+ # Check that we have all variables we need
+ if [ -z "$LXC_NAME" ] || [ -z "$LXC_PATH" ] || [ -z "$LXC_ROOTFS" ]; then
+@@ -456,16 +448,9 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ];
+         echo "Downloading the rootfs"
+         download_file $DOWNLOAD_URL/rootfs.tar.xz \
+             ${DOWNLOAD_TEMP}/rootfs.tar.xz normal
+-        download_sig  $DOWNLOAD_URL/rootfs.tar.xz.asc \
+-             ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc normal
+-        gpg_validate ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc
+-
+         echo "Downloading the metadata"
+         download_file $DOWNLOAD_URL/meta.tar.xz \
+             ${DOWNLOAD_TEMP}/meta.tar.xz normal
+-        download_sig  $DOWNLOAD_URL/meta.tar.xz.asc \
+-            ${DOWNLOAD_TEMP}/meta.tar.xz.asc normal
+-        gpg_validate ${DOWNLOAD_TEMP}/meta.tar.xz.asc
+         if [ -d $LXC_CACHE_PATH ]; then
+             rm -Rf $LXC_CACHE_PATH