diff --git a/libs/liburcu/Makefile b/libs/liburcu/Makefile new file mode 100644 index 000000000..4ce361fa2 --- /dev/null +++ b/libs/liburcu/Makefile @@ -0,0 +1,51 @@ +# +# Copyright (C) 2014 CZ.NIC, z.s.p.o. +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=liburcu +PKG_VERSION:=0.7.12 +PKG_RELEASE:=1 + +PKG_SOURCE:=userspace-rcu-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_SUBDIR:=userspace-rcu-$(PKG_VERSION) +PKG_SOURCE_URL:=https://lttng.org/files/urcu/ +PKG_MD5SUM:=5957c9f5d2d4a483dcada7f313b539ca + +PKG_BUILD_DIR:=$(BUILD_DIR)/userspace-rcu-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 +PKG_INSTALL:=1 +PKG_USE_MIPS16:=0 + +include $(INCLUDE_DIR)/package.mk + +define Package/liburcu + SECTION:=libs + CATEGORY:=Libraries + TITLE:=User-space Read-Copy-Update library + URL:=https://lttng.org/ + MAINTAINER:=daniel.salzman@nic.cz + DEPENDS:=+libpthread +endef + +define Package/liburcu/description + Userspace Read-Copy-Update library. +endef + +define Build/InstallDev + $(INSTALL_DIR) $(1)/usr/include + $(CP) $(PKG_INSTALL_DIR)/usr/include/urcu* $(1)/usr/include/ + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liburcu*.{a,so*} $(1)/usr/lib/ +endef + +define Package/liburcu/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/liburcu*.so.* $(1)/usr/lib/ +endef + +$(eval $(call BuildPackage,liburcu)) diff --git a/net/knot/Makefile b/net/knot/Makefile new file mode 100644 index 000000000..91b1ed4e7 --- /dev/null +++ b/net/knot/Makefile @@ -0,0 +1,143 @@ +# +# Copyright (C) 2014 CZ.NIC, z.s.p.o. +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk + +PKG_NAME:=knot +PKG_VERSION:=1.5.0-rc2 +PKG_RELEASE:=1 + +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) +PKG_SOURCE_URL:=https://secure.nic.cz/files/knot-dns/ +PKG_MD5SUM:=9a93226c200813ee7bfe27dcf7b6cbc9 + +PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) +PKG_BUILD_PARALLEL:=1 +PKG_FIXUP:=autoreconf +PKG_INSTALL:=1 + +include $(INCLUDE_DIR)/package.mk + +define Package/knot/Default + SECTION:=net + CATEGORY:=Network + TITLE:=Knot DNS + URL:=https://www.knot-dns.cz + MAINTAINER:=daniel.salzman@nic.cz + SUBMENU:=IP Addresses and Names + DEPENDS:=+libopenssl +liburcu +endef + +define Package/knot-libknot + $(call Package/knot/Default) + TITLE+= (library) +endef + +define Package/knot + $(call Package/knot/Default) + TITLE+= (server) + DEPENDS+=+knot-libknot +endef + +define Package/knot-utils + $(call Package/knot/Default) + TITLE+= (utils) + DEPENDS+=+knot-libknot +endef + +define Package/knot-tests + $(call Package/knot/Default) + TITLE+= (tests) + DEPENDS+=+knot-libknot +endef + +define Package/knot-libknot/description + Knot DNS library. +endef + +define Package/knot/description + High-performance authoritative-only DNS server. +endef + +define Package/knot-utils/description + DNS utilities: kdig, khost, knsupdate and knsec3hash. +endef + +define Package/knot-tests/description + Unit tests for Knot DNS server. + Usage: /usr/share/knot/runtests.sh +endef + +CONFIGURE_ARGS += \ + --enable-recvmmsg=no \ + --disable-fastparser \ + --with-rundir=/var/run \ + --with-storage=/etc/knot + +TARGET_CFLAGS += -std=gnu99 -DPSELECT_COMPAT + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) + $(MAKE) -C $(PKG_BUILD_DIR)/libtap check + $(MAKE) -C $(PKG_BUILD_DIR)/tests check-compile-only + $(MAKE) -C $(PKG_BUILD_DIR)/src/zscanner check-compile-only +endef + +define Package/knot-libknot/install + $(INSTALL_DIR) $(1)/usr/lib + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libknot.so.* $(1)/usr/lib/ + $(CP) $(PKG_INSTALL_DIR)/usr/lib/libzscanner.so.* $(1)/usr/lib/ +endef + +define Package/knot/install + $(INSTALL_DIR) $(1)/usr/sbin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/knotc $(1)/usr/sbin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/knotd $(1)/usr/sbin/ + + $(INSTALL_DIR) $(1)/etc/knot + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/knot/knot.sample.conf $(1)/etc/knot/knot.conf + $(INSTALL_CONF) $(PKG_INSTALL_DIR)/etc/knot/example.com.zone $(1)/etc/knot/ + + $(INSTALL_DIR) $(1)/etc/init.d + $(INSTALL_BIN) ./files/knotd.init $(1)/etc/init.d/knotd +endef + +define Package/knot-utils/install + $(INSTALL_DIR) $(1)/usr/bin + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/kdig $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/khost $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/knsupdate $(1)/usr/bin/ + $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/knsec3hash $(1)/usr/bin/ +endef + +define Package/knot-tests/install + $(INSTALL_DIR) $(1)/usr/share/knot + $(INSTALL_BIN) ./files/runtests.sh $(1)/usr/share/knot + + $(INSTALL_DIR) $(1)/usr/share/knot/tap + $(INSTALL_BIN) $(PKG_BUILD_DIR)/libtap/runtests $(1)/usr/share/knot/tap/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/libtap/tap/libtap.sh $(1)/usr/share/knot/tap/ + + $(INSTALL_DIR) $(1)/usr/share/knot/tests + find $(PKG_BUILD_DIR)/tests/.libs -maxdepth 1 -executable -type f | \ + xargs -I{} basename {} | \ + xargs -I{} $(INSTALL_BIN) -T $(PKG_BUILD_DIR)/tests/.libs/{} $(1)/usr/share/knot/tests/test_{} + + $(INSTALL_DIR) $(1)/usr/share/knot/tests/data + $(INSTALL_CONF) $(PKG_BUILD_DIR)/tests/data/sample_conf $(1)/usr/share/knot/tests/data/ + + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/zscanner/tests/.libs/zscanner-tool $(1)/usr/share/knot/tests/ + $(INSTALL_BIN) $(PKG_BUILD_DIR)/src/zscanner/tests/unittests $(1)/usr/share/knot/tests/test_zscanner + $(INSTALL_CONF) $(PKG_BUILD_DIR)/src/zscanner/tests/TESTS $(1)/usr/share/knot/tests/ + cp -a $(PKG_BUILD_DIR)/src/zscanner/tests/data $(1)/usr/share/knot/tests/ +endef + +$(eval $(call BuildPackage,knot-libknot)) +$(eval $(call BuildPackage,knot)) +$(eval $(call BuildPackage,knot-utils)) +$(eval $(call BuildPackage,knot-tests)) diff --git a/net/knot/files/knotd.init b/net/knot/files/knotd.init new file mode 100644 index 000000000..23d3bd58e --- /dev/null +++ b/net/knot/files/knotd.init @@ -0,0 +1,45 @@ +#!/bin/sh /etc/rc.common +START=70 + +knot_bin="/usr/sbin/knotd" +knot_ctl="/usr/sbin/knotc" +config_file="/etc/knot/knot.conf" +pid_file="/var/run/knot.pid" + +start() { + echo "Starting Knot DNS" + + if [ -e $pid_file ]; then + echo " Already running with PID `cat $pid_file`" + return 1 + fi + + $knot_bin -c $config_file -d + + if [ $? -ne 0 ]; then + echo " Failed to start" + fi +} + +stop() { + echo "Stopping Knot DNS" + + if [ -e $pid_file ]; then + kill `cat $pid_file` + rm -f $pid_file + else + echo " No PID file $pid_file" + return 1 + fi +} + +restart() { + stop + start +} + +reload() { + echo "Reloading Knot DNS" + + $knot_ctl -c $config_file reload +} diff --git a/net/knot/files/runtests.sh b/net/knot/files/runtests.sh new file mode 100644 index 000000000..10032cb59 --- /dev/null +++ b/net/knot/files/runtests.sh @@ -0,0 +1,9 @@ +#!/bin/sh + +cd `dirname "$0"`/tests +../tap/runtests -b /tmp ./test_* + +ret=$? +cd - + +return $ret diff --git a/net/knot/patches/01_strptime_susv3.patch b/net/knot/patches/01_strptime_susv3.patch new file mode 100644 index 000000000..fc14b91d5 --- /dev/null +++ b/net/knot/patches/01_strptime_susv3.patch @@ -0,0 +1,21 @@ +diff --git a/src/libknot/dnssec/key.c b/src/libknot/dnssec/key.c +index 7dc0540..3e351bb 100644 +--- a/src/libknot/dnssec/key.c ++++ b/src/libknot/dnssec/key.c +@@ -260,7 +260,15 @@ static int key_param_time(const void *save_to, char *value) + + struct tm parsed = { 0 }; + +- if (!strptime(value, "%Y%m%d%H%M%S", &parsed)) { ++ if (strlen(value) != 14) { ++ return KNOT_EINVAL; ++ } ++ ++ char *v = value; ++ char buf[32] = ""; ++ int ret = sprintf(buf, "%.4s %.2s %.2s %.2s %.2s %.2s", ++ v, v + 4, v + 6, v + 8, v + 10, v + 12); ++ if (ret != 19 || !strptime(buf, "%Y %m %d %H %M %S", &parsed)) { + return KNOT_EINVAL; + } + diff --git a/net/knot/patches/02_knot.conf.patch b/net/knot/patches/02_knot.conf.patch new file mode 100644 index 000000000..f82af0cfc --- /dev/null +++ b/net/knot/patches/02_knot.conf.patch @@ -0,0 +1,28 @@ +diff --git a/samples/knot.sample.conf.in b/samples/knot.sample.conf.in +index 956e8a9..a068e67 100644 +--- a/samples/knot.sample.conf.in ++++ b/samples/knot.sample.conf.in +@@ -14,7 +14,7 @@ system { + + # User for running server + # May also specify user.group (e.g. knot.knot) +- user knot.knot; ++ user root.root; + + # Directory for storing run-time data + # e.g. PID file and control sockets +@@ -63,11 +63,11 @@ zones { + # storage "@storage_dir@"; + # + # Example master zone +-# example.com { +-# file "@config_dir@/example.com.zone"; ++ example.com { ++ file "example.com.zone"; + # xfr-out slave0; + # notify-out slave0; +-# } ++ } + # + # Example slave zone + # example.net { diff --git a/net/knot/patches/03_zscanner_tests.patch b/net/knot/patches/03_zscanner_tests.patch new file mode 100644 index 000000000..74be97830 --- /dev/null +++ b/net/knot/patches/03_zscanner_tests.patch @@ -0,0 +1,41 @@ +diff --git a/src/zscanner/tests/TESTS b/src/zscanner/tests/TESTS +index c88aef1..4e2148f 100644 +--- a/src/zscanner/tests/TESTS ++++ b/src/zscanner/tests/TESTS +@@ -18,10 +18,8 @@ + 05-2_TTL + 05-3_TTL + 05-4_TTL +-06-0_INCLUDE + 06-1_INCLUDE + 06-2_INCLUDE +-06-3_INCLUDE + 06-4_INCLUDE + 06-5_INCLUDE + 06-6_INCLUDE +diff --git a/src/zscanner/tests/unittests.in b/src/zscanner/tests/unittests.in +index 846f351..272856c 100644 +--- a/src/zscanner/tests/unittests.in ++++ b/src/zscanner/tests/unittests.in +@@ -1,9 +1,9 @@ + #!/bin/sh + +-SOURCE=@top_srcdir@/src/zscanner/tests +-BUILD=@top_builddir@/src/zscanner/tests ++SOURCE="." ++BUILD="." + +-. @top_srcdir@/libtap/tap/libtap.sh ++. ../tap/libtap.sh + + cd "$BUILD" + +@@ -11,7 +11,7 @@ TMPDIR=$(test_tmpdir) + TESTS_DIR="$SOURCE"/data + ZSCANNER_TOOL="$BUILD"/zscanner-tool + +-plan 68 ++plan 66 + + mkdir -p "$TMPDIR"/includes/ + for a in 1 2 3 4 5 6; do