webperimental: killstack decides stack protects.
[freeciv.git] / windows / installer_legacy / Makefile
blob78adfc77fab83dbf0c269822e534914cd891d184
2 # Makefile for Freeciv Windows installer creation
4 # Usage:
6 # 1. download and extract the MinGW build environment from
7 # https://sourceforge.net/projects/freeciv/files/dependencies/gnuwin32/
8 # Current version is gnuwin32-2016-07-27.
9 # 2. double click on "gnuwin32/msys.bat"
10 # 3. install the development packages:
11 # $ hg qpush -a
12 # 4. close current session and restart msys.bat. This is required
13 # for PATH to be set correctly after development packages
14 # installation.
15 # 5. change into the Freeciv directory where this Makefile resides
16 # $ cd <path_to_freeciv_source>/win32/installer
17 # 6. run make
18 # $ make
19 # 7. find the installer executables in the 'Output' directory
23 # Variable setup
26 ifeq ($(MIN_WIN_VER),)
27 MIN_WIN_VER=0x0600
28 endif
31 # Make rules
35 # by default build all installers
36 all: gtk3-installer sdl2-installer qt-installer ruledit-installer
38 gtk3-installer:
39 make GUI=gtk3 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-gtk3
41 sdl2-installer:
42 make GUI=sdl2 FCMP=gtk3 EXTRA_CONFIG="--disable-ruledit $(EXTRA_CONFIG)" wrap-sdl2
44 qt-installer:
45 make GUI=qt FCMP=qt wrap-qt
47 ruledit-installer:
48 make wrap-ruledit
50 snapshot:
51 cd ../.. ; ./autogen.sh --no-configure-run
52 make VERSION_REVTYPE="svn" EXTRA_CONFIG="--enable-svnrev" all
55 # build Freeciv
57 build-freeciv-common:
58 # create build directory
59 mkdir -p build-$(GUI)
60 # configure
61 cd build-$(GUI); ../../../configure CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --enable-client=$(GUI) --with-followtag="windows-S3_1" --enable-fcdb=sqlite3 --enable-fcmp=$(FCMP) $(EXTRA_CONFIG)
62 # make
63 make -C build-$(GUI)
64 make -C build-$(GUI)/translations/core update-po
65 make -C build-$(GUI)/bootstrap langstat_core.txt
67 build-freeciv-ruledit:
68 # create build directory
69 mkdir -p build-ruledit
70 # configure
71 cd build-ruledit; ../../../configure CPPFLAGS="-D_WIN32_WINNT=$(MIN_WIN_VER)" --disable-client --disable-server --disable-fcmp --disable-freeciv-manual --enable-ruledit $(EXTRA_CONFIG)
72 # make
73 make -C build-ruledit
74 make -C build-ruledit/translations/ruledit update-po
75 make -C build-ruledit/bootstrap langstat_ruledit.txt
77 build-freeciv-gtk3: build-freeciv-common
79 build-freeciv-sdl2: build-freeciv-common
81 build-freeciv-qt: build-freeciv-common
83 # install Freeciv
85 install-freeciv-common:
86 # make install
87 make -C build-$(GUI) DESTDIR=`pwd`/install-$(GUI) install
88 # reorder directory layout
89 mv install-$(GUI)/usr/local/bin/* install-$(GUI)/
90 mv install-$(GUI)/usr/local/etc install-$(GUI)/
91 mv install-$(GUI)/usr/local/share/freeciv install-$(GUI)/data
92 mkdir -p install-$(GUI)/share
93 mv install-$(GUI)/usr/local/share/locale install-$(GUI)/share/
94 mv install-$(GUI)/usr/local/share/doc install-$(GUI)/doc
95 mkdir -p install-$(GUI)/debuginfo
96 cp build-$(GUI)/gen_headers/fc_config.h install-$(GUI)/debuginfo
97 mkdir -p install-$(GUI)/doc/freeciv/installer
98 cp licenses/COPYING.installer install-$(GUI)/doc/freeciv/installer/
99 # delete unneeded files
100 rm -r install-$(GUI)/usr
101 # strip 'freeciv-manual' and 'freeciv-mp-<gui>' executables
102 strip install-$(GUI)/freeciv-m*
103 # add start menu files
104 cp freeciv-server.cmd freeciv-mp-$(FCMP).cmd freeciv-$(GUI).cmd Freeciv.url install-$(GUI)/
106 install-freeciv-gtk3: install-freeciv-common
108 install-freeciv-sdl2: install-freeciv-common
109 # add CJK fonts
110 cp /opt/fireflysung-1.3.0/fireflysung.ttf install-sdl2/data/themes/gui-sdl2/human/
111 cp /opt/fireflysung-1.3.0/COPYRIGHT install-sdl2/data/themes/gui-sdl2/human/COPYING.fireflysung
112 cp /opt/sazanami-20040629/sazanami-gothic.ttf install-sdl2/data/themes/gui-sdl2/human/
113 cp /opt/sazanami-20040629/README install-sdl2/data/themes/gui-sdl2/human/COPYING.sazanami
114 cp /opt/un-fonts/UnDotum.ttf install-sdl2/data/themes/gui-sdl2/human/
115 cp /opt/un-fonts/COPYING install-sdl2/data/themes/gui-sdl2/human/COPYING.UnDotum
117 install-freeciv-qt: install-freeciv-common
118 # strip 'freeciv-ruledit' executable
119 strip install-$(GUI)/freeciv-ruledit.exe
120 cp freeciv-ruledit.cmd install-$(GUI)/
122 install-ruledit-dir:
123 mkdir -p install-ruledit/share
125 install-ruledit: install-ruledit-dir
126 # make install
127 make -C build-ruledit DESTDIR=`pwd`/install-ruledit install
128 # reorder directory layout
129 mv install-ruledit/usr/local/bin/* install-ruledit/
130 mv install-ruledit/usr/local/etc install-ruledit/
131 mv install-ruledit/usr/local/share/freeciv install-ruledit/data
132 mv install-ruledit/usr/local/share/locale install-ruledit/share/
133 mv install-ruledit/usr/local/share/doc install-ruledit/doc
134 mkdir -p install-ruledit/debuginfo
135 cp build-ruledit/gen_headers/fc_config.h install-ruledit/debuginfo
136 mkdir -p install-ruledit/doc/freeciv/installer
137 cp licenses/COPYING.installer install-ruledit/doc/freeciv/installer/
138 # delete unneeded files
139 rm -r install-ruledit/usr
140 # strip 'freeciv-ruledit' executable
141 strip install-ruledit/freeciv-ruledit.exe
142 # add start menu files
143 cp freeciv-ruledit.cmd Freeciv.url install-ruledit/
145 # install Freeciv environment
147 COMMON_DLLS := \
148 exchndl.dll \
149 freetype6.dll \
150 intl.dll \
151 libMagickCore-6.Q16-1.dll \
152 libMagickWand-6.Q16-1.dll \
153 libatk-1.0-0.dll \
154 libbz2-2.dll \
155 libcurl.dll \
156 libcairo-2.dll \
157 libcairo-gobject-2.dll \
158 libeay32.dll \
159 libffi-6.dll \
160 libfontconfig-1.dll \
161 libfreetype-6.dll \
162 libgcc_s_dw2-1.dll \
163 libgdk_pixbuf-2.0-0.dll \
164 libgio-2.0-0.dll \
165 libglib-2.0-0.dll \
166 libgmodule-2.0-0.dll \
167 libgobject-2.0-0.dll \
168 libgthread-2.0-0.dll \
169 libiconv-2.dll \
170 libidn-11.dll \
171 libintl-8.dll \
172 liblzma-5.dll \
173 libogg-0.dll \
174 libpango-1.0-0.dll \
175 libpangocairo-1.0-0.dll \
176 libpangowin32-1.0-0.dll \
177 libpixman-1-0.dll \
178 libpng14-14.dll \
179 libpng15-15.dll \
180 libpthread-2.dll \
181 libsqlite3-0.dll \
182 libvorbis-0.dll \
183 libvorbisfile-3.dll \
184 libxml2-2.dll \
185 pthreadGC2.dll \
186 ssleay32.dll \
187 zlib1.dll \
188 SDL2.dll \
189 SDL2_mixer.dll
191 install-env-common:
192 # add DLLs
193 cp -R $(addprefix /bin/, $(COMMON_DLLS)) install-$(GUI)
195 DEFAULT_FCMP_DLLS := \
196 libgdk-3-0.dll \
197 libgtk-3-0.dll
199 install-env-default-fcmp: install-env-common
200 cp -R $(addprefix /bin/, $(DEFAULT_FCMP_DLLS)) install-$(GUI)
201 # add additional GTK+3 files
202 mkdir -p install-$(GUI)/etc
203 cp -R /etc/gtk-3.0 install-$(GUI)/etc/
204 mkdir -p install-$(GUI)/lib/gtk-3.0/
205 cp -R /lib/gtk-3.0/3.0.0 install-$(GUI)/lib/gtk-3.0/
206 cp -R /share/locale install-$(GUI)/share/
207 find install-$(GUI)/share/locale -type f -not -name "freeciv*.mo" -and -not -name gtk30.mo -delete
209 install-env-gtk3: install-env-default-fcmp
211 SDL2_DLLS := \
212 libpng16-16.dll \
213 libSDL2_gfx-1-0-0.dll \
214 SDL2_image.dll \
215 SDL2_ttf.dll
217 install-env-sdl2: install-env-default-fcmp
218 # add DLLs
219 cp -R $(addprefix /bin/, $(SDL2_DLLS)) install-$(GUI)
221 QT_DLLS := \
222 libstdc++-6.dll \
223 Qt5Core.dll \
224 Qt5Gui.dll \
225 Qt5Widgets.dll
227 install-env-qt: install-env-common
228 # add DLLs
229 cp -R $(addprefix /bin/, $(QT_DLLS)) install-$(GUI)
230 # add additional Qt files
231 cp -R /plugins install-$(GUI)/
232 cp -R /share/locale install-$(GUI)/share/
233 find install-$(GUI)/share/locale -type f -not -name "freeciv*.mo" -delete
235 install-env-ruledit:
236 # add DLLs
237 cp -R $(addprefix /bin/, $(COMMON_DLLS)) install-ruledit
238 cp -R $(addprefix /bin/, $(QT_DLLS)) install-ruledit
239 # add additional Qt files
240 cp -R /plugins install-ruledit/
241 cp -R /share/locale install-ruledit/share/
242 find install-ruledit/share/locale -type f -not -name "freeciv-ruledit.mo" -delete
244 # build installer
246 installer-common: clean-install-common install-freeciv-$(GUI) install-env-$(GUI)
247 # extract Freeciv version
248 $(eval FREECIV_VERSION := $(shell ../../fc_version))
249 # create NSIS script
250 ./create-freeciv-$(GUI)-nsi.sh install-$(GUI) $(FREECIV_VERSION) > Freeciv-$(FREECIV_VERSION)-$(GUI).nsi
251 # create installer executable
252 mkdir -p Output
253 makensis Freeciv-$(FREECIV_VERSION)-$(GUI).nsi
255 installer-ruledit: clean-install-ruledit install-ruledit install-env-ruledit
256 # extract Freeciv version
257 $(eval FREECIV_VERSION := $(shell ../../fc_version))
258 # create NSIS script
259 ./create-freeciv-ruledit-nsi.sh install-ruledit $(FREECIV_VERSION) > Freeciv-$(FREECIV_VERSION)-ruledit.nsi
260 # create installer executable
261 mkdir -p Output
262 makensis Freeciv-$(FREECIV_VERSION)-ruledit.nsi
264 wrap-gtk3: build-freeciv-gtk3 installer-common
266 wrap-sdl2: build-freeciv-sdl2 installer-common
268 wrap-qt: build-freeciv-qt installer-common
270 wrap-ruledit: build-freeciv-ruledit installer-ruledit
273 # cleanup
275 clean-build-common:
276 rm -rf build-$(GUI)
278 clean-build-ruledit:
279 rm -rf build-ruledit
281 clean-install-common:
282 rm -rf install-$(GUI)
283 ./cleanup_checkout.sh ../..
285 clean-install-ruledit:
286 rm -rf install-ruledit
287 ./cleanup_checkout.sh ../..
289 clean-installer-common:
290 rm -f Output/Freeciv-*-$(GUI)-setup.exe
291 rm -f Freeciv-*-$(GUI).nsi
293 clean-installer-ruledit:
294 rm -f Output/Freeciv-ruledit-*-setup.exe
295 rm -f Freeciv-*-ruledit.nsi
297 clean:
298 make GUI=gtk3 clean-build-common clean-install-common clean-installer-common
299 make GUI=sdl2 clean-build-common clean-install-common clean-installer-common
300 make GUI=qt clean-build-common clean-install-common clean-installer-common
301 make clean-build-ruledit clean-install-ruledit clean-installer-ruledit