[git] GPG-ERROR - branch, master, updated. libgpg-error-1.32-19-gb371e3c

by Werner Koch cvs at cvs.gnupg.org
Fri Sep 21 14:39:02 CEST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Error codes used by GnuPG et al.".

The branch, master has been updated
       via  b371e3ca906e6a4db31900d419ddc2b21bed1ea3 (commit)
       via  3fc4ce49b23a364a1cf255c8e9e259047206e1e8 (commit)
      from  15309d0fb4c78f8de9bc5dea7d0f8b7468a957b4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b371e3ca906e6a4db31900d419ddc2b21bed1ea3
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Sep 21 14:20:29 2018 +0200

    core: Make cross building in mkheader more explicit.
    
    * src/mkheader.c (main): Add option --cross.
    (write_special): Don't use native in cross mode.
    * src/Makefile.am (mkheader_opts): New.
    (gpg-error.h): Add MKHEADER_OPTS.
    --
    
    The old behaviour was that an existing lock-obj-oub.native.h was
    preferred over one from syscfg even in cross mode.  The Makefile tried
    to get this right by deleting such a file first but when calling
    mkheader manually for testing this may have not been done.  We now
    allow (and also use by the Makefile) an option --cross to make this
    explicit.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/Makefile.am b/src/Makefile.am
index ca04262..c74baae 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -312,8 +312,10 @@ parts_of_gpg_error_h = 	 	\
 if FORCE_USE_SYSCFG
 pre_mkheader_cmds = if test -f lock-obj-pub.native.h; \
                     then rm lock-obj-pub.native.h; fi
+mkheader_opts = --cross
 else
 pre_mkheader_cmds = :
+mkheader_opts =
 parts_of_gpg_error_h += ./lock-obj-pub.native.h
 
 ./lock-obj-pub.native.h: Makefile gen-posix-lock-obj$(EXEEXT) posix-lock-obj.h
@@ -325,7 +327,8 @@ endif
 gpg-error.h: Makefile mkheader$(EXEEXT_FOR_BUILD) $(parts_of_gpg_error_h) \
              versioninfo.rc ../config.h
 	$(pre_mkheader_cmds)
-	./mkheader$(EXEEXT_FOR_BUILD) $(host_triplet)  $(srcdir)/gpg-error.h.in \
+	./mkheader$(EXEEXT_FOR_BUILD) $(mkheader_opts)       \
+                   $(host_triplet)  $(srcdir)/gpg-error.h.in \
                    ../config.h $(PACKAGE_VERSION) $(VERSION_NUMBER) >$@
 
 gpgrt.h: gpg-error.h
diff --git a/src/mkheader.c b/src/mkheader.c
index 6071a20..9a96b84 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -27,6 +27,7 @@ static char *host_os;      /* points into host_triplet.  */
 static char *srcdir;
 static const char *hdr_version;
 static const char *hdr_version_number;
+static int cross_building; /* Command line flag.  */
 
 /* Values take from the supplied config.h.  */
 static int have_stdint_h;
@@ -611,7 +612,11 @@ write_special (const char *fname, int lnr, const char *tag)
     }
   else if (!strcmp (tag, "include:lock-obj"))
     {
-      if (try_include_file (fname, lnr, "./lock-obj-pub.native.h", write_line))
+      /* If we are not cross compiling and the native file exists we
+       * prefer that over one from syscfg.  */
+      if (cross_building
+          || try_include_file (fname, lnr,
+                               "./lock-obj-pub.native.h", write_line))
         include_file (fname, lnr, "syscfg/lock-obj-pub.&.h", write_line);
     }
   else
@@ -636,6 +641,11 @@ main (int argc, char **argv)
     {
       argc--; argv++;
     }
