Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Upgrade to rebar3, add Windows support
This patch updates erlfdb to build using rebar3. It relies on rebar3's `pc` plugin to build the NIF instead of the compiled copy of davisp's erlang-native-compiler, which does essentially the same thing. I left the rebar_gdb_plugin code in the repo, although I did not update that plugin to make it compatible with rebar3 yet. With rebar3 in place, I also made the changes necessary to support Windows. One gotcha is that the unit tests will fail unless you set the erlfdb test_cluster_file environment variable to point to a running fdb.cluster file. I didn't get through all the hoops to make the approach of spinning up an embedded fdbserver work in a x-platform way. Apparently Windows doesn't let you supply a Python script for the spawn_executable argument of erlang:open_port/2. I added a rebar3 profile to help here. The following command will cause the test suite to connect to an FDB server that is managing its configuration in the default location on Windows: rebar3 as win32_external_fdbserver eunit
- Loading branch information
Showing
7 changed files
with
43 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
|
||
# Unit testing | ||
.erlfdb/ | ||
.eunit/ | ||
.rebar/ | ||
|
||
compile_commands.json | ||
erln8.config | ||
|
||
# Build artifacts | ||
c_src/*.d | ||
c_src/*.o | ||
ebin/ | ||
|
||
priv/erlfdb_nif.* | ||
_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,11 @@ | ||
all: check | ||
|
||
build: | ||
rebar compile | ||
@rebar3 compile | ||
|
||
check: build | ||
rebar eunit | ||
@rebar3 eunit | ||
|
||
clean: | ||
rebar clean | ||
@rebar3 clean | ||
@rm -rf _build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,43 @@ | ||
{plugins, [ | ||
pc | ||
]}. | ||
|
||
{provider_hooks, [ | ||
{pre, [ | ||
{compile, {pc, compile}}, | ||
{clean, {pc, clean}} | ||
]} | ||
]}. | ||
|
||
{port_specs, [ | ||
{"priv/erlfdb_nif.so", ["c_src/*.c"]} | ||
]}. | ||
|
||
{plugins, [rebar_gdb_plugin]}. | ||
|
||
{port_env, [ | ||
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", | ||
"CFLAGS", "$CFLAGS -I/usr/local/include -Ic_src/ -g -Wall -Werror"}, | ||
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", | ||
"CXXFLAGS", "$CXXFLAGS -I/usr/local/include -Ic_src/ -g -Wall -Werror"}, | ||
{"win32", | ||
"CFLAGS", "$CFLAGS /I\"c:/Program Files/foundationdb/include\" /O2 /DNDEBUG"}, | ||
{"win32", | ||
"CXXFLAGS", "$CXXFLAGS /I\"c:/Program Files/foundationdb/include\" /O2 /DNDEBUG"}, | ||
|
||
{"(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin|gnu)", | ||
"LDFLAGS", "$LDFLAGS -L/usr/local/lib -lfdb_c"} | ||
"LDFLAGS", "$LDFLAGS -L/usr/local/lib -lfdb_c"}, | ||
{"win32", | ||
"LDFLAGS", "$LDFLAGS /LIBPATH:\"c:/Program Files/foundationdb/lib/foundationdb\" fdb_c.lib"} | ||
]}. | ||
|
||
{profiles, [ | ||
{win32_external_fdbserver, [ | ||
{eunit_opts, [ | ||
{sys_config, "win32_external_fdbserver.config"} | ||
]} | ||
]} | ||
]}. | ||
|
||
{eunit_opts, [ | ||
debug_info, | ||
verbose | ||
]}. | ||
|
||
{pre_hooks, [{"", compile, "escript enc compile"}]}. | ||
{post_hooks, [{"", clean, "escript enc clean"}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
[]. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[ | ||
{erlfdb, [ | ||
{test_cluster_file, <<"c:/ProgramData/foundationdb/fdb.cluster">>} | ||
]} | ||
]. |