Commit 9fb82e23 authored by jayd1860's avatar jayd1860
Browse files

v1.32.4

-- Fix some bugs in path utils functions
-- More improvements in build/installation process
parent 85bd4f33
Loading
Loading
Loading
Loading
+21 −21
Original line number Diff line number Diff line
function  Buildme(targetname)
if nargin==0
    targetname = 'Homer3';
end

function  Buildme()
platform = setplatformparams();
currdir = pwd;
dirnameApp = ffpath('Homer3.m');
if exist(dirnameApp,'dir')
    cd(dirnameApp);
end

exclLst = { ...
    '.git'; ...
    'Docs'; ...
[~, appname] = fileparts(platform.exename{1});
currdir = filesepStandard(pwd);
dirnameInstall = filesepStandard(ffpath('Buildme.m'));
cd(dirnameInstall);

exclLst = {
    '.git';
    'Docs';
    'UnitTests'; ...
    'Install'; ...
    'setpaths.m'; ...
    'getpaths.m'; ...
    'Install';
    'Data';
    'setpaths.m';
    'getpaths.m';
    };

Buildexe(targetname, exclLst)
Buildexe(appname, exclLst)
rootdir = filesepStandard(fileparts(which(platform.exename{1})));
for ii = 1:length(platform.exename)
    if exist(['./',  platform.exename{ii}],'file')
        movefile(['./',  platform.exename{ii}], currdir);
    if exist([rootdir,  platform.exename{ii}],'file')
        movefile([rootdir,  platform.exename{ii}], dirnameInstall);
    end
end
if ispathvalid('./Buildme.log','file')
    movefile('./Buildme.log',currdir);
    if ~pathscompare('./', dirnameInstall)
        movefile('./Buildme.log', dirnameInstall);
    end
end
cd(currdir);
+5 −3
Original line number Diff line number Diff line
function cleanup(dirnameInstall, dirnameApp, options)
platform = setplatformparams();
global platform

installfilename = sprintf('%s_install', lower(getAppname()));

if ~exist('dirnameInstall','var') | isempty(dirnameInstall)
    if exist('./Install','dir')
@@ -16,8 +18,8 @@ if ~exist('options','var')
end


if exist([dirnameInstall, 'homer3_install'],'dir')
    rmdir_safe([dirnameInstall, 'homer3_install']);
if exist([dirnameInstall, installfilename],'dir')
    rmdir_safe([dirnameInstall, installfilename]);
end
for ii=1:length(platform.exename(1))
    if exist([dirnameInstall, platform.exename{ii}],'file')==2
+33 −32
Original line number Diff line number Diff line
function createInstallFile(options)
global installfilename

setNamespace('Homer3')
installfilename = sprintf('%s_install', lower(getAppname()));
[~, exename] = getAppname();

if ~exist('options','var') | isempty(options)
setNamespace(exename)

if ~exist('options','var') || isempty(options)
    options = 'all';
end

@@ -10,13 +14,13 @@ end
dirnameApp = getAppDir;
if isempty(dirnameApp)
    MessageBox('Cannot create installation package. Could not find root application folder.');
    deleteNamespace('Homer3')
    deleteNamespace(exename)
    return;
end
dirnameInstall = filesepStandard(fileparts(which('createInstallFile.m')));
if isempty(dirnameInstall)
    MessageBox('Cannot create installation package. Could not find root installation folder.');
    deleteNamespace('Homer3')
    deleteNamespace(exename)
    return;
end
addpath(dirnameInstall, '-end')
@@ -28,16 +32,16 @@ cleanup(dirnameInstall, dirnameApp, 'start');
% Set the executable names based on the platform type
platform = setplatformparams();

if exist([dirnameInstall, 'homer3_install'],'dir')
    rmdir_safe([dirnameInstall, 'homer3_install']);
if exist([dirnameInstall, installfilename],'dir')
    rmdir_safe([dirnameInstall, installfilename]);
end
if exist([dirnameInstall, 'homer3_install.zip'],'file')
    delete([dirnameInstall, 'homer3_install.zip']);
if exist([dirnameInstall, installfilename, '.zip'],'file')
    delete([dirnameInstall, installfilename, '.zip']);
end
mkdir([dirnameInstall, 'homer3_install']);
mkdir([dirnameInstall, 'homer3_install/FuncRegistry']);
mkdir([dirnameInstall, 'homer3_install/FuncRegistry/UserFunctions']);
mkdir([dirnameInstall, 'homer3_install/SubjDataSample']);
mkdir([dirnameInstall, installfilename]);
mkdir([dirnameInstall, installfilename, '/FuncRegistry']);
mkdir([dirnameInstall, installfilename, '/FuncRegistry/UserFunctions']);
mkdir([dirnameInstall, installfilename, '/SubjDataSample']);

% Generate executables
if ~strcmp(options, 'nobuild')
@@ -50,73 +54,70 @@ if ~strcmp(options, 'nobuild')
    end
end

dirnameDb2DotMat = findWaveletDb2([dirnameInstall, 'homer3_install/']);
dirnameDb2DotMat = findWaveletDb2([dirnameInstall, installfilename]);

% Copy files to installation package folder
for ii=1:length(platform.exename)
    if exist([dirnameInstall, platform.exename{ii}],'file')
        copyfile([dirnameInstall, platform.exename{ii}], [dirnameInstall, 'homer3_install/', platform.exename{ii}]);
        copyfile([dirnameInstall, platform.exename{ii}], [dirnameInstall, installfilename, '/', platform.exename{ii}]);
    end
end
if exist([dirnameInstall, platform.setup_script],'file')==2
    copyfile([dirnameInstall, platform.setup_script], [dirnameInstall, 'homer3_install']);
    if ispc()
        copyfile([dirnameInstall, platform.setup_script], [dirnameInstall, 'homer3_install/Autorun.bat']);
    end
    copyfile([dirnameInstall, platform.setup_script], [dirnameInstall, installfilename]);
end
for ii=1:length(platform.setup_exe)
    if exist([dirnameInstall, platform.setup_exe{ii}],'file')
        if ispc()
            copyfile([dirnameInstall, platform.setup_exe{1}], [dirnameInstall, 'homer3_install/installtemp']);
            copyfile([dirnameInstall, platform.setup_exe{1}], [dirnameInstall, installfilename, '/installtemp']);
        else
            copyfile([dirnameInstall, platform.setup_exe{ii}], [dirnameInstall, 'homer3_install/', platform.setup_exe{ii}]);
            copyfile([dirnameInstall, platform.setup_exe{ii}], [dirnameInstall, installfilename, '/', platform.setup_exe{ii}]);
        end
    end
end

if exist([dirnameApp, 'SubjDataSample'],'dir')
    copyfile([dirnameApp, 'SubjDataSample'], [dirnameInstall, 'homer3_install/SubjDataSample']);
    copyfile([dirnameApp, 'SubjDataSample'], [dirnameInstall, installfilename, '/SubjDataSample']);
end

for ii=1:length(platform.createshort_script)
    if exist([dirnameInstall, platform.createshort_script{ii}],'file')
        copyfile([dirnameInstall, platform.createshort_script{ii}], [dirnameInstall, 'homer3_install']);
        copyfile([dirnameInstall, platform.createshort_script{ii}], [dirnameInstall, installfilename]);
    end
end

if exist([dirnameApp, 'AppSettings.cfg'],'file')
    copyfile([dirnameApp, 'AppSettings.cfg'], [dirnameInstall, 'homer3_install']);
    copyfile([dirnameApp, 'AppSettings.cfg'], [dirnameInstall, installfilename]);
end

if exist([dirnameDb2DotMat, 'db2.mat'],'file')
    copyfile([dirnameDb2DotMat, 'db2.mat'], [dirnameInstall, 'homer3_install']);
    copyfile([dirnameDb2DotMat, 'db2.mat'], [dirnameInstall, installfilename]);
end

if exist([dirnameInstall, 'makefinalapp.pl'],'file')
    copyfile([dirnameInstall, 'makefinalapp.pl'], [dirnameInstall, 'homer3_install']);
    copyfile([dirnameInstall, 'makefinalapp.pl'], [dirnameInstall, installfilename]);
end

if exist([dirnameInstall, 'generateDesktopPath.bat'],'file')
    copyfile([dirnameInstall, 'generateDesktopPath.bat'], [dirnameInstall, 'homer3_install']);
    copyfile([dirnameInstall, 'generateDesktopPath.bat'], [dirnameInstall, installfilename]);
end

if exist([dirnameApp, 'README.md'],'file')
    copyfile([dirnameApp, 'README.md'], [dirnameInstall, 'homer3_install']);
    copyfile([dirnameApp, 'README.md'], [dirnameInstall, installfilename]);
end

if exist([dirnameApp, 'FuncRegistry/UserFunctions'],'dir')
    copyfile([dirnameApp, 'FuncRegistry/UserFunctions'], [dirnameInstall, 'homer3_install/FuncRegistry/UserFunctions']);
    copyfile([dirnameApp, 'FuncRegistry/UserFunctions'], [dirnameInstall, installfilename, '/FuncRegistry/UserFunctions']);
end

if ispathvalid([dirnameInstall, 'uninstall.bat'])
    copyfile([dirnameInstall, 'uninstall.bat'], [dirnameInstall, 'homer3_install/uninstall.bat']);
    copyfile([dirnameInstall, 'uninstall.bat'], [dirnameInstall, installfilename, '/uninstall.bat']);
end

% Zip it all up into a single installation file
zip([dirnameInstall, 'homer3_install.zip'], [dirnameInstall, 'homer3_install']);
zip([dirnameInstall, installfilename, '.zip'], [dirnameInstall, installfilename]);

% Clean up 
deleteNamespace('Homer3')
deleteNamespace(exename)
fclose all;
cleanup(dirnameInstall, dirnameApp);

+7 −4
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ global stats

handles = stats.handles;

msgFail{1}    = sprintf('Homer3 failed to install properly. Error code %d', stats.err);
msgFail{1}   = sprintf('%s failed to install properly. Error code %d', stats.name, stats.err);
msgFail{2}    = 'Contact jdubb@bu.edu for help with installation.';

hGui         = handles.this;
@@ -58,11 +58,11 @@ handles = stats.handles;

msgSuccess{1} = 'Installation Completed Successfully!';
if ispc()
    msgSuccess{2} = 'To run: Click on the Homer3 icon on your Desktop to launch one of these applications';
    msgSuccess{2} = sprintf('To run: Click on the %s icon on your Desktop to launch one of these applications', stats.name);
elseif islinux()
    msgSuccess{2} = 'To run: Click on the Homer3.sh icon on your Desktop to launch one of these applications';
    msgSuccess{2} = sprintf('To run: Click on the %s.sh icon on your Desktop to launch one of these applications', stats.name);
elseif ismac()
    msgSuccess{2} = 'To run: Click on the Homer3.command icon on your Desktop to launch one of these applications';
    msgSuccess{2} = sprintf('To run: Click on the %s.command icon on your Desktop to launch one of these applications', stats.name);
end

set(handles.this, 'name','SUCCESS:');
@@ -90,6 +90,9 @@ stats.handles.msgMoreInfo = handles.textMoreInfo;
stats.dirnameApp = getAppDir('isdeployed');
stats.pushbuttonOKPress = false;

stats.name = varargin{1};


fprintf('FinishInstallGUI_OpeningFcn: dirnameApp = %s\n', stats.dirnameApp);

platform = setplatformparams();

Install/getAppname.m

0 → 100644
+11 −0
Original line number Diff line number Diff line
function [appname, exename] = getAppname()
global platform

if isempty(platform) || ~isstruct(platform)
    platform = setplatformparams();
end
[~, exename] = fileparts(platform.exename{1});
appname = exename;
k = findstr('gui',lower(appname));
appname(k:k+2) = '';
Loading