+  if (argc && !strcmp (argv[0], "--cross"))
+    {
+      cross_building = 1;
+      argc--; argv++;
+    }
 
   if (argc == 1)
     {

commit 3fc4ce49b23a364a1cf255c8e9e259047206e1e8
Author: Werner Koch <wk at gnupg.org>
Date:   Fri Sep 21 14:02:42 2018 +0200

    core: Simplify calling convention of mkheader.
    
    * src/Makefile.am (gpg-error.h): Remove HOST_OS from mkheader call.
    * src/mkheader.c (canon_host_triplet): Add return arg r_os.
    (main): Remove first arg and derive host_os from host_triplet.
    --
    
    No need to let the caller pass the host_os, we can derive it from the
    triplet.
    
    Signed-off-by: Werner Koch <wk at gnupg.org>

diff --git a/src/Makefile.am b/src/Makefile.am
index 360e7f5..ca04262 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -325,7 +325,7 @@ endif
 gpg-error.h: Makefile mkheader$(EXEEXT_FOR_BUILD) $(parts_of_gpg_error_h) \
              versioninfo.rc ../config.h
 	$(pre_mkheader_cmds)
-	./mkheader$(EXEEXT_FOR_BUILD) $(host_os) $(host_triplet)  $(srcdir)/gpg-error.h.in \
+	./mkheader$(EXEEXT_FOR_BUILD) $(host_triplet)  $(srcdir)/gpg-error.h.in \
                    ../config.h $(PACKAGE_VERSION) $(VERSION_NUMBER) >$@
 
 gpgrt.h: gpg-error.h
diff --git a/src/mkheader.c b/src/mkheader.c
index 7a38a1b..6071a20 100644
--- a/src/mkheader.c
+++ b/src/mkheader.c
@@ -22,8 +22,8 @@
 
 #define LINESIZE 1024
 
-static const char *host_os;
-static char *host_triplet;
+static char *host_triplet; /* malloced.  */
+static char *host_os;      /* points into host_triplet.  */
 static char *srcdir;
 static const char *hdr_version;
 static const char *hdr_version_number;
@@ -78,12 +78,13 @@ xstrdup (const char *string)
 
 
 /* Return a malloced string with TRIPLET.  If TRIPLET has an alias
-   return that instead.  In general build-aux/config.sub should do the
-   aliasing but some returned triplets are anyway identical and thus
-   we use this function to map it to the canonical form.
-   NO_VENDOR_HACK is for internal use; caller must call with 0. */
+ * return that instead.  In general build-aux/config.sub should do the
+ * aliasing but some returned triplets are anyway identical and thus
+ * we use this function to map it to the canonical form.  A pointer to
+ * the OS part of the returned value is stored at R_OS.
+ * NO_VENDOR_HACK is for internal use; caller must call with 0. */
 static char *
-canon_host_triplet (const char *triplet, int no_vendor_hack)
+canon_host_triplet (const char *triplet, int no_vendor_hack, char **r_os)
 {
   struct {
     const char *name;
@@ -117,6 +118,8 @@ canon_host_triplet (const char *triplet, int no_vendor_hack)
   int i;
   const char *lastalias = NULL;
   const char *s;
+  char *p;
+  char *result;
 
   for (i=0; tbl[i].name; i++)
     {
@@ -126,7 +129,8 @@ canon_host_triplet (const char *triplet, int no_vendor_hack)
         {
           if (!lastalias)
             break; /* Ooops: first entry has no alias.  */
-          return xstrdup (lastalias);
+          result = xstrdup (lastalias);
+          goto leave;
         }
     }
   for (i=0, s=triplet; *s; s++)
@@ -139,7 +143,6 @@ canon_host_triplet (const char *triplet, int no_vendor_hack)
        * The VENDOR part is then in general useless because
        * KERNEL-SYSTEM is specific enough.  We now do a second pass by
        * replacing VENDOR with "unknown".  */
-      char *p;
       char *buf = xmalloc (strlen (triplet) + 7 + 1);
 
       for (p=buf,s=triplet,i=0; *s; s++)
@@ -154,12 +157,26 @@ canon_host_triplet (const char *triplet, int no_vendor_hack)
             }
         }
       *p = 0;
-      p = canon_host_triplet (buf, 1);
+      result = canon_host_triplet (buf, 1, NULL);
       xfree (buf);
-      return p;
+      goto leave;
+    }
+
+  result = xstrdup (triplet);
+ leave:
+  /* Find the OS part.  */
+  if (r_os)
+    {
+      *r_os = result + strlen (result); /* Default to the empty string.  */
+      for (i=0, p=result; *p; p++)
+        if (*p == '-' && ++i == 2)
+          {
+            *r_os = p+1;
+            break;
+          }
     }
 
-  return xstrdup (triplet);
+  return result;
 }
 
 
@@ -176,7 +193,7 @@ parse_config_h (const char *fname)
   fp = fopen (fname, "r");
   if (!fp)
     {
-      fprintf (stderr, "%s:%d: can't open file: %s",
+      fprintf (stderr, "%s:%d: can't open file: %s\n",
                fname, lnr, strerror (errno));
       return 1;
     }
@@ -623,30 +640,28 @@ main (int argc, char **argv)
   if (argc == 1)
     {
       /* Print just the canonicalized host triplet.  */
-      host_triplet = canon_host_triplet (argv[0], 0);
+      host_triplet = canon_host_triplet (argv[0], 0, &host_os);
       printf ("%s\n", host_triplet);
       goto leave;
     }
-  else if (argc == 6)
+  else if (argc == 5)
     ; /* Standard operation.  */
   else
     {
       fputs ("usage: " PGM
-             " host_os host_triplet template.h config.h"
-             " version version_number\n"
+             " host_triplet template.h config.h version version_number\n"
              "       " PGM
              " host_triplet\n",
              stderr);
       return 1;
     }
-  host_os = argv[0];
-  host_triplet_raw = argv[1];
-  fname = argv[2];
-  config_h = argv[3];
-  hdr_version = argv[4];
-  hdr_version_number = argv[5];
+  host_triplet_raw = argv[0];
+  fname = argv[1];
+  config_h = argv[2];
+  hdr_version = argv[3];
+  hdr_version_number = argv[4];
 
-  host_triplet = canon_host_triplet (host_triplet_raw, 0);
+  host_triplet = canon_host_triplet (host_triplet_raw, 0, &host_os);
 
   srcdir = malloc (strlen (fname) + 2 + 1);
   if (!srcdir)
@@ -667,7 +682,7 @@ main (int argc, char **argv)
   fp = fopen (fname, "r");
   if (!fp)
     {
-      fprintf (stderr, "%s:%d: can't open file: %s",
+      fprintf (stderr, "%s:%d: can't open file: %s\n",
                fname, lnr, strerror (errno));
       return 1;
     }

-----------------------------------------------------------------------

Summary of changes:
 src/Makefile.am |  5 +++-
 src/mkheader.c  | 77 ++++++++++++++++++++++++++++++++++++++-------------------
 2 files changed, 55 insertions(+), 27 deletions(-)


hooks/post-receive
-- 
Error codes used by GnuPG et al.
http://git.gnupg.org




More information about the Gnupg-commits mailing list