forked from analizo/analizo
-
Notifications
You must be signed in to change notification settings - Fork 5
/
development-setup.sh
executable file
·135 lines (115 loc) · 3.18 KB
/
development-setup.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#!/bin/sh
set -e
setup_debian() {
sudo apt-get -q -y install wget
which lsb_release || sudo apt-get -q -y install lsb-release
codename=$(lsb_release -c | awk '{print($2)}')
if type prepare_$codename >/dev/null 2>&1; then
prepare_$codename
else
echo "WARNING: no specific preparation steps for $codename"
fi
sudo apt-get -q -y install wget
if [ ! -f /etc/apt/sources.list.d/analizo.list ]; then
echo "deb http://www.analizo.org/download/ ./" | sudo sh -c 'cat > /etc/apt/sources.list.d/analizo.list'
wget -O - http://www.analizo.org/download/signing-key.asc | sudo apt-key add -
echo "deb http://debian.joenio.me unstable/" | sudo sh -c 'cat >> /etc/apt/sources.list.d/analizo.list'
wget -O - http://debian.joenio.me/signing.asc | sudo apt-key add -
sudo apt-get update
fi
packages=$(sed -e '1,/^Build-Depends-Indep:/ d; /^\S/,$ d; s/,//; s/(.*$//' debian/control)
sudo apt-get -q -y -f install $packages
sudo apt-get -q -y install libfile-sharedir-install-perl libtext-template-perl pandoc
}
prepare_squeeze() {
if ! test -f /etc/apt/sources.list.d/squeeze-backports.list; then
echo 'deb http://backports.debian.org/debian-backports squeeze-backports main' > /etc/apt/sources.list.d/squeeze-backports.list
apt-get update
fi
apt-get install -q -y -t squeeze-backports rubygems
(gem list | grep rspec) || sudo gem install --no-ri --no-rdoc rspec
apt-get install -q -y equivs
for fakepkg in ruby-rspec; do
(
echo "Section: misc"
echo "Priority: optional"
echo "Standards-Version: 3.6.2"
echo
echo "Package: ${fakepkg}"
) > /tmp/${fakepkg}.equivs
(cd /tmp/ && equivs-build ${fakepkg}.equivs && dpkg -i ${fakepkg}_1.0_all.deb)
done
}
prepare_precise() {
if ! grep -q ZeroMQ Makefile.PL; then
# only needed while we depend on ZeroMQ
return
fi
apt-get install -q -y libzeromq-perl
}
prepare_quantal() {
if ! grep -q ZeroMQ Makefile.PL; then
# only needed while we depend on ZeroMQ
return
fi
apt-get install -q -y libzeromq-perl
}
# FIXME share data with Makefile.PL
needed_programs='
cpanm
doxyparse
git
ruby
sloccount
rake
rspec
sqlite3
man
pkg-config
'
needed_libraries='
uuid
libzmq
'
check_non_perl_dependencies() {
failed=false
for program in $needed_programs; do
printf "Looking for $program ... "
if ! which $program; then
echo "*** $program NOT FOUND *** "
failed=true
fi
done
for package in $needed_libraries; do
printf "Looking for $package ... "
if pkg-config $package; then
echo OK
else
echo "*** ${package}-dev NOT FOUND ***"
failed=true
fi
done
if [ "$failed" = 'true' ]; then
echo
echo "ERROR: missing dependencies"
echo "See HACKING for tips on how to install missing dependencies"
exit 1
fi
}
setup_generic() {
check_non_perl_dependencies
cpanm --installdeps .
}
if [ ! -f ./analizo ]; then
echo "Please run this script from the root of Analizo sources!"
exit 1
fi
force_generic=false
if [ "$1" = '--generic' ]; then
force_generic=true
fi
if [ -x /usr/bin/dpkg -a -x /usr/bin/apt-get -a "$force_generic" = false ]; then
setup_debian
else
setup_generic
fi