I would like to adopt unbound package.

-- 
Takashi Yano <takashi.y...@nifty.ne.jp>
--- origsrc/unbound-1.6.2/libunbound/libunbound.c       2017-04-06 
08:13:06.000000000 -0500
+++ src/unbound-1.6.2/libunbound/libunbound.c   2017-05-02 10:21:56.184047100 
-0500
@@ -73,7 +73,7 @@
 #include <time.h>
 #endif
 
-#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H)
+#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H) || defined(__CYGWIN__)
 #include <windows.h>
 #include <iphlpapi.h>
 #endif /* UB_ON_WINDOWS */
@@ -1051,9 +1051,11 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, co
        int r;
 
        if(fname == NULL) {
-#if !defined(UB_ON_WINDOWS) || !defined(HAVE_WINDOWS_H)
                fname = "/etc/resolv.conf";
-#else
+       }
+       in = fopen(fname, "r");
+       if(!in) {
+#if defined(UB_ON_WINDOWS) || defined(HAVE_WINDOWS_H) || defined(__CYGWIN__)
                FIXED_INFO *info;
                ULONG buflen = sizeof(*info);
                IP_ADDR_STRING *ptr;
@@ -1087,11 +1089,7 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, co
                        return UB_NOERROR;
                }
                free(info);
-               return UB_READFILE;
-#endif /* WINDOWS */
-       }
-       in = fopen(fname, "r");
-       if(!in) {
+#endif
                /* error in errno! perror(fname) */
                return UB_READFILE;
        }
--- origsrc/unbound-1.6.2/smallapp/unbound-control.c    2017-04-11 
08:37:39.000000000 -0500
+++ src/unbound-1.6.2/smallapp/unbound-control.c        2017-05-02 
02:25:52.443333700 -0500
@@ -68,6 +68,11 @@
 #endif
 #ifdef HAVE_SYS_SHM_H
 #include "sys/shm.h"
+#ifndef SHM_R
+#include <sys/stat.h>
+#define SHM_R S_IRUSR|S_IRGRP|S_IROTH
+#define SHM_W S_IWUSR|S_IWGRP|S_IWOTH
+#endif
 #endif
 #ifdef HAVE_SYS_UN_H
 #include <sys/un.h>
--- origsrc/unbound-1.6.2/util/shm_side/shm_main.c      2017-04-12 
10:01:11.000000000 -0500
+++ src/unbound-1.6.2/util/shm_side/shm_main.c  2017-05-02 02:02:17.720319200 
-0500
@@ -47,6 +47,10 @@
 #endif
 #ifdef HAVE_SYS_SHM_H
 #include <sys/shm.h>
+#ifndef SHM_R
+#include <sys/stat.h>
+#define SHM_R S_IRUSR|S_IRGRP|S_IROTH
+#endif
 #endif
 #include <sys/time.h>
 #include <errno.h>
inherit python3

NAME="unbound"
VERSION=1.19.1
RELEASE=1
LICENSE="BSD-3-Clause"
CATEGORY="Libs"
SUMMARY="DNS resolver"
DESCRIPTION="Unbound is a validating, recursive, and caching DNS resolver.
Unbound is designed as a set of modular components, so that also DNSSEC
validation and stub-resolvers (that do not run as a server, but are linked
into an application) are easily possible."
HOMEPAGE="http://www.unbound.net/";
SRC_URI="
        http://www.unbound.net/downloads/unbound-${VERSION}.tar.gz
        https://src.fedoraproject.org/rpms/unbound/raw/f40/f/root.anchor
        https://src.fedoraproject.org/rpms/unbound/raw/f40/f/icannbundle.pem
"
PATCH_URI="
        1.6.2-resolvconf-cygwin.patch
        1.6.2-shmget-cygwin.patch
"

PKG_NAMES="${NAME} lib${NAME}8 lib${NAME}-common lib${NAME}-devel 
python3-${NAME}"
unbound_CATEGORY="Net"
unbound_CONTENTS="
        usr/sbin/unbound*
        usr/share/man/man1/*
        usr/share/man/man8/*
        var/run/${NAME}
"
libunbound8_REQUIRES="libunbound-common"
libunbound8_CONTENTS="usr/bin/cygunbound-8.dll"
libunbound_common_CONTENTS="
        etc/defaults/etc/${NAME}/
        etc/defaults/var/lib/${NAME}/
        etc/postinstall/${NAME}.sh
        etc/preremove/${NAME}.sh
        usr/share/doc/${NAME}/
        usr/share/man/man5/*
"
libunbound_devel_CONTENTS="
        usr/include/unbound*.h
        usr/lib/libunbound.dll.a
        usr/lib/pkgconfig/libunbound.pc
        usr/share/man/man3/*
"
python3_unbound_CONTENTS="${PYTHON3_SITELIB#/}/*"

DIFF_EXCLUDES="ltmain.sh"

CPPFLAGS+=" -DFD_SETSIZE=1024"
LIBS=-liphlpapi
CYGCONF_ARGS="
        --enable-shared --disable-static
        --disable-flto
        --with-libevent
        --with-pthreads
        --with-conf-file=/etc/${NAME}/unbound.conf
        --with-pidfile=/var/run/${NAME}/unbound.pid
        --with-rootkey-file=/var/lib/${NAME}/root.key
        LEX=:
"

src_compile() {
        cd ${S}
        cygautoreconf

        mkdir -p ${B}/lib-only
        cd ${B}/lib-only
        lndirs ${S}
        cygconf \
                --with-nettle \
                --with-libunbound-only
        cygmake

        mkdir -p ${B}/py3
        cd ${B}/py3
        lndirs ${S}
        cygconf \
                --with-ssl \
                --with-pythonmodule --with-pyunbound \
                PYTHON=${PYTHON3} PYTHON_LDFLAGS=${LIBPYTHON3%% *}
        cygmake
}

src_install() {
        cd ${B}/py3
        cyginstall

        cd ${B}/lib-only
        cyginstall unbound-event-install
        dopkgconfig contrib/libunbound.pc

        insinto /etc/${NAME}
        doins ${S}/icannbundle.pem

        insinto /var/lib/${NAME}
        newins ${S}/root.anchor root.key

        make_etc_defaults /etc/${NAME} /var/lib/${NAME}
        keepdir /var/run/${NAME}
}

BUILD_REQUIRES="swig"
--- origsrc/unbound-1.19.1/libunbound/libunbound.c      2024-02-21 
10:06:14.070706000 +0900
+++ src/unbound-1.19.1/libunbound/libunbound.c  2024-02-21 10:20:57.101941000 
+0900
@@ -76,7 +76,7 @@
 #include <time.h>
 #endif
 
-#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H) || defined(__CYGWIN__)
+#if defined(UB_ON_WINDOWS) && defined (HAVE_WINDOWS_H)
 #include <windows.h>
 #include <iphlpapi.h>
 #endif /* UB_ON_WINDOWS */
@@ -1139,7 +1139,7 @@ ub_ctx_resolvconf(struct ub_ctx* ctx, co
        }
        in = fopen(fname, "r");
        if(!in) {
-#if defined(UB_ON_WINDOWS) || defined(HAVE_WINDOWS_H) || defined(__CYGWIN__)
+#if defined(UB_ON_WINDOWS) || defined(HAVE_WINDOWS_H)
                FIXED_INFO *info;
                ULONG buflen = sizeof(*info);
                IP_ADDR_STRING *ptr;

Reply via email to