Skip to content
Snippets Groups Projects
Commit e56f809f authored by Marek Vavruša's avatar Marek Vavruša
Browse files

Merge branch 'port_libknot_2.0'

parents 9b467c76 1067795b
No related branches found
No related tags found
No related merge requests found
......@@ -15,6 +15,7 @@ endif
# Dependencies
$(eval $(call find_lib,libknot))
$(eval $(call find_lib,libknot-int))
$(eval $(call find_lib,libuv))
$(eval $(call find_lib,cmocka))
$(eval $(call find_python))
......@@ -24,4 +25,4 @@ CFLAGS += $(libknot_CFLAGS) $(libuv_CFLAGS) $(cmocka_CFLAGS) $(python_CFLAGS)
include help.mk
include lib/libkresolve.mk
include daemon/kresolved.mk
include tests/tests.mk
\ No newline at end of file
include tests/tests.mk
info:
$(info )
$(info Target: Knot DNS Resolver $(MAJOR).$(MINOR)-$(PLATFORM))
$(info Compiler: $(CC))
$(info CFLAGS: $(CFLAGS))
$(info LDFLAGS: $(LDFLAGS))
$(info Compiler: $(CC) $(CFLAGS))
$(info Linker: $(LD) $(LDFLAGS))
$(info PREFIX: $(PREFIX))
$(info BINDIR: $(BINDIR))
$(info LIBDIR: $(LIBDIR))
......@@ -12,7 +11,8 @@ info:
$(info Features)
$(info --------)
$(info [$(HAS_libknot)] library (libknot))
$(info [$(HAS_libknot-int)] library (libknot-int))
$(info [$(HAS_libuv)] daemon (libuv))
$(info [$(HAS_cmocka)] unit tests (libcmocka))
$(info [$(HAS_python)] integration tests (libpython))
$(info )
\ No newline at end of file
$(info )
......@@ -22,7 +22,6 @@
#include <libknot/internal/mempattern.h>
#include <libknot/internal/namedb/namedb_lmdb.h>
#include <libknot/dnssec/random.h>
#include <libknot/errcode.h>
#include <libknot/descriptor.h>
......
......@@ -19,7 +19,7 @@
#include <libknot/descriptor.h>
#include <libknot/rrtype/rdname.h>
#include <libknot/processing/requestor.h>
#include <libknot/dnssec/random.h>
#include <dnssec/random.h>
#include "lib/layer/iterate.h"
#include "lib/resolve.h"
......@@ -287,7 +287,7 @@ static int prepare_query(knot_layer_t *ctx, knot_pkt_t *pkt)
return KNOT_NS_PROC_FAIL;
}
query->id = knot_random_uint16_t();
query->id = dnssec_random_uint16_t();
knot_wire_set_id(pkt->wire, query->id);
/* Declare EDNS0 support. */
......
......@@ -19,7 +19,7 @@
#include <libknot/internal/mempool.h>
#include <libknot/processing/requestor.h>
#include <libknot/descriptor.h>
#include <libknot/dnssec/random.h>
#include <dnssec/random.h>
#include "lib/resolve.h"
#include "lib/defines.h"
......
......@@ -14,7 +14,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <libknot/dnssec/random.h>
#include <dnssec/random.h>
#include <libknot/descriptor.h>
#include <libknot/rrtype/rdname.h>
#include <libknot/packet/wire.h>
......@@ -62,7 +62,7 @@ int kr_init_zone_cut(struct kr_zonecut *cut)
return KNOT_EINVAL;
}
const unsigned hint_id = knot_random_uint16_t() % HINT_COUNT;
const unsigned hint_id = dnssec_random_uint16_t() % HINT_COUNT;
const struct hint_info *hint = &SBELT[hint_id];
kr_set_zone_cut(cut, KR_DNAME_ROOT, hint->name);
......
......@@ -3,8 +3,8 @@ MAINTAINER Marek Vavrusa <marek.vavrusa@nic.cz>
# Environment
ENV THREADS 4
ENV BUILD_PKGS git-core make gcc libtool autoconf pkg-config libcmocka-dev libssl-dev liblmdb-dev
ENV RUNTIME_PKGS libssl1.0.0 liblmdb0
ENV BUILD_PKGS git-core make gcc libtool autoconf pkg-config libcmocka-dev libgnutls28-dev liblmdb-dev libjansson-dev
ENV RUNTIME_PKGS libgnutls28 libjansson liblmdb0
# Expose port
EXPOSE 53
......
......@@ -2,74 +2,94 @@
set -e
CMOCKA_TAG="cmocka-0.4.1"
URCU_TAG="v0.8.6"
CMOCKA_URL="git://git.cryptomilk.org/projects/cmocka.git"
LIBUV_TAG="v1.3.0"
LIBUV_URL="https://github.com/libuv/libuv.git"
KNOT_TAG="master"
KNOT_URL="https://github.com/CZNIC-Labs/knot.git"
GMP_TAG="6.0.0"
GMP_URL="https://gmplib.org/download/gmp/gmp-${GMP_TAG}.tar.xz"
JANSSON_TAG="2.7"
JANSSON_URL="http://www.digip.org/jansson/releases/jansson-${JANSSON_TAG}.tar.gz"
NETTLE_TAG="2.7.1"
NETTLE_URL="https://ftp.gnu.org/gnu/nettle/nettle-${NETTLE_TAG}.tar.gz"
GNUTLS_TAG="3.3.12"
GNUTLS_URL="ftp://ftp.gnutls.org/gcrypt/gnutls/v3.3/gnutls-${GNUTLS_TAG}.tar.xz"
# prepare build env
PREFIX=${1}; [ -z ${PREFIX} ] && PREFIX="${HOME}/.local"
PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
# prepare install prefix
PREFIX=${1}; [ -z ${PREFIX} ] && export PREFIX="${HOME}/.local"
install -d ${PREFIX}/{lib,libexec,include,bin,sbin,man,share,etc,info,doc,var}
[ ! -d .depend ] && mkdir .depend; cd .depend
# platform-specific
DEPEND_CACHE="https://dl.dropboxusercontent.com/u/2255176/resolver-${TRAVIS_OS_NAME}-cache.tgz"
PIP_PKGS="${TRAVIS_BUILD_DIR}/tests/pydnstest/requirements.txt cpp-coveralls"
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
if curl "${DEPEND_CACHE}" > cache.tgz; then
echo "extracting prebuilt dependencies from ${DEPEND_CACHE}"
tar -xz -C ${HOME} -f cache.tgz || true
# prepare build env
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
export BUILD_DIR="$(pwd)/.build-depend"
export LOG=$(pwd)/build.log
[ ! -e ${BUILD_DIR} ] && mkdir ${BUILD_DIR}; cd ${BUILD_DIR}
echo "building in ${BUILD_DIR} log ${LOG}" | tee ${LOG}
function fetch_pkg {
if [ "${2##*.}" == git ]; then
[ ! -e $1 ] && git clone -b $3 "$2" $1 &> /dev/null
else
[ ! -f $1.tar.${2##*.} ] && curl "$2" > $1.tar.${2##*.}
tar xf $1.tar.${2##*.}
fi
brew install --force makedepend
brew install --force python
brew link --overwrite python
pip install --upgrade pip
pip install -r ${PIP_PKGS}
fi
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
pip install --user ${USER} -r ${PIP_PKGS}
fi
cd $1
}
# liburcu
if [ ! -e ${PREFIX}/include/urcu.h ]; then
git clone -b ${URCU_TAG} git://git.urcu.so/userspace-rcu.git || true
cd userspace-rcu
./bootstrap
./configure --prefix=${PREFIX} --disable-dependency-tracking --disable-rpath
( make ${MAKEOPTS} ; make install ) || true
cd ..
fi
function build_pkg {
if [ -f CMakeLists.txt ]; then
[ -e cmake-build ] && rm -r cmake-build; mkdir cmake-build; cd cmake-build
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
else
if [ ! -e ./configure ]; then
[ -e autogen.sh ] && sh autogen.sh || autoreconf -if
fi
./configure --prefix=${PREFIX} --enable-shared --disable-static $*
fi
make ${MAKEOPTS}
make install
}
# libknot
if [ ! -e ${PREFIX}/include/libknot ]; then
git clone -b ${KNOT_TAG} https://github.com/CZNIC-Labs/knot.git || true
cd knot
autoreconf -i
if [ $(uname) == "Darwin" ]; then # Workaround for crypto version check on OS X
export libcrypto_CFLAGS="-I /usr/local/opt/openssl/include"
export libcrypto_LIBS="-L/usr/local/opt/openssl/lib -lcrypto"
function pkg {
if [ ! -e ${PREFIX}/$4 ]; then
cd ${BUILD_DIR}
echo "[x] fetching $1-$3"
fetch_pkg "$1-$3" "$2" $3 >> ${LOG}
echo "[x] building $1-$3"
shift 4
(build_pkg $*) >> ${LOG} 2>&1
fi
./configure --prefix=${PREFIX} --with-lmdb=no --disable-fastparser --disable-dependency-tracking
make ${MAKEOPTS} && make install
cd ..
fi
}
# gnutls + dependencies
pkg gmp ${GMP_URL} ${GMP_TAG} include/gmp.h
pkg nettle ${NETTLE_URL} ${NETTLE_TAG} include/nettle \
--disable-documentation --with-lib-path=${PREFIX}/lib --with-include-path=${PREFIX}/include
export GMP_CFLAGS="-I${PREFIX}/include"
export GMP_LIBS="-L${PREFIX}/lib -lgmp"
pkg gnutls ${GNUTLS_URL} ${GNUTLS_TAG} include/gnutls \
--disable-tests --disable-doc --disable-valgrind-tests
# jansson
pkg jansson ${JANSSON_URL} ${JANSSON_TAG} include/jansson.h
# libknot
pkg libknot ${KNOT_URL} ${KNOT_TAG} include/libknot \
--with-lmdb=no --disable-fastparser --disable-daemon --disable-utilities --disable-documentation
# cmocka
if [ ! -e ${PREFIX}/include/cmocka.h ]; then
git clone -b ${CMOCKA_TAG} git://git.cryptomilk.org/projects/cmocka.git || true
cd cmocka
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${PREFIX} ..
make ${MAKEOPTS} && make install
cd ../..
fi
pkg cmocka ${CMOCKA_URL} ${CMOCKA_TAG}
# libuv
if [ ! -e ${PREFIX}/include/uv.h ]; then
git clone -b ${LIBUV_TAG} https://github.com/libuv/libuv.git || true
cd libuv
sh autogen.sh
./configure --prefix=${PREFIX} --disable-dependency-tracking
make ${MAKEOPTS} && make install
pkg libuv ${LIBUV_URL} ${LIBUV_TAG} include/uv.h
# travis-specific
PIP_PKGS="${TRAVIS_BUILD_DIR}/tests/pydnstest/requirements.txt cpp-coveralls"
if [ "${TRAVIS_OS_NAME}" == "osx" ]; then
DEPEND_CACHE="https://dl.dropboxusercontent.com/u/2255176/resolver-${TRAVIS_OS_NAME}-cache.tar.gz"
curl "${DEPEND_CACHE}" > cache.tar.gz && tar -xz -C ${HOME} -f cache.tar.gz || true
brew install --force makedepend python
brew link --overwrite python
pip install --upgrade pip
pip install -r ${PIP_PKGS}
fi
if [ "${TRAVIS_OS_NAME}" == "linux" ]; then
pip install --user ${USER} -r ${PIP_PKGS}
fi
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment