grim/purple-spasm

Update to the latest skeleton

2017-08-07, Gary Kramlich
02bd31495762
Update to the latest skeleton
--- a/.hgignore Thu May 18 23:12:38 2017 -0500
+++ b/.hgignore Mon Aug 07 22:32:12 2017 -0500
@@ -4,3 +4,5 @@
*.so
*.sublime-workspace
+syntax: regexp
+^build.*\/
--- a/Makefile.example Thu May 18 23:12:38 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-#!/usr/bin/make -f
-
-PIDGIN_TREE_TOP ?= ../pidgin-2.12.0
-WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
-
-PLUGIN_NAME := helloworld
-PLUGIN_SOURCES := helloworld.c
-PLUGIN_HEADERS :=
-PLUGIN_LIBS :=
-PLUGIN_CFLAGS :=
-
-include libpurple.mk
--- a/README.md Thu May 18 23:12:38 2017 -0500
+++ b/README.md Mon Aug 07 22:32:12 2017 -0500
@@ -1,65 +1,5 @@
# skeleton-libpurple
-This repository is a starting point for writing libpurple plugins.
-
-You can fork it and use it's build system to build your own custom plugin immediately. By forking this repo you can easily pull in updates to it too!
-
-## Getting Started
-
-To get started, copy `Makefile.example` to `Makefile` and edit it to fit your needs.
-
-For example, say your plugin is named `my-awesome-plugin` and has a source file of `awesome.c`. Your `Makefile` would look like the following.
-
- #!/usr/bin/make -f
-
- PIDGIN_TREE_TOP ?= ../pidgin-2.12.0
- WIN32_DEV_TOP ?= $(PIDGIN_TREE_TOP)/../win32-dev
-
- PLUGIN_LIBRARIES :=
- PLUGIN_CFLAGS :=
- PLUGIN_NAME := awesome
- PLUGIN_SOURCES := awesome.c
- PLUGIN_HEADERS :=
- include libpurple.mk
-
-`PIDGIN_TREE_TOP` and `WIN32_DEV_TOP` are relative paths to where your keep the Pidgin development files for Windows.
-
-`PLUGIN_LIBRARIES` are additional flags to pass to the linker.
-
-`PLUGIN_CFLAGS` are additional flags to pass to the C compiler.
-
-`PLUGIN_NAME` is the base filename that the plugin should have. In the example above, this would output `awesome.dll` on Windows and `awesome.so` on Linux.
-
-`PLUGIN_SOURCES` is a space separated list of source filenames that will be used to build the plugin.
+This is a skeleton repo to make it easier to create libpurple plugins.
-`PLUGIN_HEADERS` is a space separated list of header filename that will be used to build the plugin.
-
-`include libpurple.mk` imports `libpurple.mk` which abstracts out all the complexities of the build system.
-
-## Usage
-
-Once you've setup the `Makefile` you can build your plugin by simply typing `make`.
-
-If everything built fine, you can use `make install` to install the plugin so that your libpurple client can use it.
-
-If you ever want to uninstall the plugin, you can type `make uninstall`.
-
-While developing your build will become incremental automatically, so if you wnat for a build from scratch, you can use `make clean` to remove the intermediate files.
-
-## Support
-
-If you're having issues with this repository, please open an issue in the Bitbucket project.
-
-## 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.
-
-### 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.
+For more information please see [README.skeleton.md](README.skeleton.md).
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/README.skeleton.md Mon Aug 07 22:32:12 2017 -0500
@@ -0,0 +1,46 @@
+# skeleton-libpurple
+
+This repository is a starting point for writing libpurple plugins.
+
+You can fork it and use its build system to build your own custom plugin immediately. By forking this repo you can easily pull in updates to it too!
+
+## Getting Started
+
+This plugin uses the [Meson build system](https://mesonbuild.com/). It is currently set up for simple plugins where all you need to do is make a few changes.
+
+Below is the top of the stock `meson.build`.
+
+ project(
+ 'skeleton-libpurple',
+ 'c',
+ version: '0.1.0',
+ )
+
+ SOURCES = [
+ 'hello-world.c',
+ ]
+
+You should change `skeleton-libpurple` and `version` in the call to `project()` to match the name and version of your plugin respectively.
+
+Next you'll need to set the `SOURCES` variable to the list of files in your plugin.
+
+Once that's done you can move on to the usage section.
+
+## Usage
+
+Once your `meson.build` file is good to go, you can generate your build system with `meson build`. This will generate your build system in a directory named build in the current directory.
+
+To now run the build you can run `ninja -C build` or if you prefer:
+
+ cd build
+ ninja
+
+If everything built fine, you can use `ninja install` to install the plugin so that your libpurple client can use it.
+
+If you ever want to uninstall the plugin, you can type `ninja uninstall`.
+
+While developing your build will become incremental automatically, so if you want to build from scratch, you can use `ninja clean` to remove the intermediate files.
+
+## Support
+
+If you're having issues with this repository, please open an issue in the Bitbucket project.
--- a/libpurple.mk Thu May 18 23:12:38 2017 -0500
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,148 +0,0 @@
-#!/usr/bin/make -f
-# skeleton-libpurple - A skeleton for developing libpurple plugins
-# Copyright (C) 2017 Gary Kramlich <grim@reaperworld.com>
-# Copyright (C) 2016-2017 Eion Robb <eion@robbmob.com>
-#
-# This program is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# as published by the Free Software Foundation; either version 2
-# of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# 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) # window
-# set the target's name
-PLUGIN_TARGET := $(PLUGIN_NAME).dll
-
-# set the platform cflags and libs
-PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_WIN32)
-PLATFORM_LIBS := $(PLUGIN_LIBS_WIN32)
-
-# 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 \
- -I$(WIN32_DEV_TOP)/glib-2.28.8/lib/glib-2.0/include \
- -I$(PIDGIN_TREE_TOP)/libpurple \
- -I$(PIDGIN_TREE_TOP)
-PLATFORM_LIBS += \
- -L$(WIN32_DEV_TOP)/glib-2.28.8/lib \
- -L$(PIDGIN_TREE_TOP)/libpurple \
- -lpurple \
- -lintl \
- -lglib-2.0 \
- -lgobject-2.0 \
- -lz
-else # not windows
-PLUGIN_TARGET := $(PLUGIN_NAME).so
-
-UNAME_S := $(shell uname -s)
-ifeq ($(UNAME_S),Darwin)
-PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_DARWIN)
-PLATFORM_LIBS := $(PLUGIN_LIBS_DARWIN)
-else
-PLATFORM_CFLAGS := $(PLUGIN_CFLAGS_LINUX)
-PLATFORM_LIBS := $(PLUGIN_LIBS_LINUX)
-endif
-
-endif
-
-# set a bunch of variables if there weren't set already
-CC ?= gcc
-CFLAGS ?= -O2 -g -g3 \
- -Wall -Wextra -Werror -Wformat \
- -Wno-deprecated-declarations -Wno-unused-parameter \
- -fno-strict-aliasing
-LDFLAGS ?=
-
-# pkg-config if necessary
-PKG_CONFIG ?= pkg-config
-LIBPURPLE_PC_MODULE ?= purple
-LIBPURPLE_CFLAGS ?= $(shell $(PKG_CONFIG) --cflags $(LIBPURPLE_PC_MODULE))
-LIBPURPLE_LIBS ?= $(shell $(PKG_CONFIG) --libs $(LIBPURPLE_PC_MODULE))
-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=$(PLUGIN_PIXMAPSDIR) \
- -DPLUGIN_VERSION=\"$(PLUGIN_VERSION)\"
-
-# 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
-
-all: $(PLUGIN_TARGET)
-
-clean:
- rm -f $(PLUGIN_OBJECTS) $(PLUGIN_TARGET) $(CLEAN_FILES)
-
-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 -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) $(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)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/meson.build Mon Aug 07 22:32:12 2017 -0500
@@ -0,0 +1,28 @@
+project(
+ 'skeleton-libpurple',
+ 'c',
+ version: '0.1.0',
+)
+
+SOURCES = [
+ 'hello-world.c',
+]
+
+# The code below should not need to be modified for simple use cases.
+add_project_arguments(
+ '-DPREFIX="@0@"'.format(get_option('prefix')),
+ '-DLIBDIR="@0@"'.format(get_option('libdir')),
+ '-DPLUGIN_VERSION="@0@"'.format(meson.project_version()),
+ language : 'c'
+)
+
+PURPLE = dependency('purple', version: '>=2.0.0')
+
+shared_library(
+ meson.project_name(),
+ SOURCES,
+ name_prefix: '',
+ dependencies: [PURPLE],
+ install: true,
+ install_dir: PURPLE.get_pkgconfig_variable('plugindir'),
+)