Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: basho/eleveldb
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: develop
Choose a base ref
...
head repository: vernemq/eleveldb
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: develop
Choose a head ref
Can’t automatically merge. Don’t worry, you can still create the pull request.

Commits on Mar 4, 2015

  1. Add support for rebar3 - remove use of rebar2 port compiler config

    Rebar3 doesn't include a port compiler because it turns out it is too
    brittle and unportable. Switch to a Makefile via a compile hook instead
    to make things compatible with both rebar2 and rebar3.
    Vagabond committed Mar 4, 2015
    Copy the full SHA
    230111a View commit details

Commits on Mar 5, 2015

  1. Copy the full SHA
    10a6157 View commit details
  2. Need lager

    Vagabond committed Mar 5, 2015
    Copy the full SHA
    29a5360 View commit details

Commits on Apr 13, 2015

  1. Fixes for OSX builds

    * Fix lager dependency specification
    * Add failure handling for port_env lookups to rebar.config.script
    kellymclaughlin committed Apr 13, 2015
    Copy the full SHA
    af02650 View commit details
  2. Copy the full SHA
    a28dfbc View commit details
  3. Merge pull request #1 from helium/bugfix/fix-osx-build

    Fix OSX build
    reiddraper committed Apr 13, 2015
    Copy the full SHA
    4e199ab View commit details

Commits on Aug 3, 2016

  1. merge adt-helium branch

    Andre Graf committed Aug 3, 2016
    Copy the full SHA
    f6886d2 View commit details
  2. bump leveldb tag

    ioolkos authored Aug 3, 2016
    Copy the full SHA
    bc30c2c View commit details

Commits on Nov 9, 2018

  1. Copy the full SHA
    751961c View commit details

Commits on Jul 23, 2019

  1. Copy the full SHA
    ab628e6 View commit details

Commits on Jan 2, 2020

  1. Fix build for snappy

    codeadict committed Jan 2, 2020
    Copy the full SHA
    d23c6d1 View commit details
  2. Copy the full SHA
    39ff9b5 View commit details
  3. Copy the full SHA
    6aedc84 View commit details
  4. Copy the full SHA
    8ec412b View commit details
  5. Added rebar3 lock file

    codeadict committed Jan 2, 2020
    Copy the full SHA
    63da45e View commit details
  6. Copy the full SHA
    e367880 View commit details
  7. Copy the full SHA
    46665d2 View commit details
  8. Copy the full SHA
    653d02f View commit details
  9. Copy the full SHA
    3a28998 View commit details
  10. Improve gitignore

    codeadict committed Jan 2, 2020
    Copy the full SHA
    b42c974 View commit details
  11. Copy the full SHA
    760d1b1 View commit details

Commits on Jan 15, 2020

  1. Copy the full SHA
    6b56faf View commit details
  2. Modernize travis

    codeadict committed Jan 15, 2020
    Copy the full SHA
    7c95088 View commit details

Commits on Jan 16, 2020

  1. Testing on OSX pass 1

    codeadict committed Jan 16, 2020
    Copy the full SHA
    2278955 View commit details
  2. Copy the full SHA
    af05e93 View commit details
  3. Fix bash script

    codeadict committed Jan 16, 2020
    Copy the full SHA
    96e915a View commit details
  4. Make travis wait 30 mins

    codeadict committed Jan 16, 2020
    Copy the full SHA
    812d9ca View commit details
  5. Move the travis wait

    codeadict committed Jan 16, 2020
    Copy the full SHA
    f4f0b9d View commit details
  6. Copy the full SHA
    fb80a64 View commit details
  7. More resilient rebar3 path

    codeadict committed Jan 16, 2020
    Copy the full SHA
    b2886c7 View commit details

Commits on Jan 18, 2020

  1. Fix kerl build

    codeadict committed Jan 18, 2020
    Copy the full SHA
    f52e69f View commit details
  2. ditch bash command

    codeadict committed Jan 18, 2020
    Copy the full SHA
    ceece3d View commit details

Commits on Jan 19, 2020

  1. Copy the full SHA
    911f6ef View commit details
  2. Fix kerl path

    codeadict committed Jan 19, 2020
    Copy the full SHA
    6e2535f View commit details
  3. Fix rebar3 on makefile

    codeadict committed Jan 19, 2020
    Copy the full SHA
    4f069db View commit details

