forked from EionRobb/purple-teams
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
140 lines (110 loc) · 5.56 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
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
PKG_CONFIG ?= pkg-config
DIR_PERM = 0755
LIB_PERM = 0755
FILE_PERM = 0644
MAKENSIS ?= makensis
CFLAGS ?= -O2 -g -pipe
LDFLAGS ?=
# Do some nasty OS and purple version detection
ifeq ($(OS),Windows_NT)
#only defined on 64-bit windows
PROGFILES32 = ${ProgramFiles(x86)}
ifndef PROGFILES32
PROGFILES32 = $(PROGRAMFILES)
endif
TEAMS_TARGET = libteams.dll
TEAMS_DEST = "$(PROGFILES32)/Pidgin/plugins"
TEAMS_ICONS_DEST = "$(PROGFILES32)/Pidgin/pixmaps/pidgin/protocols"
TEAMS_THEME_DEST = "$(PROGFILES32)/Pidgin/pixmaps/pidgin/emotes/teams"
MAKENSIS = "$(PROGFILES32)/NSIS/makensis.exe"
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
INCLUDES =
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"),)
TEAMS_TARGET = FAILNOPURPLE
TEAMS_DEST =
TEAMS_ICONS_DEST =
TEAMS_THEME_DEST =
else
TEAMS_TARGET = libteams.so
TEAMS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple`
TEAMS_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple`/pixmaps/pidgin/protocols
TEAMS_THEME_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple`/pixmaps/pidgin/emotes/skype
endif
else
TEAMS_TARGET = libteams3.so
TEAMS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=plugindir purple-3`
TEAMS_ICONS_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple-3`/pixmaps/pidgin/protocols
TEAMS_THEME_DEST = $(DESTDIR)`$(PKG_CONFIG) --variable=datadir purple-3`/pixmaps/pidgin/emotes/skype
endif
endif
WIN32_CFLAGS = -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 -DPACKAGE_VERSION='"$(PLUGIN_VERSION)"' -Wall -Wextra -Werror -Wno-deprecated-declarations -Wno-unused-parameter -fno-strict-aliasing -Wformat -Wno-sign-compare
WIN32_LDFLAGS = -L$(WIN32_DEV_TOP)/glib-2.28.8/lib -L$(PROTOBUF_C_DIR)/bin -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
C_FILES = \
teams_connection.c \
teams_contacts.c \
teams_login.c \
teams_messages.c \
teams_util.c \
libteams.c
PURPLE_COMPAT_FILES := purple2compat/http.c purple2compat/purple-socket.c
PURPLE_C_FILES := libteams.c $(C_FILES)
.PHONY: all install FAILNOPURPLE clean translations
all: $(TEAMS_TARGET)
libteams.so: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) $(PROTOBUF_OPTS) `$(PKG_CONFIG) purple glib-2.0 json-glib-1.0 zlib --libs --cflags` $(INCLUDES) -Ipurple2compat -g -ggdb
libteams3.so: $(PURPLE_C_FILES)
$(CC) -fPIC $(CFLAGS) -shared -o $@ $^ $(LDFLAGS) $(PROTOBUF_OPTS) `$(PKG_CONFIG) purple-3 glib-2.0 json-glib-1.0 zlib --libs --cflags` $(INCLUDES) -g -ggdb
libteams.dll: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(WIN32_CC) -shared -o $@ $^ $(WIN32_PIDGIN2_CFLAGS) $(WIN32_PIDGIN2_LDFLAGS) -Ipurple2compat
libteams3.dll: $(PURPLE_C_FILES)
$(WIN32_CC) -shared -o $@ $^ $(WIN32_PIDGIN3_CFLAGS) $(WIN32_PIDGIN3_LDFLAGS)
install: $(TEAMS_TARGET) install-icons
mkdir -m $(DIR_PERM) -p $(TEAMS_DEST)
install -m $(LIB_PERM) -p $(TEAMS_TARGET) $(TEAMS_DEST)
install-icons: icons/16/teams.png icons/22/teams.png icons/48/teams.png
mkdir -m $(DIR_PERM) -p $(TEAMS_ICONS_DEST)/16
mkdir -m $(DIR_PERM) -p $(TEAMS_ICONS_DEST)/22
mkdir -m $(DIR_PERM) -p $(TEAMS_ICONS_DEST)/48
install -m $(FILE_PERM) -p icons/16/teams.png $(TEAMS_ICONS_DEST)/16/teams.png
install -m $(FILE_PERM) -p icons/22/teams.png $(TEAMS_ICONS_DEST)/22/teams.png
install -m $(FILE_PERM) -p icons/48/teams.png $(TEAMS_ICONS_DEST)/48/teams.png
installer: pidgin-teams.nsi libteams.dll
$(MAKENSIS) "/DPIDGIN_VARIANT"="Pidgin" "/DPRODUCT_NAME"="pidgin-teams" "/DINSTALLER_NAME"="pidgin-teams-installer" "/DJSON_GLIB_DLL"="libjson-glib-1.0.dll" pidgin-teams.nsi
translations: po/purple-teams.pot
po/purple-teams.pot:
xgettext $^ -k_ --no-location -o $@
po/%.po: po/purple-teams.pot
msgmerge $@ po/purple-teams.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-teams.mo
FAILNOPURPLE:
echo "You need libpurple development headers installed to be able to compile this plugin"
clean:
rm -f $(TEAMS_TARGET)