diff scripts/pkg/pkg.m @ 12167:ad636c1f353b

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 b0084095098e
children 0ade5992e374
line wrap: on
line diff
--- a/scripts/pkg/pkg.m	Wed Jan 26 15:14:51 2011 -0500
+++ b/scripts/pkg/pkg.m	Wed Jan 26 15:44:51 2011 -0500
@@ -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);