[svn] gpg-error - r256 - in trunk: . contrib contrib/conf-w32ce-msc src

svn author wk cvs at cvs.gnupg.org
Thu Oct 28 16:24:53 CEST 2010


Author: wk
Date: 2010-10-28 16:24:52 +0200 (Thu, 28 Oct 2010)
New Revision: 256

Added:
   trunk/contrib/
   trunk/contrib/conf-w32ce-msc/
   trunk/contrib/conf-w32ce-msc/build.mk
   trunk/contrib/conf-w32ce-msc/config.h
Modified:
   trunk/ChangeLog
   trunk/src/gpg-error.h.in
   trunk/src/init.c
   trunk/src/mkstrtable.awk
   trunk/src/w32-gettext.c
Log:
Add some code to allow building with MSC.


Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2010-10-26 09:42:02 UTC (rev 255)
+++ trunk/ChangeLog	2010-10-28 14:24:52 UTC (rev 256)
@@ -1,3 +1,16 @@
+2010-10-28  Werner Koch  <wk at g10code.com>
+
+	* contrib/conf-w32ce-msc/build.mk: New.
+	* contrib/conf-w32ce-msc/config.h: New.
+
+	* src/mkstrtable.awk: s/inline/GPG_ERR_INLINE/
+	* src/w32-gettext.c: Include gpg-error.h and replace all
+	__inline__ by GPG_ERR_INLINE.
+	(module_init):  Use _GPG_ERR_CONSTRUCTOR.
+	(_gpg_w32__init_gettext_module): Build also if we don't have
+	constructors
+	* src/gpg-error.h.in (GPG_ERR_INLINE) [_MSC_VER]: Define as __inline.
+
 2010-10-26  Werner Koch  <wk at g10code.com>
 
 	Release 1.10.

Added: trunk/contrib/conf-w32ce-msc/build.mk
===================================================================
--- trunk/contrib/conf-w32ce-msc/build.mk	                        (rev 0)
+++ trunk/contrib/conf-w32ce-msc/build.mk	2010-10-28 14:24:52 UTC (rev 256)
@@ -0,0 +1,95 @@
+# build.mk - Makefile to build libgpg-error using Visual-C
+# Copyright 2010 g10 Code GmbH
+#
+# This file is free software; as a special exception the author gives
+# unlimited permission to copy and/or distribute it, with or without
+# modifications, as long as this notice is preserved.
+#
+# This file is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+# This is a helper make script to build libgpg-error for WindowsCE
+# using the Microsoft Visual C compiler.  
+
+# The target build directry where we run the Visual C compiler/
+# This needs to be an absolute directory name.
+targetdir = /home/smb/xppro-gnu/src/libgpg-error
+
+
+help:
+	@echo "Run "
+	@echo "  make -f ../contrib/conf-w32ce-msc/build.mk copy-source"
+	@echo "on the POSIX system and then"
+	@echo "  nmake -f build.mk all"
+	@echo "on the Windows system"
+
+
+CFLAGS = -DHAVE_CONFIG_H -DDLL_EXPORT -I.
+LDFLAGS = 
+
+# Standard source files
+sources = \
+	init.c init.h      \
+	strsource.c	   \
+	strerror.c	   \
+	code-to-errno.c	   \
+	code-from-errno.c  \
+	w32-gettext.c      \
+        gettext.h          \
+	err-sources.h 	   \
+	err-codes.h
+
+# Sources files in this directory inclduing this Makefile
+conf_sources = \
+	build.mk \
+	config.h
+
+# Source files built by running the standard build system.
+built_sources = \
+	code-from-errno.h \
+	code-to-errno.h	  \
+	err-codes-sym.h	  \
+	err-sources-sym.h \
+	errnos-sym.h	  \
+	gpg-error.h	  \
+	mkerrcodes.h	  \
+	mkw32errmap.map.c \
+	gpg-error.def
+
+copy-static-source:
+	@if [ ! -f ./w32-gettext.c ]; then \
+           echo "Please cd to the src/ directory first"; \
+	   exit 1; \
+        fi
+	cp -t $(targetdir) $(sources);
+	cd ../contrib/conf-w32ce-msc ; cp -t $(targetdir) $(conf_sources)
+
+
+copy-built-source:
+	@if [ ! -f ./mkw32errmap.map.c ]; then \
+           echo "Please build using ./autogen.sh --build-w32ce first"; \
+	   exit 1; \
+        fi
+	cp -t $(targetdir) $(built_sources)
+
+copy-source: copy-static-source copy-built-source
+
+
+all:  $(sources) $(conf_sources) $(built_sources)
+	$(CC) $(CFLAGS) -c w32-gettext.c
+	$(CC) $(CFLAGS) -c init.c
+	$(CC) $(CFLAGS) -c strsource.c
+	$(CC) $(CFLAGS) -c strerror.c
+	$(CC) $(CFLAGS) -c code-to-errno.c
+	$(CC) $(CFLAGS) -c code-from-errno.c
+	$(CC) $(LDFLAGS) /LD -Felibgpg-error-0.dll \
+	   w32-gettext.obj init.obj strsource.obj strerror.obj \
+	   code-to-errno.obj code-from-errno.obj \
+	   gpg-error.def
+
+# Note that install needs to be run on the POSIX platform and the all
+# is only to make sure we build everything; it won't compile anything
+# because Visual-C is probably not installed on that platform.
+install: all
+	@echo fixme Install the files


