aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/sledjchisl
diff options
context:
space:
mode:
authoronefang2021-09-04 12:20:46 +1000
committeronefang2021-09-04 12:20:46 +1000
commit76f3c26714c4b366f36c05cf0cbbf1fa7bdab329 (patch)
treec70ca7789a133a589b627c9bf4054b6e8eae797e /src/sledjchisl
parentSelf build, part 0 - build sledjchisl if it doesn't exist. (diff)
downloadopensim-SC-76f3c26714c4b366f36c05cf0cbbf1fa7bdab329.zip
opensim-SC-76f3c26714c4b366f36c05cf0cbbf1fa7bdab329.tar.gz
opensim-SC-76f3c26714c4b366f36c05cf0cbbf1fa7bdab329.tar.bz2
opensim-SC-76f3c26714c4b366f36c05cf0cbbf1fa7bdab329.tar.xz
Self build, part 1 - build opensim-SC if it doesn't exist.
Diffstat (limited to 'src/sledjchisl')
-rw-r--r--src/sledjchisl/sledjchisl.c358
1 files changed, 193 insertions, 165 deletions
diff --git a/src/sledjchisl/sledjchisl.c b/src/sledjchisl/sledjchisl.c
index aa40936..a869647 100644
--- a/src/sledjchisl/sledjchisl.c
+++ b/src/sledjchisl/sledjchisl.c
@@ -1250,6 +1250,184 @@ struct _simList
1250}; 1250};
1251simList *ourSims = NULL; 1251simList *ourSims = NULL;
1252 1252
1253static void copyOpenSim(char *t)
1254{
1255 if (shellMeFail("rm -fr ", t)) E("Failed to rm!");
1256 if ((! qfile_exist(t)) && (! qfile_mkdir(t, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", t);
1257// TODO - have to make sure it's all owned by opensimsc.
1258 if (shellMeFail("cd %s; cp -al %s/current/* -t %s ", scRoot, scRoot, t)) C("Failed to cp!");
1259 if (shellMeFail("cd %s; cp -al %s/current/.??* -t %s ", scRoot, scRoot, t)) C("Failed to cp!");
1260}
1261
1262static void buildOpensim()
1263{
1264 char *t = xmprintf("%s/current_NEW", scRoot);
1265
1266 I("Building opensim-SC in %s", t);
1267 copyOpenSim(t);
1268
1269 if (shellMeFail("chmod -R a+x %s/*.sh", t)) C("Can't set proper permissions for %s/*.sh", t);
1270 if (shellMeFail("chmod -R a+x %s/scripts/*.sh", t)) C("Can't set proper permissions for %s/scripts/*.sh", t);
1271 if (shellMeFail("chmod -R a+x %s/scripts/install/*.sh", t)) C("Can't set proper permissions for %s/scripts/install/*.sh", t);
1272 if (shellMeFail("chmod a+x %s/scripts/show-console", t)) C("Can't set proper permissions for %s/scripts/show-console", t);
1273 if (shellMeFail("chmod a+x %s/scripts/start-sim", t)) C("Can't set proper permissions for %s/scripts/start-sim", t);
1274
1275/*
1276# Poor mans git sub modules / subtrees, coz otherwise it gets complex.
1277#if [ ! -d git-sub-modules/opensim-moneymodule-gloebit ]; then
1278# pushd git-sub-modules >/dev/null
1279# git clone https://github.com/gloebit/opensim-moneymodule-gloebit.git
1280# popd >/dev/null
1281#else
1282# pushd git-sub-modules/opensim-moneymodule-gloebit >/dev/null
1283# git pull
1284# popd >/dev/null
1285#fi
1286#rm -rf addon-modules/Gloebit/GloebitMoneyModule
1287#cp -r git-sub-modules/opensim-moneymodule-gloebit/addon-modules/Gloebit/GloebitMoneyModule addon-modules/Gloebit/
1288*/
1289 if (shellMeFail("cd %s; ./runprebuild.sh autoclean | grep -v '...Cleaning project:'", t)) E("Failed to autoclean!");
1290 // Clean the stuff autoclean forgets to clean. I feel so dirty.
1291 if (shellMeFail("cd %s; find -name obj -type d -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
1292 if (shellMeFail("cd %s; find -name *.csproj -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
1293 if (shellMeFail("cd %s; find -name *.csproj.* -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
1294 if (shellMeFail("cd %s; find -name *.pdb -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
1295 if (shellMeFail("cd %s; rm -fr bin/ScriptEngines", t)) E("Failed to rm ScriptEngines!");
1296 // Clean the stuff the tests created.
1297 if (shellMeFail("cd %s; rm Test*.txt", t)) E("Failed to Test results!");
1298/*
1299# Prebuild converts Microsoft.CSharp.targets to Microsoft.CSHARP.Targets, which case sensitive file systems fail to find.
1300#find -name *.csproj | xargs sed -i "s@Microsoft.CSHARP.Targets@Microsoft.CSharp.targets@g"
1301
1302# Debian no longer provides nant.
1303#./nant-color
1304
1305if [ "4" == $(mono -V | head -n 1 | cut -d ' ' -f 5 | cut -d '.' -f 1) ]; then
1306 export XBUILD_COLORS=errors=brightred,warnings=yellow,events=blue
1307 xbuild /target:clean
1308 xbuild /p:TargetFrameworkVersion="v4.5"xbuild /p:TargetFrameworkVersion="v4.5"
1309else
1310 # Use this for Mono 5 and later.
1311 msbuild /p:Configuration=Release
1312# msbuild /p:Configuration=Debug
1313fi
1314*/
1315 // Use this for Mono 5 and later.
1316 if (shellMeFail("cd %s; ./runprebuild.sh vs2015 | grep -v '...Creating project:'", t)) C("Failed to prebuild!");
1317 // msbuild has a /maxcpucount option, but it takes longer to count the CPUs than it takes to compile, so ends up taking MORE time. Pffft.
1318 if (shellMeFail("cd %s; msbuild /p:Configuration=Debug /verbosity:minimal", t)) C("Failed to msbuild!");
1319// if (shellMeFail("cd %s; msbuild /p:Configuration=Release /verbosity:minimal", t)) C("Failed to msbuild!");
1320// #cp -f addon-modules/Gloebit/GloebitMoneyModule/bin/Gloebit.dll bin
1321 if (shellMeFail("cd %s/src; ./BuildIt.sh", t)) C("Failed to compile sledjchisl!");
1322 free(t);
1323 t = xmprintf("%s/current", scRoot);
1324 if (readlink0(t, toybuf, sizeof(toybuf)))
1325 {
1326 I("Making a backup of %s", toybuf);
1327 if (shellMeFail("rm -fr %s_BACKUP", toybuf)) W("Failed to remove old backup.");
1328 if (shellMeFail("mv %s %s_BACKUP", toybuf, toybuf)) C("Failed to create backup!");
1329 }
1330 free(t);
1331 snprintf(toybuf, sizeof(toybuf), "%s/current", scRoot);
1332 t = xmprintf("%s/current_NEW", scRoot);
1333 if (shellMeFail("rm -fr %s", toybuf)) C("Failed to remove old symlink.");
1334 if (0 != symlink(t, toybuf)) perror_msg("Symlinking %s to %s", t, toybuf);
1335 I("Done building opensim-SC in %s", t);
1336 free(t);
1337}
1338
1339static void runTests(char *tests[], char *title, char* file)
1340{
1341 char *t = "export MONO_THREADS_PER_CPU=100;";
1342 int i = 0;
1343
1344 // For printing out line numbers use "exec /usr/bin/cli --debug /usr/lib/nunit/nunit-console.exe" instead of "nunit-console".
1345 if (FLAG(v))
1346 snprintf(toybuf, sizeof(toybuf), "echo '%s tests.'; cd %s; %s exec /usr/bin/cli --debug /usr/lib/nunit/nunit-console.exe ", title, scTemp, t);
1347 else
1348 snprintf(toybuf, sizeof(toybuf), "echo '%s tests.'; cd %s; %s nunit-console ", title, scTemp, t);
1349 while(NULL != tests[i])
1350 {
1351 t = xmprintf("%s/current/bin/%s.dll ", scRoot, tests[i++]);
1352 strcat(toybuf, t);
1353 free(t);
1354 }
1355 t = xmprintf("-nologo -output=Test%sOutput.txt -err=Test%sError.txt -labels -noxml ", file, file);
1356 strcat(toybuf, t);
1357 free(t);
1358 I(toybuf);
1359 shellMe(toybuf);
1360}
1361static void testOpenSim(simData *simd, char *sim, char *type, int count, int window, int panes, int pane)
1362{
1363 char *t = xmprintf("%s/../db", scTemp);
1364
1365 if ((! qfile_exist(t)) && (! qfile_mkdir(t, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", t);
1366 free(t);
1367 char *standard0[] =
1368 {
1369 "OpenSim.Tests",
1370 "OpenSim.Framework.Tests",
1371 "OpenSim.Framework.Servers.Tests",
1372 "OpenSim.Framework.Serialization.Tests",
1373 "OpenSim.Region.ClientStack.LindenCaps.Tests",
1374 "OpenSim.Region.ClientStack.LindenUDP.Tests",
1375 "OpenSim.Region.ScriptEngine.Tests",
1376 "OpenSim.Region.CoreModules.Tests",
1377 "OpenSim.Region.Framework.Tests",
1378 NULL
1379 };
1380 runTests(standard0, "Standard", "");
1381 char *SQL[] =
1382 {
1383 "OpenSim.Data.Tests",
1384 NULL
1385 };
1386 runTests(SQL, "SQL", "SQL");
1387 char *standard1[] =
1388 {
1389 "OpenSim.Capabilities.Handlers.Tests",
1390 "OpenSim.Server.Handlers.Tests",
1391 "OpenSim.Services.InventoryService.Tests",
1392 "OpenSim.Tests.Permissions", // Naturally OpenSim can't be consistent.
1393 NULL
1394 };
1395 runTests(standard1, "Standard part 2", "1");
1396 char *Physics[] =
1397 {
1398 "OpenSim.Region.PhysicsModule.BulletS.Tests",
1399 "OpenSim.Region.PhysicsModule.Ode.Tests",
1400 NULL
1401 };
1402 runTests(Physics, "Physics", "Physics");
1403 char *Stress[] =
1404 {
1405 "OpenSim.Tests.Stress",
1406 NULL
1407 };
1408 runTests(Stress, "Stress", "Stress");
1409 char *Performance[] =
1410 {
1411 "OpenSim.Tests.Performance",
1412 NULL
1413 };
1414 runTests(Performance, "Performance", "Perf");
1415 char *Optional[] =
1416 {
1417 "OpenSim.Region.OptionalModules",
1418 NULL
1419 };
1420 runTests(Optional, "Optional", "Opt");
1421 char *Robust[] =
1422 {
1423 "Robust.Tests",
1424 NULL
1425 };
1426 runTests(Robust, "Robust", "Robust");
1427}
1428
1429
1430
1253 1431
1254static int getIntFromIni(qlisttbl_t *ini, char *name) 1432static int getIntFromIni(qlisttbl_t *ini, char *name)
1255{ 1433{
@@ -1915,6 +2093,10 @@ void startSim(simData *simd, char *sim, char *type, int count, int window, int p
1915{ 2093{
1916 if (!checkSimIsRunning(simd->tab)) 2094 if (!checkSimIsRunning(simd->tab))
1917 { 2095 {
2096 // If OpenSim.exe doesn't exist, start a BUILD.
2097 snprintf(toybuf, sizeof(toybuf), "%s/current/bin/OpenSim.exe", scRoot);
2098 if (! qfile_exist(toybuf))
2099 buildOpensim();
1918 I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s is starting.", window, type, pane, simd->paneID, scTemp, count, simd->name); 2100 I("Tmux tab [%d:%s](pane %d) tmux ID %s, from %s/sim%d - %s is starting.", window, type, pane, simd->paneID, scTemp, count, simd->name);
1919 // NOTE - earlier versions of tmux that are still in use don't have the '-T pane title' option, so do it with a printf command. 2101 // NOTE - earlier versions of tmux that are still in use don't have the '-T pane title' option, so do it with a printf command.
1920// doTmuxCmd("select-pane -t %s:%s -T '%s'", Tconsole, simd->paneID, simd->tab); 2102// doTmuxCmd("select-pane -t %s:%s -T '%s'", Tconsole, simd->paneID, simd->tab);
@@ -2018,104 +2200,6 @@ static int filterARs(struct dirtree *node)
2018 return 0; 2200 return 0;
2019} 2201}
2020 2202
2021static void copyOpenSim(char *t)
2022{
2023 if (shellMeFail("rm -fr ", t)) E("Failed to rm!");
2024 if ((! qfile_exist(t)) && (! qfile_mkdir(t, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", t);
2025// TODO - have to make sure it's all owned by opensimsc.
2026 if (shellMeFail("cd %s; cp -al %s/current/* -t %s ", scRoot, scRoot, t)) C("Failed to cp!");
2027 if (shellMeFail("cd %s; cp -al %s/current/.??* -t %s ", scRoot, scRoot, t)) C("Failed to cp!");
2028}
2029
2030static void runTests(char *tests[], char *title, char* file)
2031{
2032 char *t = "export MONO_THREADS_PER_CPU=100;";
2033 int i = 0;
2034
2035 // For printing out line numbers use "exec /usr/bin/cli --debug /usr/lib/nunit/nunit-console.exe" instead of "nunit-console".
2036 if (FLAG(v))
2037 snprintf(toybuf, sizeof(toybuf), "echo '%s tests.'; cd %s; %s exec /usr/bin/cli --debug /usr/lib/nunit/nunit-console.exe ", title, scTemp, t);
2038 else
2039 snprintf(toybuf, sizeof(toybuf), "echo '%s tests.'; cd %s; %s nunit-console ", title, scTemp, t);
2040 while(NULL != tests[i])
2041 {
2042 t = xmprintf("%s/current/bin/%s.dll ", scRoot, tests[i++]);
2043 strcat(toybuf, t);
2044 free(t);
2045 }
2046 t = xmprintf("-nologo -output=Test%sOutput.txt -err=Test%sError.txt -labels -noxml ", file, file);
2047 strcat(toybuf, t);
2048 free(t);
2049 I(toybuf);
2050 shellMe(toybuf);
2051}
2052static void testOpenSim(simData *simd, char *sim, char *type, int count, int window, int panes, int pane)
2053{
2054 char *t = xmprintf("%s/../db", scTemp);
2055
2056 if ((! qfile_exist(t)) && (! qfile_mkdir(t, S_IRWXU | S_IRGRP | S_IXGRP, true))) C("Unable to create path %s", t);
2057 free(t);
2058 char *standard0[] =
2059 {
2060 "OpenSim.Tests",
2061 "OpenSim.Framework.Tests",
2062 "OpenSim.Framework.Servers.Tests",
2063 "OpenSim.Framework.Serialization.Tests",
2064 "OpenSim.Region.ClientStack.LindenCaps.Tests",
2065 "OpenSim.Region.ClientStack.LindenUDP.Tests",
2066 "OpenSim.Region.ScriptEngine.Tests",
2067 "OpenSim.Region.CoreModules.Tests",
2068 "OpenSim.Region.Framework.Tests",
2069 NULL
2070 };
2071 runTests(standard0, "Standard", "");
2072 char *SQL[] =
2073 {
2074 "OpenSim.Data.Tests",
2075 NULL
2076 };
2077 runTests(SQL, "SQL", "SQL");
2078 char *standard1[] =
2079 {
2080 "OpenSim.Capabilities.Handlers.Tests",
2081 "OpenSim.Server.Handlers.Tests",
2082 "OpenSim.Services.InventoryService.Tests",
2083 "OpenSim.Tests.Permissions", // Naturally OpenSim can't be consistent.
2084 NULL
2085 };
2086 runTests(standard1, "Standard part 2", "1");
2087 char *Physics[] =
2088 {
2089 "OpenSim.Region.PhysicsModule.BulletS.Tests",
2090 "OpenSim.Region.PhysicsModule.Ode.Tests",
2091 NULL
2092 };
2093 runTests(Physics, "Physics", "Physics");
2094 char *Stress[] =
2095 {
2096 "OpenSim.Tests.Stress",
2097 NULL
2098 };
2099 runTests(Stress, "Stress", "Stress");
2100 char *Performance[] =
2101 {
2102 "OpenSim.Tests.Performance",
2103 NULL
2104 };
2105 runTests(Performance, "Performance", "Perf");
2106 char *Optional[] =
2107 {
2108 "OpenSim.Region.OptionalModules",
2109 NULL
2110 };
2111 runTests(Optional, "Optional", "Opt");
2112 char *Robust[] =
2113 {
2114 "Robust.Tests",
2115 NULL
2116 };
2117 runTests(Robust, "Robust", "Robust");
2118}
2119 2203
2120// Forward declare this. 2204// Forward declare this.
2121my_ulonglong dbCount(char *table, char *where); 2205my_ulonglong dbCount(char *table, char *where);
@@ -8656,72 +8740,7 @@ Create the /opt/opensim-SC directory structure.
8656//////////////////////////////////////////////////////////////////////////////////////////////////// 8740////////////////////////////////////////////////////////////////////////////////////////////////////
8657 if (BUILD == currentMode) 8741 if (BUILD == currentMode)
8658 { 8742 {
8659 char *t = xmprintf("%s/current_NEW", scRoot); 8743 buildOpensim();
8660
8661 I("Building opensim-SC.");
8662 copyOpenSim(t);
8663
8664 if (shellMeFail("chmod -R a+x %s/*.sh", t)) C("Can't set proper permissions for %s/*.sh", t);
8665 if (shellMeFail("chmod -R a+x %s/scripts/*.sh", t)) C("Can't set proper permissions for %s/scripts/*.sh", t);
8666 if (shellMeFail("chmod -R a+x %s/scripts/install/*.sh", t)) C("Can't set proper permissions for %s/scripts/install/*.sh", t);
8667 if (shellMeFail("chmod a+x %s/scripts/show-console", t)) C("Can't set proper permissions for %s/scripts/show-console", t);
8668 if (shellMeFail("chmod a+x %s/scripts/start-sim", t)) C("Can't set proper permissions for %s/scripts/start-sim", t);
8669
8670/*
8671# Poor mans git sub modules / subtrees, coz otherwise it gets complex.
8672#if [ ! -d git-sub-modules/opensim-moneymodule-gloebit ]; then
8673# pushd git-sub-modules >/dev/null
8674# git clone https://github.com/gloebit/opensim-moneymodule-gloebit.git
8675# popd >/dev/null
8676#else
8677# pushd git-sub-modules/opensim-moneymodule-gloebit >/dev/null
8678# git pull
8679# popd >/dev/null
8680#fi
8681#rm -rf addon-modules/Gloebit/GloebitMoneyModule
8682#cp -r git-sub-modules/opensim-moneymodule-gloebit/addon-modules/Gloebit/GloebitMoneyModule addon-modules/Gloebit/
8683*/
8684 if (shellMeFail("cd %s; ./runprebuild.sh autoclean | grep -v '...Cleaning project:'", t)) E("Failed to autoclean!");
8685 // Clean the stuff autoclean forgets to clean. I feel so dirty.
8686 if (shellMeFail("cd %s; find -name obj -type d -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
8687 if (shellMeFail("cd %s; find -name *.csproj -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
8688 if (shellMeFail("cd %s; find -name *.csproj.* -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
8689 if (shellMeFail("cd %s; find -name *.pdb -type f -print | xargs /bin/rm -fr", t)) E("Failed to rm obj!");
8690 if (shellMeFail("cd %s; rm -fr bin/ScriptEngines", t)) E("Failed to rm ScriptEngines!");
8691 // Clean the stuff the tests created.
8692 if (shellMeFail("cd %s; rm Test*.txt", t)) E("Failed to Test results!");
8693/*
8694# Prebuild converts Microsoft.CSharp.targets to Microsoft.CSHARP.Targets, which case sensitive file systems fail to find.
8695#find -name *.csproj | xargs sed -i "s@Microsoft.CSHARP.Targets@Microsoft.CSharp.targets@g"
8696
8697# Debian no longer provides nant.
8698#./nant-color
8699
8700if [ "4" == $(mono -V | head -n 1 | cut -d ' ' -f 5 | cut -d '.' -f 1) ]; then
8701 export XBUILD_COLORS=errors=brightred,warnings=yellow,events=blue
8702 xbuild /target:clean
8703 xbuild /p:TargetFrameworkVersion="v4.5"xbuild /p:TargetFrameworkVersion="v4.5"
8704else
8705 # Use this for Mono 5 and later.
8706 msbuild /p:Configuration=Release
8707# msbuild /p:Configuration=Debug
8708fi
8709*/
8710 // Use this for Mono 5 and later.
8711 if (shellMeFail("cd %s; ./runprebuild.sh vs2015 | grep -v '...Creating project:'", t)) C("Failed to prebuild!");
8712 // msbuild has a /maxcpucount option, but it takes longer to count the CPUs than it takes to compile, so ends up taking MORE time. Pffft.
8713 if (shellMeFail("cd %s; msbuild /p:Configuration=Debug /verbosity:minimal", t)) C("Failed to msbuild!");
8714// if (shellMeFail("cd %s; msbuild /p:Configuration=Release /verbosity:minimal", t)) C("Failed to msbuild!");
8715// #cp -f addon-modules/Gloebit/GloebitMoneyModule/bin/Gloebit.dll bin
8716 if (shellMeFail("cd %s/src; ./BuildIt.sh", t)) C("Failed to compile sledjchisl!");
8717/* TODO -
8718 figure out what current symlink currently points to
8719 delete that_BACKUP
8720 copy that to that_BACKUP
8721 point the symlink to this
8722*/
8723 free(t);
8724 I("Done building opensim-SC.");
8725 goto finished; 8744 goto finished;
8726 } 8745 }
8727 } 8746 }
@@ -8866,7 +8885,16 @@ fi
8866 // Start ROBUST or join the tmux session, or just figure out where the sims are running in tmux. 8885 // Start ROBUST or join the tmux session, or just figure out where the sims are running in tmux.
8867 if ((START == currentMode) && !checkSimIsRunning("ROBUST")) 8886 if ((START == currentMode) && !checkSimIsRunning("ROBUST"))
8868 { 8887 {
8869 char *c = xmprintf("cd %s", scRoot); 8888 char *c = xmprintf("%s/current/bin/Robust.exe", scRoot);
8889
8890 // If Robust.exe doesn't exist, start a BUILD.
8891 if (! qfile_exist(c))
8892 {
8893 W("Need to build Robust.exe.");
8894 buildOpensim();
8895 }
8896 free(c);
8897 c = xmprintf("cd %s", scRoot);
8870 I("ROBUST is starting up."); 8898 I("ROBUST is starting up.");
8871 sendTmuxCmd("@0.%1", c); 8899 sendTmuxCmd("@0.%1", c);
8872 free(c); 8900 free(c);