-
Notifications
You must be signed in to change notification settings - Fork 239
/
before_install_linux.sh
executable file
·59 lines (45 loc) · 1.5 KB
/
before_install_linux.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
#!/usr/bin/env bash
set -euox pipefail
if [ -v STYLE_CHECKS ]; then
set +ux
exit 0
fi
if [ ! -v IMAGEMAGICK_VERSION ]; then
echo "you must specify an ImageMagick version."
echo "example: 'IMAGEMAGICK_VERSION=6.8.9-10 bash ./before_install_linux.sh'"
exit 1
fi
# remove all existing imagemagick related packages
sudo apt-get autoremove -y imagemagick* libmagick* --purge
# install build tools, ImageMagick delegates
sudo apt-get install -y build-essential libx11-dev libxext-dev zlib1g-dev \
liblcms2-dev libpng-dev libjpeg-dev libfreetype6-dev \
libtiff5-dev libwebp-dev liblqr-1-0-dev vim gsfonts ghostscript
project_dir=$(pwd)
build_dir="${project_dir}/build-ImageMagick/ImageMagick-${IMAGEMAGICK_VERSION}"
if [ -v CONFIGURE_OPTIONS ]; then
build_dir="${build_dir}-${CONFIGURE_OPTIONS}"
fi
build_imagemagick() {
mkdir -p build-ImageMagick
version=(${IMAGEMAGICK_VERSION//./ })
wget "https://imagemagick.org/archive/releases/ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
tar -xf "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
rm "ImageMagick-${IMAGEMAGICK_VERSION}.tar.xz"
mv "ImageMagick-${IMAGEMAGICK_VERSION}" "${build_dir}"
options="--with-magick-plus-plus=no --disable-docs"
if [ -v CONFIGURE_OPTIONS ]; then
options="${CONFIGURE_OPTIONS} ${options}"
fi
cd "${build_dir}"
./configure --prefix=/usr "${options}"
make -j $(nproc)
}
if [ ! -d "${build_dir}" ]; then
build_imagemagick
fi
cd "${build_dir}"
sudo make install -j $(nproc)
cd "${project_dir}"
sudo ldconfig
set +ux