Increment version number
[pidgin-git.git] / Makefile.mingw
blob514912e6d9b4353be2342a5bebe552e146a71553
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.0
36 STRIPPED_RELEASE_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-win32bin
37 DEBUG_SYMBOLS_DIR = $(PIDGIN_TREE_TOP)/pidgin-$(PIDGIN_VERSION)-dbgsym
40 # Any *.dll or *.exe files included in win32-install-dir that we don't compile
41 # should be included in this list so they don't get stripped
42 EXTERNAL_DLLS = \
43         comerr32.dll \
44         exchndl.dll \
45         freebl3.dll \
46         gssapi32.dll \
47         k5sprt32.dll \
48         krb5_32.dll \
49         libenchant.dll \
50         libenchant_ispell.dll \
51         libenchant_myspell.dll \
52         libgtkspell-0.dll \
53         libmeanwhile-1.dll \
54         libnspr4.dll \
55         libplc4.dll \
56         libplds4.dll \
57         libsasl.dll \
58         libxml2-2.dll \
59         nss3.dll \
60         nssckbi.dll \
61         nssutil3.dll \
62         saslANONYMOUS.dll \
63         saslCRAMMD5.dll \
64         saslDIGESTMD5.dll \
65         saslGSSAPI.dll \
66         saslLOGIN.dll \
67         saslPLAIN.dll \
68         libsilc-1-1-2.dll \
69         libsilcclient-1-1-2.dll \
70         smime3.dll \
71         softokn3.dll \
72         sqlite3.dll \
73         ssl3.dll
75 #build an expression for `find` to use to ignore the above files
76 EXTERNAL_DLLS_FIND_EXP = $(patsubst %,-o -name %,$(EXTERNAL_DLLS))
78 include $(PIDGIN_COMMON_RULES)
80 .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)
82 all: $(PIDGIN_CONFIG_H) $(PIDGIN_REVISION_H)
83         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE)
84         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE)
85 ifndef DISABLE_NLS
86         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE)
87 endif
89 install: all $(PIDGIN_INSTALL_DIR)
90         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) install
91         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE) install
92 ifndef DISABLE_NLS
93         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE) install
94 endif
95         $(MAKE) -C share/ca-certs -f $(MINGW_MAKEFILE) install
96         $(MAKE) -C share/sounds -f $(MINGW_MAKEFILE) install
97         mkdir -p $(PIDGIN_INSTALL_DIR)/spellcheck
98         cp $(GTKSPELL_TOP)/bin/libgtkspell-0.dll $(PIDGIN_INSTALL_DIR)/spellcheck
99         cp $(ENCHANT_TOP)/bin/libenchant.dll $(PIDGIN_INSTALL_DIR)/spellcheck
100         cp -R $(ENCHANT_TOP)/lib $(PIDGIN_INSTALL_DIR)/spellcheck
101         cp $(WIN32_DEV_TOP)/pidgin-inst-deps-20100315/exchndl.dll $(PIDGIN_INSTALL_DIR)
103 pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip:
104         pidgin/win32/nsis/generate_gtk_zip.sh `pwd`
106 generate_installer_includes: create_release_install_dir pidgin/win32/nsis/gtk-runtime-$(GTK_BUNDLE_VERSION).zip debug_symbols_zip $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop
107         rm -f pidgin/win32/nsis/pidgin-translations.nsh pidgin/win32/nsis/pidgin-spellcheck.nsh pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
108         find $(STRIPPED_RELEASE_DIR)/locale -maxdepth 1 -mindepth 1 \
109          -exec basename {} ';' \
110          | LC_ALL=C sort | sed -e s/^/\!insertmacro\ LANG_SECTION\ \"/ -e s/$$/\"/ \
111          > pidgin/win32/nsis/pidgin-translations.nsh
112         #Convert the available.lst lines to "!insertmacro SPELLCHECK_SECTION lang lang_name lang_file"
113         sed -e "/^#/d" -e "s/^[^,]\{1,\},[^,]\{1,\},/\"/" \
114          -e "s/,/\"\ \"/" -e "s/,/\"\ \"/" -e "s/[\ \t]*$$/\"/" \
115          -e "s/^/\!insertmacro\ SPELLCHECK_SECTION\ /" \
116          pidgin/win32/nsis/available.lst \
117          > pidgin/win32/nsis/pidgin-spellcheck.nsh
118         #Convert the lines to "!insertmacro CHECK_SPELLCHECK_SECTION lang"
119         iconv -f latin1 -t utf-8 pidgin/win32/nsis/pidgin-spellcheck.nsh | \
120          sed -e "s/SPELLCHECK_SECTION/CHECK_SPELLCHECK_SECTION/" \
121          -e "s/ \"[^\"]*\"\ \"[^\"]*\"[\t\ ]*$$//" | \
122          iconv -f utf-8 -t latin1 \
123         > pidgin/win32/nsis/pidgin-spellcheck-preselect.nsh
124         #Generate the Installer translations
125         echo "!define GCOMPRIS_NSIS_INCLUDE_PATH \".\"" > $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh
126         echo "@INSERT_TRANSLATIONS@" >> $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh
127         $(PERL) $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/create_nsis_translations.pl \
128                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/nsis_translations.desktop \
129                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/langmacros.nsh \
130                 $(PIDGIN_TREE_TOP)/pidgin/win32/nsis/translations
132 create_release_install_dir: install
133         rm -rf $(STRIPPED_RELEASE_DIR)
134         mkdir $(STRIPPED_RELEASE_DIR)
135         tar -cf - $(PIDGIN_INSTALL_DIR) --exclude=Gtk --exclude=spellcheck/share \
136          | tar --strip 2 -xC $(STRIPPED_RELEASE_DIR) -f -
137         find $(STRIPPED_RELEASE_DIR) \( -name '*.dll' -o -name '*.exe' \) \
138          -not \( -false $(EXTERNAL_DLLS_FIND_EXP) \) \
139          -exec $(STRIP) --strip-unneeded {} ';'
141 installer: generate_installer_includes
142         $(MAKENSIS) $(MAKENSISOPT)V3 $(MAKENSISOPT)DPIDGIN_VERSION="$(PIDGIN_VERSION)" $(MAKENSISOPT)DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" $(MAKENSISOPT)DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" $(MAKENSISOPT)DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" pidgin/win32/nsis/pidgin-installer.nsi
143         mv pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION).exe ./
145 installer_offline: generate_installer_includes
146         $(MAKENSIS) $(MAKENSISOPT)V3 $(MAKENSISOPT)DPIDGIN_VERSION="$(PIDGIN_VERSION)" $(MAKENSISOPT)DPIDGIN_PRODUCT_VERSION="$(PIDGIN_PRODUCT_VERSION)" $(MAKENSISOPT)DOFFLINE_INSTALLER $(MAKENSISOPT)DPIDGIN_INSTALL_DIR="$(STRIPPED_RELEASE_DIR)" $(MAKENSISOPT)DGTK_INSTALL_VERSION="$(GTK_INSTALL_VERSION)" pidgin/win32/nsis/pidgin-installer.nsi
147         mv pidgin/win32/nsis/pidgin-$(PIDGIN_VERSION)-offline.exe ./
149 installer_zip: create_release_install_dir
150         rm -f pidgin-$(PIDGIN_VERSION)-win32-bin.zip
151         zip -9 -r pidgin-$(PIDGIN_VERSION)-win32-bin.zip $(STRIPPED_RELEASE_DIR)
153 debug_symbols_zip: install
154         rm -rf $(DEBUG_SYMBOLS_DIR) $(DEBUG_SYMBOLS_DIR).zip
155         mkdir $(DEBUG_SYMBOLS_DIR)
156         tar -cf - `find $(PIDGIN_INSTALL_DIR) \( -name '*.dll' -o -name '*.exe' \) \
157          -not \( -false $(EXTERNAL_DLLS_FIND_EXP) \) -print` \
158          | tar --strip 2 --xform s/$$/.dbgsym/ -xC $(DEBUG_SYMBOLS_DIR) -f -
159         zip -9 -r $(DEBUG_SYMBOLS_DIR).zip $(DEBUG_SYMBOLS_DIR) 
161 installers: installer installer_offline debug_symbols_zip installer_zip
163 Doxyfile.mingw: Doxyfile.in
164         sed -e "s/@PACKAGE@/pidgin/" -e "s/@VERSION@/$(PIDGIN_VERSION)/" -e "s/@top_srcdir@/$(PIDGIN_TREE_TOP)/g" -e "s/@enable_dot@/NO/" $< > $@
166 docs: Doxyfile.mingw
167         @echo "Running doxygen..."
168         @doxygen Doxyfile.mingw
170 clean:
171         $(MAKE) -C $(PURPLE_PO_TOP) -f $(MINGW_MAKEFILE) clean
172         $(MAKE) -C $(PIDGIN_TOP) -f $(MINGW_MAKEFILE) clean
173         $(MAKE) -C $(PURPLE_TOP) -f $(MINGW_MAKEFILE) clean
174         $(MAKE) -C share/ca-certs -f $(MINGW_MAKEFILE) clean
175         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
176         rm -rf doc/html Doxyfile.mingw
178 uninstall:
179         rm -rf $(PURPLE_INSTALL_PERL_DIR) $(PIDGIN_INSTALL_PLUGINS_DIR) $(PURPLE_INSTALL_PO_DIR) $(PIDGIN_INSTALL_DIR) $(STRIPPED_RELEASE_DIR) $(DEBUG_SYMBOLS_DIR)
180         rm -f ./VERSION
182 include $(PIDGIN_COMMON_TARGETS)