Property changes on: trunk/contrib/conf-w32ce-msc/build.mk
___________________________________________________________________
Added: svn:executable
   + *

Added: trunk/contrib/conf-w32ce-msc/config.h
===================================================================
--- trunk/contrib/conf-w32ce-msc/config.h	                        (rev 0)
+++ trunk/contrib/conf-w32ce-msc/config.h	2010-10-28 14:24:52 UTC (rev 256)
@@ -0,0 +1,153 @@
+/* config.h for building with Visual-C for WindowsCE. 
+ * Copyright 2010 g10 Code GmbH
+ * 
+ * This file is free software; as a special exception the author gives
+ * unlimited permission to copy and/or distribute it, with or without
+ * modifications, as long as this notice is preserved.
+ * 
+ * This file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+ * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ */
+
+/* This file was originally created by running 
+ *   ./autogen.sh --build-w32ce
+ * on svn revision 253 (libgpg-error 1.10) and then adjusted to work
+ * with Visual-C.
+ */
+
+/* Define to the version of this package. */
+#define PACKAGE_VERSION "1.11-msc1"
+
+
+/* Name of package */
+#define PACKAGE "libgpg-error"
+
+/* Define to the address where bug reports for this package should be sent. */
+#define PACKAGE_BUGREPORT "bug-gnupg at gnupg.org"
+
+/* Define to the full name of this package. */
+#define PACKAGE_NAME "libgpg-error"
+
+/* Define to the full name and version of this package. */
+#define PACKAGE_STRING "libgpg-error " PACKAGE_VERSION
+
+/* Define to the one symbol short name of this package. */
+#define PACKAGE_TARNAME "libgpg-error"
+
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
+
+
+/* Define to 1 if translation of program messages to the user's native
+   language is requested. */
+/* #undef ENABLE_NLS */
+
+/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the
+   CoreFoundation framework. */
+/* #undef HAVE_CFLOCALECOPYCURRENT */
+
+/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in
+   the CoreFoundation framework. */
+/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */
+
+/* Define if the GNU dcgettext() function is already present or preinstalled.
+   */
+/* #undef HAVE_DCGETTEXT */
+
+/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you
+   don't. */
+#define HAVE_DECL_STRERROR_R 0
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+/* #undef HAVE_DLFCN_H */
+
+/* Define if the GNU gettext() function is already present or preinstalled. */
+/* #undef HAVE_GETTEXT */
+
+/* Define if you have the iconv() function and it works. */
+/* #undef HAVE_ICONV */
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#define HAVE_INTTYPES_H 1
+
+/* Define to 1 if you have the <locale.h> header file. */
+/* #undef HAVE_LOCALE_H */
+
+/* Define to 1 if you have the <memory.h> header file. */
+#define HAVE_MEMORY_H 1
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#define HAVE_STDINT_H 1
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#define HAVE_STDLIB_H 1
+
+/* Define to 1 if you have the `strerror_r' function. */
+/* #undef HAVE_STRERROR_R */
+
+/* Define to 1 if you have the <strings.h> header file. */
+#define HAVE_STRINGS_H 1
+
+/* Define to 1 if you have the <string.h> header file. */
+#define HAVE_STRING_H 1
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#define HAVE_SYS_STAT_H 1
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#define HAVE_SYS_TYPES_H 1
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#define HAVE_UNISTD_H 1
+
+/* Defined if we run on WindowsCE */
+#define HAVE_W32CE_SYSTEM 1
+
+/* Defined if we run on a W32 API based system */
+#define HAVE_W32_SYSTEM 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+   */
+#define LT_OBJDIR ".libs/"
+
+/* Define to 1 if your C compiler doesn't accept -c and -o together. */
+/* #undef NO_MINUS_C_MINUS_O */
+
+/* Define to 1 if you have the ANSI C header files. */
+#define STDC_HEADERS 1
+
+/* Define to 1 if strerror_r returns char *. */
+/* #undef STRERROR_R_CHAR_P */
+
+
+/* Version number of package */
+#define VERSION PACKAGE_VERSION
+
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+   this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
+/* Define to empty if `const' does not conform to ANSI C. */
+/* #undef const */
+
+
+/* Force using of NLS for W32 even if no libintl has been found.  This is 
+   okay because we have our own gettext implementation for W32.  */
+#if defined(HAVE_W32_SYSTEM) && !defined(ENABLE_NLS)
+#define ENABLE_NLS 1
+#endif
+/* For building we need to define these macro.  */
+#define GPG_ERR_ENABLE_GETTEXT_MACROS 1
+#define GPG_ERR_ENABLE_ERRNO_MACROS 1
+
+/* snprintf is not part of oldnames.lib thus we redefine it here. */
+#define snprintf _snprintf
+


