From dfb4b3ba3ca54ade361413abfe245708e720c4af Mon Sep 17 00:00:00 2001 From: Max Lv Date: Sat, 10 Jan 2015 22:16:15 +0800 Subject: [PATCH] refine mingw compatibility --- README.md | 2 +- configure | 20 ++++++++++---------- configure.ac | 2 +- debian/changelog | 6 ++++++ libudns/udns_init.c | 2 ++ openwrt/Makefile | 2 +- shadowsocks-libev.8 | 3 ++- src/server.c | 8 +++++++- 8 files changed, 30 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 08cd0cc68..16e2f7783 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ It is a port of [shadowsocks](https://github.com/shadowsocks/shadowsocks) created by [@clowwindy](https://github.com/clowwindy) maintained by [@madeye](https://github.com/madeye) and [@linusyang](https://github.com/linusyang). -Current version: 2.0.3 | [![Build Status](https://travis-ci.org/shadowsocks/shadowsocks-libev.png?branch=master)](https://travis-ci.org/shadowsocks/shadowsocks-libev) | [Changelog](Changes) +Current version: 2.0.4 | [![Build Status](https://travis-ci.org/shadowsocks/shadowsocks-libev.png?branch=master)](https://travis-ci.org/shadowsocks/shadowsocks-libev) | [Changelog](Changes) Features -------- diff --git a/configure b/configure index c1882bfde..97e51fb68 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.69 for shadowsocks-libev 2.0.3. +# Generated by GNU Autoconf 2.69 for shadowsocks-libev 2.0.4. # # Report bugs to . # @@ -590,8 +590,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='shadowsocks-libev' PACKAGE_TARNAME='shadowsocks-libev' -PACKAGE_VERSION='2.0.3' -PACKAGE_STRING='shadowsocks-libev 2.0.3' +PACKAGE_VERSION='2.0.4' +PACKAGE_STRING='shadowsocks-libev 2.0.4' PACKAGE_BUGREPORT='max.c.lv@gmail.com' PACKAGE_URL='' @@ -1336,7 +1336,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures shadowsocks-libev 2.0.3 to adapt to many kinds of systems. +\`configure' configures shadowsocks-libev 2.0.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1407,7 +1407,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of shadowsocks-libev 2.0.3:";; + short | recursive ) echo "Configuration of shadowsocks-libev 2.0.4:";; esac cat <<\_ACEOF @@ -1528,7 +1528,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -shadowsocks-libev configure 2.0.3 +shadowsocks-libev configure 2.0.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. @@ -2051,7 +2051,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by shadowsocks-libev $as_me 2.0.3, which was +It was created by shadowsocks-libev $as_me 2.0.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ @@ -2872,7 +2872,7 @@ fi # Define the identity of the package. PACKAGE='shadowsocks-libev' - VERSION='2.0.3' + VERSION='2.0.4' cat >>confdefs.h <<_ACEOF @@ -15636,7 +15636,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by shadowsocks-libev $as_me 2.0.3, which was +This file was extended by shadowsocks-libev $as_me 2.0.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -15702,7 +15702,7 @@ _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ -shadowsocks-libev config.status 2.0.3 +shadowsocks-libev config.status 2.0.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index af3311999..b4949bac9 100755 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ dnl -*- Autoconf -*- dnl Process this file with autoconf to produce a configure script. AC_PREREQ([2.67]) -AC_INIT([shadowsocks-libev], [2.0.3], [max.c.lv@gmail.com]) +AC_INIT([shadowsocks-libev], [2.0.4], [max.c.lv@gmail.com]) AC_CONFIG_SRCDIR([src/encrypt.c]) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_AUX_DIR(auto) diff --git a/debian/changelog b/debian/changelog index 2d9d19466..506a4b3bd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +shadowsocks-libev (2.0.4-1) unstable; urgency=low + + * Fix building issues with MinGW32. + + -- Max Lv Sun, 11 Jan 2015 13:33:31 +0900 + shadowsocks-libev (2.0.3-1) unstable; urgency=high * Fix some issues. diff --git a/libudns/udns_init.c b/libudns/udns_init.c index c426008e9..5e2455419 100644 --- a/libudns/udns_init.c +++ b/libudns/udns_init.c @@ -55,6 +55,8 @@ static void dns_set_srch_internal(struct dns_ctx *ctx, char *srch) { #ifdef __MINGW32__ +#define NO_IPHLPAPI + #ifndef NO_IPHLPAPI /* Apparently, some systems does not have proper headers for IPHLPAIP to work. * The best is to upgrade headers, but here's another, ugly workaround for diff --git a/openwrt/Makefile b/openwrt/Makefile index f60932168..55ed19872 100644 --- a/openwrt/Makefile +++ b/openwrt/Makefile @@ -1,7 +1,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=shadowsocks-libev -PKG_VERSION:=2.0.3 +PKG_VERSION:=2.0.4 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE_URL:=https://github.com/shadowsocks/shadowsocks-libev/archive diff --git a/shadowsocks-libev.8 b/shadowsocks-libev.8 index a809f07e0..a2db6f893 100644 --- a/shadowsocks-libev.8 +++ b/shadowsocks-libev.8 @@ -84,7 +84,8 @@ Use a configuration file. Run as a specific user. .TP .B \-d \fIaddr\fP -Setup the name servers for libudns. The default server is 8.8.8.8. +Setup the name servers for libudns. The default server is fetched from +/etc/resolv.conf. .TP .B \-u Enable UDP relay. diff --git a/src/server.c b/src/server.c index 46675c889..0e6ba93d5 100644 --- a/src/server.c +++ b/src/server.c @@ -1146,9 +1146,15 @@ int main(int argc, char **argv) // setup udns if (nameserver_num == 0) { +#ifdef __MINGW32__ nameservers[nameserver_num++] = "8.8.8.8"; + resolv_init(loop, nameservers, nameserver_num); +#else + resolv_init(loop, NULL, 0); +#endif + } else { + resolv_init(loop, nameservers, nameserver_num); } - resolv_init(loop, nameservers, nameserver_num); // inilitialize listen context struct listen_ctx listen_ctx_list[server_num];