grim/purple-spasm

98640f033e15
Parents c05e4b726076
Children 132557e864b0
Add support for plugin pixmaps. Fixes #3
  • +6 -0
    README.md
  • +14 -4
    libpurple.mk
  • --- a/README.md Thu Apr 27 20:30:24 2017 -0500
    +++ b/README.md Thu Apr 27 20:59:23 2017 -0500
    @@ -53,3 +53,9 @@
    ## Advanced Usage
    This is a normal `Makefile` which means you can add additional targets to fit your needs. To make building your plugin depend on these targets you can set the `PLUGIN_DEPENDENCIES` variable to a space separate list of targets that the plugin itself should depend on.
    +
    +### Installing Pixmaps
    +
    +This build system also support installing pixmaps. To specify the pixmaps set the `PLUGIN_PIXMAPS` variable to a space separated list of pixmaps to install.
    +
    +The pixmaps will be installed into the normal Pidgin pixmaps directory.
    --- a/libpurple.mk Thu Apr 27 20:30:24 2017 -0500
    +++ b/libpurple.mk Thu Apr 27 20:59:23 2017 -0500
    @@ -18,7 +18,7 @@
    # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    # figure out the os and set the proper variables for it
    -ifeq ($(OS),Windows_NT)
    +ifeq ($(OS),Windows_NT) # window
    # set the target's name
    PLUGIN_TARGET := $(PLUGIN_NAME).dll
    @@ -29,6 +29,7 @@
    # set the variables for windows that are usually populated by pkg-config
    CC ?= $(WIN32_DEV_TOP)/mingw-4.7.2/bin/gcc
    LIBPURPLE_PLUGIN_DIR := $(PROGRAMFILES)/Pidgin/plugins
    +PLUGIN_PIXMAPSDIR := $(PROGRAMFILES)/Pidgin/pixmaps/pidgin
    PLATFORM_CFLAGS += \
    -I$(WIN32_DEV_TOP)/glib-2.28.8/include \
    -I$(WIN32_DEV_TOP)/glib-2.28.8/include/glib-2.0 \
    @@ -43,7 +44,7 @@
    -lglib-2.0 \
    -lgobject-2.0 \
    -lz
    -else
    +else # not windows
    PLUGIN_TARGET := $(PLUGIN_NAME).so
    UNAME_S := $(shell uname -s)
    @@ -73,15 +74,19 @@
    LIBPURPLE_PLUGIN_DIR ?= $(shell $(PKG_CONFIG) --variable=plugindir $(LIBPURPLE_PC_MODULE))
    LIBPURPLE_DATA_DIR ?= $(shell $(PKG_CONFIG) --variable=datadir $(LIBPURPLE_PC_MODULE))
    LIBPURPLE_LIB_DIR ?= $(shell $(PKG_CONFIG) --variable=libdir $(LIBPURPLE_PC_MODULE))
    +PLUGIN_PIXMAPSDIR := $(LIBPURPLE_DATA_DIR)/pixmaps/pidgin
    # Variables that are platform independent
    PLUGIN_OBJECTS := $(PLUGIN_SOURCES:%.c=%.o)
    ADDITIONAL_CFLAGS := \
    -DDATADIR=$(LIBPURPLE_DATA_DIR) \
    -DLIBDIR=$(LIBPURPLE_LIB_DIR) \
    - -DPIXMAPSDIR=$(LIBPURPLE_DATA_DIR)/pixmaps/pidgin \
    + -DPIXMAPSDIR=$(PLUGIN_PIXMAPSDIR) \
    -DPLUGIN_VERSION=\"$(PLUGIN_VERSION)\"
    +# Generate a list of destination of the pixmaps to install
    +INSTALLED_PIXMAPS := $(PLUGIN_PIXMAPS:%=$(PLUGIN_PIXMAPSDIR)/%)
    +
    # Build targets
    .PHONY: all clean install uninstall
    @@ -90,11 +95,16 @@
    clean:
    rm -f $(PLUGIN_OBJECTS) $(PLUGIN_TARGET) $(CLEAN_FILES)
    -install: $(PLUGIN_TARGET)
    +install: $(PLUGIN_TARGET) $(INSTALLED_PIXMAPS)
    install -D $(PLUGIN_TARGET) $(LIBPURPLE_PLUGIN_DIR)/$(PLUGIN_TARGET)
    +# This target will fulfill the dependency of the INSTALLED_PIXMAPS variable above
    +$(PLUGIN_PIXMAPSDIR)/%: %
    + install -D $< $@
    +
    uninstall:
    rm -f $(LIBPURPLE_PLUGIN_DIR)/$(PLUGIN_TARGET)
    + rm -f $(INSTALLED_PIXMAPS)
    %.o: %.c $(MAKEFILE_LIST)
    $(CC) $(CFLAGS) $(ADDITIONAL_CFLAGS) $(PLATFORM_CFLAGS) $(LIBPURPLE_CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<