[PATCH 1/3] build: permit disabling rpath

classic Classic list List threaded Threaded
3 messages Options
thb
Reply | Threaded
Open this post in threaded view
|

[PATCH 1/3] build: permit disabling rpath

thb
From: Thorsten Behrens <[hidden email]>

Signed-off-by: Thorsten Behrens <[hidden email]>
---
 configure.ac | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/configure.ac b/configure.ac
index 992d1bd..426492a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -398,6 +398,9 @@ if test "$gcry_cv_visibility_attribute" = "yes" \
    CFLAGS="$CFLAGS -fvisibility=hidden"
 fi
 
+# permit disabling rpath
+AC_LIB_RPATH
+
 #
 # Check whether ld supports a version script.
 # (Actually not a check but a list of systems which are known to support it.)
--
2.13.6


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
thb
Reply | Threaded
Open this post in threaded view
|

[PATCH 2/3] port: first cut at native W32 building

thb
From: Thorsten Behrens <[hidden email]>

Signed-off-by: Thorsten Behrens <[hidden email]>
---
 src/Makefile.am       | 10 ++++++----
 src/estream-printf.c  |  6 +++++-
 src/estream.c         | 16 ++++++++++++++--
 src/gpg-error.c       |  2 ++
 src/init.c            |  6 +++---
 src/mkheader.c        | 14 +++++++++++++-
 src/versioninfo.rc.in |  2 --
 src/w32-estream.c     |  5 +++++
 src/w32-gettext.c     |  4 ++--
 9 files changed, 50 insertions(+), 15 deletions(-)

diff --git a/src/Makefile.am b/src/Makefile.am
index 4446612..253da3b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -38,8 +38,10 @@ bin_PROGRAMS = gpg-error
 
 if HAVE_W32_SYSTEM
 noinst_PROGRAMS = gen-w32-lock-obj
+exe_extension = .exe
 else
 noinst_PROGRAMS = gen-posix-lock-obj
+exe_extension =
 endif
 
 # Distributed lock object definitions for cross compilation.
@@ -264,7 +266,7 @@ gpg-error.def: Makefile gpg-error.def.in
 
 # It is correct to use $(CC_FOR_BUILD) here.  We want to run the
 # program at build time.
-mkerrcodes: mkerrcodes.c mkerrcodes.h Makefile
+mkerrcodes${exe_extension}: mkerrcodes.c mkerrcodes.h Makefile
  $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkerrcodes.c
 
 if HAVE_W32CE_SYSTEM
@@ -274,7 +276,7 @@ mkw32errmap: mkw32errmap.c mkw32errmap.tab.h Makefile
  $(CC_FOR_BUILD) -I. -I$(srcdir) -o $@ $(srcdir)/mkw32errmap.c
 endif
 
-code-from-errno.h: mkerrcodes Makefile
+code-from-errno.h: mkerrcodes${exe_extension} Makefile
  ./mkerrcodes | $(AWK) -f $(srcdir)/mkerrcodes2.awk >$@
 
 errnos-sym.h: Makefile mkstrtable.awk errnos.in
@@ -283,7 +285,7 @@ errnos-sym.h: Makefile mkstrtable.awk errnos.in
  $(srcdir)/errnos.in >$@
 
 
-mkheader: mkheader.c Makefile
+mkheader${exe_extension}: mkheader.c Makefile
  $(CC_FOR_BUILD) -g -O0 -I. -I$(srcdir) -o $@ $(srcdir)/mkheader.c
 
 parts_of_gpg_error_h = \
@@ -310,7 +312,7 @@ endif
 
 # We also depend on versioninfo.rc because that is build by
 # config.status and thus has up-to-date version numbers.
-gpg-error.h: Makefile mkheader $(parts_of_gpg_error_h) \
+gpg-error.h: Makefile mkheader${exe_extension} $(parts_of_gpg_error_h) \
              versioninfo.rc ../config.h
  $(pre_mkheader_cmds)
  ./mkheader $(host_os) $(host_triplet)  $(srcdir)/gpg-error.h.in \
diff --git a/src/estream-printf.c b/src/estream-printf.c
index f1cbcde..194d814 100644
--- a/src/estream-printf.c
+++ b/src/estream-printf.c
@@ -85,7 +85,11 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <io.h>
+#else
+# include <unistd.h>
+#endif
 #include <stdarg.h>
 #include <errno.h>
 #include <stddef.h>
diff --git a/src/estream.c b/src/estream.c
index dd2b289..e466a30 100644
--- a/src/estream.c
+++ b/src/estream.c
@@ -74,12 +74,15 @@
 # include <sys/time.h>
 #endif
 #include <sys/types.h>
-#include <sys/file.h>
 #include <sys/stat.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <io.h>
+#else
+# include <unistd.h>
+#endif
 #include <stdarg.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -112,6 +115,15 @@
 
 
 #ifdef HAVE_W32_SYSTEM
+# ifndef  S_IRUSR
+#  define S_IRUSR _S_IREAD
+# endif
+# ifndef  S_IWUSR
+#  define S_IWUSR _S_IWRITE
+# endif
+# ifndef  S_IXUSR
+#  define S_IXUSR 0x00400000
+# endif
 # ifndef  S_IRGRP
 #  define S_IRGRP S_IRUSR
 # endif
