Skip to content

Commit

Permalink
rebar.config cleanup, much smaller snappy.so object
Browse files Browse the repository at this point in the history
Removed unnecessary linking with all the shared objects from google-snappy
(it even linked with the unit tests object). The final snappy.so NIF object is
now about 135Kb instead of 400Kb.
  • Loading branch information
fdmanana committed Mar 26, 2011
1 parent b84e7b5 commit aa38b5e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
all: snappy eunit

snappy:
./support/build-google-snappy.sh
./rebar compile

eunit:
Expand All @@ -9,6 +10,7 @@ eunit:
check: eunit

clean:
./support/clean-google-snappy.sh
./rebar clean
rm -fr priv ebin

21 changes: 5 additions & 16 deletions rebar.config
Original file line number Diff line number Diff line change
@@ -1,20 +1,9 @@
{port_sources, ["c_src/*.cc", "c_src/google-snappy/*.cc"]}.
{so_name, "snappy.so"}.

{erl_opts, [debug_info, warn_unused_vars, nowarn_shadow_vars, warn_unused_import]}.
{port_sources, ["c_src/*.cc"]}.
{port_envs, [
%% Make sure to link -lstdc++ on linux or solaris
{"CXXFLAGS", "$CXXFLAGS -Ic_src"},
{"(linux|solaris)", "LDFLAGS", "$LDFLAGS -lstdc++"},

%% OS X Leopard flags for 64-bit
{"darwin9.*-64$", "CXXFLAGS", "-m64"},
{"darwin9.*-64$", "LDFLAGS", "-arch x86_64"},

%% OS X Snow Leopard flags for 32-bit
{"darwin10.*-32$", "CXXFLAGS", "-m32"},
{"darwin10.*-32$", "LDFLAGS", "-arch i386"}
{"LDFLAGS", "$LDFLAGS c_src/google-snappy/snappy.o c_src/google-snappy/snappy-sinksource.o"}
]}.

{port_pre_script, {"support/build-google-snappy.sh", ""}}.
{port_cleanup_script, "support/clean-google-snappy.sh"}.

{so_name, "snappy.so"}.
{eunit_opts, [verbose]}.

0 comments on commit aa38b5e

Please sign in to comment.