forked from analizo/analizo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
development-setup.sh
executable file
·103 lines (87 loc) · 2.27 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
#!/bin/sh
set -e
setup_debian() {
which wget || sudo apt-get -q -y -f install wget
which gpg || sudo apt-get -q -y -f install gnupg
which lsb_release || sudo apt-get -q -y -f 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
which apt-file || sudo apt-get -q -y -f install apt-file
sudo apt-get update
sudo apt-file update
sudo apt-get -q -y -f install dh-make-perl libdist-zilla-perl liblocal-lib-perl cpanminus doxygen-doxyparse
packages=$(locate_package $(dzil authordeps))
if [ -n "$packages" ]; then
sudo apt-get -q -y -f install $packages
fi
dzil authordeps --missing | cpanm --notest
packages=$(locate_package $(dzil listdeps))
if [ -n "$packages" ]; then
sudo apt-get -q -y -f install $packages
fi
dzil listdeps --missing | cpanm --notest
}
locate_package() {
packages=
for module in $@; do
package=$(dh-make-perl locate $module | grep 'package$' | grep ' is in ' | sed 's/.\+is in \(.\+\) package/\1/')
packages="$packages $package"
done
echo $packages
}
# FIXME share data with Makefile.PL/dist.ini
needed_programs='
cpanm
git
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
dzil listdeps | cpanm
}
if [ ! -f ./bin/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