When cross-compiling, also build native binaries, and use them to create
authorJohn Darrington <john@darrington.wattle.id.au>
Sun, 13 Dec 2020 11:25:55 +0000 (12:25 +0100)
committerJohn Darrington <john@darrington.wattle.id.au>
Sun, 13 Dec 2020 17:58:01 +0000 (18:58 +0100)
the files in doc/pspp-figures.  Obviously an effect of this is that cross
builds require both native and host libraries.

INSTALL
configure.ac
doc/automake.mk

diff --git a/INSTALL b/INSTALL
index 15f356a9451d361a3e6cdfb759018374c451b5fb..66d9355fced5b9db208e9870653f5fc673c600e2 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -225,10 +225,18 @@ is an example:
 
      ./configure CC=c89 CFLAGS=-O0 LIBS=-lposix
 
+Cross Compiling
+===============
+
 To cross-compile PSPP, you will likely need to set the
 PKG_CONFIG_LIBDIR environment variable to point to an
 appropriate pkg-config for the cross-compilation environment.
 
+Part of cross-compiling procedure builds a native binary.  Therefore, you
+will need not only the dependent libraries for your target, but also for the
+build machine.   This is because the native version is used to create
+examples for the user manual.
+
 See "Defining Variables", below, for more details.
 
 Installation Names
index 2edf516a95f8e6681181949c67868c580cc60a9b..e62a77504d01186f444a2debf8dea18e0f0736f3 100644 (file)
@@ -325,6 +325,10 @@ RELOCATABLE_STRIP=:
 
 PSPP_CHECK_PREREQS
 
+dnl The makefile needs to know if we're cross compiling, so that
+dnl it can make arrangements to build the documentation examples.
+AM_CONDITIONAL(cross_compiling, test x"$cross_compiling" = x"yes" )
+
 AC_CONFIG_FILES(
   [Makefile gl/Makefile po/Makefile tests/atlocal perl-module/lib/PSPP.pm])
 
index 3d2377c258fcdb4e96a42ff82c488dcdcb71ea5a..3571cc4960b116f22a75dca1fc975b618036ae74 100644 (file)
@@ -169,15 +169,34 @@ CLEANFILES += $(FIGURE_TXTS) $(FIGURE_SPVS) $(FIGURE_TEXIS) $(FIGURE_HTMLS)
 SUFFIXES += .sps .spv .txt .html .texi .pdf
 
 # Use pspp to process a syntax file into an output file.
-pspp = src/ui/terminal/pspp
-$(FIGURE_SPVS): $(pspp)$(EXEEXT)
+if cross_compiling
+pspp = native/src/ui/terminal/pspp
+pspp_output = native/utilities/pspp-output
+
+native/Makefile:
+       $(MKDIR_P) native
+       (cd native && $(top_srcdir)/configure --without-gui)
+
+native/gl/libgl.la: native/Makefile
+       (cd native && flock --verbose $(top_builddir)/native-lock $(MAKE) gl/libgl.la)
+
+$(pspp): native/gl/libgl.la
+       (cd native && flock --verbose $(top_builddir)/native-lock $(MAKE) src/ui/terminal/pspp)
+
+$(pspp_output): native/gl/libgl.la
+       (cd native && flock --verbose $(top_builddir)/native-lock $(MAKE) utilities/pspp-output)
+else
+pspp = src/ui/terminal/pspp$(EXEEXT)
+pspp_output = utilities/pspp-output$(EXEEXT)
+endif
+
+$(FIGURE_SPVS): $(pspp)
 .sps.spv:
        $(AM_V_GEN)(cd $(top_srcdir)/examples \
          && $(abs_top_builddir)/$(pspp) ../doc/pspp-figures/$(<F) -o - -O format=spv) > $@.tmp
        $(AM_V_at)mv $@.tmp $@
 
 # In some cases, the tutorial only wants some parts of the output.
-pspp_output = utilities/pspp-output
 convert = $(AM_V_GEN)$(pspp_output) convert $< $@
 doc/pspp-figures/tutorial2a.spv: doc/pspp-figures/tutorial2.spv $(pspp_output)
        $(convert) --command='Descriptives'