mirror of https://gitlab.com/nakst/essence
Merge branch 'master' into 'master'
Build Essence on Windows 10 host See merge request nakst/essence!11
This commit is contained in:
commit
0a55febb24
|
@ -399,7 +399,8 @@ void PortGCC() {
|
|||
// Build libstdc++.
|
||||
// TODO Waiting on GCC 11.3 to do this for the port. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100017.
|
||||
// TODO Work out why this sometimes hangs on Darwin.
|
||||
if SystemGetHostName() != "Darwin" {
|
||||
// Also skip building libstdc++ on MSYS/Windows because it leads to gcc internal compiler error, Segfault
|
||||
if SystemGetHostName() != "Darwin" && !StringStartsWith(SystemGetHostName(), "MSYS") {
|
||||
assert SystemShellExecuteWithWorkingDirectory("bin/build-gcc", "make all-target-libstdc++-v3 -j %processorCount%");
|
||||
assert SystemShellExecuteWithWorkingDirectory("bin/build-gcc", "make install-target-libstdc++-v3");
|
||||
}
|
||||
|
|
18
util/build.c
18
util/build.c
|
@ -392,7 +392,12 @@ void BuildUtilities() {
|
|||
}
|
||||
|
||||
BUILD_UTILITY("render_svg", "-lm", "");
|
||||
#ifdef __MSYS__
|
||||
// On MSYS/Windows parallel build gets often hung/deadlocked
|
||||
BUILD_UTILITY("build_core", "-pthread", "");
|
||||
#else
|
||||
BUILD_UTILITY("build_core", "-pthread -DPARALLEL_BUILD", "");
|
||||
#endif
|
||||
}
|
||||
|
||||
void Build(int optimise, bool compile) {
|
||||
|
@ -648,7 +653,7 @@ void Run(int emulator, int log, int debug) {
|
|||
case EMULATOR_VIRTUALBOX: {
|
||||
// TODO Automatically setup the Essence VM if it doesn't exist.
|
||||
|
||||
CallSystem("VBoxManage storageattach Essence --storagectl AHCI --port 0 --device 0 --type hdd --medium none");
|
||||
CallSystem("VBoxManage storageattach Essence --storagectl SATA --port 0 --device 0 --type hdd --medium none");
|
||||
CallSystem("VBoxManage closemedium disk bin/vbox.vdi --delete");
|
||||
|
||||
if (IsOptionEnabled("Emulator.VBoxEFI")) {
|
||||
|
@ -660,7 +665,7 @@ void Run(int emulator, int log, int debug) {
|
|||
CallSystem("VBoxManage modifyvm Essence --firmware bios");
|
||||
}
|
||||
|
||||
CallSystem("VBoxManage storageattach Essence --storagectl AHCI --port 0 --device 0 --type hdd --medium bin/vbox.vdi");
|
||||
CallSystem("VBoxManage storageattach Essence --storagectl SATA --port 0 --device 0 --type hdd --medium bin/vbox.vdi");
|
||||
|
||||
CallSystem("VBoxManage startvm --putenv VBOX_GUI_DBG_ENABLED=true Essence");
|
||||
} break;
|
||||
|
@ -1137,11 +1142,18 @@ void DoCommand(const char *l) {
|
|||
CallSystem("mv bin/installer_archive.dat root/Installer\\ Data/archive.dat");
|
||||
CallSystem("mv bin/installer_metadata.dat root/Installer\\ Data/metadata.dat");
|
||||
} else if (0 == strcmp(l, "font-editor")) {
|
||||
#ifdef __MSYS__
|
||||
BUILD_UTILITY("font_editor", "-Wl,-subsystem,windows -Wno-unused-parameter -mwindows", "");
|
||||
#else
|
||||
BUILD_UTILITY("font_editor", "-lX11 -Wno-unused-parameter", "");
|
||||
#endif
|
||||
CallSystem("bin/font_editor res/Fonts/Bitmap\\ Sans\\ Regular\\ 9.font");
|
||||
} else if (0 == strcmp(l, "config")) {
|
||||
#ifdef __MSYS__
|
||||
BUILD_UTILITY("config_editor", "-Wl,-subsystem,windows -Wno-unused-parameter -mwindows", "");
|
||||
#else
|
||||
BUILD_UTILITY("config_editor", "-lX11 -Wno-unused-parameter", "");
|
||||
|
||||
#endif
|
||||
if (CallSystem("bin/config_editor")) {
|
||||
printf("The config editor could not be opened.\n"
|
||||
"This likely means your system does not have X11 setup.\n"
|
||||
|
|
|
@ -1337,9 +1337,18 @@ int main(int argc, char **argv) {
|
|||
|
||||
if (0 == strcmp(s.section, "toolchain")) {
|
||||
if (0 == strcmp(s.key, "path")) {
|
||||
#ifndef __MSYS__
|
||||
executeEnvironment[0] = (char *) malloc(5 + s.valueBytes + 1);
|
||||
#else
|
||||
executeEnvironment[0] = (char *) malloc(5 + s.valueBytes + 1 + strlen(getenv("PATH")) + 1);
|
||||
#endif
|
||||
strcpy(executeEnvironment[0], "PATH=");
|
||||
strcat(executeEnvironment[0], s.value);
|
||||
#ifdef __MSYS__
|
||||
// append current PATH to INI PATH otherwise we will get gcc error "error while loading shared libraries: ?: cannot open shared object file: No such file or directory"
|
||||
strcat(executeEnvironment[0], ":");
|
||||
strcat(executeEnvironment[0], getenv("PATH"));
|
||||
#endif
|
||||
} else if (0 == strcmp(s.key, "tmpdir")) {
|
||||
if (s.value[0]) {
|
||||
executeEnvironment[1] = (char *) malloc(7 + s.valueBytes + 1);
|
||||
|
@ -1579,7 +1588,7 @@ int main(int argc, char **argv) {
|
|||
CopyFile(buffer, "bin/Object Files/crtend.o", false);
|
||||
|
||||
Execute(toolchainCC, "-c", "desktop/crt1.c", "-o", "bin/Object Files/crt1.o", ArgString(cCompileFlags), ArgString(commonCompileFlags));
|
||||
Execute(toolchainCC, "-c", "desktop/crtglue.c", "-o" "bin/Object Files/crtglue.o", ArgString(cCompileFlags), ArgString(commonCompileFlags));
|
||||
Execute(toolchainCC, "-c", "desktop/crtglue.c", "-o", "bin/Object Files/crtglue.o", ArgString(cCompileFlags), ArgString(commonCompileFlags));
|
||||
CopyFile("bin/Object Files/crti.o", "root/Applications/POSIX/lib/crti.o", false);
|
||||
CopyFile("bin/Object Files/crtbegin.o", "root/Applications/POSIX/lib/crtbegin.o", false);
|
||||
CopyFile("bin/Object Files/crtend.o", "root/Applications/POSIX/lib/crtend.o", false);
|
||||
|
|
|
@ -7,7 +7,11 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __MSYS__
|
||||
#define UI_WINDOWS
|
||||
#else
|
||||
#define UI_LINUX
|
||||
#endif
|
||||
#define UI_IMPLEMENTATION
|
||||
#include "luigi.h"
|
||||
|
||||
|
|
|
@ -5,7 +5,11 @@
|
|||
// TODO Extensions: binary search, shifting glyphs in editor, undo/redo.
|
||||
|
||||
#define UI_IMPLEMENTATION
|
||||
#ifdef __MSYS__
|
||||
#define UI_WINDOWS
|
||||
#else
|
||||
#define UI_LINUX
|
||||
#endif
|
||||
#include "luigi.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -2,6 +2,17 @@ str url #option;
|
|||
str directoryName #option;
|
||||
str checksum #option;
|
||||
|
||||
// Returns true if file matches given SHA 256 checksum
|
||||
// Note: using StringStartsWith and StringEndsWith to avoid mismatch due to asterisk in front of file name on MSYS2/Windows
|
||||
bool FileMatchesSHA256Checksum(str filename, str checksum) {
|
||||
str shasum = SystemShellEvaluate("shasum -a 256 %filename%");
|
||||
if StringStartsWith(shasum, checksum) && StringEndsWith(shasum, filename) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void Get(str url, str directoryName, str checksum) {
|
||||
assert url != "";
|
||||
assert directoryName != "";
|
||||
|
@ -42,8 +53,10 @@ void Get(str url, str directoryName, str checksum) {
|
|||
}
|
||||
|
||||
if checksum != "" {
|
||||
if SystemShellEvaluate("shasum -a 256 %cachePath%") != "%checksum% %cachePath%\n" {
|
||||
if FileMatchesSHA256Checksum(cachePath, checksum) {
|
||||
LogError("Checksum mismatch for file '%cachePath%'.\n");
|
||||
SystemShellExecute("shasum -a 256 %cachePath%");
|
||||
Log("%checksum% is the expected checksum");
|
||||
PathDelete(cachePath);
|
||||
assert false;
|
||||
}
|
||||
|
|
|
@ -467,7 +467,7 @@ uintptr_t HeapAllocate(ExecutionContext *context);
|
|||
|
||||
// --------------------------------- Platform layer definitions.
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__MSYS__)
|
||||
#include <assert.h>
|
||||
#define Assert assert
|
||||
#endif
|
||||
|
@ -6807,7 +6807,7 @@ int ExternalCharacterToByte(ExecutionContext *context, Value *returnValue) {
|
|||
|
||||
// --------------------------------- Platform layer.
|
||||
|
||||
#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__)
|
||||
#if defined(_WIN32) || defined(__linux__) || defined(__APPLE__) || defined(__MSYS__)
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <direct.h>
|
||||
|
|
|
@ -15,6 +15,17 @@ str compilerPath #persist;
|
|||
int compilerIndex #persist;
|
||||
bool runningMakefiles #persist;
|
||||
|
||||
// Returns true if file matches given SHA 256 checksum
|
||||
// Note: using StringStartsWith and StringEndsWith to avoid mismatch due to asterisk in front of file name on MSYS2/Windows
|
||||
bool FileMatchesSHA256Checksum(str filename, str checksum) {
|
||||
str shasum = SystemShellEvaluate("shasum -a 256 %filename%");
|
||||
if StringStartsWith(shasum, checksum) && StringEndsWith(shasum, filename) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////
|
||||
// Environment setup
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
@ -45,8 +56,7 @@ void Setup(bool forAutomation) {
|
|||
assert false;
|
||||
}
|
||||
|
||||
if SystemShellEvaluate("shasum -a 256 util/test.txt")
|
||||
!= "2c5622dbbf2552e0e66424a302bde0918e09379afce47eef1a21ef0198990fed util/test.txt\n" {
|
||||
if FileMatchesSHA256Checksum("util/test.txt", "2c5622dbbf2552e0e66424a302bde0918e09379afce47eef1a21ef0198990fed") {
|
||||
Log(TextColorError() + "--------------------------------------------------------------------");
|
||||
Log(TextColorError() + " The source has been corrupted!! ");
|
||||
Log(TextColorError() + " Please check that you have disabled any automatic line-ending or ");
|
||||
|
|
Loading…
Reference in New Issue