Unbound 1.9.0 test

unbound
Sander Ferdinand 4 years ago
parent 7de82a7f9f
commit f56395e5e6

@ -0,0 +1,41 @@
/*
* This file is part of MXE. See LICENSE.md for licensing information.
*
* http://unbound.nlnetlabs.nl/documentation/libunbound-tutorial-1.html
*/
#include <stdio.h> /* for printf */
#include <winsock2.h> /* for inet_ntoa */
#include <unbound.h> /* unbound API */
int main(void)
{
struct ub_ctx* ctx;
struct ub_result* result;
int retval;
/* create context */
ctx = ub_ctx_create();
if(!ctx) {
printf("error: could not create unbound context\n");
return 1;
}
/* query for webserver */
retval = ub_resolve(ctx, "www.nlnetlabs.nl",
1 /* TYPE A (IPv4 address) */,
1 /* CLASS IN (internet) */, &result);
if(retval != 0) {
printf("resolve error: %s\n", ub_strerror(retval));
return 1;
}
/* show first result */
if(result->havedata)
printf("The address is %s\n",
inet_ntoa(*(struct in_addr*)result->data[0]));
ub_resolve_free(result);
ub_ctx_delete(ctx);
return 0;
}

@ -0,0 +1,51 @@
# This file is part of MXE. See LICENSE.md for licensing information.
PKG := unbound
$(PKG)_WEBSITE := https://unbound.net
$(PKG)_DESCR := Unbound is a validating, recursive, and caching DNS resolver.
$(PKG)_IGNORE :=
$(PKG)_VERSION := 1.9.0
$(PKG)_CHECKSUM := 415af94b8392bc6b2c52e44ac8f17935cc6ddf2cc81edfb47c5be4ad205ab917
$(PKG)_SUBDIR := unbound-$($(PKG)_VERSION)
$(PKG)_FILE := unbound-$($(PKG)_VERSION).tar.gz
$(PKG)_URL := https://unbound.net/downloads/unbound-$($(PKG)_VERSION).tar.gz
$(PKG)_DEPS := gcc expat libsodium openssl zlib
$(PKG)_UPDATE = \
$(call GET_LATEST_VERSION,https://unbound.net/downloads,unbound-)
define $(PKG)_BUILD
# build and install the library
cd '$(BUILD_DIR)' && '$(SOURCE_DIR)/configure' \
$(MXE_CONFIGURE_OPTS) \
--disable-flto \
--with-libunbound-only \
--with-conf_file='C:/Program Files/Unbound/service.conf' \
--with-rootkey-file='C:/Program Files/Unbound/root.key' \
--with-rootcert-file='C:/Program Files/Unbound/icannbundle.pem' \
--with-libexpat='$(PREFIX)/$(TARGET)' \
--with-libsodium='$(PREFIX)/$(TARGET)' \
--with-ssl='$(PREFIX)/$(TARGET)' \
LIBS="`'$(TARGET)-pkg-config' openssl --libs`"
# fixup libtool
$(SED) -i 's/global_symbol_pipe=""/global_symbol_pipe=echo/' '$(BUILD_DIR)/libtool'
$(MAKE) -C '$(BUILD_DIR)' -j '$(JOBS)'
$(MAKE) -C '$(BUILD_DIR)' -j 1 install
# create pkg-config file
$(INSTALL) -d '$(PREFIX)/$(TARGET)/lib/pkgconfig'
(echo 'Name: $(PKG)'; \
echo 'Version: $($(PKG)_VERSION)'; \
echo 'Description: $($(PKG)_DESCR)'; \
echo 'Requires: expat libsodium openssl zlib'; \
echo 'Libs: -lunbound -lws2_32 -liphlpapi';) \
> '$(PREFIX)/$(TARGET)/lib/pkgconfig/$(PKG).pc'
# compile test
'$(TARGET)-gcc' \
-W -Wall -Werror -ansi -pedantic \
'$(TEST_FILE)' -o '$(PREFIX)/$(TARGET)/bin/test-$(PKG).exe' \
`'$(TARGET)-pkg-config' $(PKG) --cflags --libs`
endef
Loading…
Cancel
Save