Skip to content

Commit

Permalink
Merge branch 'master' into dev-ttl
Browse files Browse the repository at this point in the history
  • Loading branch information
ttlmax committed Jan 17, 2021
2 parents 0149a13 + 1fd33df commit 6c12e43
Show file tree
Hide file tree
Showing 11 changed files with 248 additions and 108 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1 +1,2 @@
*.so
*.o
27 changes: 17 additions & 10 deletions Makefile
@@ -1,23 +1,26 @@
PROTOC_C ?= protoc-c
PKG_CONFIG ?= pkg-config

# Note: Use "-C .git" to avoid ascending to parent dirs if .git not present
GIT_REVISION_ID = $(shell git -C .git rev-parse --short HEAD 2>/dev/null)
PLUGIN_VERSION ?= $(shell cat VERSION)~git$(GIT_REVISION_ID)
PKG_DEPS ?= purple glib-2.0 json-glib-1.0

CFLAGS ?= -O2 -g -pipe -Wall
LDFLAGS ?= -Wl,-z,relro
CFLAGS ?= -O2 -g -ggdb -Wall
LDFLAGS ?=

ifdef SUPPORT_EXTERNAL_ATTACHMENTS
LDFLAGS += -lmagic
PKG_DEPS += gio-unix-2.0
CFLAGS += -DSUPPORT_EXTERNAL_ATTACHMENTS
endif

CFLAGS += -std=c99 -DSIGNALD_PLUGIN_VERSION='"$(PLUGIN_VERSION)"' -DMARKDOWN_PIDGIN
CFLAGS += -DSIGNALD_PLUGIN_VERSION='"$(PLUGIN_VERSION)"' -DMARKDOWN_PIDGIN
CFLAGS += -std=c99 -fPIC -Wl,-z,relro
CFLAGS += -Ipurple2compat `$(PKG_CONFIG) $(PKG_DEPS) --cflags`
LDFLAGS += `$(PKG_CONFIG) $(PKG_DEPS) --libs`

CC ?= gcc
LD ?= ld

ifeq ($(shell $(PKG_CONFIG) --exists purple 2>/dev/null && echo "true"),)
TARGET = FAILNOPURPLE
Expand All @@ -31,30 +34,34 @@ endif

CFLAGS += -DLOCALEDIR=\"$(LOCALEDIR)\"

PURPLE_COMPAT_FILES :=
PURPLE_C_FILES := comms.c contacts.c direct.c groups.c message.c link.c libsignald.c $(C_FILES)
PURPLE_COMPAT_FILES := purple_compat.h json_compat.h
PURPLE_H_FILES := comms.h contacts.h direct.h groups.h link.h message.h libsignald.h
PURPLE_C_FILES := comms.c contacts.c direct.c groups.c link.c message.c libsignald.c $(C_FILES)
PURPLE_OBJ_FILES:=$(PURPLE_C_FILES:.c=.o)

.PHONY: all FAILNOPURPLE clean install

LOCALES = $(patsubst %.po, %.mo, $(wildcard po/*.po))

all: $(TARGET)

libsignald.so: $(PURPLE_C_FILES) $(PURPLE_COMPAT_FILES)
$(CC) -fPIC $(CFLAGS) $(CPPFLAGS) -shared -o $@ $^ $(LDFLAGS) `$(PKG_CONFIG) $(PKG_DEPS) --libs --cflags` $(INCLUDES) -Ipurple2compat -g -ggdb
$(PURPLE_OBJ_FILES): %.o: %.c Makefile $(PURPLE_H_FILES) $(PURPLE_COMPAT_FILES)
$(CC) -c $< $(CFLAGS)

libsignald.so: $(PURPLE_OBJ_FILES)
$(LD) -shared -o $@ $^ $(LDFLAGS)

FAILNOPURPLE:
echo "You need libpurple development headers installed to be able to compile this plugin"

clean:
rm -f $(TARGET)
rm -f $(TARGET) *.o

gdb:
gdb --args pidgin -c ~/.fake_purple -n -m

install:
install -Dm644 "$(TARGET)" "$(DEST)$(TARGET)"
install -Dm644 icons/11/signal.png "$(PIXMAPDIR)/11/signal.png"
install -Dm644 icons/16/signal.png "$(PIXMAPDIR)/16/signal.png"
install -Dm644 icons/22/signal.png "$(PIXMAPDIR)/22/signal.png"
install -Dm644 icons/48/signal.png "$(PIXMAPDIR)/48/signal.png"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -4,7 +4,7 @@ signald is written by Finn Herzfeld.

I never wrote code for use in Pidgin before. EionRobb's [purple-discord](https://github.com/EionRobb/purple-discord) sources were of great help.

Tested on Ubuntu 18.04.
Tested on Ubuntu 18.04. An unofficial IRC channel exists on Freenode called `##purple-signald` for those who use it.

Windows users may take a sneak peek at [purple-signal](https://github.com/hoehermann/purple-signal).

Expand Down

0 comments on commit 6c12e43

Please sign in to comment.