annotate scripts/pkg/private/configure_make.m @ 21519:8e5eca2c5a64

pkg install: drop INSTALLDIR and stop calling configure with --prefix. * pkg/private/configure_make.m: do not export INSTALLDIR, and do not call configure with "--prefix=INSTALLDIR". This is not currently used. It can even be ignored in the case of binary packages. Packages should be robust to being built and then have their contents shuffled around later. The recent changes to pkg/private/build.m also require this change (the alternative fix would be to define desc.dir there but why would we?).
author Carnë Draug <carandraug@octave.org>
date Mon, 21 Mar 2016 23:55:38 +0000
parents 2ee20a290d61
children 9ccd64201b4d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
19697
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 19603
diff changeset
1 ## Copyright (C) 2005-2015 Søren Hauberg
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
2 ## Copyright (C) 2010 VZLU Prague, a.s.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
3 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
4 ## This file is part of Octave.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
5 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
6 ## Octave is free software; you can redistribute it and/or modify it
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
7 ## under the terms of the GNU General Public License as published by
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
8 ## the Free Software Foundation; either version 3 of the License, or (at
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
9 ## your option) any later version.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
10 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
11 ## Octave is distributed in the hope that it will be useful, but
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
14 ## General Public License for more details.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
15 ##
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
16 ## You should have received a copy of the GNU General Public License
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
17 ## along with Octave; see the file COPYING. If not, see
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
18 ## <http://www.gnu.org/licenses/>.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
19
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
20 ## -*- texinfo -*-
20852
516bb87ea72e 2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents: 20713
diff changeset
21 ## @deftypefn {} {} configure_make (@var{desc}, @var{packdir}, @var{verbose})
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
22 ## Undocumented internal function.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
23 ## @end deftypefn
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
24
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
25 function configure_make (desc, packdir, verbose)
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
26 ## Perform ./configure, make, make install in "src".
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
27 if (exist (fullfile (packdir, "src"), "dir"))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
28 src = fullfile (packdir, "src");
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
29 octave_bindir = __octave_config_info__ ("bindir");
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
30 ver = version ();
21434
1da428cbf401 deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents: 20955
diff changeset
31 ext = __octave_config_info__ ("EXEEXT");
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
32 mkoctfile_program = fullfile (octave_bindir, ...
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
33 sprintf ("mkoctfile-%s%s", ver, ext));
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
34 octave_config_program = fullfile (octave_bindir, ...
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
35 sprintf ("octave-config-%s%s", ver, ext));
17613
6b8df90c8806 Add executable extension to program paths for Windows (bug #40180)
Mike Miller <mtmiller@ieee.org>
parents: 17516
diff changeset
36 octave_binary = fullfile (octave_bindir, sprintf ("octave-%s%s", ver, ext));
16824
51bcaa55f120 pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents: 16724
diff changeset
37
17516
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
38 if (! exist (mkoctfile_program, "file"))
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
39 __gripe_missing_component__ ("pkg", "mkoctfile");
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
40 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
41 if (! exist (octave_config_program, "file"))
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
42 __gripe_missing_component__ ("pkg", "octave-config");
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
43 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
44 if (! exist (octave_binary, "file"))
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
45 __gripe_missing_component__ ("pkg", "octave");
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
46 endif
21656a949661 Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents: 17016
diff changeset
47
18420
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
48 if (verbose)
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
49 mkoctfile_program = [mkoctfile_program " --verbose"];
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
50 endif
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
51
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
52 cenv = {"MKOCTFILE"; mkoctfile_program;
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
53 "OCTAVE_CONFIG"; octave_config_program;
21519
8e5eca2c5a64 pkg install: drop INSTALLDIR and stop calling configure with --prefix.
Carnë Draug <carandraug@octave.org>
parents: 21518
diff changeset
54 "OCTAVE"; octave_binary};
19584
e33427a854ec * configure_make.m: Single-quote environment variable values.
John W. Eaton <jwe@octave.org>
parents: 18986
diff changeset
55 scenv = sprintf ("%s='%s' ", cenv{:});
18420
c2d1869a95ee Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents: 17744
diff changeset
56
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
57 ## Configure.
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
58 if (exist (fullfile (src, "configure"), "file"))
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
59 flags = "";
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
60 if (isempty (getenv ("CC")))
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16824
diff changeset
61 flags = [flags ' CC="' mkoctfile("-p", "CC") '"'];
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
62 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
63 if (isempty (getenv ("CXX")))
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16824
diff changeset
64 flags = [flags ' CXX="' mkoctfile("-p", "CXX") '"'];
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
65 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
66 if (isempty (getenv ("AR")))
17016
a3f6790df115 Fix typos from cstrcat to matrix concatenation changeset (333243133364).
Rik <rik@octave.org>
parents: 16994
diff changeset
67 flags = [flags ' AR="' mkoctfile("-p", "AR") '"'];
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
68 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
69 if (isempty (getenv ("RANLIB")))
17016
a3f6790df115 Fix typos from cstrcat to matrix concatenation changeset (333243133364).
Rik <rik@octave.org>
parents: 16994
diff changeset
70 flags = [flags ' RANLIB="' mkoctfile("-p", "RANLIB") '"'];
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
71 endif
21519
8e5eca2c5a64 pkg install: drop INSTALLDIR and stop calling configure with --prefix.
Carnë Draug <carandraug@octave.org>
parents: 21518
diff changeset
72 cmd = ["cd '" src "'; " scenv "./configure " flags];
16994
333243133364 Use matrix concatenation for strings, rather than cstrcat(), for clarity and performance.
Rik <rik@octave.org>
parents: 16824
diff changeset
73 [status, output] = shell (cmd, verbose);
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
74 if (status != 0)
14471
d2c095e45196 maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents: 14466
diff changeset
75 rmdir (desc.dir, "s");
16824
51bcaa55f120 pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents: 16724
diff changeset
76 disp (output);
51bcaa55f120 pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents: 16724
diff changeset
77 error ("pkg: error running the configure script for %s.", desc.name);
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
78 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
79 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
80
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
81 ## Make.
19603
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
82 if (ispc ())
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
83 jobs = 1;
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
84 else
19833
9fc020886ae9 maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents: 19697
diff changeset
85 jobs = nproc ("overridable");
19603
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
86 endif
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
87
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
88 if (exist (fullfile (src, "Makefile"), "file"))
18986
7141d9728ee0 pkg.m: run make with multiple simultaneous jobs (bug #42915)
Carnë Draug <carandraug@octave.org>
parents: 18420
diff changeset
89 [status, output] = shell (sprintf ("%s make --jobs %i --directory '%s'",
19603
b74ae93040e8 limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents: 19584
diff changeset
90 scenv, jobs, src), verbose);
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
91 if (status != 0)
14471
d2c095e45196 maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents: 14466
diff changeset
92 rmdir (desc.dir, "s");
16824
51bcaa55f120 pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents: 16724
diff changeset
93 disp (output);
51bcaa55f120 pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents: 16724
diff changeset
94 error ("pkg: error running `make' for the %s package.", desc.name);
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
95 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
96 endif
21519
8e5eca2c5a64 pkg install: drop INSTALLDIR and stop calling configure with --prefix.
Carnë Draug <carandraug@octave.org>
parents: 21518
diff changeset
97
14466
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
98 endif
cfb0173fe1ca maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff changeset
99 endfunction