diff options
author | Luca Deri <lucaderi@users.noreply.github.com> | 2019-12-18 19:22:12 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-18 19:22:12 +0100 |
commit | 5c225b8a2ef5f89ab99256481065d969863a6018 (patch) | |
tree | e6705d26005bf87415d642c9f4675553904b9930 | |
parent | 4961241c624b4dc8847d70c8501ecad019768fcc (diff) | |
parent | acb74905a571b846408f7db89812742794b8c2b3 (diff) |
Merge pull request #821 from aouinizied/win32-lib-appveyor
Win32 lib appveyor
-rw-r--r-- | .appveyor.yml | 17 | ||||
-rw-r--r-- | .gitattributes | 3 | ||||
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | configure.seed | 48 | ||||
-rw-r--r-- | src/lib/Makefile.in | 7 | ||||
-rw-r--r-- | src/lib/protocols/btlib.c | 2 |
6 files changed, 53 insertions, 25 deletions
diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 000000000..2a899c136 --- /dev/null +++ b/.appveyor.yml @@ -0,0 +1,17 @@ +version: 3.1.{build} +branches: + only: + - dev +environment: + matrix: + - COMPILER: mingw + MINGW_DIR: c:\msys64\mingw32 + +before_build: + - set Path=%MINGW_DIR%\bin;%Path% + +build_script: + - set Path=%MINGW_DIR%\bin;c:\msys64\usr\bin; + - bash autogen.sh + - cd src/lib + - make diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..0576151eb --- /dev/null +++ b/.gitattributes @@ -0,0 +1,3 @@ +*.sh -crlf +*.ac -crlf +*.am -crlf @@ -2,6 +2,7 @@ # nDPI [](https://travis-ci.org/ntop/nDPI) +[](https://ci.appveyor.com/project/ntop/ndpi) [](https://lgtm.com/projects/g/ntop/nDPI/context:cpp) [](https://lgtm.com/projects/g/ntop/nDPI/alerts) diff --git a/configure.seed b/configure.seed index d67978b10..c1bbf1593 100644 --- a/configure.seed +++ b/configure.seed @@ -96,28 +96,32 @@ AS_IF([test "${with_hyperscan+set}" = set],[ ]) ]) -if test -f $PCAP_HOME/libpcap/libpcap.a; then : - echo "Using libpcap from $PCAP_HOME" - PCAP_INC="-I $PCAP_HOME/libpcap" - PCAP_LIB="$PCAP_HOME/libpcap/libpcap.a $PCAP_HOME/lib/libpfring.a $LIBNUMA `$PCAP_HOME/lib/pfring_config --libs`" - - AC_CHECK_LIB([rt], [clock_gettime], [PCAP_LIB="$PCAP_LIB -lrt"]) - AC_CHECK_LIB([nl], [nl_handle_alloc], [PCAP_LIB="$PCAP_LIB -lnl"]) - # The dlopen() function is in libdl on GLIBC-based systems - # and in the C library for *BSD systems - AC_CHECK_LIB([dl], [dlopen, dlsym], [DL_LIB="-ldl"], - [AC_CHECK_LIB([c], [dlopen, dlsym], [DL_LIB="-lc"], - [AC_MSG_ERROR([unable to find the dlopen(), dlsym() functions]) ]) ]) -else - AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"]) - - if test $ac_cv_lib_pcap_pcap_open_live = "no"; then : - echo "" - echo "ERROR: Missing libpcap(-dev) library required to compile the example application" - echo "ERROR: Please install it and try again" - exit - fi -fi +case "$host" in + *-*-mingw32*|*-*-msys) + CFLAGS="${CFLAGS} -DOS_WIN32" + LDFLAGS="${LDFLAGS} -lws2_32 -lucrtbase" + ;; + *) + if test -f $PCAP_HOME/libpcap/libpcap.a; then : + echo "Using libpcap from $PCAP_HOME" + PCAP_INC="-I $PCAP_HOME/libpcap" + PCAP_LIB="$PCAP_HOME/libpcap/libpcap.a $PCAP_HOME/lib/libpfring.a $LIBNUMA `$PCAP_HOME/lib/pfring_config --libs`" + AC_CHECK_LIB([rt], [clock_gettime], [PCAP_LIB="$PCAP_LIB -lrt"]) + AC_CHECK_LIB([nl], [nl_handle_alloc], [PCAP_LIB="$PCAP_LIB -lnl"]) + # The dlopen() function is in libdl on GLIBC-based systems + # and in the C library for *BSD systems + AC_CHECK_LIB([dl], [dlopen, dlsym], [DL_LIB="-ldl"],[AC_CHECK_LIB([c], [dlopen, dlsym], [DL_LIB="-lc"],[AC_MSG_ERROR([unable to find the dlopen(), dlsym() functions]) ]) ]) + else + AC_CHECK_LIB([pcap], [pcap_open_live], [PCAP_LIB="-lpcap"]) + if test $ac_cv_lib_pcap_pcap_open_live = "no"; then : + echo "" + echo "ERROR: Missing libpcap(-dev) library required to compile the example application" + echo "ERROR: Please install it and try again" + exit + fi + fi + ;; +esac dnl> https://github.com/json-c/json-c AC_ARG_ENABLE([json-c], diff --git a/src/lib/Makefile.in b/src/lib/Makefile.in index 0c3f44838..3a29a4d3f 100644 --- a/src/lib/Makefile.in +++ b/src/lib/Makefile.in @@ -15,6 +15,7 @@ libdir = ${prefix}/lib includedir = ${prefix}/include/ndpi CC = @CC@ CFLAGS += -fPIC -DPIC -I../include -Ithird_party/include -DNDPI_LIB_COMPILATION -O2 -g -Wall @CUSTOM_NDPI@ +LDFLAGS = @LDFLAGS@ RANLIB = ranlib OBJECTS = $(patsubst protocols/%.c, protocols/%.o, $(wildcard protocols/*.c)) $(patsubst third_party/src/%.c, third_party/src/%.o, $(wildcard third_party/src/*.c)) $(patsubst ./%.c, ./%.o, $(wildcard ./*.c)) @@ -42,15 +43,15 @@ ndpi_main.c: ndpi_content_match.c.inc $(NDPI_LIB_STATIC): $(OBJECTS) ar rc $@ $(OBJECTS) - $(RANLIB) $@ + $(RANLIB) $@ $(NDPI_LIB_SHARED): $(OBJECTS) - $(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) + $(CC) -shared -fPIC $(SONAME_FLAG) -o $@ $(OBJECTS) $(LDFLAGS) ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE) ln -fs $(NDPI_LIB_SHARED) $(NDPI_LIB_SHARED_BASE).$(NDPI_VERSION_MAJOR) %.o: %.c $(HEADERS) Makefile - $(CC) $(CFLAGS) -c $< -o $@ + $(CC) $(CFLAGS) -c $< -o $@ $(LDFLAGS) clean: /bin/rm -f $(NDPI_LIB_STATIC) $(OBJECTS) *.o *.so *.lo $(NDPI_LIB_SHARED) diff --git a/src/lib/protocols/btlib.c b/src/lib/protocols/btlib.c index 8268e144d..9ddcab84f 100644 --- a/src/lib/protocols/btlib.c +++ b/src/lib/protocols/btlib.c @@ -39,8 +39,10 @@ typedef unsigned long long int u_int64_t; #include <stdint.h> #include <stdlib.h> +#ifndef WIN32 #include <arpa/inet.h> #endif +#endif #include "btlib.h" |