Commits on Jan 20, 2020

  1. Copy the full SHA
    740cba6 View commit details
  2. Keep installations

    codeadict committed Jan 20, 2020
    Copy the full SHA
    1ca3aa0 View commit details
  3. Copy the full SHA
    c8dca1b View commit details
  4. Comment out installation

    codeadict committed Jan 20, 2020
    Copy the full SHA
    f8e8237 View commit details
  5. Download rebar3 on OSX

    codeadict committed Jan 20, 2020
    Copy the full SHA
    04d84e2 View commit details
  6. Install rebar3 thu Travis

    codeadict committed Jan 20, 2020
    Copy the full SHA
    2f53f1c View commit details
  7. Copy the full SHA
    5f911db View commit details
  8. Another pass to rebar3

    codeadict committed Jan 20, 2020
    Copy the full SHA
    0b0285b View commit details
  9. Fix wrong path

    codeadict committed Jan 20, 2020
    Copy the full SHA
    4c6d840 View commit details
  10. Fix indentation

    codeadict committed Jan 20, 2020
    Copy the full SHA
    e0e6d47 View commit details
  11. Use before script

    codeadict committed Jan 20, 2020
    Copy the full SHA
    cc2aaea View commit details

Commits on Jan 21, 2020

  1. List kerl artifacts

    codeadict committed Jan 21, 2020
    Copy the full SHA
    cb7594a View commit details
  2. Set kerl build dir

    codeadict committed Jan 21, 2020
    Copy the full SHA
    a058bab View commit details
  3. Copy the full SHA
    d82c36d View commit details
  4. typo

    codeadict committed Jan 21, 2020
    Copy the full SHA
    a278877 View commit details
