changeset 5531:eae508c12529

Add build rule for build-octave (bug #49503). * src/build-octave.mk: Add new build rule for build-octave which can be used for cross-building binary packages that depend on Octave as a build tool. * dist-files.mk: Add new file to list. * index.html: Add new package to list. * src/of-communications.mk, src/of-image.mk, src/of-mapping.mk, src/of-optiminterp.mk, src/of-sparsersb.mk, src/of-statistics.mk, src/of-windows.mk: Add optional dependency on build-octave. * configure.ac: Add new configure switch "--disable-system-octave" that is needed to build the build-octave package. * Makefile.in: Add variable "USE_SYSTEM_OCTAVE". Exclude build-octave from the default build tools and build it only if a package explicitly depends on it. Display warning about missing native Octave version only if necessary.
author Markus Mützel <markus.muetzel@gmx.de>
date Tue, 08 Sep 2020 23:04:38 +0200
parents 1b16d40c6611
children 90e3f78b2304
files Makefile.in configure.ac dist-files.mk index.html src/build-octave.mk src/of-communications.mk src/of-image.mk src/of-mapping.mk src/of-optiminterp.mk src/of-sparsersb.mk src/of-statistics.mk src/of-windows.mk
diffstat 12 files changed, 150 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Tue Sep 08 16:04:48 2020 +0200
+++ b/Makefile.in	Tue Sep 08 23:04:38 2020 +0200
@@ -65,6 +65,12 @@
 # if cross, compiling, this also means we will attempt to create cross mkoctfile
 ENABLE_BINARY_PACKAGES := @ENABLE_BINARY_PACKAGES@
 
+# Set to "no" to build a minimal Octave that runs on the build system.
+# That version can be used for cross-building binary packages that depend
+# on Octave as a build tool. If "yes", it is tried to use an Octave that
+# is already installed on the build system (default is "yes").
+USE_SYSTEM_OCTAVE := @USE_SYSTEM_OCTAVE@
+
 # create and install devel tools (default no)
 ENABLE_DEVEL_TOOLS := @ENABLE_DEVEL_TOOLS@
 
@@ -257,6 +263,8 @@
 
 BUILD_COMPILER_TOOLS := build-gcc build-binutils
 BUILD_TOOLS := $(ALL_BUILD_TOOLS)
+# build-octave is added as an explicit dependency in the of- packages that need it
+BUILD_TOOLS := $(filter-out build-octave, $(BUILD_TOOLS))
 # Building flex for native mingw fails, so disable it.
 ifeq ($(MXE_NATIVE_MINGW_BUILD),yes)
   REQUIREMENTS += flex
@@ -307,6 +315,7 @@
 TMP_DIR     = $(TOP_BUILD_DIR)/tmp-$(1)
 MAKEFILE   := $(TOP_BUILD_DIR)/Makefile
 PKGS       := $(filter-out $(ALL_BUILD_TOOLS), $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html'))
+PKGS += build-octave
 
 ENV_PATH := $(PATH)
 PATH := $(BUILD_TOOLS_PREFIX)/bin:$(PATH)
@@ -723,9 +732,13 @@
 	@echo '[check requirements]'
 	$(foreach REQUIREMENT,$(REQUIREMENTS),$(call CHECK_REQUIREMENT,$(REQUIREMENT)))
 ifneq ($(MXE_NATIVE_BUILD),yes)
+  ifeq ($(USE_SYSTEM_OCTAVE),yes)
+    ifeq ($(ENABLE_BINARY_PACKAGES),yes)
 	@if ! octave -W --version | head -1 | grep ' \($($(OCTAVE_TARGET)_VERSION)\)$$' >/dev/null; then \
-	  echo "Warning - could not find native build version $($(OCTAVE_TARGET)_VERSION) of octave - some packages may fail, but continuing"; \
+	  echo "Warning - could not find native build version $($(OCTAVE_TARGET)_VERSION) of Octave - some packages may fail, but continuing"; \
 	fi
+    endif
+  endif
 endif
 	@[ -d '$(STAMP_DIR)' ] || mkdir -p '$(STAMP_DIR)'
 	@if test "$(USE_SYSTEM_GCC)" = yes; then \
--- a/configure.ac	Tue Sep 08 16:04:48 2020 +0200
+++ b/configure.ac	Tue Sep 08 23:04:38 2020 +0200
@@ -326,6 +326,16 @@
    esac], [ENABLE_BINARY_PACKAGES=no])
 AC_SUBST(ENABLE_BINARY_PACKAGES)
 
