Skip to content
This repository has been archived by the owner. It is now read-only.
Browse files
Use 'deprecated' port compiler hook in rebar to generate a script
  • Loading branch information
Hunter Morris committed Apr 4, 2011
1 parent 0d1bd81 commit 24210c2899522ac38a81763a6842c8521f14da1d
Showing 2 changed files with 13 additions and 8 deletions.
@@ -22,3 +22,6 @@ logs/*
## Distribution files

## Temporary script for compiling the port
@@ -1,15 +1,17 @@
%% -*- mode: erlang;erlang-indent-level: 2;indent-tabs-mode: nil -*-
["c_src/blowfish.c", "c_src/bcrypt.c", "c_src/bcrypt_nif.c"]},
["c_src/blowfish.c", "c_src/bcrypt.c", "c_src/bcrypt_nif.c"]}]}.

{erl_opts, [debug_info]}.

% This ugly hack is necessary because rebar's supported pre and post hooks
% don't include the environment vars necessary for building port programs.
{port_pre_script, {"echo -e \"#!/bin/sh\\n$CC $CFLAGS $ERL_CFLAGS "
"c_src/bcrypt_port.c c_src/bcrypt.o c_src/blowfish.o "
"$LDFLAGS $ERL_LDFLAGS -lpthread "
"-o priv/bcrypt\" >",
{port_cleanup_script, "rm -f"}.
{pre_hooks, [{clean, "rm -f priv/bcrypt c_src/bcrypt_port.o"}]}.
"gcc -g -O2 -Wall c_src/bcrypt_port.o c_src/bcrypt.o"
" c_src/blowfish.o -lerl_interface -lei -lpthread"
" -o priv/bcrypt"}]}.
{post_hooks, [{compile, "sh"}]}.

0 comments on commit 24210c2

Please sign in to comment.