Permalink
Browse files

Use rebar for building GeoCouch

Instead of using Emake, use rebar to build GeoCouch.
This will make it easier for future dependencies.
The output directory for the beam files changed from "build"
to "ebin".

Change-Id: Idbe9e2ef4197e5886f7ed6627d3689c9f530714f
Reviewed-on: http://review.couchbase.org/9825
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>
  • Loading branch information...
1 parent 65bab64 commit 8acfec9b9d77ae1cf0ff5fc95407b1971c98df9e @vmx vmx committed Sep 28, 2011
Showing with 25 additions and 38 deletions.
  1. +1 −0 .gitignore
  2. +0 −15 Emakefile
  3. +10 −21 Makefile
  4. +2 −2 README.md
  5. BIN rebar
  6. +4 −0 rebar.config
  7. +8 −0 src/geocouch.app.src
View
@@ -6,3 +6,4 @@ erl_crash.dump
coverage
*.tar.gz
tmp
+ebin
View
@@ -1,15 +0,0 @@
-{ [ 'src/vtree/*',
- 'src/geocouch/*'
- ], [
- {outdir, "build"},
- debug_info
-]}.
-
-% Tests
-{ [ 'test/*'
- ], [
- {i, "include"},
- {outdir, "test"},
- debug_info
-]}.
-
View
@@ -1,38 +1,27 @@
ERL=erl
VERSION=$(shell git describe)
+# Output ERL_COMPILER_OPTIONS env variable
+COMPILER_OPTIONS=$(shell $(ERL) -noinput +B -eval 'Options = case os:getenv("ERL_COMPILER_OPTIONS") of false -> []; Else -> {ok,Tokens,_} = erl_scan:string(Else ++ "."),{ok,Term} = erl_parse:parse_term(Tokens), Term end, io:format("~p~n", [[{i, "${COUCH_SRC}"}] ++ Options]), halt(0).')
+COMPILER_OPTIONS_MAKE_CHECK=$(shell $(ERL) -noinput +B -eval 'Options = case os:getenv("ERL_COMPILER_OPTIONS") of false -> []; Else -> {ok,Tokens,_} = erl_scan:string(Else ++ "."),{ok,Term} = erl_parse:parse_term(Tokens), Term end, io:format("~p~n", [[{i, "${COUCH_SRC}"},{d, makecheck}] ++ Options]), halt(0).')
-all: builddir compile
+all: compile
compile:
- @$(ERL) -boot start_clean -pa build -noinput +B -eval 'case make:all([{i, "'${COUCH_SRC}'"}]) of up_to_date -> halt(0); error -> halt(1) end.'
+ ERL_COMPILER_OPTIONS='$(COMPILER_OPTIONS)' ./rebar compile
compileforcheck:
- @$(ERL) -boot start_clean -pa build -noinput +B -eval 'case make:all([{i, "'${COUCH_SRC}'"}, {d, makecheck}]) of up_to_date -> halt(0); error -> halt(1) end.'
-
-builddir:
- @mkdir -p build
+ ERL_COMPILER_OPTIONS='$(COMPILER_OPTIONS_MAKE_CHECK)' ./rebar compile
buildandtest: all test
runtests:
- ERL_FLAGS="-pa ${COUCH_SRC} -pa ${COUCH_SRC}/../etap -pa ${COUCH_SRC}/../snappy" prove ./test/*.t
-
-check: clean builddir compileforcheck runtests
- rm -rf build
- rm -f test/*.beam
-
-#coverage: compile
-# mkdir -p coverage
-## erl -noshell -pa build -pa ${COUCH_SRC} -pa /home/vmx/src/erlang/coverize/coverize/ebin -s vtree_bulk run_cover -s init stop
-# erl -noshell -pa build -pa test/ebin -pa ${COUCH_SRC} -pa /home/vmx/src/erlang/coverize/coverize/ebin -s run_tests run_cover -s init stop
+ ERL_FLAGS="-pa ebin -pa ${COUCH_SRC} -pa ${COUCH_SRC}/../etap -pa ${COUCH_SRC}/../snappy" prove ./test/*.t
-cover: compile
- @mkdir -p coverage
- erl -noshell -pa build -pa ${COUCH_SRC} -eval 'cover:compile("src/vtree/vtree_bulk", [{i, "'${COUCH_SRC}'"}]),vtree_bulk:test(),cover:analyse_to_file(vtree_bulk, "coverage/vtree_bulk_coverage.html", [html]).' -s init stop;
+check: clean compileforcheck runtests
+ ./rebar clean
clean:
- rm -rf build
- rm -f test/*.beam
+ ./rebar clean
rm -f *.tar.gz
geocouch-$(VERSION).tar.gz:
View
@@ -73,12 +73,12 @@ Add the test to `<vanilla-couch>/share/www/script/couch_tests.js`
The compiled beam files from GeoCouch need to be in Erlang's path,
which can be set with the `ERL_FLAGS` environment variable:
- export ERL_FLAGS="-pa <geocouch>/build"
+ export ERL_FLAGS="-pa <geocouch>/ebin"
If you run a dev instance with CouchDB's `./utils/run` you can also
define it on startup:
- ERL_FLAGS="-pa <geocouch>/build" <vanilla-couch>/utils/run
+ ERL_FLAGS="-pa <geocouch>/ebin" <vanilla-couch>/utils/run
Using GeoCouch
View
BIN rebar
Binary file not shown.
View
@@ -0,0 +1,4 @@
+{erl_opts, [
+ % Make sure test/gc_test_util.erl gets compiled
+ {src_dirs, ["test"]}
+]}.
View
@@ -0,0 +1,8 @@
+{application, geocouch, [
+ {description, "GeoCouch - A spatial index for CouchDB"},
+ {vsn, "0.2.0"},
+ {modules, []},
+ {registered, []},
+ {applications, [kernel, stdlib]},
+ {env, []}
+]}.

0 comments on commit 8acfec9

Please sign in to comment.