This repository has been archived by the owner on Jun 7, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall-deps
executable file
·196 lines (166 loc) · 6.58 KB
/
install-deps
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
#! /bin/sh
# install-deps -- needed for developer and/or maintainer builds
# Copyright (C) 2013, 2015 Olaf Meeuwissen
# Copyright (C) 2012, 2016 EPSON AVASYS CORPORATION
#
# License: GPL-3.0+
# Author : Olaf Meeuwissen
#
# This file is part of the 'Utsushi' package.
# This package is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License or, at
# your option, any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You ought to have received a copy of the GNU General Public License
# along with this package. If not, see <http://www.gnu.org/licenses/>.
# Show script usage documentation and exits the program with an
# optional status passed as its first argument.
usage () {
cat <<EOF
'`basename $0`' needed for developer and/or maintainer builds
Usage: $0 [options]
$0 --help
Searches the sources for build dependencies and makes sure these are
satisfied by installing any missing packages using \`sudo\`. The list
of build dependencies may be larger than actually necessary for your
particular build scenario(s). It covers everything you need to get
started with a clean repository checkout and pass a \`make distcheck\`
as well as some extras that we use to generate software metrics.
The following options are supported:
-h, --help display this message and exit
--with-included-boost assume that the included Boost sources will
be used (does not install any Boost library
packages). See \``dirname $0`/tools/include-boost-src\`
on how to include Boost sources.
BUG: does not really search the sources
BUG: only supports \`apt-get\`
EOF
exit $1
}
# Silently checks whether the argument is a usable command.
has () {
type $1 >/dev/null 2>&1
}
# Run a command with root privileges.
as_root () {
if test -z "$as_root" -a 0 -ne $(id -u) -a -z "$SUDO_USER"; then
if $(type sudo >/dev/null 2>&1); then
as_root=sudo
if $($as_root -A true 2>/dev/null); then
as_root="$as_root -A"
fi
fi
fi
$as_root "$@"
}
# Set initial values of global variables.
DO_HELP=no
WITH_INCLUDED_BOOST=no
# Process command line options and arguments.
parsed_opts=`getopt \
--options h \
--longopt help \
--longopt with-included-boost \
-- "$@"`
if test 0 != $?; then
echo "`basename $0`: error parsing command line options" >&2
usage 1
fi
eval set -- "$parsed_opts"
while test x-- != "x$1"; do
case "$1" in
-h|--help) DO_HELP=yes; shift;;
--with-included-boost) WITH_INCLUDED_BOOST=yes; shift;;
*)
echo "`basename $0`: internal inconsistency" >&2
exit 119 # Japanese emergency phone number ;-)
;;
esac
done
shift # past the '--' marker
test xno != x$DO_HELP && usage
if test 0 -ne $#; then
usage 1
fi
# Determine package management system.
PKG_MGR=
if has apt-get; then # normally absent on RPM-based systems
PKG_MGR=APT
elif has yum; then # packaged for Debian, as is 'rpm'
PKG_MGR=YUM
fi
# Install required software.
case "$PKG_MGR" in
APT)
pkg_list=
# Per Debian Policy 4.2 Package Relationships
if ! dpkg-query -W build-essential >/dev/null 2>&1; then
pkg_list="$pkg_list build-essential"
fi
# Needed by our `./bootstrap` script. These packages should
# not be necessary when building from a clean source tarball
# unless you plan to perform maintenance activities.
has automake || pkg_list="$pkg_list automake"
has autoconf || pkg_list="$pkg_list autoconf"
pkg_list="$pkg_list autoconf-archive"
has autopoint || pkg_list="$pkg_list autopoint"
has libtool || pkg_list="$pkg_list libtool"
pkg_list="$pkg_list libltdl-dev"
has gnulib-tool || pkg_list="$pkg_list gnulib"
# Needed by `./configure`
has pkg-config || pkg_list="$pkg_list pkg-config"
# Needed to generate some source files
has xsltproc || pkg_list="$pkg_list xsltproc"
# We use a number of Boost libraries to avoid reinventing
# wheels. Boost.Test is only used in the unit test suite
# exercised by `make check`.
if test xno = x$WITH_INCLUDED_BOOST; then
pkg_list="$pkg_list libboost-filesystem-dev"
pkg_list="$pkg_list libboost-iostreams-dev"
pkg_list="$pkg_list libboost-program-options-dev"
pkg_list="$pkg_list libboost-regex-dev"
pkg_list="$pkg_list libboost-test-dev"
pkg_list="$pkg_list libboost-thread-dev"
else
has bcp || pkg_list="$pkg_list libboost-tools-dev"
# Needed to build libboost-iostreams
pkg_list="$pkg_list libz-dev"
pkg_list="$pkg_list libbz2-dev"
fi
# Needed for device detection
pkg_list="$pkg_list libudev-dev"
# Needed to enable optional components
pkg_list="$pkg_list libusb-1.0-0-dev"
pkg_list="$pkg_list libgtkmm-2.4-dev"
pkg_list="$pkg_list libjpeg-dev"
pkg_list="$pkg_list libmagic-dev"
pkg_list="$pkg_list libsane-dev"
pkg_list="$pkg_list libtiff-dev"
pkg_list="$pkg_list libgraphicsmagick++1-dev"
# Needed for logo and icon format conversion
has rsvg-convert || pkg_list="$pkg_list librsvg2-bin"
has gm || has convert || pkg_list="$pkg_list graphicsmagick"
pkg_list="$pkg_list fonts-dejima-mincho"
# Needed to generate test case input
has text2image || pkg_list="$pkg_list tesseract-ocr"
pkg_list="$pkg_list fonts-dejavu-core"
# Needed for documentation generation purposes
has doxygen || pkg_list="$pkg_list doxygen"
has perl || pkg_list="$pkg_list perl-base"
has dot || pkg_list="$pkg_list graphviz"
if has pdflatex; then
pkg_list="$pkg_list texlive-fonts-recommended"
fi
as_root apt-get -qy install $pkg_list
;;
*)
echo "`basename $0`: Unsupported package management system" >&2
exit 119 # Japanese emergency phone number ;-)
;;
esac