Replace misused g_str_equal() with purple_strequal()
[pidgin-git.git] / Makefile.mingw
blobbaa6257d674f94238fa83ee44b83eb3f75727acd
1 # Makefile.mingw
3 # Author: hermanator12002@yahoo.com
4 # Date 9/11/02
5 # Description: Top Makefile for win32 (mingw) port of Pidgin and libpurple
8 PIDGIN_TREE_TOP := .
9 include $(PIDGIN_TREE_TOP)/libpurple/win32/global.mak
11 # Generate a X.X.X.X version for the installer file versioning header
12 # The last digit will be 99 for a final release, 0 for dev or unknown, or the beta number
13 PIDGIN_PRODUCT_VERSION = $(shell \
14 awk 'BEGIN {FS="."} { \
15     if (int($$3) == $$3) { \
16         $$4 = "99"; \
17     } else { \
18         $$5 = $$3; \
19         sub(int($$3), "", $$5); \
20         if ($$5 == "dev") { \
21             $$4 = "0"; \
22         } else { \
23             if (sub("beta", "", $$5) > 0) { \
24                 $$4 = $$5; \
25             } else { \
26                 $$4 = "0"; \
27             } \
28         } \
29     } \
30     printf("%s.%s.%s.%s", $$1, $$2, int($$3), $$4); \
31     exit; \
32 }' VERSION)
34 GTK_INSTALL_VERSION = 2.16.6.3
36 ifdef SIGNTOOL
37 authenticode_sign = $(SIGNTOOL) sign \
38                     /fd SHA256 \
39                     /f "$(SIGNTOOL_PFX)" /p "$(SIGNTOOL_PASSWORD)" \
40                     /d $(2) /du "https://pidgin.im" \
41                     /tr "http://timestamp.comodoca.com/rfc3161" /td SHA256 \
42                     $(1)
43 else
44 authenticode_sign = $(MONO_SIGNCODE) \
45                     -spc "$(SIGNCODE_SPC)" -v "$(SIGNCODE_PVK)" \
46                     -a sha1 -$$ commercial \
47                     -n "$(2)" -i "https://pidgin.im" \
48                     -t "http://timestamp.verisign.com/scripts/timstamp.dll" -tr 10 \
49                     $(1) && rm -f $(1).bak
50 endif
52 gpg_sign = $(GPG_SIGN) -ab $(1) && $(GPG_SIGN) --verify $(1).asc
54 STRIPPED_RELEASE_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-win32bin
55 DEBUG_SYMBOLS_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-dbgsym
57 PIDGIN_INST_DEP_DIR="$(WIN32_DEV_TOP)/pidgin-inst-deps-20130214"
59 # Any *.dll or *.exe files included in win32-install-dir that we don't compile
60 # should be included in this list so they don't get stripped
61 EXTERNAL_DLLS = \
62         exchndl.dll \
63         freebl3.dll \
64         libenchant.dll \
65         libenchant_ispell.dll \
66         libenchant_myspell.dll \
67         libgtkspell-0.dll \
68         libmeanwhile-1.dll \
69         libnspr4.dll \
70         libplc4.dll \
71         libplds4.dll \
72         libssp-0.dll \
73         nss3.dll \
74         nssutil3.dll \
75         smime3.dll \
76         softokn3.dll \
77         sqlite3.dll \
78         ssl3.dll
80 #build an expression for `find` to use to ignore the above files
81 EXTERNAL_DLLS_FIND_EXP = $(patsubst %,-o -name %,$(EXTERNAL_DLLS))
83 include $(PIDGIN_COMMON_RULES)
85 .PHONY: all docs install installer installer_offline installer_zip debug_symbols_zip installers clean uninstall create_release_install_dir generate_installer_includes $(PIDGIN_REVISION_H) $(PIDGIN_REVISION_RAW_TXT) gtk_runtime_zip
87 all: $(PIDGIN_CONFIG_H) $(PIDGIN_REVISION_H)
88         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE)
89         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE)
90 ifndef DISABLE_NLS
91         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE)
92 endif
94 install: all $(PIDGIN_INSTALL_DIR)
95         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) install
96         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE) install
97 ifndef DISABLE_NLS
98         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE) install
99 endif
100         $(MAKE) -C share/ca-certs -f $(MINGW_MAKEFILE) install
101         $(MAKE) -C share/sounds -f $(MINGW_MAKEFILE) install
102         mkdir -p $(PIDGIN_INSTALL_DIR)/spellcheck/lib/enchant
103         cp $(GTKSPELL_TOP)/bin/libgtkspell-0.dll $(PIDGIN_INSTALL_DIR)/spellcheck
104         cp $(ENCHANT_TOP)/bin/libenchant.dll $(PIDGIN_INSTALL_DIR)/spellcheck
105         cp -R $(ENCHANT_TOP)/lib/enchant/*.dll $(PIDGIN_INSTALL_DIR)/spellcheck/lib/enchant
106         cp $(PIDGIN_INST_DEP_DIR)/exchndl.dll $(PIDGIN_INSTALL_DIR)
107         cp $(GCC_SSP_TOP)/libssp-0.dll $(PIDGIN_INSTALL_DIR)
109 gtk_runtime_zip:
110         pidgin/win32/nsis/generate_gtk_zip.sh "`pwd`" "$(GPG_SIGN)"
112 generate_installer_includes: create_release_install_dir gtk_runtime_zip debug_symbols_zip $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop
113         rm -f pidgin/win32/nsis/pidgin-translations.nsh pidgin/win32/nsis/pidgin-spellcheck.nsh pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
114         find $(STRIPPED_RELEASE_DIR)/locale -maxdepth 1 -mindepth 1 \
115          -exec basename {} ';' \
116          | LC_ALL=C sort | sed -e s/^/\!insertmacro\ LANG_SECTION\ \"/ -e s/$$/\"/ \
117          > pidgin/win32/nsis/pidgin-translations.nsh
118         #Convert the available.lst lines to "!insertmacro SPELLCHECK_SECTION lang lang_name lang_file"
119         sed -e "/^#/d" -e "s/^[^,]\{1,\},[^,]\{1,\},/\"/" \
120          -e "s/,/\"\ \"/" -e "s/,/\"\ \"/" -e "s/[\ \t]*$$/\"/" \
121          -e "s/^/\!insertmacro\ SPELLCHECK_SECTION\ /" \
122          pidgin/win32/nsis/available.lst \
123          > pidgin/win32/nsis/pidgin-spellcheck.nsh
124         #Convert the lines to "!insertmacro CHECK_SPELLCHECK_SECTION lang"
125         iconv -f latin1 -t utf-8 pidgin/win32/nsis/pidgin-spellcheck.nsh | \
126          sed -e "s/SPELLCHECK_SECTION/CHECK_SPELLCHECK_SECTION/" \
127          -e "s/ \"[^\"]*\"\ \"[^\"]*\"[\t\ ]*$$//" | \
128          iconv -f utf-8 -t latin1 \
129         > pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
130         #Generate the Installer translations
131         echo "!define GCOMPRIS_NSIS_INCLUDE_PATH \".\"" > $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh
132         echo "@INSERT_TRANSLATIONS@" >> $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh
133         $(PERL) $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/create_nsis_translations.pl \
134                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop \
135                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh \
136                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/translations
138 create_release_install_dir: install
139         rm -rf $(STRIPPED_RELEASE_DIR)
140         mkdir $(STRIPPED_RELEASE_DIR)
141         tar -cf - $(PIDGIN_INSTALL_DIR) --exclude=Gtk --exclude=spellcheck/share \
142          | tar --strip 2 -xC $(STRIPPED_RELEASE_DIR) -f -
143         find $(STRIPPED_RELEASE_DIR) \( -name '*.dll' -o -name '*.exe' \) \
144          -not \( -false $(EXTERNAL_DLLS_FIND_EXP) \) \
145          -exec $(STRIP) --strip-unneeded {} ';'
146         $(call authenticode_sign, $(STRIPPED_RELEASE_DIR)/pidgin.exe, "Pidgin $(PIDGIN_VERSION)")
148 installer: generate_installer_includes
149         $(eval $@_DEBUG_SYMBOLS_SHA1SUM := $(shell sha1sum $(DEBUG_SYMBOLS_DIR).zip | sed -e "s/\ .*$$//"))
150         $(eval $@_GTK_SHA1SUM := $(shell sha1sum pidgin/win32/nsis/gtk-runtime-$(GTK_INSTALL_VERSION).zip | sed -e "s/\ .*$$//"))
151         $(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" \
152                 -DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" \
153                 -DDEBUG_SYMBOLS_SHA1SUM="$($@_DEBUG_SYMBOLS_SHA1SUM)" -DGTK_SHA1SUM="$($@_GTK_SHA1SUM)"\
154                 pidgin/win32/nsis/pidgin-installer.nsi
155         $(call authenticode_sign, pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION).exe, "Pidgin Installer")
156         mv pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION).exe ./
157         $(call gpg_sign, pidgin-$(PIDGIN_VERSION).exe)
159 installer_offline: generate_installer_includes
160         $(MAKENSIS) -V3 -DPIDGIN_VERSION="$(PIDGIN_VERSION)" -DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" \
161                 -DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" -DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" \
162                 -DOFFLINE_INSTALLER \
163                 pidgin/win32/nsis/pidgin-installer.nsi
164         $(call authenticode_sign, pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION)-offline.exe, "Pidgin Installer")
165         mv pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION)-offline.exe ./
166         $(call gpg_sign, pidgin-$(PIDGIN_VERSION)-offline.exe)
168 installer_zip: create_release_install_dir
169         rm -f pidgin-$(PIDGIN_VERSION)-win32-bin.zip
170         zip -9 -r pidgin-$(PIDGIN_VERSION)-win32-bin.zip $(STRIPPED_RELEASE_DIR)
171         $(call gpg_sign, pidgin-$(PIDGIN_VERSION)-win32-bin.zip)
173 debug_symbols_zip: install
174         rm -rf $(DEBUG_SYMBOLS_DIR) $(DEBUG_SYMBOLS_DIR).zip
175         mkdir $(DEBUG_SYMBOLS_DIR)
176         tar -cf - `find $(PIDGIN_INSTALL_DIR) \( -name '*.dll' -o -name '*.exe' \) \
177          -not \( -false $(EXTERNAL_DLLS_FIND_EXP) \) -print` \
178          | tar --strip 2 --xform s/$$/.dbgsym/ -xC $(DEBUG_SYMBOLS_DIR) -f -
179         cp $(MEANWHILE_TOP)/bin/libmeanwhile-1.dll.unstripped $(DEBUG_SYMBOLS_DIR)/libmeanwhile-1.dll.dbgsym
180         zip -9 -r $(DEBUG_SYMBOLS_DIR).zip $(DEBUG_SYMBOLS_DIR) 
181         $(call gpg_sign, $(DEBUG_SYMBOLS_DIR).zip)
183 installers: installer installer_offline debug_symbols_zip installer_zip
185 Doxyfile.mingw: Doxyfile.in
186         sed -e "s/@PACKAGE@/pidgin/" -e "s/@VERSION@/$(PIDGIN_VERSION)/" -e "s/@top_srcdir@/$(PIDGIN_TREE_TOP)/g" -e "s/@enable_dot@/NO/" $< > $@
188 docs: Doxyfile.mingw
189         @echo "Running doxygen..."
190         @doxygen Doxyfile.mingw
192 clean:
193         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE) clean
194         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE) clean
195         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) clean
196         $(MAKE) -C share/ca-certs -f $(MINGW_MAKEFILE) clean
197         rm -f $(PIDGIN_CONFIG_H) $(PIDGIN_REVISION_H) $(PIDGIN_REVISION_RAW_TXT) ./VERSION pidgin-$(PIDGIN_VERSION)*.exe pidgin-$(PIDGIN_VERSION)-win32-bin.zip $(DEBUG_SYMBOLS_DIR).zip
198         rm -rf doc/html Doxyfile.mingw
200 uninstall:
201         rm -rf $(PURPLE_INSTALL_PERL_DIR) $(PIDGIN_INSTALL_PLUGINS_DIR) $(PURPLE_INSTALL_PO_DIR) $(PIDGIN_INSTALL_DIR) $(STRIPPED_RELEASE_DIR) $(DEBUG_SYMBOLS_DIR)
202         rm -f ./VERSION
204 include $(PIDGIN_COMMON_TARGETS)