aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2018-09-21 12:20:29 +0000
committerWerner Koch <[email protected]>2018-09-21 12:25:19 +0000
commitb371e3ca906e6a4db31900d419ddc2b21bed1ea3 (patch)
tree6d376e3a2523355e87d7163290863346ed1b7bec
parentcore: Simplify calling convention of mkheader. (diff)
downloadlibgpg-error-b371e3ca906e6a4db31900d419ddc2b21bed1ea3.tar.gz
libgpg-error-b371e3ca906e6a4db31900d419ddc2b21bed1ea3.zip
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 <[email protected]>
-rw-r--r--src/Makefile.am5
-rw-r--r--src/mkheader.c12
2 files changed, 15 insertions, 2 deletions
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)
{