Skip to content

Commit

Permalink
Win32-SM91 support and fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Will committed Dec 23, 2021
1 parent 95c6275 commit accb3f3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 15 deletions.
6 changes: 3 additions & 3 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -158,18 +158,18 @@ eunit: couch
exunit: export BUILDDIR = $(shell echo %cd%)
exunit: export MIX_ENV=test
exunit: export ERL_LIBS = $(shell echo %cd%)\src
exunit: export ERL_AFLAGS = -config $(shell echo %cd%)/rel/files/eunit.config
exunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
exunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(shell echo %cd%)/bin/couchjs $(shell echo %cd%)/share/server/main.js
exunit: couch elixir-init setup-eunit elixir-check-formatted elixir-credo
@mix test --cover --trace $(EXUNIT_OPTS)

setup-eunit: export BUILDDIR = $(shell pwd)
setup-eunit: export ERL_AFLAGS = "-config $(shell echo %cd%)/rel/files/eunit.config")
setup-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
setup-eunit:
@$(REBAR) setup_eunit 2> nul

just-eunit: export BUILDDIR = $(shell pwd)
just-eunit: export ERL_AFLAGS = "-config $(shell echo %cd%)/rel/files/eunit.config")
just-eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
just-eunit:
@$(REBAR) -r eunit $(EUNIT_OPTS)

Expand Down
10 changes: 1 addition & 9 deletions src/couch/priv/couch_js/86/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -287,17 +287,9 @@ int runWithContext(JSContext* cx, couch_args* args) {

// Compile and run
JS::CompileOptions options(cx);
options.setFileAndLine(filename, 1);
JS::RootedScript script(cx);
FILE* fp;

fp = fopen(args->scripts[i], "r");
if(fp == NULL) {
fprintf(stderr, "Failed to read file: %s\n", filename);
return 3;
}
script = JS::CompileUtf8File(cx, options, fp);
fclose(fp);
script = JS::CompileUtf8Path(cx, options, filename);
if (!script) {
JS::RootedValue exc(cx);
if(!JS_GetPendingException(cx, &exc)) {
Expand Down
11 changes: 8 additions & 3 deletions src/couch/rebar.config.script
Original file line number Diff line number Diff line change
Expand Up @@ -155,8 +155,13 @@ end.
};
{unix, _} when SMVsn == "91" ->
{
"-DXP_UNIX -I/usr/include/mozjs-91 -I/usr/local/include/mozjs-91 -I/opt/homebrew/include/mozjs-91/ -std=c++17 -Wno-invalid-offsetof",
"-L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-91 -lm"
"$CFLAGS -DXP_UNIX -I/usr/include/mozjs-91 -I/usr/local/include/mozjs-91 -I/opt/homebrew/include/mozjs-91/ -std=c++17 -Wno-invalid-offsetof",
"$LDFLAGS -L/usr/local/lib -L /opt/homebrew/lib/ -std=c++17 -lmozjs-91 -lm"
};
{win32, _} when SMVsn == "91" ->
{
"/std:c++17 /DXP_WIN",
"$LDFLAGS mozjs-91.lib"
}
end.

Expand Down Expand Up @@ -189,7 +194,7 @@ IcuDarwinEnv = [{"CFLAGS", "-DXP_UNIX -I/usr/local/opt/icu4c/include -I/opt/home
IcuBsdEnv = [{"CFLAGS", "-DXP_UNIX -I/usr/local/include"},
{"LDFLAGS", "-L/usr/local/lib"}].
IcuWinEnv = [{"CFLAGS", "$DRV_CFLAGS /DXP_WIN"},
{"LDFLAGS", "icuin.lib icudt.lib icuuc.lib"}].
{"LDFLAGS", "$LDFLAGS icuin.lib icudt.lib icuuc.lib"}].

ComparePath = "priv/couch_ejson_compare.so".
CompareSrc = ["priv/couch_ejson_compare/*.c"].
Expand Down

0 comments on commit accb3f3

Please sign in to comment.