building: fixes in new scripts

This commit is contained in:
nakst 2022-03-20 09:05:45 +00:00
parent af5bb07722
commit 82ccd24c61
2 changed files with 23 additions and 36 deletions

View File

@ -89,7 +89,7 @@ BuildFont fonts[] = {
{},
} },
{ "Hack", "Hack License.md", "Mono", "Latn,Grek,Cyrl", (FontFile []) {
{ "Hack", "Hack License.txt", "Mono", "Latn,Grek,Cyrl", (FontFile []) {
{ "4", "Hack Regular.ttf" },
{ "4i", "Hack Regular Italic.ttf" },
{ "7", "Hack Bold.ttf" },
@ -1267,10 +1267,6 @@ void DoCommand(const char *l) {
}
printf("\n");
} else if (0 == strcmp(l, "build-optional-ports")) {
CallSystemF("bin/script ports/port.script portName=all targetName=" TARGET_NAME " toolchainPrefix=" TOOLCHAIN_PREFIX);
} else if (0 == memcmp(l, "do ", 3)) {
CallSystem(l + 3);
} else if (0 == memcmp(l, "live ", 5) || 0 == strcmp(l, "live")) {
if (argc < 4) {
fprintf(stderr, "Usage: \"./start.sh live <iso/raw> <drive size in MB> [extra options]\".\n");
@ -1337,34 +1333,6 @@ void DoCommand(const char *l) {
printf("Created " ColorHighlight "bin/essence.iso" ColorNormal ".\n");
} else if (0 == memcmp(l, "a2l ", 4)) {
AddressToLine(l + 3);
} else if (0 == strcmp(l, "build-port") || 0 == memcmp(l, "build-port ", 11)) {
bool alreadyNamedPort = l[10] == ' ';
char *l2 = NULL;
if (!alreadyNamedPort) {
printf("\n");
CallSystem("bin/script ports/port.script");
LoadOptions();
if (!IsOptionEnabled("Flag.ENABLE_POSIX_SUBSYSTEM")) {
printf("\nMost ports require the POSIX subsystem to be enabled.\n");
printf("Run " ColorHighlight "config" ColorNormal " and select " ColorHighlight "Flag.ENABLE_POSIX_SUBSYSTEM" ColorNormal " to enable it.\n");
}
printf("\nEnter the port to be built: ");
size_t pos;
getline(&l2, &pos, stdin);
l2[strlen(l2) - 1] = 0;
} else {
l2 = (char *) l + 11;
}
CallSystemF("bin/script ports/port.script portName=%s targetName=" TARGET_NAME " toolchainPrefix=" TOOLCHAIN_PREFIX, l2);
if (!alreadyNamedPort) {
free(l2);
}
} else if (0 == strcmp(l, "make-crash-report")) {
system("rm crash-report.tar.gz");
system("mkdir crash-report");

View File

@ -8,6 +8,8 @@ str target #option;
str targetName;
str targetToolchainPrefix;
int currentCompilerIndex;
bool acceptedLicense #persist;
str compilerPath #persist;
int compilerIndex #persist;
@ -83,7 +85,7 @@ void Setup(bool forAutomation) {
assert FileWriteAll("bin/commit.txt", StringSlice(StringSplitByCharacter(SystemShellEvaluate("git log"), "\n", true)[0], 8, 15));
}
int currentCompilerIndex = 1;
currentCompilerIndex = 1;
if compilerPath == "" {
port.StartWithOptions("gcc", true, forAutomation, targetName, targetToolchainPrefix);
@ -100,7 +102,6 @@ void Setup(bool forAutomation) {
if compilerIndex != currentCompilerIndex {
Log("Warning: Your cross compiler appears to be out of date.");
Log("Run %TextColorHighlight()%get-toolchain%TextPlain()% before continuing.");
// TODO Implement get-toolchain.
}
if toolchainHasRedZone {
@ -157,6 +158,24 @@ void DoCommand(str command) {
Log("- Shared: %TextColorHighlight()%%countShared%");
Log("- Arch: %TextColorHighlight()%%countArch%");
Log("- Other: %TextColorHighlight()%%countOther%");
} else if StringStartsWith(command, "do ") {
SystemShellExecute(StringSlice(command, 3, command:len()));
} else if command == "build-optional-ports" {
port.StartWithOptions("all", false, true, targetName, targetToolchainPrefix);
} else if StringStartsWith(command, "build-port ") {
port.StartWithOptions(StringSlice(command, 11, command:len()), false, false, targetName, targetToolchainPrefix);
} else if command == "build-port" {
Log("");
port.StartWithOptions("", false, false, targetName, targetToolchainPrefix);
Log("\nMost ports require the POSIX subsystem to be enabled.\n"
+ "If you haven't enabled it, run %TextColorHighlight()%config%TextPlain()% and "
+ "select %TextColorHighlight()%Flag.ENABLE_POSIX_SUBSYSTEM%TextPlain()%.\n"
+ "\nEnter the port to be built: ");
port.StartWithOptions(StringTrim(ConsoleGetLine()), false, false, targetName, targetToolchainPrefix);
} else if command == "get-toolchain" {
port.StartWithOptions("gcc", true, false, targetName, targetToolchainPrefix);
compilerPath = port.compilerPath;
compilerIndex = currentCompilerIndex;
} else {
SystemShellExecute("bin/build %command%");
}
@ -312,7 +331,7 @@ void AutomationBuild() {
assert FileCopy("util/hsluv.h", "Essence/Licenses/hsluv.h");
assert FileCopy("util/stb_ds.h", "Essence/Licenses/stb_ds.h");
assert FileCopy("util/stb_truetype.h", "Essence/Licenses/stb_truetype.h");
assert FileCopy("res/Fonts/Hack License.md", "Essence/Licenses/Hack License.md");
assert FileCopy("res/Fonts/Hack License.txt", "Essence/Licenses/Hack License.txt");
assert FileCopy("res/Fonts/Inter License.txt", "Essence/Licenses/Inter License.txt");
assert FileCopy("res/Fonts/Atkinson Hyperlegible License.txt", "Essence/Licenses/Atkinson Hyperlegible License.txt");
assert FileCopy("res/Fonts/OpenDyslexic License.txt", "Essence/Licenses/OpenDyslexic License.txt");