From 3c18630ddd403234e6195bea58dc1a2e859abdc0 Mon Sep 17 00:00:00 2001 From: Lothar May Date: Thu, 23 Jun 2011 16:52:03 +1000 Subject: new package libircclient --- src/libircclient-1-makefile.patch | 15 +++++ src/libircclient-2-disable-ipv6.patch | 14 +++++ src/libircclient-3-win32def.patch | 105 ++++++++++++++++++++++++++++++++++ src/libircclient-test.cpp | 11 ++++ src/libircclient.mk | 43 ++++++++++++++ tools/patch-tool-mingw | 2 +- 6 files changed, 189 insertions(+), 1 deletion(-) create mode 100644 src/libircclient-1-makefile.patch create mode 100644 src/libircclient-2-disable-ipv6.patch create mode 100644 src/libircclient-3-win32def.patch create mode 100644 src/libircclient-test.cpp create mode 100644 src/libircclient.mk diff --git a/src/libircclient-1-makefile.patch b/src/libircclient-1-makefile.patch new file mode 100644 index 0000000..7166294 --- /dev/null +++ b/src/libircclient-1-makefile.patch @@ -0,0 +1,15 @@ +The wrong source files are specified in the makefile. +There is one wrapper source file which includes all and +implements additional functions. + +--- a/src/Makefile.in 2011-03-11 01:21:16.000000000 +0100 ++++ b/src/Makefile.in 2011-03-11 01:22:04.000000000 +0100 +@@ -20,7 +20,7 @@ + cp ../include/libirc_events.h @prefix@/include/libirc_events.h + cp libirc.a @prefix@/include/lib/libirc.a + +-$(OBJS): utils.c dcc.c errors.c portable.c sockets.c colors.c ++$(OBJS): libircclient.c + + libircclient.a: $(OBJS) + $(AR) libircclient.a $(OBJS) diff --git a/src/libircclient-2-disable-ipv6.patch b/src/libircclient-2-disable-ipv6.patch new file mode 100644 index 0000000..e622d49 --- /dev/null +++ b/src/libircclient-2-disable-ipv6.patch @@ -0,0 +1,14 @@ +IPv6 support is broken and is forced to be disabled. +This place is sufficient - IPv6 initialisation will now cause an error. + +--- a/src/libircclient.c 2011-05-26 21:23:06.000000000 +0200 ++++ b/src/libircclient.c 2011-05-26 21:23:33.000000000 +0200 +@@ -194,7 +194,7 @@ + const char * username, + const char * realname) + { +-#if defined (ENABLE_IPV6) ++#if 0 + struct sockaddr_in6 saddr; + struct addrinfo ainfo, *res = NULL; + char portStr[32]; diff --git a/src/libircclient-3-win32def.patch b/src/libircclient-3-win32def.patch new file mode 100644 index 0000000..dc4acf8 --- /dev/null +++ b/src/libircclient-3-win32def.patch @@ -0,0 +1,105 @@ +Use the proper WIN32 define. + +--- a/src/sockets.c 2011-05-26 21:29:33.000000000 +0200 ++++ b/src/sockets.c 2011-05-26 21:30:25.000000000 +0200 +@@ -15,7 +15,7 @@ + /* + * The sockets interface was moved out to simplify going OpenSSL integration. + */ +-#if !defined (WIN32) ++#if !defined (_WIN32) + #include + #include + #include +@@ -47,7 +47,7 @@ + + static int socket_error() + { +-#if !defined (WIN32) ++#if !defined (_WIN32) + return errno; + #else + return WSAGetLastError(); +@@ -64,7 +64,7 @@ + + static int socket_make_nonblocking (socket_t * sock) + { +-#if !defined (WIN32) ++#if !defined (_WIN32) + return fcntl (*sock, F_SETFL, fcntl (*sock, F_GETFL,0 ) | O_NONBLOCK) != 0; + #else + unsigned long mode = 0; +@@ -75,7 +75,7 @@ + + static int socket_close (socket_t * sock) + { +-#if !defined (WIN32) ++#if !defined (_WIN32) + close (*sock); + #else + closesocket (*sock); +--- a/src/portable.c 2011-05-26 21:29:27.000000000 +0200 ++++ b/src/portable.c 2011-05-26 21:30:03.000000000 +0200 +@@ -13,7 +13,7 @@ + */ + + +-#if !defined (WIN32) ++#if !defined (_WIN32) + #include "config.h" + #include + #include +@@ -65,7 +65,7 @@ + + static inline int libirc_mutex_init (port_mutex_t * mutex) + { +-#if defined (WIN32) ++#if defined (_WIN32) + InitializeCriticalSection (mutex); + return 0; + #elif defined (PTHREAD_MUTEX_RECURSIVE) +@@ -78,13 +78,13 @@ + + return pthread_mutex_init (mutex, 0); + +-#endif /* defined (WIN32) */ ++#endif /* defined (_WIN32) */ + } + + + static inline void libirc_mutex_destroy (port_mutex_t * mutex) + { +-#if defined (WIN32) ++#if defined (_WIN32) + DeleteCriticalSection (mutex); + #else + pthread_mutex_destroy (mutex); +@@ -94,7 +94,7 @@ + + static inline void libirc_mutex_lock (port_mutex_t * mutex) + { +-#if defined (WIN32) ++#if defined (_WIN32) + EnterCriticalSection (mutex); + #else + pthread_mutex_lock (mutex); +@@ -104,7 +104,7 @@ + + static inline void libirc_mutex_unlock (port_mutex_t * mutex) + { +-#if defined (WIN32) ++#if defined (_WIN32) + LeaveCriticalSection (mutex); + #else + pthread_mutex_unlock (mutex); +--- a/include/libircclient.h 2011-05-26 21:35:53.000000000 +0200 ++++ b/include/libircclient.h 2011-05-26 21:36:04.000000000 +0200 +@@ -43,7 +43,7 @@ + #ifndef INCLUDE_LIBIRC_H + #define INCLUDE_LIBIRC_H + +-#if !defined (WIN32) ++#if !defined (_WIN32) + #include /* fd_set */ + #else + #include diff --git a/src/libircclient-test.cpp b/src/libircclient-test.cpp new file mode 100644 index 0000000..7a74a58 --- /dev/null +++ b/src/libircclient-test.cpp @@ -0,0 +1,11 @@ +#include + +int +main() +{ + irc_callbacks_t callbacks; + memset(&callbacks, 0, sizeof(callbacks)); + + irc_create_session(&callbacks); + return 0; +} diff --git a/src/libircclient.mk b/src/libircclient.mk new file mode 100644 index 0000000..bd0d0d7 --- /dev/null +++ b/src/libircclient.mk @@ -0,0 +1,43 @@ +# This file is part of mingw-cross-env. +# See doc/index.html for further information. + +# libircclient +# Note that IPv6 support is partly broken and therefore disabled. +PKG := libircclient +$(PKG)_IGNORE := +$(PKG)_VERSION := 1.3 +$(PKG)_CHECKSUM := 19b01d0227e717b58630037131798ee34fb0b414 +$(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION) +$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz +$(PKG)_WEBSITE := http://sourceforge.net/projects/$(PKG)/ +$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/$(PKG)/$(PKG)/$($(PKG)_VERSION)/$($(PKG)_FILE) +$(PKG)_DEPS := gcc + +define $(PKG)_UPDATE + wget -q -O- 'http://sourceforge.net/projects/libircclient/files/libircclient/' | \ + $(SED) -n 's,.*/\([0-9][^"]*\)/".*,\1,p' | \ + head -1 +endef + +define $(PKG)_BUILD + cd '$(1)' && ./configure \ + --prefix='$(PREFIX)/$(TARGET)' \ + --host='$(TARGET)' \ + --disable-debug \ + --enable-threads \ + --disable-ipv6 + $(MAKE) -C '$(1)'/src -j '$(JOBS)' + $(INSTALL) -d '$(PREFIX)/$(TARGET)/lib' + $(INSTALL) -m644 '$(1)/src/libircclient.a' '$(PREFIX)/$(TARGET)/lib/' + $(INSTALL) -d '$(PREFIX)/$(TARGET)/include/libircclient' + $(INSTALL) -m644 '$(1)/include/libircclient.h' '$(PREFIX)/$(TARGET)/include/libircclient' + $(INSTALL) -m644 '$(1)/include/libirc_errors.h' '$(PREFIX)/$(TARGET)/include/libircclient' + $(INSTALL) -m644 '$(1)/include/libirc_events.h' '$(PREFIX)/$(TARGET)/include/libircclient' + $(INSTALL) -m644 '$(1)/include/libirc_rfcnumeric.h' '$(PREFIX)/$(TARGET)/include/libircclient' + $(INSTALL) -m644 '$(1)/include/libirc_options.h' '$(PREFIX)/$(TARGET)/include/libircclient' + + '$(TARGET)-g++' \ + -W -Wall -Werror -ansi -pedantic \ + '$(2).cpp' -o '$(PREFIX)/$(TARGET)/bin/test-libircclient.exe' \ + -lircclient -lws2_32 +endef diff --git a/tools/patch-tool-mingw b/tools/patch-tool-mingw index 304e1b7..8615779 100755 --- a/tools/patch-tool-mingw +++ b/tools/patch-tool-mingw @@ -7,7 +7,7 @@ cmd=$1 pkg=$2 # mingw-cross-env directory -mcedir=~/mingw-cross-env +mcedir=~/dev/mingw-cross-env # directory for unpacked tarballs/git repos gitsdir=~/gits -- cgit v0.12