mirror of https://github.com/getdnsapi/getdns.git
Fix lib name on linux
This commit is contained in:
parent
8b3e3412f5
commit
1cca550799
|
@ -5,5 +5,5 @@ add_executable(@TPKG_NAME@ @TPKG_NAME@.c)
|
|||
target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@)
|
||||
|
||||
add_library(libgetdns SHARED IMPORTED )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so )
|
||||
target_link_libraries(@TPKG_NAME@ libgetdns)
|
|
@ -9,3 +9,7 @@
|
|||
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake"
|
||||
) > CMakeLists.txt
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt
|
||||
fi
|
|
@ -1,111 +0,0 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <getdns/getdns.h>
|
||||
#include <getdns/getdns_extra.h>
|
||||
|
||||
int main(int ac, char *av[])
|
||||
{
|
||||
FILE *f;
|
||||
char *buf = NULL;
|
||||
size_t len;
|
||||
ssize_t bytes_read;
|
||||
|
||||
f = fopen(av[1], "r");
|
||||
if (!f) {
|
||||
fprintf(stderr, "Could not open %s", av[1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
bytes_read = getdelim(&buf, &len, '\0', f);
|
||||
fclose(f);
|
||||
|
||||
if (bytes_read == -1) {
|
||||
fprintf(stderr, "Could not read %s", av[1]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
buf = realloc(buf, bytes_read + 1);
|
||||
if (!buf) {
|
||||
fprintf(stderr, "Could not grow buffer");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
buf[bytes_read] = '\0';
|
||||
|
||||
getdns_dict *dict = NULL;
|
||||
getdns_list *list = NULL;
|
||||
getdns_bindata *bindata = NULL;
|
||||
getdns_return_t r;
|
||||
|
||||
if (!(dict = getdns_dict_create())) {
|
||||
fprintf(stderr, "Could not create dict");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = getdns_yaml2dict(buf, &dict);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error setting dict data: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/*
|
||||
* Now add a list, bindata and int to the dict by hand to check
|
||||
* the other yaml2* functions work.
|
||||
*/
|
||||
if (!(list = getdns_list_create())) {
|
||||
fprintf(stderr, "Could not create list");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = getdns_str2list("[\"One\", \"two\", \"three\"]", &list);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error setting list data: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = getdns_dict_set_list(dict, "List entry", list);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error adding list to dict: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = getdns_str2bindata("2001:7fd::1", &bindata);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error setting bindata: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
r = getdns_dict_set_bindata(dict, "Bindata entry", bindata);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error adding list to dict: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
|
||||
uint32_t intval;
|
||||
r = getdns_str2int("32767", &intval);
|
||||
if (r) {
|
||||
fprintf(stderr, "Error setting int: %s", getdns_get_errorstr_by_id(r));
|
||||
goto fail;
|
||||
}
|
||||
if (intval != 32767) {
|
||||
fprintf(stderr, "Error reading int: wrong value");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
char *dict_str = getdns_pretty_print_dict(dict);
|
||||
if (!dict_str) {
|
||||
fprintf(stderr, "Could not convert dict to string");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
printf("%s\n", dict_str);
|
||||
free(dict_str);
|
||||
getdns_dict_destroy(dict);
|
||||
exit(EXIT_SUCCESS);
|
||||
|
||||
fail:
|
||||
if (dict)
|
||||
getdns_dict_destroy(dict);
|
||||
if (list)
|
||||
getdns_list_destroy(list);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.5)
|
||||
project (@TPKG_NAME@)
|
||||
add_executable(@TPKG_NAME@ @TPKG_NAME@.c)
|
||||
|
||||
target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@)
|
||||
|
||||
add_library(libgetdns SHARED IMPORTED )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib )
|
||||
target_link_libraries(@TPKG_NAME@ libgetdns)
|
|
@ -1,16 +0,0 @@
|
|||
BaseName: 255-yaml-config
|
||||
Version: 1.0
|
||||
Description: Test YAML configuration
|
||||
CreationDate: Wed 13 Sep 2017 12:42:32 BST
|
||||
Maintainer: Jim Hague
|
||||
Category:
|
||||
Component:
|
||||
CmdDepends:
|
||||
Depends: 200-stub-only-compile-install.tpkg
|
||||
Help:
|
||||
Pre: 255-yaml-config.pre
|
||||
Post:
|
||||
Test: 255-yaml-config.test
|
||||
AuxFiles:
|
||||
Passed:
|
||||
Failure:
|
|
@ -1,87 +0,0 @@
|
|||
{
|
||||
"Bindata entry": <bindata of 0x200107fd000000000000000000000001>,
|
||||
"List entry":
|
||||
[
|
||||
<bindata of "One">,
|
||||
<bindata of "two">,
|
||||
<bindata of "three">
|
||||
],
|
||||
"dnssec_return_status": 1000,
|
||||
"upstream_recursive_servers":
|
||||
[
|
||||
{
|
||||
"address_data": <bindata for 145.100.185.15>,
|
||||
"tls_auth_name": <bindata of "dnsovertls.sinodun.com">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 145.100.185.16>,
|
||||
"tls_auth_name": <bindata of "dnsovertls1.sinodun.com">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 185.49.141.37>,
|
||||
"tls_auth_name": <bindata of "getdnsapi.net">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 184.105.193.78>,
|
||||
"tls_auth_name": <bindata of "unicast.censurfridns.dk">
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 2001:610:1:40ba:145:100:185:15>,
|
||||
"tls_auth_name": <bindata of "dnsovertls.sinodun.com">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 2001:610:1:40ba:145:100:185:16>,
|
||||
"tls_auth_name": <bindata of "dnsovertls1.sinodun.com">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 2a04:b900:0:100::38>,
|
||||
"tls_auth_name": <bindata of "getdnsapi.net">,
|
||||
"tls_pubkey_pinset":
|
||||
[
|
||||
{
|
||||
"digest": <bindata of "sha256">,
|
||||
"value": <bindata of foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=>
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"address_data": <bindata for 2620:ff:c000:0:1:0:64:25>,
|
||||
"tls_auth_name": <bindata of "unicast.censurfridns.dk">
|
||||
}
|
||||
]
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
upstream_recursive_servers:
|
||||
# IPv4 addresses
|
||||
# The Surfnet/Sinodun servers
|
||||
- address_data: 145.100.185.15
|
||||
tls_auth_name: "dnsovertls.sinodun.com"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
|
||||
- address_data: 145.100.185.16
|
||||
tls_auth_name: "dnsovertls1.sinodun.com"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
|
||||
# The getdnsapi.net server
|
||||
- address_data: 185.49.141.37
|
||||
tls_auth_name: "getdnsapi.net"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
|
||||
# The uncensored DNS servers (no SPKI available)
|
||||
- address_data: 184.105.193.78
|
||||
tls_auth_name: "unicast.censurfridns.dk"
|
||||
# IPv6 addresses
|
||||
# The Surfnet/Sinodun servers
|
||||
- address_data: 2001:610:1:40ba:145:100:185:15
|
||||
tls_auth_name: "dnsovertls.sinodun.com"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: 62lKu9HsDVbyiPenApnc4sfmSYTHOVfFgL3pyB+cBL4=
|
||||
- address_data: 2001:610:1:40ba:145:100:185:16
|
||||
tls_auth_name: "dnsovertls1.sinodun.com"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: cE2ecALeE5B+urJhDrJlVFmf38cJLAvqekONvjvpqUA=
|
||||
# The getdnsapi.net server
|
||||
- address_data: 2a04:b900:0:100::38
|
||||
tls_auth_name: "getdnsapi.net"
|
||||
tls_pubkey_pinset:
|
||||
- digest: "sha256"
|
||||
value: foxZRnIh9gZpWnl+zEiKa0EJ2rdCGroMWm02gaxSc9Q=
|
||||
# The uncensored DNS server (no SPKI available)
|
||||
- address_data: 2620:ff:c000:0:1::64:25
|
||||
tls_auth_name: "unicast.censurfridns.dk"
|
||||
|
||||
# Require DNSSEC validation. For releases earlier than 1.2 a trust anchor must
|
||||
# be configured configured manually. This can be done with unbound-anchor.
|
||||
dnssec_return_status: GETDNS_EXTENSION_TRUE
|
|
@ -1,11 +0,0 @@
|
|||
# #-- 255-yaml-config.test --#
|
||||
# source the master var file when it's there
|
||||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
(
|
||||
BUILDDIR4SED=`echo "${BUILDDIR}/build-with-stubby" | sed 's/\//\\\\\//g'`
|
||||
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake"
|
||||
) > CMakeLists.txt
|
|
@ -1,7 +0,0 @@
|
|||
# #-- 255-yaml-config.test --#
|
||||
# source the master var file when it's there
|
||||
[ -f ../.tpkg.var.master ] && source ../.tpkg.var.master
|
||||
# use .tpkg.var.test for in test variable passing
|
||||
[ -f .tpkg.var.test ] && source .tpkg.var.test
|
||||
|
||||
cmake . && make && "./${TPKG_NAME}" 255-yaml-config.input | tee out && diff out "${TPKG_NAME}.good"
|
|
@ -5,5 +5,5 @@ add_executable(@TPKG_NAME@ @TPKG_NAME@.c)
|
|||
target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@)
|
||||
|
||||
add_library(libgetdns SHARED IMPORTED )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so )
|
||||
target_link_libraries(@TPKG_NAME@ libgetdns)
|
|
@ -9,3 +9,7 @@
|
|||
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake"
|
||||
) > CMakeLists.txt
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt
|
||||
fi
|
|
@ -5,5 +5,5 @@ add_executable(@TPKG_NAME@ @TPKG_NAME@.c)
|
|||
target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@)
|
||||
|
||||
add_library(libgetdns SHARED IMPORTED )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so )
|
||||
target_link_libraries(@TPKG_NAME@ libgetdns)
|
|
@ -9,3 +9,7 @@
|
|||
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake"
|
||||
) > CMakeLists.txt
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt
|
||||
fi
|
|
@ -5,5 +5,5 @@ add_executable(@TPKG_NAME@ @TPKG_NAME@.c)
|
|||
target_include_directories(@TPKG_NAME@ PRIVATE @BUILDDIR@)
|
||||
|
||||
add_library(libgetdns SHARED IMPORTED )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.dylib )
|
||||
set_target_properties(libgetdns PROPERTIES IMPORTED_LOCATION @BUILDDIR@/libgetdns.so )
|
||||
target_link_libraries(@TPKG_NAME@ libgetdns)
|
|
@ -9,3 +9,7 @@
|
|||
sed -e "s/@BUILDDIR@/${BUILDDIR4SED}/g" \
|
||||
-e "s/@TPKG_NAME@/${TPKG_NAME}/g" "${TPKG_NAME}.cmake"
|
||||
) > CMakeLists.txt
|
||||
|
||||
if [[ "$OSTYPE" == "darwin"* ]]; then
|
||||
sed -i '' -e "s/libgetdns.so/libgetdns.dylib/g" CMakeLists.txt
|
||||
fi
|
Loading…
Reference in New Issue