Skip to content

Instantly share code, notes, and snippets.

@umq
Created March 1, 2012 05:35
Show Gist options
  • Save umq/1947564 to your computer and use it in GitHub Desktop.
Save umq/1947564 to your computer and use it in GitHub Desktop.
FreeBSD port skeleton for knot-dns by CZ-NIC http://www.knot-dns.cz
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# dns/knot
# dns/knot/files
# dns/knot/files/knot.in
# dns/knot/files/pkg-message.in
# dns/knot/distinfo
# dns/knot/pkg-descr
# dns/knot/pkg-plist
# dns/knot/Makefile
#
echo c - dns/knot
mkdir -p dns/knot > /dev/null 2>&1
echo c - dns/knot/files
mkdir -p dns/knot/files > /dev/null 2>&1
echo x - dns/knot/files/knot.in
sed 's/^X//' >dns/knot/files/knot.in << '630171dfbed3fc0066bbe3be3cefcb0b'
X#!/bin/sh
X#
X# $FreeBSD$
X#
X# PROVIDE: knot
X# REQUIRE: DAEMON
X# REQUIRE: LOGIN
X# KEYWORD: shutdown
X#
X# Add the following lines to /etc/rc.conf to enable knot:
X#
X# knot_enable="YES": Set to NO by default.
X# Set it to YES to enable knot.
X# knot_config="": Set to %%PREFIX%%/etc/knot/knot.conf
X# by default.
X
X. /etc/rc.subr
X
Xname=knot
Xrcvar=knot_enable
Xload_rc_config ${name}
X
X: ${knot_enable:="NO"}
X: ${knot_config="%%PREFIX%%/etc/knot/knot.conf"}
X
Xcommand=%%PREFIX%%/sbin/${name}c
Xprocname=%%PREFIX%%/sbin/${name}d
X
Xcommand_args="-c ${knot_config} -w start"
Xrequired_files=${knot_config}
X
Xextra_commands="reload compile"
Xstart_precmd="${name}_precmd"
Xreload_cmd="${name}_reload"
Xstop_cmd="${name}_stop"
Xstatus_cmd="${name}_status"
Xcompile_cmd="${name}_compile"
X
Xknot_precmd() {
X knot_compile
X}
Xknot_restart() {
X echo "Restarting ${name}."
X ${command} -c ${knot_config} -w restart
X}
Xknot_reload() {
X echo "Reloading ${name}."
X ${command} -c ${knot_config} reload
X}
Xknot_stop() {
X echo "Stopping ${name}."
X ${command} -c ${knot_config} -w stop
X}
Xknot_status() {
X ${command} -c ${knot_config} running
X}
Xknot_compile() {
X echo "Compiling zone(s)..."
X ${command} -c ${knot_config} compile
X}
X
Xrun_rc_command "$1"
630171dfbed3fc0066bbe3be3cefcb0b
echo x - dns/knot/files/pkg-message.in
sed 's/^X//' >dns/knot/files/pkg-message.in << 'bb85ee5856902856c59d830ad19c09e9'
X
X####################################################################
X#
X# To start using Knot DNS, you should complete the following tasks:
X#
X# ----- configure --------------------------------------------------
X#
X $EDITOR %%PREFIX%%/etc/knot/knot.conf
X#
X# For all option have a look at the contents of
X# %%PREFIX%%/etc/knot/knot.conf.sample
X#
X# For example, under "system" you might like to add
X# user "bind.bind";
X# to not have knotd run as root/wheel
X#
X# ----- prepare ----------------------------------------------------
X#
X echo knot_enable=\"YES\" >> /etc/rc.conf
X#
X# ----- startup ----------------------------------------------------
X#
X %%PREFIX%%/etc/rc.d/knot start
X#
X####################################################################
X
bb85ee5856902856c59d830ad19c09e9
echo x - dns/knot/distinfo
sed 's/^X//' >dns/knot/distinfo << 'c78ef0f65fcdd5ff5517e690fa8f08a6'
XSHA256 (knot-1.0.0.tar.gz) = ab947ff09655f44bd4106da65764810ff760b646b83e9b0939ee994f943372a6
XSIZE (knot-1.0.0.tar.gz) = 1050994
c78ef0f65fcdd5ff5517e690fa8f08a6
echo x - dns/knot/pkg-descr
sed 's/^X//' >dns/knot/pkg-descr << '1a7bc414af869195ddd395e2208e12c0'
XKnot DNS is a high-performance authoritative-only DNS server
Xwhich supports all key features of the domain name system
Xincluding zone transfers, dynamic updates and DNSSEC.
X
XKey features:
X
X - Open source
X
X - High-performance, multi-threaded, and mostly
X lock-free implementation which scales well on SMPs
X
X - Object-oriented design
X
X - Support for all important DNS protocols:
X - Full and incremental zone transfers
X - EDNS0 and DNSSEC extensions, including NSEC3
X - NSID
X
X
XWWW: http://www.knot-dns.cz/
1a7bc414af869195ddd395e2208e12c0
echo x - dns/knot/pkg-plist
sed 's/^X//' >dns/knot/pkg-plist << '37f7c1b63162d53680df4de6f19a9d5a'
X@comment $FreeBSD$
X@stopdaemon knot
Xetc/knot/example.com.zone
Xetc/knot/knot.sample.conf
Xlibexec/knot-zcompile
Xlibexec/unittests
Xlibexec/unittests-libknot
Xlibexec/unittests-libknot-realdata
Xlibexec/unittests-xfr
Xlibexec/unittests-zcompile
Xsbin/knotc
Xsbin/knotd
X@dirrmtry etc/knot
37f7c1b63162d53680df4de6f19a9d5a
echo x - dns/knot/Makefile
sed 's/^X//' >dns/knot/Makefile << '1b7b8a95e508d3f4d196f908073eb455'
X# New ports collection makefile for: knot
X# Date created: 29 February 2012
X# Whom: Leo Vandewoestijne <freebsd@dns-lab.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME= knot
XPORTVERSION= 1.0.0
XCATEGORIES= dns ipv6
XMASTER_SITES= http://public.nic.cz/files/knot-dns/ \
X http://www.dns-lab.com/downloads/knot-dns/
X
XMAINTAINER= freebsd@dns-lab.com
XCOMMENT= Knot DNS is a high performance authoritative-only DNS server
X
XLICENSE= GPLv3
XLICENSE_FILE= ${WRKSRC}/COPYING
X
XBUILD_DEPENDS= bison:${PORTSDIR}/devel/bison \
X flex:${PORTSDIR}/textproc/flex
XLIB_DEPENDS= urcu.1:${PORTSDIR}/sysutils/userspace-rcu
X
XCONFIGURE_ARGS= --sysconfdir=${PREFIX}/etc/${PORTNAME}
XGNU_CONFIGURE= yes
XUSE_AUTOTOOLS= libtool
XUSE_OPENSSL= yes
X
XSUB_FILES= pkg-message
X
XUSE_RC_SUBR= knot
X
XMAN8= knotc.8 knotd.8
X
XPORTDOCS= AUTHORS COPYING ChangeLog CodingStyle INSTALL \
X KNOWN_ISSUES NEWS README RELNOTES
XPORTEXAMPLES= *.zone* *.conf
X
X.if defined(WITH_X86_64)
X CFLAGS+= -fPIC
X CONFIGURE_ARGS+= --build amd64
X.endif
X
Xpost-install:
X.if !defined(NOPORTDOCS)
X @${MKDIR} ${DOCSDIR}
X @${INSTALL_DATA} ${PORTDOCS:S,^,${WRKSRC}/,} ${DOCSDIR}/
X.endif
X.if !defined(NOPORTEXAMPLES)
X @${MKDIR} ${EXAMPLESDIR}
X @${INSTALL_DATA} ${PORTEXAMPLES:S,^,${WRKSRC}/samples/,} ${EXAMPLESDIR}/
X.endif
X @${CAT} ${PKGMESSAGE}
X
X.include <bsd.port.mk>
1b7b8a95e508d3f4d196f908073eb455
exit
@umq
Copy link
Author

umq commented Mar 1, 2012

It requires urcu library, which not yet in FreeBSD ports.
A port skeleton for urcu is at: https://gist.github.com/1947564

@DNS-Lab
Copy link

DNS-Lab commented Mar 12, 2012

This skeleton doesn't address the x86_64 configure args.

Before the 0.9.6 release I was already working on both urcu and knot ports (after communicating weeks in advance with NIC-CZ).
userspace-rcu was added at 6 march:
http://www.freebsd.org/cgi/query-pr.cgi?pr=165496
and since some hours after that Knot is pending:
http://www.freebsd.org/cgi/query-pr.cgi?pr=165798

In above example I see however some possible points of improvement, which I'd like to address in the 1st portrevision.

@umq
Copy link
Author

umq commented Mar 12, 2012

@DNS-Lab:
Thanks for finding this.

I had a look at ports/165798 and found some problems.
I've sent a follow-up to the PR, and updated this gist as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment