grim/purple-spasm

132557e864b0
Add support for protocol icons. Fixes #2
  • +4 -0
    README.md
  • +38 -3
    libpurple.mk
  • --- a/README.md Thu Apr 27 20:59:23 2017 -0500
    +++ b/README.md Thu Apr 27 22:24:08 2017 -0500
    @@ -59,3 +59,7 @@
    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.
    +
    +### Installing Protocol Pixmaps
    +
    +The protocol pixmaps are configured similar to `PLUGIN_PIXMAPS` but have a few extra requirements. First you need to use the variable `PROTOCOL_PIXMAPS`. This variable should be a space separate list of filenames that include the size of the pixmap. The sizes are 16, 22, 48, and scaled. For 16, 22, and 48 the images must be .png files and the scaled files must be .svgs. The filenames should specified like `foobar16.png`, `foobar22.png`, `foobar48.png`, and `foobarscaled.svg`. These will then be installed into the proper size directory in the Pidgin install.
    --- a/libpurple.mk Thu Apr 27 20:59:23 2017 -0500
    +++ b/libpurple.mk Thu Apr 27 22:24:08 2017 -0500
    @@ -87,6 +87,21 @@
    # Generate a list of destination of the pixmaps to install
    INSTALLED_PIXMAPS := $(PLUGIN_PIXMAPS:%=$(PLUGIN_PIXMAPSDIR)/%)
    +# Generate a list of protocol icons based on their sizes. We need to stash
    +# everything in a temp variable so that we can do the final substitution.
    +INSTALLED_PROTOCOL_PIXMAPS :=
    +_PIXMAP_TEMP := $(subst 16,,$(filter %16.png,$(PROTOCOL_PIXMAPS)))
    +INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%=$(PLUGIN_PIXMAPSDIR)/protocols/16/%)
    +
    +_PIXMAP_TEMP := $(subst 22,,$(filter %22.png,$(PROTOCOL_PIXMAPS)))
    +INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%=$(PLUGIN_PIXMAPSDIR)/protocols/22/%)
    +
    +_PIXMAP_TEMP := $(subst 48,,$(filter %48.png,$(PROTOCOL_PIXMAPS)))
    +INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%=$(PLUGIN_PIXMAPSDIR)/protocols/48/%)
    +
    +_PIXMAP_TEMP := $(subst scaled,,$(filter %scaled.svg,$(PROTOCOL_PIXMAPS)))
    +INSTALLED_PROTOCOL_PIXMAPS += $(_PIXMAP_TEMP:%=$(PLUGIN_PIXMAPSDIR)/protocols/scaled/%)
    +
    # Build targets
    .PHONY: all clean install uninstall
    @@ -95,19 +110,39 @@
    clean:
    rm -f $(PLUGIN_OBJECTS) $(PLUGIN_TARGET) $(CLEAN_FILES)
    -install: $(PLUGIN_TARGET) $(INSTALLED_PIXMAPS)
    +install: $(PLUGIN_TARGET) $(INSTALLED_PIXMAPS) $(INSTALLED_PROTOCOL_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 $< $@
    + install -D -m 644 $< $@
    +
    +$(PLUGIN_PIXMAPSDIR)/protocols/16/%.png: %16.png
    + install -D -m 644 $< $@
    +
    +$(PLUGIN_PIXMAPSDIR)/protocols/22/%.png: %22.png
    + install -D -m 644 $< $@
    +
    +$(PLUGIN_PIXMAPSDIR)/protocols/48/%.png: %48.png
    + install -D -m 644 $< $@
    +
    +$(PLUGIN_PIXMAPSDIR)/protocols/scaled/%.svg: %scaled.svg
    + install -D -m 644 $< $@
    uninstall:
    rm -f $(LIBPURPLE_PLUGIN_DIR)/$(PLUGIN_TARGET)
    - rm -f $(INSTALLED_PIXMAPS)
    + rm -f $(INSTALLED_PIXMAPS) $(INSTALLED_PROTOCOL_PIXMAPS)
    %.o: %.c $(MAKEFILE_LIST)
    $(CC) $(CFLAGS) $(ADDITIONAL_CFLAGS) $(PLATFORM_CFLAGS) $(LIBPURPLE_CFLAGS) $(PLUGIN_CFLAGS) -c -o $@ $<
    $(PLUGIN_TARGET): $(PLUGIN_OBJECTS) $(PLUGIN_HEADERS) $(MAKEFILE_LIST) $(PLUGIN_DEPENDENCIES)
    $(CC) -o $@ -shared $(PLUGIN_OBJECTS) $(LDFLAGS) $(PLUGIN_LIBS) $(LIBS) $(LIBPURPLE_LIBS) $(PLATFORM_LIBS)
    +
    +protocol_pixmaps:
    + echo $(PROTOCOL_PIXMAPS_16)
    + echo $(PROTOCOL_PIXMAPS_22)
    + echo $(PROTOCOL_PIXMAPS_48)
    + echo $(PROTOCOL_PIXMAPS_SCALED)
    + echo $(INSTALLED_PROTOCOL_PIXMAPS)
    + echo $(PLUGIN_PIXMAPSDIR)