-
Notifications
You must be signed in to change notification settings - Fork 4
/
deps.sh
executable file
·99 lines (87 loc) · 1.64 KB
/
deps.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#! /bin/bash
# Living on the edge!
CLIENT_DIR="rabbitmq-erlang-client"
SERVER_DIR="rabbitmq-server"
CODEGEN_DIR="rabbitmq-codegen"
function git_clone {
cd contrib
echo "==> $1 (get-deps)"
git clone "https://github.com/rabbitmq/$1.git"
cd ..
}
function git_update {
if [ -d contrib/$1 ]
then
cd contrib/$1
echo "==> $1 (update-deps)"
git pull
cd ../..
else
git_clone $1
fi
}
function delete {
echo "==> $1 (delete-deps)"
rm -rf contrib/$1
}
function pre_compile {
if [ ! -d ebin ]; then
mkdir ebin
fi
if [ ! -d priv ]; then
mkdir priv
fi
make -C contrib/rabbitmq-erlang-client
# hack for reltool
if [ ! -d oacd_hop ]; then
mkdir oacd_hop
ln -sf ../ebin oacd_hop/ebin
ln -sf ../src oacd_hop/src
ln -sf ../include oacd_hop/include
ln -sf ../priv oacd_hop/priv
ln -sf ../deps oacd_hop/deps
fi
# record what commit/version the rep is at
COMMIT=""
if [ -d ".git" ]
then
COMMIT=`git log -1 --pretty=format:%H`
fi
if [ -e "include/commit_ver.hrl" ] && [ ! $COMMIT ]
then
exit 0
else
if [ ! COMMIT ]
then
COMMIT="undefined"
else
COMMIT="\"$COMMIT\""
fi
fi
if [ ! -d include ]; then
mkdir include
fi
echo "%% automatically generated by precompile script. Editing means this
%% will just be overwritten.
-define(COMMIT, $COMMIT)." > include/commit_ver.hrl
}
if [ ! -d contrib ]
then
mkdir contrib
fi
case $1 in
"get")
git_clone $CODEGEN_DIR
git_clone $CLIENT_DIR
git_clone $SERVER_DIR;;
"update")
git_update $CODEGEN_DIR
git_update $CLIENT_DIR
git_update $SERVER_DIR;;
"delete")
delete $CODEGEN_DIR
delete $CLIENT_DIR
delete $SERVER_DIR;;
"pre_compile")
pre_compile;;
esac