Mercurial > octave
annotate scripts/pkg/private/configure_make.m @ 27919:1891570abac8
update Octave Project Developers copyright for the new year
In files that have the "Octave Project Developers" copyright notice,
update for 2020.
author | John W. Eaton <jwe@octave.org> |
---|---|
date | Mon, 06 Jan 2020 22:29:51 -0500 |
parents | b442ec6dda5c |
children | bd51beb6205e |
rev | line source |
---|---|
27919
1891570abac8
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
27918
diff
changeset
|
1 ## Copyright (C) 2005-2020 The Octave Project Developers |
27918
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27216
diff
changeset
|
2 ## |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27216
diff
changeset
|
3 ## See the file COPYRIGHT.md in the top-level directory of this distribution |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27216
diff
changeset
|
4 ## or <https://octave.org/COPYRIGHT.html/>. |
b442ec6dda5c
use centralized file for copyright info for individual contributors
John W. Eaton <jwe@octave.org>
parents:
27216
diff
changeset
|
5 ## |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
6 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
7 ## 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
|
8 ## |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
9 ## Octave is free software: you can redistribute it and/or modify it |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
10 ## under the terms of the GNU General Public License as published by |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
11 ## the Free Software Foundation, either version 3 of the License, or |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
12 ## (at your option) any later version. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
13 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
14 ## 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
|
15 ## WITHOUT ANY WARRANTY; without even the implied warranty of |
22755
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3a2b891d0b33
maint: Standardize Copyright formatting.
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
17 ## GNU General Public License for more details. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
18 ## |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
19 ## 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
|
20 ## along with Octave; see the file COPYING. If not, see |
24534
194eb4bd202b
maint: Update punctuation for GPL v3 license text.
Rik <rik@octave.org>
parents:
24370
diff
changeset
|
21 ## <https://www.gnu.org/licenses/>. |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
22 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
23 ## -*- texinfo -*- |
20852
516bb87ea72e
2015 Code Sprint: remove class of function from docstring for all m-files.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
24 ## @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
|
25 ## Undocumented internal function. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
26 ## @end deftypefn |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
27 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
28 function configure_make (desc, packdir, verbose) |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
29 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
30 ## Perform ./configure, make, make install in "src". |
25787
3293cd2651fb
prefer 'isfolder' over 'exist (..., "dir")' in Octave functions
Mike Miller <mtmiller@octave.org>
parents:
25564
diff
changeset
|
31 if (isfolder (fullfile (packdir, "src"))) |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
32 src = fullfile (packdir, "src"); |
21434
1da428cbf401
deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents:
20955
diff
changeset
|
33 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
|
34 ver = version (); |
21434
1da428cbf401
deprecate octave_config_info
John W. Eaton <jwe@octave.org>
parents:
20955
diff
changeset
|
35 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
|
36 mkoctfile_program = fullfile (octave_bindir, ... |
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
37 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
|
38 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
|
39 sprintf ("octave-config-%s%s", ver, ext)); |
25564
65a28dec405b
use octave bat file in pkg install configure/make when in windows (Bug #53938)
John Donoghue
parents:
25054
diff
changeset
|
40 if (ispc () && ! isunix ()) |
65a28dec405b
use octave bat file in pkg install configure/make when in windows (Bug #53938)
John Donoghue
parents:
25054
diff
changeset
|
41 octave_binary = fullfile (octave_bindir, sprintf ("octave-%s.bat", ver)); |
65a28dec405b
use octave bat file in pkg install configure/make when in windows (Bug #53938)
John Donoghue
parents:
25054
diff
changeset
|
42 else |
65a28dec405b
use octave bat file in pkg install configure/make when in windows (Bug #53938)
John Donoghue
parents:
25054
diff
changeset
|
43 octave_binary = fullfile (octave_bindir, sprintf ("octave-%s%s", ver, ext)); |
65a28dec405b
use octave bat file in pkg install configure/make when in windows (Bug #53938)
John Donoghue
parents:
25054
diff
changeset
|
44 endif |
16824
51bcaa55f120
pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents:
16724
diff
changeset
|
45 |
17516
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
46 if (! exist (mkoctfile_program, "file")) |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
47 __gripe_missing_component__ ("pkg", "mkoctfile"); |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
48 endif |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
49 if (! exist (octave_config_program, "file")) |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
50 __gripe_missing_component__ ("pkg", "octave-config"); |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
51 endif |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
52 if (! exist (octave_binary, "file")) |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
53 __gripe_missing_component__ ("pkg", "octave"); |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
54 endif |
21656a949661
Add hook function to handle missing Octave components
Mike Miller <mtmiller@ieee.org>
parents:
17016
diff
changeset
|
55 |
18420
c2d1869a95ee
Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
56 if (verbose) |
c2d1869a95ee
Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
57 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
|
58 endif |
c2d1869a95ee
Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
59 |
c2d1869a95ee
Pass --verbose option to mkoctfile when installing packages with --verbose (bug #41351).
Mike Miller <mtmiller@ieee.org>
parents:
17744
diff
changeset
|
60 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
|
61 "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
|
62 "OCTAVE"; octave_binary}; |
19584
e33427a854ec
* configure_make.m: Single-quote environment variable values.
John W. Eaton <jwe@octave.org>
parents:
18986
diff
changeset
|
63 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
|
64 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
65 ## Configure. |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
66 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
|
67 flags = ""; |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
68 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
|
69 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
|
70 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
71 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
|
72 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
|
73 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
74 if (isempty (getenv ("AR"))) |
17016
a3f6790df115
Fix typos from cstrcat to matrix concatenation changeset (333243133364).
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
75 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
|
76 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
77 if (isempty (getenv ("RANLIB"))) |
17016
a3f6790df115
Fix typos from cstrcat to matrix concatenation changeset (333243133364).
Rik <rik@octave.org>
parents:
16994
diff
changeset
|
78 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
|
79 endif |
21519
8e5eca2c5a64
pkg install: drop INSTALLDIR and stop calling configure with --prefix.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
80 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
|
81 [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
|
82 if (status != 0) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
83 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
|
84 disp (output); |
51bcaa55f120
pkg: display output of shell commands on real time if verbose.
Carnë Draug <carandraug+dev@gmail.com>
parents:
16724
diff
changeset
|
85 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
|
86 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
87 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
88 |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
89 ## Make. |
19603
b74ae93040e8
limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents:
19584
diff
changeset
|
90 if (ispc ()) |
b74ae93040e8
limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents:
19584
diff
changeset
|
91 jobs = 1; |
b74ae93040e8
limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents:
19584
diff
changeset
|
92 else |
19833
9fc020886ae9
maint: Clean up m-files to follow Octave coding conventions.
Rik <rik@octave.org>
parents:
19697
diff
changeset
|
93 jobs = nproc ("overridable"); |
19603
b74ae93040e8
limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents:
19584
diff
changeset
|
94 endif |
b74ae93040e8
limit number of jobs for make command to 1 under windows (bug #44053)
Avinoam Kalma
parents:
19584
diff
changeset
|
95 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
96 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
|
97 [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
|
98 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
|
99 if (status != 0) |
14471
d2c095e45196
maint: Remove redundant private function from the package manager.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
14466
diff
changeset
|
100 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
|
101 disp (output); |
27216
823b4bcf79fc
unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
102 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
|
103 endif |
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
104 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
105 endif |
21519
8e5eca2c5a64
pkg install: drop INSTALLDIR and stop calling configure with --prefix.
Carnë Draug <carandraug@octave.org>
parents:
21518
diff
changeset
|
106 |
14466
cfb0173fe1ca
maint: Refactor pkg.m and move subfunctions to private/ directory.
Carlo de Falco <kingcrimson@tiscali.it>
parents:
diff
changeset
|
107 endfunction |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
108 |
21759
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
109 ## Executes a shell command. |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
110 ## In the end it calls system(), but in the case of MS Windows it will first |
b002b4331a12
maint: Use two newlines after endfunction and start of BIST tests.
Rik <rik@octave.org>
parents:
21758
diff
changeset
|
111 ## check if sh.exe works. |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
112 ## |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
113 ## If VERBOSE is true, it will prints the output to STDOUT in real time and |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21615
diff
changeset
|
114 ## the second output argument will be an empty string. Otherwise, it will |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
115 ## contain the output of the execeuted command. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
116 function [status, output] = shell (cmd, verbose) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
117 persistent have_sh; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
118 |
24370
b1d1229d9e83
maint: Use single quotes to simplify excessive backslash escapes in code.
Rik <rik@octave.org>
parents:
23220
diff
changeset
|
119 cmd = strrep (cmd, '\', '/'); |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
120 if (ispc () && ! isunix ()) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
121 if (isempty (have_sh)) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
122 if (system ('sh.exe -c "exit"')) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
123 have_sh = false; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
124 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
125 have_sh = true; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
126 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
127 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
128 if (have_sh) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
129 cmd = ['sh.exe -c "' cmd '"']; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
130 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
131 error ("pkg: unable to find the command shell."); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
132 endif |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
133 endif |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21615
diff
changeset
|
134 ## if verbose, we want to display the output in real time. To do this, we |
27216
823b4bcf79fc
unless necessary for formatting or code, use ' instead of `
John W. Eaton <jwe@octave.org>
parents:
26376
diff
changeset
|
135 ## must call system with 1 output argument. But then the variable 'output' |
21751
b571fc85953f
maint: Use two spaces after period to indicate sentence break.
Rik <rik@octave.org>
parents:
21615
diff
changeset
|
136 ## won't exist. So we initialize it empty. If an error does occur, and we |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
137 ## are verbose we will return an empty string but it's all fine since |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
138 ## the error message has already been displayed. |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
139 output = ""; |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
140 if (verbose) |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
141 [status] = system (cmd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
142 else |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
143 [status, output] = system (cmd); |
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
144 endif |
21758
ffad2baa90f7
maint: Use newlines to make code more readable.
Rik <rik@octave.org>
parents:
21751
diff
changeset
|
145 |
21615
9ccd64201b4d
pkg: remove excessive number of private function files.
Carnë Draug <carandraug@octave.org>
parents:
21519
diff
changeset
|
146 endfunction |