Skip to content

Commit

Permalink
Feat/support sm91 4.x from lostnet (#3884)
Browse files Browse the repository at this point in the history
* Win32-SM91 support and fixes

* spidermonkey_68 identified as spidermonkey_60 and erroneously(?) blocked by configure on aarch64 #3149

* remove unnecessary shell when setting ERL_AFLAGS

* fix foundationdb urls in github workflow

* quote AFLAGS like win echo and fix references to pwd

Co-authored-by: Will <w.young@schaetz-cro.ch>
  • Loading branch information
lostnet and Will authored Jan 12, 2022
1 parent 7f63d93 commit 0d6e131
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 23 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
uses: actions/cache@v2
id: wgetcache
with:
key: wgetcache-${{env.FIREFOX_VERSION}}-${{env.FDB_VERSION}}
key: wgetcache-${{env.FIREFOX_VERSION}}-${{env.FDB_VERSION}}-${{ runner.os }}
path: |
firefox-${{env.FIREFOX_VERSION}}esr.source.tar.xz
foundationdb-clients_${{env.FDB_VERSION}}-1_amd64.deb
Expand All @@ -32,8 +32,8 @@ jobs:
- name: wget moz
if: steps.wgetcache.outputs.cache-hit != 'true'
run: |
wget -nv -S https://www.foundationdb.org/downloads/${{env.FDB_VERSION}}/ubuntu/installers/foundationdb-clients_${{env.FDB_VERSION}}-1_amd64.deb
wget -nv -S https://www.foundationdb.org/downloads/${{env.FDB_VERSION}}/ubuntu/installers/foundationdb-server_${{env.FDB_VERSION}}-1_amd64.deb
wget -nv -S https://github.com/apple/foundationdb/releases/download/${{env.FDB_VERSION}}/foundationdb-clients_${{env.FDB_VERSION}}-1_amd64.deb
wget -nv -S https://github.com/apple/foundationdb/releases/download/${{env.FDB_VERSION}}/foundationdb-server_${{env.FDB_VERSION}}-1_amd64.deb
wget -nv https://download.cdn.mozilla.net/pub/firefox/releases/${{env.FIREFOX_VERSION}}esr/source/firefox-${{env.FIREFOX_VERSION}}esr.source.tar.xz
- name: couch checkout
Expand Down
12 changes: 6 additions & 6 deletions Makefile.win
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ endif
.PHONY: eunit
# target: eunit - Run EUnit tests, use EUNIT_OPTS to provide custom options
eunit: export BUILDDIR = $(shell echo %cd%)
eunit: export ERL_AFLAGS = $(shell echo "-config rel/files/eunit.config")
eunit: export ERL_AFLAGS = "-config rel/files/eunit.config"
eunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(shell echo %cd%)/bin/couchjs $(shell echo %cd%)/share/server/main.js
eunit: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
eunit: couch
Expand All @@ -159,19 +159,19 @@ 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 = "-config rel/files/eunit.config"
exunit: export COUCHDB_QUERY_SERVER_JAVASCRIPT = $(shell echo %cd%)/bin/couchjs $(shell echo %cd%)/share/server/main.js
exunit: export COUCHDB_TEST_ADMIN_PARTY_OVERRIDE=1
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 BUILDDIR = $(shell echo %cd%)
setup-eunit: export ERL_AFLAGS = "-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 BUILDDIR = $(shell echo %cd%)
just-eunit: export ERL_AFLAGS = "-config rel/files/eunit.config"
just-eunit:
@$(REBAR) -r eunit $(EUNIT_OPTS)

Expand Down
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,9 @@ parse_opts() {

parse_opts $@

if [ "${ARCH}" = "aarch64" ] && [ "${SM_VSN}" != "1.8.5" ]
if [ "${ARCH}" = "aarch64" ] && [ "${SM_VSN}" = "60" ]
then
echo "ERROR: SpiderMonkey 60 is known broken on ARM 64 (aarch64). Use 1.8.5 instead."
echo "ERROR: SpiderMonkey 60 is known broken on ARM 64 (aarch64). Use another version instead."
exit 1
fi

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 @@ -191,7 +196,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 0d6e131

Please sign in to comment.