From f9b3354c50793c62ce235b33ba13eaafefa6f1c0 Mon Sep 17 00:00:00 2001 From: Dave Smith Date: Tue, 16 Dec 2008 13:16:23 -0700 Subject: [PATCH] Adding support for packaging to enable easier publishing via faxien --- Rakefile | 14 ++++++++++++++ base.rake | 20 ++++++++++++++++++++ c_src/buildlib.sh | 1 - 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index 3254178..b58cd3f 100644 --- a/Rakefile +++ b/Rakefile @@ -37,3 +37,17 @@ task :test do run_tests "test", "+A10" end +task :package => [:compile] do + app = File.basename(APP, ".app") + vsn = erl_app_version(app) + target_dir = "#{app}-#{vsn}" + Dir.mkdir target_dir + cp_r 'ebin', target_dir + cp_r 'include', target_dir + cp_r 'src', target_dir + cp_r 'priv', target_dir + Dir.mkdir "#{target_dir}/priv/bin" + cp_r Dir.glob('c_src/system/bin/*'), "#{target_dir}/priv/bin" + puts "Packaged to #{target_dir}" +end + diff --git a/base.rake b/base.rake index a36f24f..107051f 100644 --- a/base.rake +++ b/base.rake @@ -73,6 +73,26 @@ def erl_app_modules(app) end end +def erl_app_version(app) + script = <<-ERL + ok = application:load(#{app}), + {ok, Vsn} = application:get_key(#{app}, vsn), + io:format("~s\\n", [Vsn]). + ERL + output = erl_run(script, "-pa ebin") + output.strip() +end + +def erl_app_version(app) + script = <<-ERL + ok = application:load(#{app}), + {ok, Vsn} = application:get_key(#{app}, vsn), + io:format("~s\\n", [Vsn]). + ERL + output = erl_run(script, "-pa ebin") + output.strip() +end + def erts_dir() script = <<-ERL io:format("~s\n", [lists:concat([code:root_dir(), "/erts-", erlang:system_info(version)])]) diff --git a/c_src/buildlib.sh b/c_src/buildlib.sh index 8693d9b..1550d07 100755 --- a/c_src/buildlib.sh +++ b/c_src/buildlib.sh @@ -22,7 +22,6 @@ tar -xzf db-${DB_VER}.tar.gz && \ (cd db-${DB_VER}/build_unix && \ ../dist/configure --prefix=$WORKDIR --disable-shared --with-pic && make && ranlib libdb-*.a && make install) && \ mkdir -p $TARGETDIR/utils && \ - cp $WORKDIR/bin/* $TARGETDIR/utils && \ rm -rf db-${DB_VER}