1WIN32=1 2 3# The version number to put in the plugin info 4PIDGIN_OTR_VERSION = 4.0.2 5 6# Name of the gettext domain 7GETTEXT_PACKAGE = pidgin-otr 8 9# Replace this with the path to the pidgin and purple headers 10PIDGIN_HEADERS ?= -I/usr/i586-mingw32msvc/include/pidgin \ 11 -I/usr/i586-mingw32msvc/include/pidgin/win32 12PURPLE_HEADERS ?= -I/usr/i586-mingw32msvc/include/libpurple \ 13 -I/usr/i586-mingw32msvc/include/libpurple/win32 14 15# Replace this with the path to the extracted GTK+ "all-in-one" win32 bundle 16GTK_WIN32_BUNDLE ?= /usr/i586-mingw32msvc/misc/gtk_bundle 17 18# Replace this with the to path DLL files from a Win32 Pidgin distributable 19# (i.e. pidgin.dll and libpurple.dll) 20PIDGIN_WIN32_LIBS ?= /usr/i586-mingw32msvc/misc/pidgin_dlls 21 22# If you have a pkg-config that finds the win32 versions, you can use it 23# instead of the -I lines below 24#GTK_HDRS ?= `pkg-config --cflags glib-2.0 gtk+-2.0` 25GTK_HDRS ?= -I$(GTK_WIN32_BUNDLE)/include \ 26 -I$(GTK_WIN32_BUNDLE)/include/gtk-2.0 \ 27 -I$(GTK_WIN32_BUNDLE)/include/glib-2.0 \ 28 -I$(GTK_WIN32_BUNDLE)/include/cairo \ 29 -I$(GTK_WIN32_BUNDLE)/include/pango-1.0 \ 30 -I$(GTK_WIN32_BUNDLE)/include/atk-1.0 \ 31 -I$(GTK_WIN32_BUNDLE)/include/gdk-pixbuf-2.0 \ 32 -I$(GTK_WIN32_BUNDLE)/lib/glib-2.0/include \ 33 -I$(GTK_WIN32_BUNDLE)/lib/gtk-2.0/include 34 35 36# The location of the libotr include files. Note that if, for example, 37# the full path of message.h is /usr/include/libotr/message.h, you 38# should put /usr/include on the next line, not /usr/include/libotr 39LIBOTRINCDIR = /usr/i586-mingw32msvc/include 40 41# The locataion of libotr.a. 42LIBOTRLIBDIR = /usr/i586-mingw32msvc/lib 43 44# Location of libintl.h 45LIBINTLINCDIR = /usr/i586-mingw32msvc/include 46 47# Location of intl.dll 48LIBINTLLIBDIR = /usr/i586-mingw32msvc/lib 49 50# Installed location of libotr toolkit 51LIBOTRBINDIR = /usr/i586-mingw32msvc/bin 52 53# Source location of libotr 54LIBOTRSRCDIR = ../libotr-4.1.1 55 56# The target 57TARGET = pidgin-otr.dll 58 59# The target zipfile 60ZIPFILE = pidgin-otr-$(PIDGIN_OTR_VERSION).zip 61 62# Compiling with -fPIE and linking with -pie causes the plugin to crash 63# on load, so we'll skip those. 64CC_HARDENING_OPTIONS ?= -fstack-protector-all -Wstack-protector -fwrapv \ 65 --param ssp-buffer-size=1 -fno-strict-overflow -Wall -Wextra \ 66 -Wno-unused-parameter -Wno-missing-field-initializers -Wformat-security 67# In theory, we'd also like the following: 68# LD_HARDENING_OPTIONS ?= -Wl,-dynamicbase -Wl,--nxcompat -pie -z relro -z now 69LD_HARDENING_OPTIONS ?= -Wl,--dynamicbase -Wl,--nxcompat 70 71CC = i586-mingw32msvc-gcc 72LDFLAGS = -Wl,--enable-auto-image-base $(LD_HARDENING_OPTIONS) 73LDLIBS = $(LIBOTRLIBDIR)/libotr.a -L$(GTK_WIN32_BUNDLE)/lib \ 74 -L$(PIDGIN_WIN32_LIBS) -lgtk-win32-2.0 -lglib-2.0 \ 75 -lgdk_pixbuf-2.0 -lgobject-2.0 -lpidgin -llibpurple \ 76 -lgcrypt -lgpg-error -L$(LIBINTLLIBDIR) -lintl -lssp 77 78CC ?= gcc 79override CFLAGS += -g -O2 -Wall $(CC_HARDENING_OPTIONS) \ 80 $(PIDGIN_HEADERS) $(PURPLE_HEADERS) \ 81 $(GTK_HDRS) -I$(LIBOTRINCDIR) $(FPIC) -DUSING_GTK -DPURPLE_PLUGINS \ 82 -DPIDGIN_OTR_VERSION=\"$(PIDGIN_OTR_VERSION)\" \ 83 -I$(LIBINTLINCDIR) -DENABLE_NLS \ 84 -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" 85 #-DPIDGIN_NAME=\"Pidgin\" 86 87all: $(TARGET) 88 $(MAKE) -C po -f Makefile.mingw 89 90$(TARGET): otr-plugin.o ui.o dialogs.o gtk-ui.o gtk-dialog.o tooltipmenu.o 91 $(CC) -g -shared $(LDFLAGS) $^ -o $@ $(LDLIBS) 92 93clean: 94 rm -f *.o 95 rm -f $(TARGET) 96 $(MAKE) -C po -f Makefile.mingw clean 97 98distclean: clean 99 $(MAKE) -C po -f Makefile.mingw distclean 100 101## Prepare the win32_export directory 102prepare_win32_export: all 103 mkdir win32_export 104 # Copy pieces over from the libotr source dir 105 for f in otr_mackey.exe otr_parse.exe otr_remac.exe otr_modify.exe \ 106 otr_readforge.exe otr_sesskeys.exe; do \ 107 cp -a $(LIBOTRBINDIR)/$$f win32_export/; done 108 cp -a $(LIBOTRSRCDIR)/README win32_export/README.Toolkit.txt 109 cp -a $(LIBOTRSRCDIR)/Protocol-v3.html win32_export/Protocol-v3.html 110 cp -a $(LIBOTRSRCDIR)/COPYING win32_export/COPYING.txt 111 cp -a $(LIBOTRSRCDIR)/COPYING.LIB win32_export/COPYING.LIB.txt 112 cp -a $(TARGET) win32_export/ 113 cp -a README win32_export/README.txt 114 cp -a packaging/windows/pidgin-otr.nsi win32_export/ 115 for i in po/*.gmo; do \ 116 l=`basename $$i .gmo`; \ 117 mkdir -p win32_export/locale/$$l/LC_MESSAGES; \ 118 cp -a $$i win32_export/locale/$$l/LC_MESSAGES/pidgin-otr.mo; \ 119 done 120 cd win32_export; \ 121 i586-mingw32msvc-strip *.exe *.dll; \ 122 perl -pi -e 's/$$/\r/' README.Toolkit.txt Protocol-v3.html \ 123 COPYING.txt COPYING.LIB.txt README.txt; 124 125installer: prepare_win32_export 126 makensis packaging/windows/pidgin-otr.nsi 127 rm -rf win32_export 128 129## Package up all the pieces needed to build the installer 130zip: prepare_win32_export 131 rm -f $(ZIPFILE) 132 cd win32_export; \ 133 zip -r $(ZIPFILE) ./*; \ 134 mv $(ZIPFILE) ../; 135 rm -rf win32_export 136 137