Skip to content
This repository was archived by the owner on Dec 17, 2018. It is now read-only.

Commit 25cb414

Browse files
connor rigbyConnorRigby
authored andcommitted
I ported some erlang. Probably don't use this.
1 parent 6728a0c commit 25cb414

19 files changed

+629
-245
lines changed

.formatter.exs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Used by "mix format"
2+
[
3+
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
4+
]

.gitignore

Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,27 @@
1-
.rebar
2-
rebar
3-
ebin
4-
priv
5-
.eunit/*
6-
*.swp
1+
# The directory Mix will write compiled artifacts to.
2+
/_build/
3+
4+
# If you run "mix test --cover", coverage assets end up here.
5+
/cover/
6+
7+
# The directory Mix downloads your dependencies sources to.
8+
/deps/
9+
10+
# Where 3rd-party dependencies like ExDoc output generated docs.
11+
/doc/
12+
13+
# Ignore .fetch files in case you like to edit your project deps locally.
14+
/.fetch
15+
16+
# If the VM crashes, it generates a dump, let's ignore it too.
17+
erl_crash.dump
18+
19+
# Also ignore archive artifacts (built via "mix archive.build").
20+
*.ez
21+
22+
# Ignore package tarball (built via "mix hex.build").
23+
esqlite-*.tar
24+
25+
/priv
726
*.o
8-
*~
9-
_build
10-
c_src/*.d
27+
*.db

.travis.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

AUTHORS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@
77

88
# Authors contributing directly to esqlite
99

10-
Maas-Maarten Zeeman <[email protected]>
10+
Maas-Maarten Zeeman <[email protected]>

CONTRIBUTERS

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
# Names should be added to this file as
99
# Name or Organization <email address>
1010

11-
Aleph Archives
11+
Aleph Archives
1212
Qing Liang <[email protected]>
13+
Connor Rigby <[email protected]>

Makefile

Lines changed: 21 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,30 @@
1-
PROJECT = esqlite
2-
DIALYZER = dialyzer
1+
ifeq ($(ERL_EI_INCLUDE_DIR),)
2+
$(error ERL_EI_INCLUDE_DIR not set. Invoke via mix)
3+
endif
34

4-
REBAR := $(shell which rebar 2>/dev/null || echo ./rebar)
5-
REBAR_URL := https://github.com/downloads/basho/rebar/rebar
5+
# Set Erlang-specific compile and linker flags
6+
ERL_CFLAGS ?= -I$(ERL_EI_INCLUDE_DIR)
7+
ERL_LDFLAGS ?= -L$(ERL_EI_LIBDIR)
68

7-
all: compile
9+
SRC=$(wildcard c_src/*.c)
10+
OBJ=$(SRC:.c=.o)
811

9-
./rebar:
10-
erl -noshell -s inets start -s ssl start \
11-
-eval '{ok, saved_to_file} = httpc:request(get, {"$(REBAR_URL)", []}, [], [{stream, "./rebar"}])' \
12-
-s inets stop -s init stop
13-
chmod +x ./rebar
12+
LDFLAGS ?= -fPIC -shared -pedantic
13+
CFLAGS ?= -fPIC -O2
1414

15-
compile: rebar
16-
$(REBAR) compile
15+
NIF=priv/esqlite3_nif.so
1716

18-
test: compile
19-
$(REBAR) eunit
17+
all: priv $(NIF)
2018

21-
clean: rebar
22-
$(REBAR) clean
19+
priv:
20+
mkdir -p priv
2321

24-
distclean:
25-
rm $(REBAR)
22+
%.o: %.c
23+
$(CC) -c $(ERL_CFLAGS) $(CFLAGS) -o $@ $<
2624

27-
# dializer
28-
29-
build-plt:
30-
@$(DIALYZER) --build_plt --output_plt .$(PROJECT).plt \
31-
--apps kernel stdlib
32-
33-
dialyze:
34-
@$(DIALYZER) --src src --plt .$(PROJECT).plt --no_native \
35-
-Werror_handling -Wrace_conditions -Wunmatched_returns -Wunderspecs
25+
$(NIF): $(OBJ)
26+
$(CC) $^ $(ERL_LDFLAGS) $(LDFLAGS) -o $@
3627

28+
clean:
29+
$(RM) $(NIF)
30+
$(RM) $(OBJ)

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
Esqlite [![Build Status](https://secure.travis-ci.org/mmzeeman/esqlite.png?branch=master)](http://travis-ci.org/mmzeeman/esqlite)
21
=======
32

43
An Erlang nif library for sqlite3.
@@ -17,4 +16,3 @@ Special care has been taken not to block the scheduler of the calling
1716
process. This is done by handling all commands from erlang within a
1817
lightweight thread. The erlang scheduler will get control back when
1918
the command has been added to the command-queue of the thread.
20-

0 commit comments

Comments
 (0)