From 371ef580f18e61e44028daa3f74e31a18f436254 Mon Sep 17 00:00:00 2001 From: onefang Date: Wed, 15 Dec 2021 02:30:48 +1000 Subject: sledjchisl build command no longer does tmux shenanigans. --- BuildIt.sh | 4 +-- src/sledjchisl/sledjchisl.c | 87 ++++++++++++++++++++++++--------------------- 2 files changed, 48 insertions(+), 43 deletions(-) diff --git a/BuildIt.sh b/BuildIt.sh index 7f4f308..ea2b418 100755 --- a/BuildIt.sh +++ b/BuildIt.sh @@ -3,6 +3,4 @@ pushd src >/dev/null time ./BuildIt.sh popd >/dev/null -sudo chown -R opensimsc:opensimsc * -sudo chown -R opensimsc:opensimsc .??* -bin/sledjchisl build -v +time bin/sledjchisl build -v diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c index 3d1e645..673b576 100644 --- a/src/sledjchisl/sledjchisl.c +++ b/src/sledjchisl/sledjchisl.c @@ -1307,14 +1307,23 @@ static void buildOpensim() { char *t = xmprintf("%s/current_NEW", scRoot); - I("Building opensim-SC in %s", t); - copyOpenSim(t); + if (BUILD == currentMode) + { + free(t); + t = xmprintf("."); + I("Building opensim-SC in current directory."); + } + else + { + copyOpenSim(t); + I("Building opensim-SC in %s", t); - if (shellMeFail("chmod -R a+x %s/*.sh", t)) C("Can't set proper permissions for %s/*.sh", t); - if (shellMeFail("chmod -R a+x %s/scripts/*.sh", t)) C("Can't set proper permissions for %s/scripts/*.sh", t); - if (shellMeFail("chmod -R a+x %s/scripts/install/*.sh", t)) C("Can't set proper permissions for %s/scripts/install/*.sh", t); - if (shellMeFail("chmod a+x %s/scripts/show-console", t)) C("Can't set proper permissions for %s/scripts/show-console", t); - if (shellMeFail("chmod a+x %s/scripts/start-sim", t)) C("Can't set proper permissions for %s/scripts/start-sim", t); + if (shellMeFail("chmod -R a+x %s/*.sh", t)) C("Can't set proper permissions for %s/*.sh", t); + if (shellMeFail("chmod -R a+x %s/scripts/*.sh", t)) C("Can't set proper permissions for %s/scripts/*.sh", t); + if (shellMeFail("chmod -R a+x %s/scripts/install/*.sh", t)) C("Can't set proper permissions for %s/scripts/install/*.sh", t); + if (shellMeFail("chmod a+x %s/scripts/show-console", t)) C("Can't set proper permissions for %s/scripts/show-console", t); + if (shellMeFail("chmod a+x %s/scripts/start-sim", t)) C("Can't set proper permissions for %s/scripts/start-sim", t); + } /* # Poor mans git sub modules / subtrees, coz otherwise it gets complex. @@ -1362,20 +1371,25 @@ fi if (shellMeFail("cd %s; msbuild /p:Configuration=Debug /verbosity:minimal", t)) C("Failed to msbuild!"); // if (shellMeFail("cd %s; msbuild /p:Configuration=Release /verbosity:minimal", t)) C("Failed to msbuild!"); // #cp -f addon-modules/Gloebit/GloebitMoneyModule/bin/Gloebit.dll bin - if (shellMeFail("cd %s/src; ./BuildIt.sh", t)) C("Failed to compile sledjchisl!"); - free(t); - t = xmprintf("%s/current", scRoot); - if (readlink0(t, toybuf, sizeof(toybuf))) + + if (BUILD != currentMode) { - I("Making a backup of %s", toybuf); - if (shellMeFail("rm -fr %s_BACKUP", toybuf)) W("Failed to remove old backup."); - if (shellMeFail("mv %s %s_BACKUP", toybuf, toybuf)) C("Failed to create backup!"); + if (shellMeFail("cd %s/src; ./BuildIt.sh", t)) C("Failed to compile sledjchisl!"); + free(t); + t = xmprintf("%s/current", scRoot); + if (readlink0(t, toybuf, sizeof(toybuf))) + { + I("Making a backup of %s", toybuf); + if (shellMeFail("rm -fr %s_BACKUP", toybuf)) W("Failed to remove old backup."); + if (shellMeFail("mv %s %s_BACKUP", toybuf, toybuf)) C("Failed to create backup!"); + } + free(t); + snprintf(toybuf, sizeof(toybuf), "%s/current", scRoot); + t = xmprintf("%s/current_NEW", scRoot); + if (shellMeFail("rm -fr %s", toybuf)) C("Failed to remove old symlink."); + if (0 != symlink(t, toybuf)) perror_msg("Symlinking %s to %s", t, toybuf); } - free(t); - snprintf(toybuf, sizeof(toybuf), "%s/current", scRoot); - t = xmprintf("%s/current_NEW", scRoot); - if (shellMeFail("rm -fr %s", toybuf)) C("Failed to remove old symlink."); - if (0 != symlink(t, toybuf)) perror_msg("Symlinking %s to %s", t, toybuf); + I("Done building opensim-SC in %s", t); free(t); } @@ -8656,6 +8670,15 @@ jit library is loaded or the JIT compiler will not be activated. */ luaL_openlibs(L); // Load Lua libraries. +//////////////////////////////////////////////////////////////////////////////////////////////////// +// Build all of opensim-SC +//////////////////////////////////////////////////////////////////////////////////////////////////// + if (BUILD == currentMode) + { + buildOpensim(); + goto finished; + } + /* Load the config scripts. Normally we start in /opt/opensim_SC current/bin/sledjchisl here is a symlink to ../src/build/toybox/toybox or ../src/build/toybox/generated/unstripped/toybox @@ -8884,17 +8907,11 @@ Copy correct config/config.ini to there. // After the session is created, we rely on the scRun directory to be group sticky, so that anyone in the opensim group can attach to the tmux socket. pre = xmprintf("sudo -Hu %s ", scUser); } - if (BUILD == currentMode) - snprintf(toybuf, sizeof(toybuf), - "%s %s %s/%s set-option -g default-command 'export PATH=%s:$PATH; bash'\\; " - // Set x,y to huge values, to work around an OpenSim bug. - "new-session -d -x 256 -y 420 -s %s -n '%s' bash -c 'export PATH=%s:$PATH; printf \"\\033]0;SledjChisl\\007\"; " - "/usr/bin/valgrind --leak-check=full %s/current/bin/sledjchisl %s %s; cd %s; bash' \\; " - , - pre, Tcmd, scRun, Tsocket, scBin, - Tconsole, Ttab, scBin, - scRoot, modeStrings[currentMode], FLAG(v) ? "-v" : "", scRoot - ); + if (BUILD == currentMode) // Shouldn't happen, we deal with this above. + { + free(pre); + goto finished; + } else snprintf(toybuf, sizeof(toybuf), "%s %s %s/%s set-option -g default-command 'export PATH=%s:$PATH; bash'\\; " @@ -9048,16 +9065,6 @@ Copy correct config/config.ini to there. perror_msg("Symlinking %s to %s", newPath, tmp); free(tmp); free(newPath); - - -//////////////////////////////////////////////////////////////////////////////////////////////////// -// Build all of opensim-SC -//////////////////////////////////////////////////////////////////////////////////////////////////// - if (BUILD == currentMode) - { - buildOpensim(); - goto finished; - } } -- cgit v1.1