changeset 12247:2d85734b7dd4 release-3-4-x

Let pkg.m export environment variables MKOCTFILE, OCTAVE_CONFIG and OCTAVE. For configure, set all of these, for make, all except OCTAVE. They contain the full path of the respective programs of the correct version.
author Olaf Till <olaf.till@uni-jena.de>
date Wed, 26 Jan 2011 15:44:51 -0500
parents cd8a1563bdc0
children cbe089b92e03
files doc/ChangeLog doc/interpreter/package.txi scripts/ChangeLog scripts/pkg/pkg.m
diffstat 4 files changed, 33 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/doc/ChangeLog
+++ b/doc/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-26  Olaf Till <olaf.till@uni-jena.de>
+
+	* interpreter/package.txi: Document variables MKOCTFILE,
+	OCTAVE_CONFIG, and OCTAVE exported by pkg for configure and make.
+
 2011-01-25  Rik  <octave@nomad.inbox5.com>
 
 	* Makefile.am: Remove pass-through rules for AUTHORS, BUGS, and
--- a/doc/interpreter/package.txi
+++ b/doc/interpreter/package.txi
@@ -259,11 +259,15 @@
 packages installation.  The Octave package manager will execute
 @file{./configure} in this directory if this script exists, and will
 then call @code{make} if a file @file{Makefile} exists in this
-directory.  @code{make install} will however not be called.  If a file
-called @code{FILES} exists all files listed there will be copied to the
-@code{inst} directory, so they also will be installed.  If the
-@code{FILES} file doesn't exist, @file{src/*.m} and @file{src/*.oct}
-will be copied to the @code{inst} directory.
+directory.  @code{make install} will however not be called.  The
+environment variables @env{MKOCTFILE}, @w{@env{OCTAVE_CONFIG}}, and
+@env{OCTAVE} will be set to the full paths of the programs
+@code{mkoctfile}, @code{octave-config}, and @code{octave}, respectively,
+of the correct version when @code{configure} and @code{make} are
+called.  If a file called @code{FILES} exists all files listed there
+will be copied to the @code{inst} directory, so they also will be
+installed.  If the @code{FILES} file doesn't exist, @file{src/*.m} and
+@file{src/*.oct} will be copied to the @code{inst} directory.
 
 @item package/doc
 An optional directory containing documentation for the package.  The
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2011-01-26  Olaf Till  <olaf.till@uni-jena.de>
+
+	* pkg/pkg.m: Export environment variables MKOCTFILE and
+	OCTAVE_CONFIG for configure and make, to configure also OCTAVE.
+
 2011-01-24  John W. Eaton  <jwe@octave.org>
 
 	* audio/lin2mu: Doc fix.
--- a/scripts/pkg/pkg.m
+++ b/scripts/pkg/pkg.m
@@ -1287,6 +1287,16 @@
   ## Perform ./configure, make, make install in "src".
   if (exist (fullfile (packdir, "src"), "dir"))
     src = fullfile (packdir, "src");
+    octave_bindir = octave_config_info ("bindir");
+    ver = version ();
+    mkoctfile = fullfile (octave_bindir, sprintf ("mkoctfile-%s", ver));
+    octave_config = fullfile (octave_bindir, sprintf ("octave-config-%s", ver));
+    octave_binary = fullfile (octave_bindir, sprintf ("octave-%s", ver));
+    cenv = {"MKOCTFILE"; mkoctfile;
+            "OCTAVE_CONFIG"; octave_config;
+            "OCTAVE"; octave_binary;
+            "INSTALLDIR"; desc.dir};
+    scenv = sprintf ("%s=\"%s\" ", cenv{:});
     ## Configure.
     if (exist (fullfile (src, "configure"), "file"))
       flags = "";
@@ -1302,8 +1312,9 @@
       if (isempty (getenv ("RANLIB")))
         flags = cstrcat (flags, " RANLIB=\"", octave_config_info ("RANLIB"), "\"");
       endif
-      [status, output] = shell (strcat ("cd '", src, "'; ./configure --prefix=\"",
-                                        desc.dir, "\"", flags));
+      [status, output] = shell (cstrcat ("cd '", src, "'; ", scenv,
+					 "./configure --prefix=\"",
+                                         desc.dir, "\"", flags));
       if (status != 0)
         rm_rf (desc.dir);
         error ("the configure script returned the following error: %s", output);
@@ -1315,8 +1326,7 @@
 
     ## Make.
     if (exist (fullfile (src, "Makefile"), "file"))
-      [status, output] = shell (cstrcat ("export INSTALLDIR=\"", desc.dir,
-                                         "\"; make -C '", src, "'"));
+      [status, output] = shell (cstrcat (scenv, "make -C '", src, "'"));
       if (status != 0)
         rm_rf (desc.dir);
         error ("'make' returned the following error: %s", output);