| 1 |
## Copyright (C) 2026 John Donoghue |
| 2 |
## |
| 3 |
## This program is free software; you can redistribute it and/or |
| 4 |
## modify it under the terms of the GNU General Public License as |
| 5 |
## published by the Free Software Foundation; either version 3 of the |
| 6 |
## License, or (at your option) any later version. |
| 7 |
## |
| 8 |
## This program is distributed in the hope that it will be useful, but |
| 9 |
## WITHOUT ANY WARRANTY; without even the implied warranty of |
| 10 |
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 11 |
## General Public License for more details. |
| 12 |
## |
| 13 |
## You should have received a copy of the GNU General Public License |
| 14 |
## along with this program; if not, see |
| 15 |
## <http:##www.gnu.org/licenses/>. |
| 16 |
|
| 17 |
## post_install |
| 18 |
## Generic post_install to copy any .mex file matching .m files from the |
| 19 |
## base install to the arch files folder |
| 20 |
|
| 21 |
function post_install (desc) |
| 22 |
try |
| 23 |
if isfield(desc, "archprefix") && ! isempty(desc.archprefix) |
| 24 |
arch = [__octave_config_info__("canonical_host_type"), "-", ... |
| 25 |
__octave_config_info__("api_version")]; |
| 26 |
|
| 27 |
# get any mex files |
| 28 |
mex = dir (fullfile (desc.archprefix, arch, "*.mex")); |
| 29 |
|
| 30 |
for idx = 1:length (mex) |
| 31 |
# for any .m file that has name as a mex file, move it to the arch folder |
| 32 |
[~, funcname, ~] = fileparts (mex(idx).name); |
| 33 |
if exist (fullfile (desc.dir, [funcname ".m"])) |
| 34 |
movefile (fullfile (desc.dir, [funcname ".m"]), fullfile (desc.archprefix, arch, [funcname ".m"])); |
| 35 |
endif |
| 36 |
endfor |
| 37 |
endif |
| 38 |
catch |
| 39 |
warning ("error processing post_install %s", lasterr) |
| 40 |
end_try_catch |
| 41 |
endfunction |