1#!/usr/bin/env bash
2# -------------------------------------------------------------------------------
3# This script installs all dependencies required for building Inkscape with MSYS2
4#   execute it once on an MSYS shell, i.e.
5#    - use the "MSYS2 MSYS" shortcut in the start menu or
6#    - run "msys2.exe" in MSYS2's installation folder
7#
8# MSYS2 and installed libraries can be updated later by executing
9#   pacman -Syu --ignore=mingw-w64-*-imagemagick
10# in an MSYS shell
11# -------------------------------------------------------------------------------
12
13# select if you want to build 32-bit (i686), 64-bit (x86_64), or both
14case "$MSYSTEM" in
15  MINGW32)
16    ARCH=mingw-w64-i686
17    ;;
18  MINGW64)
19    ARCH=mingw-w64-x86_64
20    ;;
21  *)
22    ARCH={mingw-w64-i686,mingw-w64-x86_64}
23    ;;
24esac
25
26# set default options for invoking pacman (in CI this variable is already set globally)
27if [ -z $CI ]; then
28    PACMAN_OPTIONS="--needed --noconfirm"
29fi
30
31# sync package databases
32pacman -Sy
33
34# install basic development system, compiler toolchain and build tools
35eval pacman -S $PACMAN_OPTIONS \
36git \
37intltool \
38base-devel \
39$ARCH-toolchain \
40$ARCH-cmake \
41$ARCH-ninja
42
43# install Inkscape dependencies (required)
44eval pacman -S $PACMAN_OPTIONS \
45$ARCH-double-conversion \
46$ARCH-gc \
47$ARCH-gsl \
48$ARCH-libxslt \
49$ARCH-boost \
50$ARCH-gtk3 \
51$ARCH-gtkmm3 \
52$ARCH-libsoup
53
54# install Inkscape dependencies (optional)
55eval pacman -S $PACMAN_OPTIONS \
56$ARCH-poppler \
57$ARCH-potrace \
58$ARCH-libcdr \
59$ARCH-libvisio \
60$ARCH-libwpg \
61$ARCH-aspell \
62$ARCH-aspell-en \
63$ARCH-gspell
64
65# install ImageMagick (as Inkscape requires old version ImageMagick 6 we have to specify it explicitly)
66# to prevent future updates:
67#     add the line
68#        "IgnorePkg = mingw-w64-*-imagemagick"
69#     to
70#        "C:\msys64\etc\pacman.conf"
71#     or (always!) run pacman with the additional command line switch
72#        --ignore=mingw-w64-*-imagemagick
73for arch in $(eval echo $ARCH); do
74  wget -nv https://gitlab.com/ede123/bintray/-/raw/master/${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz \
75    && pacman -U $PACMAN_OPTIONS ${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz \
76    && rm  ${arch}-imagemagick-6.9.10.69-1-any.pkg.tar.xz
77done
78
79
80# install Python and modules used by Inkscape
81eval pacman -S $PACMAN_OPTIONS \
82$ARCH-python \
83$ARCH-python-pip \
84$ARCH-python-lxml \
85$ARCH-python-numpy \
86$ARCH-python-pillow \
87$ARCH-python-six \
88$ARCH-python-gobject \
89$ARCH-python-pyserial \
90$ARCH-python-coverage \
91$ARCH-scour
92
93# install modules needed by extensions manager
94eval pacman -S $PACMAN_OPTIONS \
95$ARCH-python-appdirs \
96$ARCH-python-msgpack \
97$ARCH-python-lockfile \
98$ARCH-python-cachecontrol \
99$ARCH-python-idna \
100$ARCH-python-urllib3 \
101$ARCH-python-chardet \
102$ARCH-python-certifi \
103$ARCH-python-requests
104
105# install Python modules not provided as MSYS2/MinGW packages
106PACKAGES=""
107for arch in $(eval echo $ARCH); do
108  case ${arch} in
109    mingw-w64-i686)
110      #/mingw32/bin/pip3 install --upgrade ${PACKAGES}
111      ;;
112    mingw-w64-x86_64)
113      #/mingw64/bin/pip3 install --upgrade ${PACKAGES}
114      ;;
115  esac
116done
117