Showing with 262 additions and 92 deletions.
  1. +4 −2 .gitignore
  2. +54 −9 .travis.yml
  3. +4 −4 Makefile
  4. +1 −1 README.md
  5. +88 −0 c_src/Makefile
  6. +16 −16 c_src/build_deps.sh
  7. BIN c_src/snappy-1.0.4.tar.gz
  8. BIN rebar
  9. +32 −16 rebar.config
  10. +24 −12 rebar.config.script
  11. +1 −0 rebar.lock
  12. +1 −1 src/eleveldb.app.src
  13. +1 −1 src/eleveldb.erl
  14. +1 −1 test/cacheleak.erl
  15. +1 −1 test/cleanup.erl
  16. +16 −8 test/eleveldb_schema_tests.erl
  17. +1 −1 test/iterators.erl
  18. +13 −13 test/rand_gen_1.erl
  19. +4 −6 tools.mk
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
.eunit/*
deps/*
priv/*
*.o

*.beam
ebin
c_src/leveldb/
c_src/snappy*/
c_src/system
c_src/*.[od]
*~
.local_dialyzer_plt
_build/
ltest/
63 changes: 54 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,57 @@
language: erlang

env:
global:
- KERL_DEFAULT_INSTALL_DIR="$HOME/.kerl"

addons:
apt:
packages:
- libsnappy-dev
homebrew:
update: true
packages:
- kerl
- snappy

cache:
brew: true
directories:
- $HOME/.cache/rebar3
- $HOME/.kerl
- $HOME/.kerlrc

notifications:
webhooks: http://basho-engbot.herokuapp.com/travis?key=a5be8bf3dea048bd7c5c1e93a37da1ab29709f51
email: eng@basho.com
otp_release:
- R15B02
- R15B01
- R15B
- R14B04
- R14B03
# - R15B03
disabled: true

jobs:
include:
- os: linux
otp_release: 21.3
env: OTP_VERSION=21.3
- os: linux
otp_release: 22.3
env: OTP_VERSION=22.3
- os: linux
otp_release: 23.0
env: OTP_VERSION=23.0
- os: osx
language: generic
osx_image: xcode11.3
env: OTP_VERSION=21.3
- os: osx
language: generic
osx_image: xcode11.3
env: OTP_VERSION=22.0

install:
- if [ $TRAVIS_OS_NAME == osx ] ; then kerl update releases ; fi
- if [ $TRAVIS_OS_NAME == osx ] ; then kerl list builds | grep ${OTP_VERSION} || travis_wait 45 kerl build ${OTP_VERSION} ${OTP_VERSION} ; fi
- if [ $TRAVIS_OS_NAME == osx ] ; then kerl list installations | grep ${OTP_VERSION} || kerl install ${OTP_VERSION} ; fi

before_script:
- if [ $TRAVIS_OS_NAME == osx ] ; then . ${KERL_DEFAULT_INSTALL_DIR}/${OTP_VERSION}/activate ; fi
- wget https://s3.amazonaws.com/rebar3/rebar3 && chmod u+x rebar3
- ./rebar3 update

script: REBAR=./rebar3 make test
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
REBAR ?= ./rebar
REBAR ?= rebar3

all: compile

get-deps:
./c_src/build_deps.sh get-deps

deps:
${REBAR} get-deps
$(REBAR) get-deps

rm-deps:
./c_src/build_deps.sh rm-deps

compile: deps
${REBAR} compile
$(REBAR) compile

clean:
${REBAR} clean
$(REBAR) clean

include tools.mk
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# `eleveldb` - Erlang bindings to LevelDB datastore

[![Build Status](https://secure.travis-ci.org/basho/eleveldb.png?branch=master)](http://travis-ci.org/basho/eleveldb)
[![Build Status](https://travis-ci.com/vernemq/eleveldb.svg?branch=develop)](https://travis-ci.com/vernemq/eleveldb)

This repository follows the Basho standard for branch management
as of November 28, 2013. The standard is found here:
88 changes: 88 additions & 0 deletions c_src/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Based on c_src.mk from erlang.mk by Loic Hoguin <essen@ninenines.eu>

CURDIR := $(shell pwd)
BASEDIR := $(abspath $(CURDIR)/..)

PROJECT ?= $(notdir $(BASEDIR))
PROJECT := $(strip $(PROJECT))

ERLANG_VERSION_GT_22 := $(shell erl -noshell -s init stop -eval "erlang:display(erlang:system_info(otp_release) > "22").")
ERTS_INCLUDE_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s/erts-~s/include/\", [code:root_dir(), erlang:system_info(version)]).")
ERL_INTERFACE_INCLUDE_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s\", [code:lib_dir(erl_interface, include)]).")
ERL_INTERFACE_LIB_DIR ?= $(shell erl -noshell -s init stop -eval "io:format(\"~s\", [code:lib_dir(erl_interface, lib)]).")

C_SRC_DIR = $(CURDIR)
C_SRC_OUTPUT ?= $(CURDIR)/../priv/$(PROJECT).so

# System type and C compiler/flags.

UNAME_SYS := $(shell uname -s)
SNAPPY_STATIC_OR_DYN_LIB := system/lib/libsnappy.a

ifeq ($(UNAME_SYS), Darwin)
CC ?= cc
CFLAGS ?= -O3 -std=c99 -arch x86_64 -finline-functions -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -arch x86_64 -finline-functions -Wall -stdlib=libstdc++
LDFLAGS ?= -arch x86_64 -flat_namespace -undefined suppress -stdlib=libstdc++
else ifeq ($(UNAME_SYS), FreeBSD)
CC ?= cc
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -finline-functions -Wall
FREEBSD_MAJOR_VERSION := $(shell uname -U | cut -c1-2)

ifeq ($(FREEBSD_MAJOR_VERSION), 12)
SNAPPY_STATIC_OR_DYN_LIB = /usr/local/lib/libsnappy.so
endif

else ifeq ($(UNAME_SYS), Linux)
CC ?= gcc
CFLAGS ?= -O3 -std=c99 -finline-functions -Wall -Wmissing-prototypes
CXXFLAGS ?= -O3 -finline-functions -Wall
endif

CFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) -I leveldb/include
CXXFLAGS += -fPIC -I $(ERTS_INCLUDE_DIR) -I $(ERL_INTERFACE_INCLUDE_DIR) -I leveldb/include

ifeq ($(ERLANG_VERSION_GT_22), true)
LDLIBS += -L$(ERL_INTERFACE_LIB_DIR) -lei
else
LDLIBS += -L$(ERL_INTERFACE_LIB_DIR) -lerl_interface -lei
endif

LDFLAGS += -shared leveldb/libleveldb.a $(SNAPPY_STATIC_OR_DYN_LIB) -lstdc++

# Verbosity.

c_verbose_0 = @echo " C " $(?F);
c_verbose = $(c_verbose_$(V))

cpp_verbose_0 = @echo " CPP " $(?F);
cpp_verbose = $(cpp_verbose_$(V))

link_verbose_0 = @echo " LD " $(@F);
link_verbose = $(link_verbose_$(V))

SOURCES := $(shell find $(C_SRC_DIR) -maxdepth 1 -type f \( -name "*.c" -o -name "*.C" -o -name "*.cc" -o -name "*.cpp" \))
OBJECTS = $(addsuffix .o, $(basename $(SOURCES)))

COMPILE_C = $(c_verbose) $(CC) $(CFLAGS) $(CPPFLAGS) -c
COMPILE_CPP = $(cpp_verbose) $(CXX) $(CXXFLAGS) $(CPPFLAGS) -c

$(C_SRC_OUTPUT): $(OBJECTS)
@mkdir -p $(BASEDIR)/priv/
$(link_verbose) $(CC) $(OBJECTS) $(LDFLAGS) $(LDLIBS) -o $(C_SRC_OUTPUT)

%.o: %.c
$(COMPILE_C) $(OUTPUT_OPTION) $<

%.o: %.cc
$(COMPILE_CPP) $(OUTPUT_OPTION) $<

%.o: %.C
$(COMPILE_CPP) $(OUTPUT_OPTION) $<

%.o: %.cpp
$(COMPILE_CPP) $(OUTPUT_OPTION) $<

clean:
@rm $(C_SRC_OUTPUT) $(OBJECTS)
32 changes: 16 additions & 16 deletions c_src/build_deps.sh
Original file line number Diff line number Diff line change
@@ -8,9 +8,7 @@ if [ `uname -s` = 'SunOS' -a "${POSIX_SHELL}" != "true" ]; then
fi
unset POSIX_SHELL # clear it so if we invoke other scripts, they run as ksh as well

LEVELDB_VSN="2.0.0"

SNAPPY_VSN="1.0.4"
LEVELDB_VSN="2.0.35"

set -e

@@ -32,11 +30,11 @@ MAKE=${MAKE:-make}

case "$1" in
rm-deps)
rm -rf leveldb system snappy-$SNAPPY_VSN
rm -rf leveldb system
;;

clean)
rm -rf system snappy-$SNAPPY_VSN
rm -rf system
if [ -d leveldb ]; then
(cd leveldb && $MAKE clean)
fi
@@ -54,30 +52,32 @@ case "$1" in

get-deps)
if [ ! -d leveldb ]; then
git clone git://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN)
git clone https://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN && \
curl -fSL https://patch-diff.githubusercontent.com/raw/ioolkos/leveldb/pull/1.diff -o 1.diff && \
patch -p1 -i 1.diff && \
rm -rf 1.diff)
fi
;;

*)
if [ ! -d snappy-$SNAPPY_VSN ]; then
tar -xzf snappy-$SNAPPY_VSN.tar.gz
(cd snappy-$SNAPPY_VSN && ./configure --prefix=$BASEDIR/system --libdir=$BASEDIR/system/lib --with-pic)
fi

(cd snappy-$SNAPPY_VSN && $MAKE && $MAKE install)
export MACOSX_DEPLOYMENT_TARGET=10.8

export CFLAGS="$CFLAGS -I $BASEDIR/system/include"
export CXXFLAGS="$CXXFLAGS -I $BASEDIR/system/include"
export LDFLAGS="$LDFLAGS -L$BASEDIR/system/lib"
export LD_LIBRARY_PATH="$BASEDIR/system/lib:$LD_LIBRARY_PATH"
export LEVELDB_VSN="$LEVELDB_VSN"

if [ ! -d leveldb ]; then
git clone git://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN)
git clone https://github.com/basho/leveldb
(cd leveldb && git checkout $LEVELDB_VSN && \
curl -fSL https://patch-diff.githubusercontent.com/raw/ioolkos/leveldb/pull/1.diff -o 1.diff && \
patch -p1 -i 1.diff && \
rm -rf 1.diff)
fi

(cd leveldb && $MAKE all)
(cd leveldb && $MAKE -j 3 all)

;;
esac
Binary file removed c_src/snappy-1.0.4.tar.gz
Binary file not shown.
Binary file removed rebar
Binary file not shown.
48 changes: 32 additions & 16 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,26 +1,42 @@
%%-*- mode: erlang -*-
{eunit_opts, [verbose]}.
{so_name, "eleveldb.so"}.
{plugins, [pc]}.

{artifacts, ["priv/eleveldb.so"]}.

{xref_checks, [undefined_function_calls]}.

{port_sources, ["c_src/*.cc"]}.
{port_specs, [{ "priv/eleveldb.so", ["c_src/*.cc"] }]}.

{erl_opts, [warnings_as_errors, {parse_transform, lager_transform}, debug_info]}.
{erl_opts, [warnings_as_errors, debug_info]}.

{deps, [
{cuttlefish, ".*", {git, "git://github.com/basho/cuttlefish.git", {tag, "2.0.1"}}}
]}.
{profiles,
[
{test,[
{deps,[
{cuttlefish, {git, "https://github.com/Kyorai/cuttlefish.git", {tag, "v2.3.0"}}}
]},
{eunit_opts, [verbose]}
]}
]}.

{port_env, [
%% Make sure to set -fPIC when compiling leveldb
{"CFLAGS", "$CFLAGS -Wall -O3 -fPIC"},
{"CXXFLAGS", "$CXXFLAGS -Wall -O3 -fPIC"},
{"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/leveldb/include"},
{"DRV_LDFLAGS", "$DRV_LDFLAGS c_src/leveldb/libleveldb.a c_src/system/lib/libsnappy.a -lstdc++"}
]}.
%% Make sure to set -fPIC when compiling leveldb
{"CFLAGS", "$CFLAGS -Wall -O3 -fPIC"},
{"CXXFLAGS", "$CXXFLAGS -Wall -O3 -fPIC"},
{"DRV_CFLAGS", "$DRV_CFLAGS -O3 -Wall -I c_src/leveldb/include -I c_src/leveldb -I c_src/system/include"},
{"(freebsd)", "DRV_LDFLAGS", "$DRV_LDFLAGS c_src/leveldb/libleveldb.a -lstdc++"},
{"^(?s)((?!freebsd).)*$", "DRV_LDFLAGS", "$DRV_LDFLAGS c_src/leveldb/libleveldb.a -lsnappy -lstdc++"}
]}.

{pre_hooks, [{'get-deps', "c_src/build_deps.sh get-deps"},
{compile, "c_src/build_deps.sh"}]}.
{pre_hooks, [
{"(linux|darwin|solaris|freebsd)", compile, "c_src/build_deps.sh get-deps"},
{"(linux|darwin|solaris|freebsd)", compile, "c_src/build_deps.sh"}
]}.

{post_hooks, [{clean, "c_src/build_deps.sh clean"}]}.
{provider_hooks, [
{post,[
{compile, {pc, compile}},
{clean, {pc, clean}}
]
}
]}.
36 changes: 24 additions & 12 deletions rebar.config.script
Original file line number Diff line number Diff line change
@@ -6,23 +6,35 @@
%% actually running.
case os:type() of
{unix,darwin} ->
Opt = " -mmacosx-version-min=10.8",
Opt = " -mmacosx-version-min=10.8 -stdlib=libc++",
[Mjr|_] = string:tokens(os:cmd("/usr/bin/uname -r"), "."),
Major = list_to_integer(Mjr),
if
Major >= 13 ->
Flags = ["CFLAGS", "CXXFLAGS", "DRV_CFLAGS", "DRV_LDFLAGS"],
{port_env, Vals} = lists:keyfind(port_env, 1, CONFIG),
Fold = fun({Flag,Val}, Acc) ->
case lists:member(Flag, Flags) of
true ->
[{Flag, Val++Opt}|Acc];
false ->
Acc
end
end,
NewVals = lists:foldl(Fold, [], Vals),
lists:keyreplace(port_env, 1, CONFIG, {port_env, NewVals});
case lists:keyfind(port_env, 1, CONFIG)of
false ->
CONFIG;
{port_env, Vals} ->
Fold = fun
({Regex, Flag, Val}, Acc) ->
case lists:member(Flag, Flags) of
true ->
[{Regex, Flag, Val++Opt}|Acc];
false ->
Acc
end;
({Flag, Val}, Acc) ->
case lists:member(Flag, Flags) of
true ->
[{Flag, Val++Opt}|Acc];
false ->
Acc
end
end,
NewVals = lists:foldl(Fold, [], Vals),
lists:keyreplace(port_env, 1, CONFIG, {port_env, NewVals})
end;
true ->
CONFIG
end;
1 change: 1 addition & 0 deletions rebar.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[].
2 changes: 1 addition & 1 deletion src/eleveldb.app.src
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{application, eleveldb,
[
{description, ""},
{description, "LevelDB for Erlang"},
{vsn, git},
{registered, []},
{applications, [
2 changes: 1 addition & 1 deletion src/eleveldb.erl
Original file line number Diff line number Diff line change
@@ -48,7 +48,7 @@
-on_load(init/0).

-ifdef(TEST).
-compile(export_all).
-compile([export_all, nowarn_export_all]).
-ifdef(EQC).
-include_lib("eqc/include/eqc.hrl").
-define(QC_OUT(P),
Loading