+AC_ARG_ENABLE([system-octave],
+  [AS_HELP_STRING([--disable-system-octave],
+    [Build a minimal Octave that runs on the build system. This only applies if binary packages are cross-built (default: enable, i.e. use an already installed Octave)])],
+  [case "$enableval" in
+     no) USE_SYSTEM_OCTAVE=no ;;
+     yes) USE_SYSTEM_OCTAVE=yes ;;
+     *) AC_MSG_ERROR([bad value "$enableval" for --disable-system-octave]) ;;
+   esac], [USE_SYSTEM_OCTAVE=yes])
+AC_SUBST(USE_SYSTEM_OCTAVE)
+
 AC_ARG_ENABLE([devel-tools],
   [AS_HELP_STRING([--enable-devel-tools],
     [Enable building developer tools such as gdb (default: disable)])],
--- a/dist-files.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/dist-files.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -41,6 +41,7 @@
   build-meson.mk \
   build-msvctools.mk \
   build-ninja.mk \
+  build-octave.mk \
   build-perl.mk \
   build-pkg-config-1-fixes.patch \
   build-pkg-config.mk \
--- a/index.html	Tue Sep 08 16:04:48 2020 +0200
+++ b/index.html	Tue Sep 08 23:04:38 2020 +0200
@@ -1050,6 +1050,10 @@
         <td class="website"><a href="https://ninja-build.org/">build-ninja</a></td>
     </tr>
     <tr>
+        <td class="package">build-octave</td>
+        <td class="website">Minimal version of <a href="http://www.octave.org">Octave</a> for cross-compiling some binary packages</td>
+    </tr>
+    <tr>
         <td class="package">build-perl</td>
         <td class="website"><a href="http://www.perl.org">perl</a></td>
     </tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/build-octave.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -0,0 +1,69 @@
+# This file is part of MXE.
+# See index.html for further information.
+
+## This package is intended for building a minimal version of Octave that
+## runs on the build system.  Some Octave Forge packages need Octave as a
+## build tool.
+## This version of Octave is built from the same tarball that is used for
+## cross-compiling.  However, the native Octave is unavoidably different
+## from the Octave that is built for the target system.  Packages must be
+## careful when relying on Octave for configuration settings.  Wherever
+## possible, packages should try to not depend on Octave as a build tool
+## and should use alternatives instead (e.g., [target]-octave-config or
+## check the macros defined in octave-config.h).
+##
+## It is assumed that the necessary dependencies for a native build are
+## present on the build system.
+
+PKG             := build-octave
+$(PKG)_IGNORE   :=
+$(PKG)_VERSION  := $($(OCTAVE_TARGET)_VERSION)
+$(PKG)_CHECKSUM := $($(OCTAVE_TARGET)_CHECKSUM)
+$(PKG)_SUBDIR   := $($(OCTAVE_TARGET)_SUBDIR)
+$(PKG)_FILE     := $($(OCTAVE_TARGET)_FILE)
+$(PKG)_URL      := $($(OCTAVE_TARGET)_URL)
+$(PKG)_DEPS     := $(OCTAVE_TARGET)
+
+## The following dependencies and some native build tools are necessary
+## on the build system:
+# $(PKG)_DEPS     := blas lapack pcre
+
+define $(PKG)_UPDATE
+    echo 'Warning: Updates are disabled for package build-octave.' >&2;
+    echo $($(PKG)_VERSION)
+endef
+
+$(PKG)_ENV_FLAGS := \
+    PKG_CONFIG_PATH='$(BUILD_PKG_CONFIG_PATH)' \
+    LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)' \
+    PATH='$(ENV_PATH)'
+
+ifeq ($(ENABLE_64),yes)
+  $(PKG)_ENABLE_64_CONFIGURE_OPTIONS := --enable-64
+else
+  $(PKG)_ENABLE_64_CONFIGURE_OPTIONS := --disable-64
+endif
+
+define $(PKG)_BUILD
+    mkdir '$(1)/.build'
+    cd '$(1)/.build' && \
+        $($(PKG)_ENV_FLAGS) '$(1)/configure' \
+        --prefix=$(ROOT_PREFIX) \
+        $($(PKG)_ENABLE_64_CONFIGURE_OPTIONS) \
+        --disable-docs --disable-fftw-threads --disable-java \
+        --disable-jit --disable-openmp --disable-readline --without-amd \
+        --without-arpack --without-bz2 --without-camd --without-ccolamd \
+        --without-cholmod --without-colamd --without-curl \
+        --without-cxsparse --without-fftw3 --without-fftw3f \
+        --without-fltk --without-fontconfig --without-framework-opengl \
+        --without-freetype --without-glpk --without-hdf5 --without-klu \
+        --without-magick --without-opengl --without-openssl \
+        --without-osmesa --without-portaudio --without-qhull \
+        --without-qrupdate --without-qscintilla --without-qt \
+        --without-sndfile --without-sundials_ida \
+        --without-sundials_nvecserial --without-umfpack --without-x \
+        --without-z
+
+    $($(PKG)_ENV_FLAGS) $(MAKE) -C '$(1)/.build' all -j '$(JOBS)'
+    $($(PKG)_ENV_FLAGS) $(MAKE) -C '$(1)/.build' install
+endef
--- a/src/of-communications.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-communications.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,7 +5,7 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 1.2.2
 $(PKG)_CHECKSUM := 90ebf5cd84ba8df1f8c14241598d0baedc39f371
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := communications-$($(PKG)_VERSION)
 $(PKG)_FILE     := communications-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
