Updated msys2 environment to 170126 level.
[freeciv.git] / win32 / installer_msys2 / Makefile
blobeb82025cd8e2d7c8b8b6b62f3f4a9ad0bbaf0819
2 # Makefile for Freeciv Windows installer creation
4 # See doc/README.msys2 for building instructions.
8 # Variable setup
11 WINARCH=$(shell ./win_arch.sh)
13 ifeq ($(WINARCH),win64)
14 ARCHDIR=mingw64
15 LIBGCCDLL=libgcc_s_seh-1.dll
16 GCCDLL=gcc_s-seh-1.dll
17 else
18 ARCHDIR=mingw32
19 LIBGCCDLL=libgcc_s_dw2-1.dll
20 GCCDLL=gcc_s-1.dll
21 endif
23 ifeq ($(MIN_WIN_VER),)
24 MIN_WIN_VER=0x0601
25 endif
27 INSTSUB=${ARCHDIR}
29 # msys2 has dlls in...
30 DLLPATH_PREFIX=/$(ARCHDIR)/bin/
33 # Make rules
36 # by default build all installers that are buildable with current msys2 environment
37 # gtk2-installer is not built.
38 all: gtk3-installer sdl2-installer ruledit-installer qt-installer gtk3.22-installer
40 # These are what can be built in current official environment version
41 buildable-win32: gtk3-installer sdl2-installer ruledit-installer qt-installer gtk3.22-installer
43 buildable-win64: gtk3-installer sdl2-installer ruledit-installer qt-installer gtk3.22-installer
45 # See comments on 'snapshot' target why this wrapping is needed
46 buildable: buildable-$(WINARCH)
48 gtk3-installer:
49 make GUI=gtk3 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-gtk3
51 gtk3.22-installer:
52 make GUI=gtk3.22 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-gtk3
54 gtk2-installer:
55 make GUI=gtk2 FCMP=gtk2 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-gtk2
57 sdl2-installer:
58 make GUI=sdl2 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-sdl2
60 qt-installer:
61 make GUI=qt FCMP=qt EXTRA_CONFIG="--with-qt5-includes=/$(ARCHDIR)/include --with-qt5-libs=/$(ARCHDIR)/lib $(EXTRA_CONFIG)" wrap-qt
63 ruledit-installer:
64 make wrap-ruledit
66 # Autogen.sh here will make ./win_arch.sh to work.
67 # The $(WINACRH) value we got for this run is not good. The new run
68 # launched from this target will pick correct value, and can make 'buildable' target
69 # to depend on correct arch version.
70 snapshot:
71 cd ../.. ; ./autogen.sh --no-configure-run
72 make VERSION_REVTYPE="svn" EXTRA_CONFIG="--enable-svnrev" buildable
75 # build Freeciv
77 build-freeciv-common:
78 # create build directory
79 mkdir -p build-$(WINARCH)-$(GUI)
80 # configure
81 cd build-$(WINARCH)-$(GUI); ../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --enable-client=$(GUI) --with-followtag="win32-S2_6" --without-readline --enable-fcdb=sqlite3 --with-sqlite3-prefix=/$(ARCHDIR) --enable-fcmp=$(FCMP) $(EXTRA_CONFIG)
82 # make
83 make -C build-$(WINARCH)-$(GUI)
84 make -C build-$(WINARCH)-$(GUI)/translations/freeciv update-po
85 make -C build-$(WINARCH)-$(GUI)/bootstrap langstat_freeciv.txt
87 build-freeciv-ruledit:
88 # create build directory
89 mkdir -p build-$(WINARCH)-ruledit
90 # configure
91 cd build-$(WINARCH)-ruledit; ../../../configure FREECIV_LABEL_FORCE="<base>-msys2" CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --enable-ruledit --with-qt5-includes=/$(ARCHDIR)/include --with-qt5-libs=/$(ARCHDIR)/lib $(EXTRA_CONFIG)
92 # make
93 make -C build-$(WINARCH)-ruledit
94 make -C build-$(WINARCH)-ruledit/translations/ruledit update-po
95 make -C build-$(WINARCH)-ruledit/bootstrap langstat_ruledit.txt
97 build-freeciv-gtk3: build-freeciv-common
99 build-freeciv-gtk2: build-freeciv-common
101 build-freeciv-sdl2: build-freeciv-common
103 build-freeciv-qt: build-freeciv-common
105 # install Freeciv
107 install-freeciv-common:
108 # make install
109 make -C build-$(WINARCH)-$(GUI) DESTDIR=`pwd`/install-$(WINARCH)-$(GUI) install
110 # reorder directory layout
111 mv install-$(WINARCH)-$(GUI)/$(INSTSUB)/bin/* install-$(WINARCH)-$(GUI)/
112 mv install-$(WINARCH)-$(GUI)/$(INSTSUB)/etc install-$(WINARCH)-$(GUI)/
113 mv install-$(WINARCH)-$(GUI)/$(INSTSUB)/share/freeciv install-$(WINARCH)-$(GUI)/data
114 mkdir -p install-$(WINARCH)-$(GUI)/share
115 mv install-$(WINARCH)-$(GUI)/$(INSTSUB)/share/locale install-$(WINARCH)-$(GUI)/share/
116 mv install-$(WINARCH)-$(GUI)/$(INSTSUB)/share/doc install-$(WINARCH)-$(GUI)/doc
117 mkdir -p install-$(WINARCH)-$(GUI)/debuginfo
118 cp build-$(WINARCH)-$(GUI)/gen_headers/fc_config.h install-$(WINARCH)-$(GUI)/debuginfo
119 mkdir -p install-$(WINARCH)-$(GUI)/doc/freeciv/installer
120 cp licenses/COPYING.installer install-$(WINARCH)-$(GUI)/doc/freeciv/installer/
121 # delete unneeded files
122 rm -r install-$(WINARCH)-$(GUI)/$(INSTSUB)
123 # strip 'freeciv-manual' and 'freeciv-mp-<gui>' executables
124 strip install-$(WINARCH)-$(GUI)/freeciv-m*
125 # add start menu files
126 cp freeciv-server.cmd freeciv-mp-$(FCMP).cmd freeciv-$(GUI).cmd Freeciv.url install-$(WINARCH)-$(GUI)/
128 install-freeciv-gtk3: install-freeciv-common
130 install-freeciv-gtk3.22: install-freeciv-common
132 install-freeciv-gtk2: install-freeciv-common
134 install-freeciv-sdl2: install-freeciv-common
136 install-freeciv-qt: install-freeciv-common
137 # strip 'freeciv-ruledit' executable
138 strip install-$(WINARCH)-$(GUI)/freeciv-ruledit.exe
139 cp freeciv-ruledit.cmd install-$(WINARCH)-$(GUI)/
141 install-ruledit-dir:
142 mkdir -p install-$(WINARCH)-ruledit/share
144 install-ruledit: install-ruledit-dir
145 # make install
146 make -C build-$(WINARCH)-ruledit DESTDIR=`pwd`/install-$(WINARCH)-ruledit/ install
147 # reorder directory layout
148 mv install-$(WINARCH)-ruledit/$(INSTSUB)/bin/* install-$(WINARCH)-ruledit/
149 mv install-$(WINARCH)-ruledit/$(INSTSUB)/share/freeciv install-$(WINARCH)-ruledit/data
150 mv install-$(WINARCH)-ruledit/$(INSTSUB)/share/locale install-$(WINARCH)-ruledit/share/
151 mv install-$(WINARCH)-ruledit/$(INSTSUB)/share/doc install-$(WINARCH)-ruledit/doc
152 mkdir -p install-$(WINARCH)-ruledit/debuginfo
153 cp build-$(WINARCH)-ruledit/gen_headers/fc_config.h install-$(WINARCH)-ruledit/debuginfo
154 mkdir -p install-$(WINARCH)-ruledit/doc/freeciv/installer
155 cp licenses/COPYING.installer install-$(WINARCH)-ruledit/doc/freeciv/installer/
156 # delete unneeded files
157 rm -r install-$(WINARCH)-ruledit/$(INSTSUB)
158 # strip 'freeciv-ruledit' executable
159 strip install-$(WINARCH)-ruledit/freeciv-ruledit.exe
160 # add start menu files
161 cp freeciv-ruledit.cmd Freeciv.url install-$(WINARCH)-ruledit/
163 # install Freeciv environment
165 SOUND_DLLS := \
166 SDL2.dll \
167 libSDL2_mixer-2-0-0.dll \
168 libFLAC-8.dll \
169 libfluidsynth-1.dll \
170 libmad-0.dll \
171 libmodplug-1.dll \
172 libvorbis-0.dll \
173 libvorbisenc-2.dll \
174 libvorbisfile-3.dll \
175 libogg-0.dll \
176 libportaudio-2.dll \
177 libsndfile-1.dll \
178 libspeex-1.dll
180 COMMON_DLLS := \
181 libstdc++-6.dll \
182 libeay32.dll \
183 ssleay32.dll \
184 libidn-11.dll \
185 libnghttp2-14.dll \
186 librtmp-1.dll \
187 libssh2-1.dll \
188 libcurl-4.dll \
189 libgmp-10.dll \
190 libgnutls-30.dll \
191 libhogweed-4.dll \
192 libnettle-6.dll \
193 libp11-kit-0.dll \
194 libtasn1-6.dll \
195 libatk-1.0-0.dll \
196 libbz2-1.dll \
197 libcairo-2.dll \
198 libcairo-gobject-2.dll \
199 libffi-6.dll \
200 libfontconfig-1.dll \
201 libfreetype-6.dll \
202 $(LIBGCCDLL) \
203 libgdk_pixbuf-2.0-0.dll \
204 libgio-2.0-0.dll \
205 libglib-2.0-0.dll \
206 libgmodule-2.0-0.dll \
207 libgobject-2.0-0.dll \
208 libgthread-2.0-0.dll \
209 libiconv-2.dll \
210 libintl-8.dll \
211 liblzma-5.dll \
212 libpango-1.0-0.dll \
213 libpangocairo-1.0-0.dll \
214 libpangowin32-1.0-0.dll \
215 libpixman-1-0.dll \
216 libpng16-16.dll \
217 libxml2-2.dll \
218 zlib1.dll \
219 libwinpthread-1.dll \
220 libsqlite3-0.dll \
221 $(SOUND_DLLS)
223 install-env-common:
224 # add DLLs
225 cp -R $(addprefix $(DLLPATH_PREFIX), $(COMMON_DLLS)) install-$(WINARCH)-$(GUI)/
227 DEFAULT_FCMP_DLLS := \
228 libgdk-3-0.dll \
229 libgtk-3-0.dll \
230 libexpat-1.dll \
231 libharfbuzz-0.dll \
232 libepoxy-0.dll \
233 libgraphite2.dll \
234 libpangoft2-1.0-0.dll \
235 libpcre-1.dll
237 install-env-default-fcmp: install-env-common
238 cp -R $(addprefix $(DLLPATH_PREFIX), $(DEFAULT_FCMP_DLLS)) install-$(WINARCH)-$(GUI)/
239 # add additional GTK+3 files
240 mkdir -p install-$(WINARCH)-$(GUI)/etc
241 cp -R /$(ARCHDIR)/etc/gtk-3.0 install-$(WINARCH)-$(GUI)/etc/
242 mkdir -p install-$(WINARCH)-$(GUI)/share/icons
243 cp -R /$(ARCHDIR)/share/icons/Adwaita install-$(WINARCH)-$(GUI)/share/icons/
244 mkdir -p install-$(WINARCH)-$(GUI)/lib/gtk-3.0/
245 cp -R /$(ARCHDIR)/lib/gtk-3.0/* install-$(WINARCH)-$(GUI)/lib/gtk-3.0/
246 mkdir -p install-$(WINARCH)-$(GUI)/lib/gdk-pixbuf-2.0/
247 cp -R /$(ARCHDIR)/lib/gdk-pixbuf-2.0/* install-$(WINARCH)-$(GUI)/lib/gdk-pixbuf-2.0/
248 cp -R /$(ARCHDIR)/share/locale install-$(WINARCH)-$(GUI)/share/
249 find install-$(WINARCH)-$(GUI)/share/locale -type f -not -name "freeciv*.mo" -and -not -name gtk30.mo -delete
251 install-env-gtk3: install-env-default-fcmp
253 install-env-gtk3.22: install-env-default-fcmp
255 GTK2_DLLS := \
256 libgdk-win32-2.0-0.dll \
257 libgtk-win32-2.0-0.dll \
258 libexpat-1.dll \
259 libharfbuzz-0.dll \
260 libpangoft2-1.0-0.dll \
261 libpcre-1.dll
263 install-env-gtk2: install-env-common
264 # add DLLs
265 cp -R $(addprefix $(DLLPATH_PREFIX), $(GTK2_DLLS)) install-$(WINARCH)-$(GUI)/
266 # add additional GTK+2 files
267 mkdir -p install-$(WINARCH)-$(GUI)/etc
268 cp -R /$(ARCHDIR)/etc/gtk-2.0 install-$(WINARCH)-$(GUI)/etc/
269 mkdir -p install-$(WINARCH)-$(GUI)/lib/gtk-2.0/
270 cp -R /$(ARCHDIR)/lib/gtk-2.0/2.10.0 install-$(WINARCH)-$(GUI)/lib/gtk-2.0/
271 cp -R /$(ARCHDIR)/share/locale install-$(WINARCH)-$(GUI)/share/
272 find install-$(WINARCH)-$(GUI)/share/locale -type f -not -name "freeciv*.mo" -and -not -name gtk20.mo -delete
274 SDL2_DLLS := \
275 libSDL2_gfx-1-0-0.dll \
276 SDL2_image.dll \
277 SDL2_ttf.dll \
278 libjpeg-8.dll \
279 libtiff-5.dll \
280 libwebp-6.dll
282 install-env-sdl2: install-env-default-fcmp
283 # add DLLs
284 cp -R $(addprefix $(DLLPATH_PREFIX), $(SDL2_DLLS)) install-$(WINARCH)-$(GUI)/
286 QT_DLLS := \
287 libicuin57.dll \
288 libicuuc57.dll \
289 libicudt57.dll \
290 libpcre16-0.dll \
291 libharfbuzz-0.dll \
292 libsqlite3-0.dll \
293 Qt5Core.dll \
294 Qt5Gui.dll \
295 Qt5Widgets.dll \
296 libgraphite2.dll \
297 libpcre-1.dll
299 install-env-qt: install-env-common
300 # add DLLs
301 cp -R $(addprefix $(DLLPATH_PREFIX), $(QT_DLLS)) install-$(WINARCH)-$(GUI)/
302 # add additional Qt files
303 cp -R /$(ARCHDIR)/share/qt5/plugins install-$(WINARCH)-$(GUI)/
304 cp -R /$(ARCHDIR)/share/locale install-$(WINARCH)-$(GUI)/share/
305 find install-$(WINARCH)-$(GUI)/share/locale -type f -not -name "freeciv*.mo" -delete
307 RULEDIT_DLLS := \
308 libstdc++-6.dll \
309 libeay32.dll \
310 ssleay32.dll \
311 libidn-11.dll \
312 libnghttp2-14.dll \
313 librtmp-1.dll \
314 libssh2-1.dll \
315 libcurl-4.dll \
316 libgmp-10.dll \
317 libgnutls-30.dll \
318 libhogweed-4.dll \
319 libnettle-6.dll \
320 libp11-kit-0.dll \
321 libtasn1-6.dll \
322 libatk-1.0-0.dll \
323 libbz2-1.dll \
324 libcairo-2.dll \
325 libcairo-gobject-2.dll \
326 libffi-6.dll \
327 libfontconfig-1.dll \
328 libfreetype-6.dll \
329 $(LIBGCCDLL) \
330 libglib-2.0-0.dll \
331 libgdk_pixbuf-2.0-0.dll \
332 libgio-2.0-0.dll \
333 libiconv-2.dll \
334 libintl-8.dll \
335 liblzma-5.dll \
336 libpango-1.0-0.dll \
337 libpangocairo-1.0-0.dll \
338 libpangowin32-1.0-0.dll \
339 libpixman-1-0.dll \
340 libpng16-16.dll \
341 libxml2-2.dll \
342 zlib1.dll \
343 libwinpthread-1.dll \
344 libgraphite2.dll \
345 libpcre-1.dll
347 install-env-ruledit:
348 # add DLLs
349 cp -R $(addprefix $(DLLPATH_PREFIX), $(RULEDIT_DLLS)) install-$(WINARCH)-ruledit/
350 cp -R $(addprefix $(DLLPATH_PREFIX), $(QT_DLLS)) install-$(WINARCH)-ruledit/
351 # add additional Qt files
352 cp -R /$(ARCHDIR)/share/qt5/plugins install-$(WINARCH)-ruledit/
353 cp -R /usr/share/locale install-$(WINARCH)-ruledit/share/
354 find install-$(WINARCH)-ruledit/share/locale -type f -not -name "freeciv-ruledit.mo" -delete
356 # build installer
358 installer-common: clean-install-common install-freeciv-$(GUI) install-env-$(GUI)
359 # extract Freeciv version
360 $(eval FREECIV_VERSION := $(shell ../../fc_version))
361 # create NSIS script
362 ./create-freeciv-$(GUI)-nsi.sh install-$(WINARCH)-$(GUI) $(FREECIV_VERSION) $(WINARCH) > Freeciv-$(WINARCH)-$(FREECIV_VERSION)-$(GUI).nsi
363 # create installer executable
364 mkdir -p Output
365 makensis Freeciv-$(WINARCH)-$(FREECIV_VERSION)-$(GUI).nsi
367 installer-ruledit: clean-install-ruledit install-ruledit install-env-ruledit
368 # extract Freeciv version
369 $(eval FREECIV_VERSION := $(shell ../../fc_version))
370 # create NSIS script
371 ./create-freeciv-ruledit-nsi.sh install-$(WINARCH)-ruledit $(FREECIV_VERSION) $(WINARCH) > Freeciv-$(WINARCH)-$(FREECIV_VERSION)-ruledit.nsi
372 # create installer executable
373 mkdir -p Output
374 makensis Freeciv-$(WINARCH)-$(FREECIV_VERSION)-ruledit.nsi
376 wrap-gtk3: build-freeciv-gtk3 installer-common
378 wrap-gtk2: build-freeciv-gtk2 installer-common
380 wrap-sdl2: build-freeciv-sdl2 installer-common
382 wrap-qt: build-freeciv-qt installer-common
384 wrap-ruledit: build-freeciv-ruledit installer-ruledit
387 # cleanup
389 clean-build-common:
390 rm -rf build-*-$(GUI)
392 clean-build-ruledit:
393 rm -rf build-*-ruledit
395 clean-install-common:
396 rm -rf install-*-$(GUI)
397 ./cleanup_checkout.sh ../..
399 clean-install-ruledit:
400 rm -rf install-*-ruledit
401 ./cleanup_checkout.sh ../..
403 clean-installer-common:
404 rm -f Output/Freeciv-*-$(GUI)-setup.exe
405 rm -f Freeciv-*-$(GUI).nsi
407 clean-installer-ruledit:
408 rm -f Output/Freeciv-ruledit-*-setup.exe
409 rm -f Freeciv-*-ruledit.nsi
411 clean:
412 make GUI=gtk3 clean-build-common clean-install-common clean-installer-common
413 make GUI=gtk3.22 clean-build-common clean-install-common clean-installer-common
414 make GUI=gtk2 clean-build-common clean-install-common clean-installer-common
415 make GUI=sdl2 clean-build-common clean-install-common clean-installer-common
416 make GUI=qt clean-build-common clean-install-common clean-installer-common
417 make clean-build-ruledit clean-install-ruledit clean-installer-ruledit