diff --git a/src/gpg-error.c b/src/gpg-error.c
index f890883..2c36e36 100644
--- a/src/gpg-error.c
+++ b/src/gpg-error.c
@@ -98,6 +98,8 @@ i18n_init (void)
 
 #include <windows.h>
 
+#define strncasecmp _strnicmp
+#define strcasecmp _stricmp
 
 static char *
 get_locale_dir (void)
diff --git a/src/init.c b/src/init.c
index 89475d3..1fb83b1 100644
--- a/src/init.c
+++ b/src/init.c
@@ -88,7 +88,7 @@ gpg_error_t
 _gpg_err_init (void)
 {
 #ifdef HAVE_W32_SYSTEM
-# ifdef DLL_EXPORT
+# ifdef HAVE_DLL_INIT
   /* We always have a constructor and thus this function is called
      automatically.  Due to the way the C init code of mingw works,
      the constructors are called before our DllMain function is
@@ -130,7 +130,7 @@ _gpg_err_init (void)
 void
 _gpg_err_deinit (int mode)
 {
-#if defined (HAVE_W32_SYSTEM) && !defined(DLL_EXPORT)
+#if defined (HAVE_W32_SYSTEM) && !defined(HAVE_DLL_INIT)
   struct tls_space_s *tls;
 
   tls = TlsGetValue (tls_index);
@@ -558,7 +558,7 @@ _gpg_w32ce_strerror (int err)
 
 
 /* Entry point called by the DLL loader.  */
-#ifdef DLL_EXPORT
+#ifdef HAVE_DLL_INIT
 int WINAPI
 DllMain (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 {
diff --git a/src/mkheader.c b/src/mkheader.c
index 997cab5..4b345d1 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -16,7 +16,11 @@
 #include <stdlib.h>
 #include <string.h>
 #include <errno.h>
-#include <unistd.h>
+#ifdef _WIN32
+# include <io.h>
+#else
+# include <unistd.h>
+#endif
 
 #define PGM "mkheader"
 
@@ -410,12 +414,20 @@ try_include_file (const char *fname, int lnr, const char *name,
 
   repl_flag = !!strchr (name, '&');
   incfname = mk_include_name (name, repl_flag? host_triplet : NULL);
+#ifdef _WIN32
+  rc = _access (incfname, 04);
+#else
   rc = access (incfname, R_OK);
+#endif
   if (rc && repl_flag)
     {
       free (incfname);
       incfname = mk_include_name (name, host_os);
+#ifdef _WIN32
+      rc = _access (incfname, 04);
+#else
       rc = access (incfname, R_OK);
+#endif
     }
   if (!rc)
     include_file (fname, lnr, name, outf);
diff --git a/src/versioninfo.rc.in b/src/versioninfo.rc.in
index 0986a42..6bfd3ec 100644
--- a/src/versioninfo.rc.in
+++ b/src/versioninfo.rc.in
@@ -14,8 +14,6 @@
 
 #line __LINE__ "versioninfo.rc.in"
 
-#include <afxres.h>
-
 
 VS_VERSION_INFO VERSIONINFO
  FILEVERSION @BUILD_FILEVERSION@
diff --git a/src/w32-estream.c b/src/w32-estream.c
index 2122c59..1a16d8f 100644
--- a/src/w32-estream.c
+++ b/src/w32-estream.c
@@ -45,6 +45,11 @@
 
 #include "gpgrt-int.h"
 
+#ifdef _WIN32
+/* no ssize_t in windows std headers, emulate for native build */
+typedef SSIZE_T ssize_t;
+#endif
+
 /*
  * In order to support es_poll on Windows, we create a proxy shim that
  * we use as the estream I/O functions.  This shim creates reader and
diff --git a/src/w32-gettext.c b/src/w32-gettext.c
index 3b54ebd..71716ce 100644
--- a/src/w32-gettext.c
+++ b/src/w32-gettext.c
@@ -1180,7 +1180,7 @@ static char *current_domainname;
    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
+#ifdef HAVE_DLL_INIT
 static void module_init (void) _GPG_ERR_CONSTRUCTOR;
 #endif
 static void
@@ -1195,7 +1195,7 @@ module_init (void)
     }
 }
 
-#if !defined(DLL_EXPORT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
+#if !defined(HAVE_DLL_INIT) || !defined(_GPG_ERR_HAVE_CONSTRUCTOR)
 void
 _gpg_w32__init_gettext_module (void)
 {
--
2.13.6


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel
thb
Reply | Threaded
Open this post in threaded view
|

[PATCH 3/3] port: get this to build with clang-cl on W32

thb
In reply to this post by thb
From: Stephan Bergmann <[hidden email]>

Signed-off-by: Thorsten Behrens <[hidden email]>
---
 src/gpg-error.h.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gpg-error.h.in b/src/gpg-error.h.in
index 46e8f53..e359262 100644
--- a/src/gpg-error.h.in
+++ b/src/gpg-error.h.in
@@ -142,7 +142,7 @@ typedef unsigned int gpg_error_t;
 
 
 /* GCC feature test.  */
-#if __GNUC__
+#if defined __GNUC__
 # define _GPG_ERR_GCC_VERSION (__GNUC__ * 10000 \
                                + __GNUC_MINOR__ * 100 \
                                + __GNUC_PATCHLEVEL__)
--
2.13.6


_______________________________________________
Gnupg-devel mailing list
[hidden email]
http://lists.gnupg.org/mailman/listinfo/gnupg-devel