changeset 3442:ebe73c541a16

allow binary dist to work for gnu-linux target * octave-wrapper.in: New file. * bianry-dist-rules.mk: Install wrapper program for octave, octave-config, and octave-cli binaries on gnu-linux systems. Fix strip rules for gnu-linux systems. Don't install Windows-specific files on gnu-linux systems.
author John W. Eaton <jwe@octave.org>
date Wed, 22 Jan 2014 05:06:54 -0500
parents be097438c96f
children cf04cf2fa91c
files binary-dist-rules.mk octave-wrapper.in src/transfig-1-configure.patch
diffstat 2 files changed, 87 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/binary-dist-rules.mk	Wed Jan 22 05:05:01 2014 -0500
+++ b/binary-dist-rules.mk	Wed Jan 22 05:06:54 2014 -0500
@@ -9,18 +9,16 @@
 
 OCTAVE_NSI_FILE := $(TOP_DIR)/dist/octave.nsi
 
-## FIXME: We need a way to ask "is this a windows build?"
-ifeq ($(MXE_SYSTEM), mingw)
-  WINDOWS_BINARY_DIST_DEPS := msys-base npp
-endif
-ifeq ($(MXE_SYSTEM), msvc)
-  WINDOWS_BINARY_DIST_DEPS := msys-base npp
+ifeq ($(MXE_WINDOWS_BUILD),yes)
+  WINDOWS_BINARY_DIST_DEPS := \
+    msys-base \
+    native-gcc \
+    native-binutils \
+    npp
 endif
 
 BINARY_DIST_DEPS := \
   $(OCTAVE_TARGET) \
-  native-gcc \
-  native-binutils \
   octave-forge-packages \
   units \
   transfig \
@@ -54,6 +52,12 @@
   echo "  octaverc file..."
   cp $(TOP_DIR)/build_packages.m $(OCTAVE_DIST_DIR)/src \
     && cp $(TOP_DIR)/octaverc $(OCTAVE_DIST_DIR)/share/octave/site/m/startup/octaverc
+  echo "  build_packages.m..."
+  cp $(TOP_DIR)/build_packages.m $(OCTAVE_DIST_DIR)/src
+endef
+
+ifeq ($(MXE_WINDOWS_BUILD),yes)
+define copy-windows-dist-files
   echo "  native tools..."
   cd $(TOP_DIR)/native-tools/usr \
     && tar -c -h -X $(TOP_DIR)/excluded-native-files -f - . | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
@@ -69,9 +73,8 @@
   echo "  notepad++..."
   cd $(TOP_DIR) \
     && tar -c -h -f - notepad++ | ( cd $(OCTAVE_DIST_DIR) ; tar xpf - )
-  echo "  build_packages.m..."
-  cp $(TOP_DIR)/build_packages.m $(OCTAVE_DIST_DIR)/src
 endef
+endif
 
 define make-dist-files-writable
   echo "making all dist files writable by user..."
@@ -79,15 +82,51 @@
 endef
 
 ifeq ($(STRIP_DIST_FILES),yes)
-define strip-dist-files
-  echo "stripping files..."
-  for f in $$(find $(OCTAVE_DIST_DIR) -name '*.dll' -o -name '*.exe'); do \
-    $(MXE_STRIP) $$f; \
+  ifeq ($(MXE_WINDOWS_BUILD),yes)
+    define strip-dist-files
+      echo "stripping files..."
+      for f in $(shell find $(OCTAVE_DIST_DIR) -name '*.dll' -o -name '*.exe'); do \
+	$(MXE_STRIP) $$f; \
+      done
+    endef
+  else
+    define strip-dist-files
+      echo "stripping files..."
+      for f in $(shell find $(OCTAVE_DIST_DIR) -type f -a -executable); do \
+        case "`file $$f`" in \
+          *script*) \
+          ;; \
+          *executable* | *archive* | *"shared object"*) \
+            $(MXE_STRIP) $$f; \
+          ;; \
+        esac; \
+      done
+    endef
+  endif
+else
+  define strip-dist-files
+    echo "not stripping files..."
+  endef
+endif
+
+OCTAVE_WRAPPER_SCRIPTS = octave octave-cli octave-config
+
+ifeq ($(MXE_SYSTEM), gnu-linux)
+define install-octave-wrapper-scripts
+  echo "installing octave wrapper scripts..."
+  for f in $(OCTAVE_WRAPPER_SCRIPTS); do \
+    mv $(OCTAVE_DIST_DIR)/bin/$$f-$($(OCTAVE_TARGET)_VERSION) \
+       $(OCTAVE_DIST_DIR)/bin/$$f-$($(OCTAVE_TARGET)_VERSION).real; \
+    $(SED) < octave-wrapper.in \
+      -e "s|@OCTAVE_VERSION@|\"$($(OCTAVE_TARGET)_VERSION)\"|" \
+      -e "s|@GNUPLOT_MAJOR_MINOR_VERSION@|\"$(shell echo $(gnuplot_VERSION) | $(SED) -e 's/\(^[0-9]+\.[0-9]+\)/\1/')\"|" \
+      -e "s|@PROGRAM_NAME@|\"$$f\"|" > $$f-t \
+    && mv $$f-t $(OCTAVE_DIST_DIR)/bin/$$f-$($(OCTAVE_TARGET)_VERSION); \
   done
 endef
 else
-define strip-dist-files
-  echo "not stripping files..."
+define install-octave-wrapper-scripts
+  echo "no octave wrapper scripts to install for this system..."
 endef
 endif
 
@@ -97,8 +136,10 @@
 	@$(make-dist-directory)
 	@$(generate-dist-exclude-list)
 	@$(copy-dist-files)
+	@$(copy-windows-dist-files)
 	@$(make-dist-files-writable)
 	@$(strip-dist-files)
+	@$(install-octave-wrapper-scripts)
 
 define make-installer-file
   echo "generating installer script..."
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/octave-wrapper.in	Wed Jan 22 05:06:54 2014 -0500
@@ -0,0 +1,30 @@
+#! /bin/sh
+
+OCTAVE_HOME=""
+
+if [ -z "$OCTAVE_HOME" ]; then
+  echo "you must edit $0 to set OCTAVE_HOME" 1>&2
+  exit 1;
+fi
+
+PATH="$OCTAVE_HOME/bin/:$PATH"
+
+LD_LIBRARY_PATH="$OCTAVE_HOME/lib:$OCTAVE_HOME/lib64:$OCTAVE_HOME/lib/octave/@OCTAVE_VERSION@"
+
+TERMINFO="$OCTAVE_HOME/share/terminfo"
+
+TERM="vt100"
+
+FONTCONFIG_PATH="$OCTAVE_HOME/etc/fonts"
+
+GNUPLOT_DRIVER_DIR="$OCTAVE_HOME/libexec/gnuplot/@GNUPLOT_MAJOR_MINOR_VERSION@"
+
+export OCTAVE_HOME
+export PATH
+export LD_LIBRARY_PATH
+export TERMINFO
+export TERM
+export FONTCONFIG_PATH
+export GNUPLOT_DRIVER_DIR
+
+exec "$OCTAVE_HOME/bin/@PROGRAM_NAME@.real" "$@"