summaryrefslogtreecommitdiffstats
path: root/buildtools/msys2installdeps.sh
blob: ce479375c1745d01ea7ba1c44e00eb17b9eb1141 (plain)
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
#!/usr/bin/env bash
# -------------------------------------------------------------------------------
# This script installs all dependencies required for building Inkscape with MSYS2.
#
# See https://wiki.inkscape.org/wiki/Compiling_Inkscape_on_Windows_with_MSYS2 for
# detailed instructions.
#
# The following instructions assume you are building for the standard x86_64 processor architecture,
# which means that you use the MINGW64 variant of msys2.
# Else, replace MINGW64 with the appropriate variant for your architecture.
#
# To run this script, execute it once on an MINGW64 shell, i.e.
#    - use the "MSYS2 MINGW64" shortcut in the start menu or
#    - run "mingw64.exe" in MSYS2's installation folder
#
# MSYS2 and installed libraries can be updated later by executing
#   pacman -Syu
# in an MSYS shell ("MSYS2 MSYS" shortcut in the start menu or "msys2.exe" in the
# MSYS2 folder)
# -------------------------------------------------------------------------------

# select if you want to build 32-bit (i686), 64-bit (x86_64), or both
case "$MSYSTEM" in
  MINGW32)
    ARCH=mingw-w64-i686
    ;;
  MINGW64)
    ARCH=mingw-w64-x86_64
    ;;
  UCRT64)
    ARCH=mingw-w64-ucrt-x86_64
    ;;
  CLANGARM64)
    ARCH=mingw-w64-clang-aarch64
    ;;
  *)
    ARCH={mingw-w64-i686,mingw-w64-x86_64}
    ;;
esac

# set default options for invoking pacman (in CI this variable is already set globally)
if [ -z $CI ]; then
    PACMAN_OPTIONS="--needed --noconfirm"
fi

# sync package databases
pacman -Sy

# install basic development system, compiler toolchain and build tools
eval pacman -S $PACMAN_OPTIONS \
git \
base-devel \
$ARCH-toolchain \
$ARCH-autotools \
$ARCH-cmake \
$ARCH-meson \
$ARCH-ninja \
$ARCH-ccache

# install Inkscape dependencies (required)
eval pacman -S $PACMAN_OPTIONS \
$ARCH-double-conversion \
$ARCH-gc \
$ARCH-gsl \
$ARCH-libxslt \
$ARCH-boost \
$ARCH-gtk3 \
$ARCH-gtk-doc \
$ARCH-gtkmm3 \
$ARCH-libsoup

# install Inkscape dependencies (optional)
eval pacman -S $PACMAN_OPTIONS \
$ARCH-poppler \
$ARCH-potrace \
$ARCH-libcdr \
$ARCH-libvisio \
$ARCH-libwpg \
$ARCH-aspell \
$ARCH-aspell-en \
$ARCH-gspell \
$ARCH-gtksourceview4 \
$ARCH-graphicsmagick \
$ARCH-libjxl

# install Python and modules used by Inkscape
eval pacman -S $PACMAN_OPTIONS \
$ARCH-python \
$ARCH-python-pip \
$ARCH-python-lxml \
$ARCH-python-numpy \
$ARCH-python-cssselect \
$ARCH-python-pillow \
$ARCH-python-six \
$ARCH-python-gobject \
$ARCH-python-pyserial \
$ARCH-python-coverage \
$ARCH-python-packaging \
$ARCH-python-zstandard \
$ARCH-scour

# install modules needed by extensions manager and clipart importer
eval pacman -S $PACMAN_OPTIONS \
$ARCH-python-appdirs \
$ARCH-python-beautifulsoup4 \
$ARCH-python-filelock \
$ARCH-python-msgpack \
$ARCH-python-lockfile \
$ARCH-python-cachecontrol \
$ARCH-python-idna \
$ARCH-python-urllib3 \
$ARCH-python-chardet \
$ARCH-python-certifi \
$ARCH-python-requests

# install Python modules not provided as MSYS2/MinGW packages
PACKAGES=""
for arch in $(eval echo $ARCH); do
  case ${arch} in
    mingw-w64-i686)
      #/mingw32/bin/pip3 install --upgrade ${PACKAGES}
      ;;
    mingw-w64-x86_64)
      #/mingw64/bin/pip3 install --upgrade ${PACKAGES}
      ;;
    mingw-w64-clang-aarch64)
      #/clangarm64/bin/pip3 install --upgrade ${PACKAGES}
      ;;
  esac
done


# gettext hack - to remove once gettext has the match
function hack_libintl(){
f=/$1/include/libintl.h
sed -i '/^extern int sprintf/a #ifdef __cplusplus\nnamespace std { using ::libintl_sprintf; }\n#endif' $f
cat $f
}

case "$MSYSTEM" in
  MINGW32)
    hack_libintl mingw32
    ;;
  MINGW64)
    hack_libintl mingw64
    ;;
  CLANGARM64)
    hack_libintl clangarm64
    ;;
  *)
    hack_libintl mingw32
    hack_libintl mingw64
    ;;
esac

echo "Done :-)"