new package libical

This commit is contained in:
Gareth Coco 2011-02-07 23:35:22 +11:00
parent e96bf22479
commit 6a2e8bbab4
4 changed files with 521 additions and 0 deletions

197
src/libical-1-tml.patch Normal file
View File

@ -0,0 +1,197 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been taken from:
https://build.opensuse.org/package/view_file?file=libical-0.44-tml.patch&package=mingw32-libical&project=windows%3Amingw%3Awin32
--- libical-0.44/autogen.sh 2009-01-08 17:50:28.000000000 +0100
+++ libical-0.44/autogen.sh 2009-04-15 15:25:54.000000000 +0200
@@ -37,11 +37,6 @@
exit 1
}
-if test -z "$*"; then
- echo "I am going to run ./configure with no arguments - if you wish "
- echo "to pass any to it, please specify them on the $0 command line."
-fi
-
case $CC in
*xlc | *xlc\ * | *lcc | *lcc\ *) am_opt=--include-deps;;
esac
@@ -55,7 +50,3 @@
autoconf
cd $ORIGDIR
-$srcdir/configure "$@"
-
-echo
-echo "Now type 'make' to compile $PROJECT."
--- libical-0.44/src/libical/icalrecur.c 2009-01-08 17:50:21.000000000 +0100
+++ libical-0.44/src/libical/icalrecur.c 2009-04-15 15:12:35.000000000 +0200
@@ -141,16 +141,6 @@
#include <limits.h>
-#ifndef HAVE_INTPTR_T
-#if defined (WIN32) || defined (XP_BEOS)
-typedef long intptr_t;
-#endif
-#endif
-
-#ifdef WIN32
-#define strcasecmp stricmp
-#endif
-
#include "icalrecur.h"
#include "icalerror.h"
--- libical-0.44/src/libical/icaltz-util.c 2009-01-08 17:50:21.000000000 +0100
+++ libical-0.44/src/libical/icaltz-util.c 2009-04-15 15:17:06.000000000 +0200
@@ -20,67 +20,24 @@
* Boston, MA 02110-1301, USA.
*/
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
#include <string.h>
-
#if defined(sun) && defined(__SVR4)
#include <sys/byteorder.h>
+#elif defined(_WIN32)
+#define BIG_ENDIAN 'B'
+#define LITTLE_ENDIAN 'l'
+#define BYTE_ORDER LITTLE_ENDIAN
+#define bswap32(val) ((((val) & 0x000000ffU) << 24) | (((val) & 0x0000ff00U) << 8) | (((val) & 0x00ff0000U) >> 8) | (((val) & 0xff000000U) >> 24))
+#elif defined(__linux__)
+#include <byteswap.h>
+#include <endian.h>
#else
-# ifdef HAVE_BYTESWAP_H
-# include <byteswap.h>
-# endif
-# ifdef HAVE_SYS_ENDIAN_H
-# include <sys/endian.h>
-# ifdef bswap32
-# define bswap_32 bswap32
-# else
-# define bswap_32 swap32
-# endif
-# endif
-# ifdef HAVE_ENDIAN_H
-# include <endian.h>
-# endif
-#endif
-
-#ifdef WIN32
-#if !defined(HAVE_BYTESWAP_H) && !defined(HAVE_SYS_ENDIAN_H) && !defined(HAVE_ENDIAN_H)
-#define bswap_16(x) (((x) << 8) & 0xff00) | (((x) >> 8 ) & 0xff)
-#define bswap_32(x) (((x) << 24) & 0xff000000) \
- | (((x) << 8) & 0xff0000) \
- | (((x) >> 8) & 0xff00) \
- | (((x) >> 24) & 0xff )
-#define bswap_64(x) ((((x) & 0xff00000000000000ull) >> 56) \
- | (((x) & 0x00ff000000000000ull) >> 40) \
- | (((x) & 0x0000ff0000000000ull) >> 24) \
- | (((x) & 0x000000ff00000000ull) >> 8) \
- | (((x) & 0x00000000ff000000ull) << 8) \
- | (((x) & 0x0000000000ff0000ull) << 24) \
- | (((x) & 0x000000000000ff00ull) << 40) \
- | (((x) & 0x00000000000000ffull) << 56))
+#include <sys/endian.h>
#endif
-#include <io.h>
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif
-
-#ifndef F_OK
-#define F_OK 0
-#endif
-
-#ifndef R_OK
-#define R_OK 4
-#endif
-
#include <limits.h>
#include <time.h>
#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <libical/icalerror.h>
#include <icaltz-util.h>
@@ -139,7 +96,11 @@
if ((BYTE_ORDER == BIG_ENDIAN) && sizeof (int) == 4)
return *(const int *) ptr;
else if (BYTE_ORDER == LITTLE_ENDIAN && sizeof (int) == 4)
+#ifdef __linux__
return bswap_32 (*(const int *) ptr);
+#else
+ return bswap32 (*(const unsigned *) ptr);
+#endif
#endif
else
{
--- libical-0.44/src/libical/Makefile.am 2009-01-08 17:50:22.000000000 +0100
+++ libical-0.44/src/libical/Makefile.am 2009-04-15 15:27:20.000000000 +0200
@@ -51,7 +51,7 @@
-I$(top_builddir)/src/libical \
-I$(srcdir)
-libical_la_LDFLAGS = -version-info 44:0:44
+libical_la_LDFLAGS = -version-info 44:0:44 -no-undefined
libical_la_LIBADD = $(PTHREAD_LIBS)
--- libical-0.44/src/libical/vsnprintf.c 2009-01-08 17:50:22.000000000 +0100
+++ libical-0.44/src/libical/vsnprintf.c 2009-04-15 15:23:35.000000000 +0200
@@ -1,8 +1,7 @@
-#ifndef WIN32
#include "config.h"
-#endif
+
#ifndef HAVE_SNPRINTF
-#error DO NOT USE libical version of vsnprintf.
+
/*
* Revision 12: http://theos.com/~deraadt/snprintf.c
*
--- libical-0.44/src/libicalcap/Makefile.am 2009-01-08 17:50:20.000000000 +0100
+++ libical-0.44/src/libicalcap/Makefile.am 2009-04-15 15:32:11.000000000 +0200
@@ -34,7 +34,7 @@
-I$(srcdir) \
-DWITH_RR $(RRCAP_CFLAGS)
-libicalcap_evolution_la_LDFLAGS = $(RRCAP_LIBS) -version-info 44:0:44
+libicalcap_evolution_la_LDFLAGS = $(RRCAP_LIBS) -version-info 44:0:44 -no-undefined
libicalcap_evolution_la_SOURCES = \
--- libical-0.44/src/libicalss/Makefile.am 2009-01-08 17:50:22.000000000 +0100
+++ libical-0.44/src/libicalss/Makefile.am 2009-04-15 15:34:41.000000000 +0200
@@ -63,8 +63,8 @@
-I$(top_builddir)/src/libical \
$(BDB_INCLUDE)
-libicalss_la_LDFLAGS = -version-info 44:0:44
-libicalss_la_LIBADD = $(BDB_LIBFILES)
+libicalss_la_LDFLAGS = -version-info 44:0:44 -no-undefined
+libicalss_la_LIBADD = $(BDB_LIBFILES) $(top_builddir)/src/libical/libical.la
if DEV
libicalss_la_DEVSOURCES = icalsslexer.l icalssyacc.y
--- libical-0.44/src/libicalvcal/Makefile.am 2009-01-08 17:50:23.000000000 +0100
+++ libical-0.44/src/libicalvcal/Makefile.am 2009-04-15 15:31:48.000000000 +0200
@@ -8,7 +8,7 @@
-I$(top_builddir)/src/libical \
-I$(top_srcdir)/src/libicalss
-libicalvcal_la_LDFLAGS = -version-info 44:0:44
+libicalvcal_la_LDFLAGS = -version-info 44:0:44 -no-undefined
libicalvcal_la_LIBADD = ../libical/.libs/libical.la
if DEV

282
src/libical-2-windows.patch Normal file
View File

@ -0,0 +1,282 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been taken from:
https://build.opensuse.org/package/view_file?file=libical-0.44-windows.patch&package=mingw32-libical&project=windows%3Amingw%3Awin32
--- libical-0.44/src/libical/icaltime.c 2009-09-27 04:38:51.000000000 +0200
+++ libical-0.44/src/libical/icaltime.c 2010-03-17 14:55:36.000000000 +0100
@@ -45,14 +45,19 @@
#include "icaltimezone.h"
#include "icalvalue.h"
-#ifdef WIN32
+#ifdef _WIN32
#include <windows.h>
#define snprintf _snprintf
#define strcasecmp stricmp
#endif
-#ifdef WIN32
+#ifdef HAVE_PTHREAD
+ #include <pthread.h>
+ static pthread_mutex_t tzid_mutex = PTHREAD_MUTEX_INITIALIZER;
+#endif
+
+#ifdef _WIN32
/* Undef the similar macro from pthread.h, it doesn't check if
* gmtime() returns NULL.
*/
@@ -62,11 +67,6 @@
#define gmtime_r(tp,tmp) (gmtime(tp)?(*(tmp)=*gmtime(tp),(tmp)):0)
#endif
-#ifdef HAVE_PTHREAD
- #include <pthread.h>
- static pthread_mutex_t tzid_mutex = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
/*
* Function to convert a struct tm time specification
* to an ANSI time_t using the specified time zone.
@@ -192,18 +192,20 @@
*
*/
struct icaltimetype
-icaltime_from_timet_with_zone(const time_t tm, const int is_date,
+icaltime_from_timet_with_zone(time_t tm, const int is_date,
const icaltimezone *zone)
{
struct icaltimetype tt;
struct tm t;
icaltimezone *utc_zone;
+ if (tm < 0) tm=0;
+
utc_zone = icaltimezone_get_utc_timezone ();
/* Convert the time_t to a struct tm in UTC time. We can trust gmtime
for this. */
-#ifdef HAVE_PTHREAD
+#if defined(HAVE_PTHREAD) || defined(_WIN32)
gmtime_r (&tm, &t);
#else
t = *(gmtime (&tm));
--- libical-0.44/src/libical/icaltimezone.c 2009-09-27 04:38:51.000000000 +0200
+++ libical-0.44/src/libical/icaltimezone.c 2010-03-19 14:34:25.000000000 +0100
@@ -59,6 +59,61 @@
/** This is the toplevel directory where the timezone data is installed in. */
#define ZONEINFO_DIRECTORY PACKAGE_DATA_DIR "/zoneinfo"
+#ifdef _WIN32
+/* search for data relative to where we are installed */
+
+static HMODULE hmodule;
+
+BOOL WINAPI
+DllMain (HINSTANCE hinstDLL,
+ DWORD fdwReason,
+ LPVOID lpvReserved)
+{
+ switch (fdwReason)
+ {
+ case DLL_PROCESS_ATTACH:
+ hmodule = hinstDLL;
+ break;
+ }
+
+ return TRUE;
+}
+
+char *
+get_zoneinfo_directory (void)
+{
+ static char retval[1000];
+ static int beenhere = 0;
+
+ unsigned char *p;
+
+ if (beenhere)
+ return retval;
+
+ if (!GetModuleFileName (hmodule, (CHAR *) retval, sizeof(retval) - 10))
+ return ZONEINFO_DIRECTORY;
+
+ p = _mbsrchr ((const unsigned char *) retval, '\\');
+ *p = '\0';
+ p = _mbsrchr ((const unsigned char *) retval, '\\');
+ if (p) {
+ if (stricmp ((const char *) (p+1), "bin") == 0)
+ *p = '\0';
+ }
+ strcat (retval, "\\share\\libical\\zoneinfo");
+
+ beenhere = 1;
+
+ return retval;
+}
+
+#undef ZONEINFO_DIRECTORY
+#define ZONEINFO_DIRECTORY get_zoneinfo_directory ()
+
+#endif
+
+
+
/** The prefix we use to uniquely identify TZIDs.
It must begin and end with forward slashes.
*/
@@ -1943,96 +1998,7 @@
static const char* get_zone_directory(void)
{
-#ifndef WIN32
return zone_files_directory == NULL ? ZONEINFO_DIRECTORY : zone_files_directory;
-#else
- wchar_t wbuffer[1000];
- char buffer[1000], zoneinfodir[1000], dirname[1000];
- int used_default;
- static char *cache = NULL;
- char *dirslash, *zislash;
- struct stat st;
-
- if (zone_files_directory)
- return zone_files_directory;
-
- if (cache)
- return cache;
-
- /* Get the filename of the application */
- if (!GetModuleFileNameW (NULL, wbuffer, sizeof (wbuffer) / sizeof (wbuffer[0])))
- return ZONEINFO_DIRECTORY;
-
- /* Convert to system codepage */
- if (!WideCharToMultiByte (CP_ACP, 0, wbuffer, -1, buffer, sizeof (buffer),
- NULL, &used_default) ||
- used_default) {
- /* Failed, try 8.3 format */
- if (!GetShortPathNameW (wbuffer, wbuffer,
- sizeof (wbuffer) / sizeof (wbuffer[0])) ||
- !WideCharToMultiByte (CP_ACP, 0, wbuffer, -1, buffer, sizeof (buffer),
- NULL, &used_default) ||
- used_default)
- return ZONEINFO_DIRECTORY;
- }
- /* Look for the zoneinfo directory somewhere in the path where
- * the app is installed. If the path to the app is
- *
- * C:\opt\evo-2.6\bin\evolution-2.6.exe
- *
- * and the compile-time ZONEINFO_DIRECTORY is
- *
- * C:/devel/target/evo/share/evolution-data-server-1.6/zoneinfo,
- *
- * we check the pathnames:
- *
- * C:\opt\evo-2.6/devel/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt\evo-2.6/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt\evo-2.6/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt\evo-2.6/share/evolution-data-server-1.6/zoneinfo <===
- * C:\opt\evo-2.6/evolution-data-server-1.6/zoneinfo
- * C:\opt\evo-2.6/zoneinfo
- * C:\opt/devel/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt/evo/share/evolution-data-server-1.6/zoneinfo
- * C:\opt/share/evolution-data-server-1.6/zoneinfo
- * C:\opt/evolution-data-server-1.6/zoneinfo
- * C:\opt/zoneinfo
- * C:/devel/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:/target/evo/share/evolution-data-server-1.6/zoneinfo
- * C:/evo/share/evolution-data-server-1.6/zoneinfo
- * C:/share/evolution-data-server-1.6/zoneinfo
- * C:/evolution-data-server-1.6/zoneinfo
- * C:/zoneinfo
- *
- * In Evolution's case, we would get a match already at the
- * fourth pathname check.
- */
-
- /* Strip away basename of app .exe first */
- dirslash = _mbsrchr (buffer, '\\');
- if (dirslash)
- *dirslash = '\0';
-
- while ((dirslash = _mbsrchr (buffer, '\\'))) {
- /* Strip one more directory from app .exe location */
- *dirslash = '\0';
-
- strcpy (zoneinfodir, ZONEINFO_DIRECTORY);
- while ((zislash = _mbschr (zoneinfodir, '/'))) {
- *zislash = '.';
- strcpy (dirname, buffer);
- strcat (dirname, "/");
- strcat (dirname, zislash + 1);
- if (stat (dirname, &st) == 0 &&
- S_ISDIR (st.st_mode)) {
- cache = strdup (dirname);
- return cache;
- }
- }
- }
- return ZONEINFO_DIRECTORY;
-#endif
}
void set_zone_directory(char *path)
--- libical-0.44/src/libical/icaltz-util.c 2010-03-17 15:04:14.000000000 +0100
+++ libical-0.44/src/libical/icaltz-util.c 2010-03-19 14:38:56.000000000 +0100
@@ -41,6 +42,10 @@
#include <libical/icalerror.h>
#include <icaltz-util.h>
+/** This is the filename of the file containing the city names and
+ coordinates of all the builtin timezones. */
+#define ZONES_TAB_FILENAME "zones.tab"
+
typedef struct
{
char ttisgmtcnt [4];
@@ -53,7 +58,7 @@
static int r_pos [] = {1, 2, 3, -2, -1};
-static char *search_paths [] = {"/usr/share/zoneinfo","/usr/lib/zoneinfo","/etc/zoneinfo","/usr/share/lib/zoneinfo"};
+static char *search_paths [] = {"/usr/share/zoneinfo","/usr/lib/zoneinfo","/etc/zoneinfo","/usr/share/lib/zoneinfo",PACKAGE_DATA_DIR "/zoneinfo"};
static char *zdir = NULL;
#define NUM_SEARCH_PATHS (sizeof (search_paths)/ sizeof (search_paths [0]))
@@ -174,12 +179,24 @@
return;
}
+#ifdef _WIN32
+char * get_zoneinfo_directory (void);
+#endif
+
static void
set_zone_directory (void)
{
char file_path[PATH_MAX];
- const char *fname = ZONES_TAB_SYSTEM_FILENAME;
+
+#ifdef _WIN32
+ const char *fname = ZONES_TAB_FILENAME;
+
+ sprintf (file_path, "%s\\%s", get_zoneinfo_directory(), fname);
+ if (!access (file_path, F_OK|R_OK))
+ zdir = strdup(get_zoneinfo_directory());
+#else
int i;
+ const char *fname = ZONES_TAB_SYSTEM_FILENAME;
for (i = 0;i < NUM_SEARCH_PATHS; i++) {
sprintf (file_path, "%s/%s", search_paths [i], fname);
@@ -188,6 +205,7 @@
break;
}
}
+#endif
}

View File

@ -0,0 +1,14 @@
This file is part of mingw-cross-env.
See doc/index.html for further information.
This patch has been made by: garethcoco@gmail.com
--- libical-0.44/libical.pc.in 2011-02-02 15:33:11.363284126 -0500
+++ libical-0.44/libical.pc.in 2011-02-02 15:32:44.202284263 -0500
@@ -6,6 +6,6 @@
Name: libical
Description: An implementation of basic iCAL protocols
Version: @VERSION@
-Libs: -L${libdir} -lical -licalss -licalvcal
+Libs: -L${libdir} -lical -licalss -licalvcal @PTHREAD_LIBS@
Cflags: -I${includedir}/

28
src/libical.mk Normal file
View File

@ -0,0 +1,28 @@
# This file is part of mingw-cross-env.
# See doc/index.html for further information.
# PDcurses
PKG := libical
$(PKG)_IGNORE :=
$(PKG)_VERSION := 0.44
$(PKG)_CHECKSUM := f781150e2d98806e91b7e0bee02abdc6baf9ac7d
$(PKG)_SUBDIR := $(PKG)-$($(PKG)_VERSION)
$(PKG)_FILE := $(PKG)-$($(PKG)_VERSION).tar.gz
$(PKG)_WEBSITE := http://freeassociation.sourceforge.net/
$(PKG)_URL := http://$(SOURCEFORGE_MIRROR)/project/freeassociation/$(PKG)/$(PKG)-$($(PKG)_VERSION)/$($(PKG)_FILE)
$(PKG)_DEPS := gcc pthreads
define $(PKG)_UPDATE
wget -q -O- 'http://sourceforge.net/projects/freeassociation/files/$(PKG)/' | \
$(SED) -n 's,.*/$(PKG)-\([0-9][^"]*\)/".*,\1,p' | \
head -1
endef
define $(PKG)_BUILD
cd '$(1)' && ./configure \
--host='$(TARGET)' \
--prefix='$(PREFIX)/$(TARGET)' \
--disable-shared
$(MAKE) -C '$(1)' -j '$(JOBS)'
$(MAKE) -C '$(1)' -j '$(JOBS)' install
endef