Use custom implib for GetNetworkParams
authorYaakov Selkowitz <yselkowi@redhat.com>
Wed, 15 Oct 2014 19:17:27 +0000 (14:17 -0500)
committerYaakov Selkowitz <yselkowi@redhat.com>
Wed, 15 Oct 2014 19:17:27 +0000 (14:17 -0500)
LOAD_LIBRARY_SEARCH_SYSTEM32 was only added to Vista and up with
KB2533623.  XP just ignores it, but XP x64 returns an error.
Loading Windows DLLs properly w/o this is just more work, and
GetNetworkParams is available in all supported versions, so just
create a custom implib instead which doesn't include if_nametoindex.

9.9.6-lwconfig-win32.patch
bind.cygport

index 9066b0e2c2459d4b066ba8c78b03f0e0419e13a4..5cf87ae1e65128090e679b630072518265b70de5 100644 (file)
  #undef lwres_conf_parse
  
 +#ifdef __CYGWIN__
++#define if_nametoindex W32API_if_nametoindex
 +#include <windows.h>
-+#include <iptypes.h>
-+#else
- #include <iphlpapi.h>
 +#endif
+ #include <iphlpapi.h>
++#undef W32API_if_nametoindex
  
  #define TCPIP_SUBKEY  \
        "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters"
-@@ -95,6 +100,10 @@ lwres_conf_parse(lwres_context_t *ctx, c
-       ULONG    BufLen = sizeof(FIXED_INFO);
-       DWORD    dwRetVal;
-       IP_ADDR_STRING *pIPAddr;
-+#ifdef __CYGWIN__
-+      static HMODULE hIphlpapi = NULL;
-+      static DWORD (WINAPI *GetNetworkParams)(PFIXED_INFO, PULONG) = NULL;
-+#endif
-       REQUIRE(ctx != NULL);
-       confdata = &ctx->confdata;
-@@ -109,6 +118,14 @@ lwres_conf_parse(lwres_context_t *ctx, c
-       /*
-        * We didn't get any nameservers so we need to do this ourselves
-        */
-+#ifdef __CYGWIN__
-+      if (!GetNetworkParams) {
-+              hIphlpapi = LoadLibraryEx ("iphlpapi.dll", NULL,
-+                                         LOAD_LIBRARY_SEARCH_SYSTEM32);
-+              GetNetworkParams = (typeof (GetNetworkParams)) GetProcAddress (hIphlpapi, "GetNetworkParams");
-+              if (!GetNetworkParams) return (LWRES_R_FAILURE);
-+      }
-+#endif
-       FixedInfo = (FIXED_INFO *) GlobalAlloc(GPTR, BufLen);
-       dwRetVal = GetNetworkParams(FixedInfo, &BufLen);
-       if (dwRetVal == ERROR_BUFFER_OVERFLOW) {
index 7b11696ed1bcc1cdcfe5ae0a7587d043a2a9eddc..0383b329917e404a99a00040e18e0c61eb4bffa4 100644 (file)
@@ -1,6 +1,6 @@
 NAME="bind"
 VERSION=9.9.6
-RELEASE=1
+RELEASE=2
 CATEGORY="Net"
 SUMMARY="DNS server and utilities suite"
 DESCRIPTION="BIND is an implementation of the Domain Name System (DNS)
@@ -38,28 +38,44 @@ PKG_IGNORE=${libbind9_devel_CONTENTS}
 
 DISTCLEANFILES="aclocal.m4"
 
-CYGCONF_ARGS="
-       --disable-backtrace
-       --disable-linux-caps
-       --without-dlopen
-       --with-dlz-bdb=/usr
-       --with-dlz-filesystem
-       --with-dlz-ldap=/usr
-       --with-dlz-mysql=/usr
-       --with-dlz-odbc=/usr
-       --with-dlz-postgres=/usr
-       --with-dlz-stub
-       --with-docbook-xsl=/usr/share/sgml/docbook/xsl-stylesheets
-       --with-gssapi
-       --with-libxml2=/usr
-       --with-openssl=/usr
-"
-# see config.h.win32
-CPPFLAGS+=" -DFD_SETSIZE=16384"
-DOCS="RELEASE-NOTES-BIND-${VERSION%-*}.txt"
+src_compile() {
+       cd ${S}
+       cygautoreconf
+
+       cd ${B}
+
+       # we want GetNetworkParams but not if_nametoindex
+       cat > iphlpapi.def <<_EOF
+LIBRARY "IPHLPAPI.DLL"
+EXPORTS
+GetNetworkParams${ARCH_i686+@8}
+_EOF
+       ${DLLTOOL} -k -d iphlpapi.def -l libiphlpapi.a
+       LIBS+=" -Wl,${B}/libiphlpapi.a"
+
+       # see config.h.win32
+       CPPFLAGS+=" -DFD_SETSIZE=16384"
+
+       cygconf \
+               --disable-backtrace --disable-linux-caps --without-dlopen \
+               --with-dlz-bdb=/usr \
+               --with-dlz-filesystem \
+               --with-dlz-ldap=/usr \
+               --with-dlz-mysql=/usr \
+               --with-dlz-odbc=/usr \
+               --with-dlz-postgres=/usr \
+               --with-dlz-stub \
+               --with-docbook-xsl=/usr/share/sgml/docbook/xsl-stylesheets \
+               --with-gssapi \
+               --with-libxml2=/usr \
+               --with-openssl=/usr
+
+       cygmake
+}
 
 src_install() {
        cd ${B}
        dosbin ${S}/named-config
        cyginstall
+       dodoc ${S}/RELEASE-NOTES-BIND-${VERSION%-*}.txt
 }
This page took 0.02489 seconds and 5 git commands to generate.