mirror of https://gitlab.com/nakst/essence
build busybox automatically if the POSIX subsystem is enabled
This commit is contained in:
parent
6eab9caac2
commit
e8bd0f55ff
|
@ -112,6 +112,10 @@ void PortBochs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PortBusybox() {
|
void PortBusybox() {
|
||||||
|
if PathExists("%posixRoot%/bin/busybox") {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
str version = "1.33.1";
|
str version = "1.33.1";
|
||||||
|
|
||||||
if SystemGetHostName() == "Darwin" {
|
if SystemGetHostName() == "Darwin" {
|
||||||
|
|
|
@ -178,6 +178,10 @@ bool BuildAPIDependencies() {
|
||||||
if (CallSystem("bin/script ports/port.script portName=harfbuzz targetName=" TARGET_NAME " toolchainPrefix=" TOOLCHAIN_PREFIX)) return false;
|
if (CallSystem("bin/script ports/port.script portName=harfbuzz targetName=" TARGET_NAME " toolchainPrefix=" TOOLCHAIN_PREFIX)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (IsOptionEnabled("Flag.ENABLE_POSIX_SUBSYSTEM")) {
|
||||||
|
if (CallSystem("bin/script ports/port.script portName=busybox targetName=" TARGET_NAME " toolchainPrefix=" TOOLCHAIN_PREFIX)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (CallSystem("cp -p kernel/module.h root/Applications/POSIX/include")) return false;
|
if (CallSystem("cp -p kernel/module.h root/Applications/POSIX/include")) return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3448,6 +3448,8 @@ void ScriptHeapEntryToString(ExecutionContext *context, HeapEntry *entry, const
|
||||||
ScriptHeapEntryToString(context, entry, text, bytes);
|
ScriptHeapEntryToString(context, entry, text, bytes);
|
||||||
} else {
|
} else {
|
||||||
Assert(false);
|
Assert(false);
|
||||||
|
*text = "";
|
||||||
|
*bytes = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4822,8 +4824,8 @@ void PrintLine(ImportData *importData, uintptr_t line) {
|
||||||
|
|
||||||
uintptr_t length = 0;
|
uintptr_t length = 0;
|
||||||
|
|
||||||
for (uintptr_t i = position; i < importData->fileDataBytes; i++) {
|
for (uintptr_t i = position; i <= importData->fileDataBytes; i++) {
|
||||||
if (((char *) importData->fileData)[i] == '\n') {
|
if (i == importData->fileDataBytes || ((char *) importData->fileData)[i] == '\n') {
|
||||||
length = i - position;
|
length = i - position;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -4832,21 +4834,17 @@ void PrintLine(ImportData *importData, uintptr_t line) {
|
||||||
PrintDebug(">> %.*s\n", (int) length, &((char *) importData->fileData)[position]);
|
PrintDebug(">> %.*s\n", (int) length, &((char *) importData->fileData)[position]);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ScriptExecuteFromPath(char *scriptPath, size_t scriptPathBytes) {
|
int ScriptExecuteFromFile(char *scriptPath, size_t scriptPathBytes, char *fileData, size_t fileDataBytes) {
|
||||||
Tokenizer tokenizer = { 0 };
|
Tokenizer tokenizer = { 0 };
|
||||||
ImportData importData = { 0 };
|
ImportData importData = { 0 };
|
||||||
importData.path = scriptPath;
|
importData.path = scriptPath;
|
||||||
importData.pathBytes = scriptPathBytes;
|
importData.pathBytes = scriptPathBytes;
|
||||||
importData.fileData = FileLoad(scriptPath, &tokenizer.inputBytes);
|
importData.fileData = fileData;
|
||||||
importData.fileDataBytes = tokenizer.inputBytes;
|
importData.fileDataBytes = fileDataBytes;
|
||||||
tokenizer.module = &importData;
|
tokenizer.module = &importData;
|
||||||
tokenizer.line = 1;
|
tokenizer.line = 1;
|
||||||
tokenizer.input = (const char *) importData.fileData;
|
tokenizer.input = fileData;
|
||||||
|
tokenizer.inputBytes = fileDataBytes;
|
||||||
if (!tokenizer.input) {
|
|
||||||
PrintDebug("Error: Could not load the input file '%s'.\n", scriptPath);
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
FunctionBuilder builder = { 0 };
|
FunctionBuilder builder = { 0 };
|
||||||
ExecutionContext context = { 0 };
|
ExecutionContext context = { 0 };
|
||||||
|
@ -4868,6 +4866,10 @@ int ScriptExecuteFromPath(char *scriptPath, size_t scriptPathBytes) {
|
||||||
|
|
||||||
int result = ScriptLoad(tokenizer, &context, &importData) ? ScriptExecute(&context, &importData) : 1;
|
int result = ScriptLoad(tokenizer, &context, &importData) ? ScriptExecute(&context, &importData) : 1;
|
||||||
ScriptFree(&context);
|
ScriptFree(&context);
|
||||||
|
|
||||||
|
importedModules = NULL;
|
||||||
|
importedModulesLink = &importedModules;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5250,7 +5252,6 @@ int ExternalPathMove(ExecutionContext *context, Value *returnValue) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExternalFileCopy(ExecutionContext *context, Value *returnValue) {
|
int ExternalFileCopy(ExecutionContext *context, Value *returnValue) {
|
||||||
(void) returnValue;
|
|
||||||
STACK_POP_STRING_2(entryText, entryBytes, entry2Text, entry2Bytes);
|
STACK_POP_STRING_2(entryText, entryBytes, entry2Text, entry2Bytes);
|
||||||
returnValue->i = 0;
|
returnValue->i = 0;
|
||||||
if (entryBytes == 0 || entry2Bytes == 0) return 2;
|
if (entryBytes == 0 || entry2Bytes == 0) return 2;
|
||||||
|
@ -5776,7 +5777,15 @@ int main(int argc, char **argv) {
|
||||||
if (lastSlash) *lastSlash = 0;
|
if (lastSlash) *lastSlash = 0;
|
||||||
else strcpy(scriptSourceDirectory, ".");
|
else strcpy(scriptSourceDirectory, ".");
|
||||||
|
|
||||||
int result = ScriptExecuteFromPath(scriptPath, strlen(scriptPath));
|
size_t dataBytes;
|
||||||
|
void *data = FileLoad(scriptPath, &dataBytes);
|
||||||
|
|
||||||
|
if (!data) {
|
||||||
|
PrintDebug("Error: Could not load the input file '%s'.\n", scriptPath);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int result = ScriptExecuteFromFile(scriptPath, strlen(scriptPath), data, dataBytes);
|
||||||
|
|
||||||
while (fixedAllocationBlocks) {
|
while (fixedAllocationBlocks) {
|
||||||
void *block = fixedAllocationBlocks;
|
void *block = fixedAllocationBlocks;
|
||||||
|
|
Loading…
Reference in New Issue