changeset 4192:438a4bfdc887

new rules for creating a tarball from Octave's hg sources * hg-octave-dist.mk: New file. * Makefile.in: Include hg-octave-dist.mk. (ENV_PATH, ENV_PKG_CONFIG_PATH, ENV_LD_LIBRARY_PATH): Capture values from environment.
author John W. Eaton <jwe@octave.org>
date Mon, 29 Aug 2016 11:21:19 -0400
parents 851b9f4a6b1c
children 32814edc00db
files Makefile.in hg-octave-dist.mk
diffstat 2 files changed, 54 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.in	Tue Aug 09 13:03:07 2016 +0900
+++ b/Makefile.in	Mon Aug 29 11:21:19 2016 -0400
@@ -250,8 +250,11 @@
 MAKEFILE   := $(TOP_BUILD_DIR)/Makefile
 PKGS       := $(filter-out $(ALL_BUILD_TOOLS), $(shell $(SED) -n 's/^.* class="package">\([^<]*\)<.*$$/\1/p' '$(TOP_DIR)/index.html'))
 
+ENV_PATH := $(PATH)
 PATH := $(BUILD_TOOLS_PREFIX)/bin:$(PATH)
 
+ENV_PKG_CONFIG_PATH := $(PKG_CONFIG_PATH)
+
 CONFIGURE_CPPFLAGS := CPPFLAGS='-I$(HOST_PREFIX)/include'
 ifeq ($(MXE_USE_LIB64_DIRECTORY),yes)
   CONFIGURE_LDFLAGS := LDFLAGS='-L$(HOST_PREFIX)/lib -L$(HOST_PREFIX)/lib64'
@@ -365,6 +368,8 @@
   MAKE_SHARED_FROM_STATIC_OPTIONS := --windowsdll
 endif
 
+ENV_LD_LIBRARY_PATH := $(LD_LIBRARY_PATH)
+
 ifeq ($(MXE_SYSTEM),mingw)
   MXE_WINDOWS_BUILD := yes
   ifneq ($(MXE_NATIVE_BUILD),yes)
@@ -881,3 +886,5 @@
 	$(TAR) czf $(distdir).tar.gz $(distdir)
 
 include $(TOP_DIR)/binary-dist-rules.mk
+
+include $(TOP_DIR)/hg-octave-dist.mk
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/hg-octave-dist.mk	Mon Aug 29 11:21:19 2016 -0400
@@ -0,0 +1,47 @@
+## Build and Octave tarball distribution from hg sources.  The
+## resulting tarball may then be used by the default-octave target to
+## build.  So the typical steps for building Octave from the mercurial
+## sources are
+##
+##  ./bootstrap
+##  ./configure --enable-octave=default
+##  make hg-octave-dist
+##  make
+##
+## The version number set in the mercurial sources for Octave must
+## match the one used in src/default-octave.mk.
+
+## Set PATH, PKG_CONFIG_PATH, and LD_LIBRARY_PATH to the original
+## values from the environment so that we avoid the tools that we've
+## built for cross compiling.  For these rules to work, you must have
+## appropriate versions of the required tool installed outside of the
+## mxe-octave build tree.  Things like pkg-config and other tools that
+## are built for mxe-octave may produce the wrong values for these
+## steps, especially if we eventually intend to cross compile Octave.
+## Rather than try to work around those issues, it seems simpler to
+## just use the system tools for this job.
+
+HG_OCTAVE_DIST_ENV_FLAGS := \
+  PKG_CONFIG_PATH='$(ENV_PKG_CONFIG_PATH)' \
+  LD_LIBRARY_PATH='$(LD_LIBRARY_PATH)' \
+  PATH='$(ENV_PATH)'
+
+.PHONY: hg-octave-dist
+hg-octave-dist: $(BUILD_TOOLS) update-hg-octave-repo
+	cd octave-hg-repo && \
+	rm -rf .build && \
+	mkdir .build && \
+	$(HG_OCTAVE_DIST_ENV_FLAGS) ./bootstrap && \
+	cd .build && \
+	$(HG_OCTAVE_DIST_ENV_FLAGS) ../configure && \
+	$(HG_OCTAVE_DIST_ENV_FLAGS) make -j '$(JOBS)' all && \
+	$(HG_OCTAVE_DIST_ENV_FLAGS) make -j '$(JOBS)' dist && \
+	mv '$(hg-octave_FILE)' '../../pkg/$(hg-octave_FILE)'
+
+.PHONY: update-hg-octave-repo
+update-hg-octave-repo:
+	if [ -d octave-hg-repo ]; then \
+	  cd octave-hg-repo && hg pull -u; \
+	else \
+	  hg clone http://octave.org/hg/octave octave-hg-repo; \
+	fi