Skip to content

Commit

Permalink
Remove support for wake wasm target (#1379)
Browse files Browse the repository at this point in the history
* Remove support for wake wasm target

* bring back ncurses
  • Loading branch information
V-FEXrt authored Aug 4, 2023
1 parent 1b70409 commit f2267dd
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 123 deletions.
5 changes: 0 additions & 5 deletions src/runtime/gc.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,12 +321,7 @@ struct alignas(PadObject) GCObject : public B {
template <typename... ARGS>
GCObject(ARGS &&...args) : B(std::forward<ARGS>(args)...) {
static_assert(sizeof(MovedObject) <= sizeof(T), "HeapObject is too small");
// TODO: on wasm pointer types are 4 bytes while doubles are 8 and that is
// causing this assert to fail. Doubles won't be properly aligned in wasm
// which may prove troublesome.
#ifndef __EMSCRIPTEN__
static_assert(sizeof(PadObject) == alignof(T), "HeapObject alignment wrong");
#endif
}

T *self() { return static_cast<T *>(this); }
Expand Down
41 changes: 0 additions & 41 deletions src/runtime/status.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@

#include "status.h"

#ifndef __EMSCRIPTEN__

#include <assert.h>
#include <curses.h>
#include <fcntl.h>
Expand Down Expand Up @@ -568,42 +566,3 @@ void status_finish() {
setitimer(ITIMER_REAL, &timer, 0);
}
}

#else
#include <emscripten/emscripten.h>

StatusState status_state;

void status_init() {}

// TODO: I need to make a stream buf specifically for emscripten
void status_write(const char *name, const char *data, int len) {
// clang-format off
EM_ASM_INT({
console.log('[' + UTF8ToString($0) + '] ' + UTF8ToString($1));
return 0;
}, name, data);
// clang-format on
}

void status_refresh(bool idle) {}
void status_finish() {}

void status_set_colour(const char *name, int colour) {}
void status_set_fd(const char *name, int fd) {}
void status_set_bulk_fd(int fd, const char *streams) {}

int status_get_colour(const char *name) { return 0; }

int status_get_fd(const char *name) { return -1; }

std::ostream &status_get_generic_stream(const char *name) { return std::cout; }

void StatusBuf::emit_header() {}
int StatusBuf::overflow(int c) { return 0; }
StatusBuf::StatusBuf(std::string name, wcl::optional<std::string> extra, int color,
TermInfoBuf &buf)
: buf(buf) {}
StatusBuf::~StatusBuf() {}

#endif
2 changes: 0 additions & 2 deletions src/util/poll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@
#define USE_EPOLL 1
#elif defined(__APPLE__)
#define USE_PSELECT 1
#elif defined(__EMSCRIPTEN__)
#define USE_PSELECT
#else
#define USE_PPOLL 1
#endif
Expand Down
2 changes: 0 additions & 2 deletions tools/fuse-waked/fuse-waked.wake
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,4 @@ from wake import _
from gcc_wake import _

target buildFuseDaemon variant: Result (List Path) Error = match variant
# Fuse doesn't, and likely won't ever, support building for wasm
Pair "wasm-cpp14-release" _ = Pass Nil
_ = tool @here Nil variant "lib/wake/fuse-waked" (json, fuse, util, Nil) Nil Nil
39 changes: 2 additions & 37 deletions vendor/gmp.wake
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,6 @@
package build_wake

from wake import _
from gcc_wake import _

def gmp = match _
Pair "wasm-cpp14-release" _ = buildGmpWASM Unit
_ = Pass (pkg "gmp")

def buildGmpWASM _ =
require Some emmake = emmake
else failWithError "emmake is not available"

def emsdk = replace `/[^/]*$` "" emmake
def version = "6.2.1"

require Pass buildDir = vendorBuildDir Unit

def job =
"""
cd .build
wget https://ftp.gnu.org/gnu/gmp/gmp-%{version}.tar.xz
tar xmf gmp-%{version}.tar.xz
cd gmp-%{version}
emconfigure ./configure --disable-assembly --host none --enable-cxx
emmake make -j4 MAKEINFO=true
"""
| makePlan "compiling gmp" (buildDir, Nil)
| editPlanEnvironment (addEnvironmentPath emsdk)
| setPlanDirectory @here
| setPlanShare False
| runJobWith defaultRunner
require Pass outputs = job.getJobOutputs
def headers = filter (matches `.*\.h` _.getPathName) outputs
def objects = filter (matches `.*\.a` _.getPathName) outputs
def cflags = "-I{@here}/.build/gmp-{version}", Nil
def lflags = Nil

Pass (SysLib version headers objects cflags lflags)
def gmp _ =
Pass (pkg "gmp")
38 changes: 2 additions & 36 deletions vendor/sqlite3.wake
Original file line number Diff line number Diff line change
Expand Up @@ -16,40 +16,6 @@
package build_wake

from wake import _
from gcc_wake import _

def sqlite3 = match _
Pair "wasm-cpp14-release" _ = buildSqlite3WASM Unit
_ = Pass (pkg "sqlite3")

def buildSqlite3WASM _ =
require Some emmake = emmake
else failWithError "emmake is not available"

def emsdk = replace `/[^/]*$` "" emmake
def version = "0.0.0"

require Pass buildDir = vendorBuildDir Unit

def job =
"""
cd .build
wget https://sqlite.org/2022/sqlite-amalgamation-3390200.zip
unzip sqlite-amalgamation-3390200
cd sqlite-amalgamation-3390200
emcc -c sqlite3.c
"""
| makePlan "compiling sqlite3" (buildDir, Nil)
| editPlanEnvironment (addEnvironmentPath emsdk)
| setPlanDirectory @here
| setPlanShare False
| runJobWith defaultRunner
require Pass outputs = job.getJobOutputs
def headers = filter (matches `.*\.h` _.getPathName) outputs
def objects = filter (matches `.*\.o` _.getPathName) outputs
def cflags = "-I{@here}/.build/sqlite-amalgamation-3390200", Nil
def lflags = Nil

Pass (SysLib version headers objects cflags lflags)
def sqlite3 _ =
Pass (pkg "sqlite3")

0 comments on commit f2267dd

Please sign in to comment.