Property changes on: trunk/contrib/conf-w32ce-msc/config.h
___________________________________________________________________
Added: svn:executable
   + *

Modified: trunk/src/gpg-error.h.in
===================================================================
--- trunk/src/gpg-error.h.in	2010-10-26 09:42:02 UTC (rev 255)
+++ trunk/src/gpg-error.h.in	2010-10-28 14:24:52 UTC (rev 256)
@@ -25,6 +25,8 @@
 
 #ifdef __GNUC__
 #define GPG_ERR_INLINE __inline__
+#elif _MSC_VER >= 1300
+#define GPG_ERR_INLINE __inline
 #elif __STDC_VERSION__ >= 199901L
 #define GPG_ERR_INLINE inline
 #else

Modified: trunk/src/init.c
===================================================================
--- trunk/src/init.c	2010-10-26 09:42:02 UTC (rev 255)
+++ trunk/src/init.c	2010-10-28 14:24:52 UTC (rev 256)
@@ -380,6 +380,10 @@
       tls_index = TlsAlloc ();
       if (tls_index == TLS_OUT_OF_INDEXES)
         return FALSE; 
+#ifndef _GPG_ERR_HAVE_CONSTRUCTOR
+      /* If we have not constructors (e.g. MSC) we call it here.  */
+      _gpg_w32__init_gettext_module ();
+#endif
       /* falltru.  */
     case DLL_THREAD_ATTACH:
       tls = LocalAlloc (LPTR, sizeof *tls);

Modified: trunk/src/mkstrtable.awk
===================================================================
--- trunk/src/mkstrtable.awk	2010-10-26 09:42:02 UTC (rev 255)
+++ trunk/src/mkstrtable.awk	2010-10-28 14:24:52 UTC (rev 256)
@@ -157,7 +157,7 @@
   print "    " pos[coded_msgs];
   print "  };";
   print "";
-  print "static inline int";
+  print "static GPG_ERR_INLINE int";
   print namespace "msgidxof (int code)";
   print "{";
   print "  return (0 ? 0";

Modified: trunk/src/w32-gettext.c
===================================================================
--- trunk/src/w32-gettext.c	2010-10-26 09:42:02 UTC (rev 255)
+++ trunk/src/w32-gettext.c	2010-10-28 14:24:52 UTC (rev 256)
@@ -50,8 +50,8 @@
 #endif /*!jnlib_malloc*/
 
 #include "init.h"
+#include "gpg-error.h"
 
-
 
 /* localname.c from gettext BEGIN.  */
 
@@ -1026,7 +1026,7 @@
 
 /* Support functions.  */
 
-static __inline__ uint32_t
+static GPG_ERR_INLINE uint32_t
 do_swap_u32 (uint32_t i)
 {
   return (i << 24) | ((i & 0xff00) << 8) | ((i >> 8) & 0xff00) | (i >> 24);
@@ -1041,8 +1041,8 @@
 /* The so called `hashpjw' function by P.J. Weinberger
    [see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
    1986, 1987 Bell Telephone Laboratories, Inc.]  */
-static __inline__ unsigned long
-hash_string( const char *str_param )
+static GPG_ERR_INLINE unsigned long
+hash_string (const char *str_param)
 {
   unsigned long int hval, g;
   const char *str = str_param;
@@ -1147,11 +1147,11 @@
 
 
 /* Constructor for this module.  This can only be used if we are a
-   DLL.  IF used as a static lib we can't control the process set; for
+   DLL.  If used as a static lib we can't control the process set; for
    example it might be used with a main module which is not build with
    mingw and thus does not know how to call the constructors.  */
 #ifdef DLL_EXPORT
-static void module_init (void) __attribute__ ((__constructor__));
+static void module_init (void) _GPG_ERR_CONSTRUCTOR;
 #endif
 static void
 module_init (void)
@@ -1165,7 +1165,7 @@
     }
 }
 
-#ifndef DLL_EXPORT
+#if !defined(DLL_EXPORT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
 void
 _gpg_w32__init_gettext_module (void)
 {





More information about the Gnupg-commits mailing list