manywaypark's Blog
개발, 검색, 함수

'erlyweb'에 해당되는 글 1건

  1. 2009.06.01 erlyweb 빌드 하기

erlyweb 빌드 하기

함수형 언어/Erlang 2009. 6. 1. 18:43 by manywaypark
erlyweb의 빌드 스크립트(make.sh)는 기본적으로 erlang의 lib 폴더(보통 /usr/local/lib/erlang/lib, code:lib_dir()로 찍어보면 나온다)에 yaws가 깔린 것으로 가정하고 만들어져있다.
즉, 다음과 같다.
#!/bin/bash

ERLIB=$(erl -noshell -eval 'io:format(code:lib_dir()).' -s erlang halt)
YAWS=$(ls $ERLIB | grep yaws)

cat >Emakefile <<EOF
{"src/erlyweb/*", [debug_info, {outdir, "ebin"},
{i,"$ERLIB/$YAWS/include"}]}.
{"src/erlydb/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlsql/*", [debug_info, {outdir, "ebin"}]}.
{"src/erltl/*", [debug_info, {outdir, "ebin"}]}.
{"src/smerl/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-mysql-driver/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-psql-driver/*", [debug_info, strict_record_tests, {outdir,
"ebin"}]}.
EOF

ebin_dir="./ebin"
# bash check if directory exists
if [ ! -d $ebin_dir ]; then
    mkdir $ebin_dir
fi

erl -noshell -eval 'make:all(), filelib:fold_files("src/", ".+\.et$", true, fun(F, _Acc) -> erltl:compile(F, [{outdir, "ebin"}, debug_info, show_errors, show_warnings]) end, []).' -pa ebin -s erlang halt
일견 복잡해보이지만, 실제로 하는 일은 erlang의 기본 lib 폴더에서 yaws 폴더를 찾은 후에 Emakefile을 만들고 erlang 방식의 make를 돌리는 것이다.
문제는 나는 yaws를 직접 빌드해서 설치해서 다른 디렉토리(/usr/local/lib)에 있다는 것이다.
그냥 간단하게 make.sh를 다음과 같이 고쳐서 make 하면 잘된다. 나는 yaws의 기본 설정(즉, prefix 따위 설정 안한)으로 빌드했다. prefix 설정으로 설치 경로 바꾼 경우는 적절히 바꾸면 될 것이다.^^
#!/bin/bash

#ERLIB=$(erl -noshell -eval 'io:format(code:lib_dir()).' -s erlang halt)
#YAWS=$(ls $ERLIB | grep yaws)

cat >Emakefile <<EOF
{"src/erlyweb/*", [debug_info, {outdir, "ebin"},
{i,"/usr/local/lib/yaws/include"}]}.
{"src/erlydb/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlsql/*", [debug_info, {outdir, "ebin"}]}.
{"src/erltl/*", [debug_info, {outdir, "ebin"}]}.
{"src/smerl/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-mysql-driver/*", [debug_info, {outdir, "ebin"}]}.
{"src/erlang-psql-driver/*", [debug_info, strict_record_tests, {outdir,
"ebin"}]}.
EOF

ebin_dir="./ebin"
# bash check if directory exists
if [ ! -d $ebin_dir ]; then
    mkdir $ebin_dir
fi

erl -noshell -eval 'make:all(), filelib:fold_files("src/", ".+\.et$", true, fun(F, _Acc) -> erltl:compile(F, [{outdir, "ebin"}, debug_info, show_errors, show_warnings]) end, []).' -pa ebin -s erlang halt

happy hackin'
1 
분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

04-25 10:54