@@ -13,6 +13,12 @@
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 $(PKG)_OPTIONS := comm_cv_hdf5_cppflags='-I$(HOST_INCDIR)' comm_cv_hdf5_ldflags='-L$(HOST_LIBDIR)' comm_cv_hdf5_libs=-lhdf5
--- a/src/of-image.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-image.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,14 +5,20 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 2.12.0
 $(PKG)_CHECKSUM := 0d15ba153ea5d4fd5f658b551b7009a27a454cf3
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := image-$($(PKG)_VERSION)
 $(PKG)_FILE     := image-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
-$(PKG)_DEPS     := 
+$(PKG)_DEPS     :=
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE
--- a/src/of-mapping.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-mapping.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,7 +5,7 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 1.4.0
 $(PKG)_CHECKSUM := e26da08449cda32508cdca3225c087060fa0fe16
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := mapping-$($(PKG)_VERSION)
 $(PKG)_FILE     := mapping-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
@@ -13,6 +13,12 @@
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE
--- a/src/of-optiminterp.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-optiminterp.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,14 +5,20 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 0.3.6
 $(PKG)_CHECKSUM := 8d6309f389ccfadaadd0dd52e84db21aa75b82f3
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := optiminterp-$($(PKG)_VERSION)
 $(PKG)_FILE     := optiminterp-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
-$(PKG)_DEPS     := 
+$(PKG)_DEPS     :=
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE
--- a/src/of-sparsersb.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-sparsersb.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,7 +5,7 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 1.0.7
 $(PKG)_CHECKSUM := b218a4825445731925021335064990fa71708898
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := sparsersb-$($(PKG)_VERSION)
 $(PKG)_FILE     := sparsersb-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
@@ -13,6 +13,12 @@
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE
--- a/src/of-statistics.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-statistics.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,7 +5,7 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 1.4.2
 $(PKG)_CHECKSUM := 8329abd3da0f75f94e5ea85bb6e51dc16c7d0274
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := statistics-$($(PKG)_VERSION)
 $(PKG)_FILE     := statistics-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
@@ -13,6 +13,12 @@
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE
--- a/src/of-windows.mk	Tue Sep 08 16:04:48 2020 +0200
+++ b/src/of-windows.mk	Tue Sep 08 23:04:38 2020 +0200
@@ -5,14 +5,20 @@
 $(PKG)_IGNORE   :=
 $(PKG)_VERSION  := 1.5.0
 $(PKG)_CHECKSUM := c2323df04664626a30d837154f2a7ea3255b9182
-$(PKG)_REMOTE_SUBDIR := 
+$(PKG)_REMOTE_SUBDIR :=
 $(PKG)_SUBDIR   := windows-$($(PKG)_VERSION)
 $(PKG)_FILE     := windows-$($(PKG)_VERSION).tar.gz
 $(PKG)_URL      := '$(OCTAVE_FORGE_BASE_URL)/$($(PKG)_FILE)/download'
-$(PKG)_DEPS     := 
+$(PKG)_DEPS     :=
 
 ifeq ($(ENABLE_BINARY_PACKAGES),yes)
     $(PKG)_DEPS += $(OCTAVE_TARGET)
+    ifeq ($(MXE_NATIVE_BUILD),no)
+        ifeq ($(USE_SYSTEM_OCTAVE),no)
+            # Remove this when package builds without calling Octave
+            $(PKG)_DEPS += build-octave
+        endif
+    endif
 endif
 
 define $(PKG)_UPDATE