123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142 |
- PIDGIN_TREE_TOP ?= ../pidgin-2.10.11
- PIDGIN3_TREE_TOP ?= ../pidgin-main
- LIBPURPLE_DIR ?= $(PIDGIN_TREE_TOP)/libpurple
- WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
- WIN32_CC ?= $(WIN32_DEV_TOP)/mingw-4.7.2/bin/gcc
- PROTOC_C ?= protoc-c
- PKG_CONFIG ?= pkg-config
- DIR_PERM = 0755
- LIB_PERM = 0755
- FILE_PERM = 0644
- REVISION_ID = $(shell hg id -i)
- REVISION_NUMBER = $(shell hg id -n)
- ifneq ($(REVISION_ID),)
- PLUGIN_VERSION ?= 0.9.$(shell date +%Y.%m.%d).git.r$(REVISION_NUMBER).$(REVISION_ID)
- else
- PLUGIN_VERSION ?= 0.9.$(shell date +%Y.%m.%d)
- endif
- CFLAGS ?= -O2 -g -pipe -Wall
- LDFLAGS ?= -Wl,-z,relro
- CFLAGS += -std=c99 -DEMAIL_PLUGIN_VERSION='"$(PLUGIN_VERSION)"'
- # Comment out to disable localisation
- CFLAGS += -DENABLE_NLS
- # Do some nasty OS and purple version detection
- ifeq ($(OS),Windows_NT)
- EMAIL_TARGET = libemail.dll
- EMAIL_DEST = "$(PROGRAMFILES)/Pidgin/plugins"
- EMAIL_ICONS_DEST = "$(PROGRAMFILES)/Pidgin/pixmaps/pidgin/protocols"
- LOCALEDIR = "$(PROGRAMFILES)/Pidgin/locale"
- else
- UNAME_S := $(shell uname -s)
- #.. There are special flags we need for OSX
- ifeq ($(UNAME_S), Darwin)
- #
- #.. /opt/local/include and subdirs are included here to ensure this compiles
- # for folks using Macports. I believe Homebrew uses /usr/local/include
- # so things should "just work". You *must* make sure your packages are
- # all up to date or you will most likely get compilation errors.
- #
- INCLUDES = -I/opt/local/include -lz $(OS)
- CC = gcc
- else
- CC ?= gcc
- endif
- ifeq ($(shell $(PKG_CONFIG) --exists purple-3 2>/dev/null && echo "true"),)
- ifeq ($(shell $(PKG_CONFIG) --exists purple 2>/dev/null && echo "true"),)
- EMAIL_TARGET = FAILNOPURPLE
- EMAIL_DEST =
- EMAIL_ICONS_DEST =
- else
- EMAIL_TARGET = libemail.so
- EMAIL_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple`
- EMAIL_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple`/pixmaps/pidgin/protocols
- LOCALEDIR = $(DESTDIR)$(shell $(PKG_CONFIG) --variable=datadir purple)/locale
- endif
- else
- EMAIL_TARGET = libemail3.so
- EMAIL_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple-3`
- EMAIL_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple-3`/pixmaps/pidgin/protocols
- LOCALEDIR = $(DESTDIR)$(shell $(PKG_CONFIG) --variable=datadir purple-3)/locale
- endif
- endif
- WIN32_CFLAGS = -std=c99 -I$(WIN32_DEV_TOP)/glib-2.28.8/include -I$(WIN32_DEV_TOP)/glib-2.28.8/include/glib-2.0 -I$(WIN32_DEV_TOP)/glib-2.28.8/lib/glib-2.0/include -I$(WIN32_DEV_TOP)/json-glib-0.14/include/json-glib-1.0 -DENABLE_NLS -DEMAIL_PLUGIN_VERSION='"$(PLUGIN_VERSION)"' -Wall -Wextra -Werror -Wno-deprecated-declarations -Wno-unused-parameter -fno-strict-aliasing -Wformat
- WIN32_LDFLAGS = -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -L$(WIN32_DEV_TOP)/json-glib-0.14/lib -lpurple -lintl -lglib-2.0 -lgobject-2.0 -ljson-glib-1.0 -g -ggdb -static-libgcc -lz
- WIN32_PIDGIN2_CFLAGS = -I$(PIDGIN_TREE_TOP)/libpurple -I$(PIDGIN_TREE_TOP) $(WIN32_CFLAGS)
- WIN32_PIDGIN3_CFLAGS = -I$(PIDGIN3_TREE_TOP)/libpurple -I$(PIDGIN3_TREE_TOP) -I$(WIN32_DEV_TOP)/gplugin-dev/gplugin $(WIN32_CFLAGS)
- WIN32_PIDGIN2_LDFLAGS = -L$(PIDGIN_TREE_TOP)/libpurple $(WIN32_LDFLAGS)
- WIN32_PIDGIN3_LDFLAGS = -L$(PIDGIN3_TREE_TOP)/libpurple -L$(WIN32_DEV_TOP)/gplugin-dev/gplugin $(WIN32_LDFLAGS) -lgplugin
- CFLAGS += -DLOCALEDIR=\"$(LOCALEDIR)\"
- C_FILES :=
- PURPLE_COMPAT_FILES := purple2compat/purple-socket.c
- PURPLE_C_FILES := libemail.c $(C_FILES)
- .PHONY: all install FAILNOPURPLE clean install-icons install-locales %-locale-install
- LOCALES = $(patsubst %.po, %.mo, $(wildcard po/*.po))
- all: $(EMAIL_TARGET)
- libemail.so: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
- $(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) `$(PKG_CONFIG) purple glib-2.0 json-glib-1.0 --libs --cflags` $(INCLUDES) -Ipurple2compat -g -ggdb
- libemail3.so: $(PURPLE_C_FILES)
- $(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) `$(PKG_CONFIG) purple-3 glib-2.0 json-glib-1.0 --libs --cflags` $(INCLUDES) -g -ggdb
- libemail.dll: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
- $(WIN32_CC) -O0 -g -ggdb -shared -o $@ $^ $(WIN32_PIDGIN2_CFLAGS) $(WIN32_PIDGIN2_LDFLAGS) -Ipurple2compat
- libemail3.dll: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
- $(WIN32_CC) -O0 -g -ggdb -shared -o $@ $^ $(WIN32_PIDGIN3_CFLAGS) $(WIN32_PIDGIN3_LDFLAGS)
- po/purple-email.pot: libemail.c
- xgettext $^ -k_ --no-location -o $@
- po/%.po: po/purple-email.pot
- msgmerge $@ po/purple-email.pot > tmp-$*
- mv -f tmp-$* $@
- po/%.mo: po/%.po
- msgfmt -o $@ $^
- %-locale-install: po/%.mo
- install -D -m $(FILE_PERM) -p po/$(*F).mo $(LOCALEDIR)/$(*F)/LC_MESSAGES/purple-email.mo
- install: $(EMAIL_TARGET) install-icons install-locales
- mkdir -m $(DIR_PERM) -p $(EMAIL_DEST)
- install -m $(LIB_PERM) -p $(EMAIL_TARGET) $(EMAIL_DEST)
- install-icons: email16.png email22.png email48.png
- mkdir -m $(DIR_PERM) -p $(EMAIL_ICONS_DEST)/16
- mkdir -m $(DIR_PERM) -p $(EMAIL_ICONS_DEST)/22
- mkdir -m $(DIR_PERM) -p $(EMAIL_ICONS_DEST)/48
- install -m $(FILE_PERM) -p email16.png $(EMAIL_ICONS_DEST)/16/email.png
- install -m $(FILE_PERM) -p email22.png $(EMAIL_ICONS_DEST)/22/email.png
- install -m $(FILE_PERM) -p email48.png $(EMAIL_ICONS_DEST)/48/email.png
- install-locales: $(patsubst po/%.po, %-locale-install, $(wildcard po/*.po))
- FAILNOPURPLE:
- echo "You need libpurple development headers installed to be able to compile this plugin"
- clean:
- rm -f $(EMAIL_TARGET)
- gdb:
- gdb --args pidgin -c ~/.fake_purple -n -m
|