Further expanded plugin API documentation.

Added --pluginprefix and --dataprefix to tp-magic-config script.
Started a glossary section in API documentation.
Added Table of Contents to API documentation.
Added a manpage for tp-magic-config script.
This commit is contained in:
William Kendrick 2007-07-31 20:04:43 +00:00
parent 3061d2ff5e
commit ace762e890
6 changed files with 1074 additions and 127 deletions

View file

@ -0,0 +1,86 @@
.\" tp-magic-config - 2007.07.31
.TH TP-MAGIC-CONFIG 3 "31 Jul 2007" "2007.07.31" "Tux Paint Import"
.SH NAME
tp-magic-config -- Helps creating 'Magic' tool plugins for Tux Paint(1)
.SH SYNOPSYS
.TP 16
.B tp-magic-config [\-\-apiversion | \-\-version | \-\-cflags | \-\-pluginprefix | \-\-dataprefix]
.SH DESCRIPTION
\fItp-magic-config\fP is a simple shell script that responds with various
pieces of information about the currently-installed version of
\fITux Paint\fP(1) that are useful when building 'Magic' tool plugins.
.SH OPTIONS
.TP 8
.B \-\-apiversion
Outputs the version of the \fITux Paint\fP 'Magic' tool plugin API that the
installed copy of \fITux Paint\fP supports. (For API compatibility testing.)
.TP 8
.B \-\-version
Outputs the version of \fITux Paint\fP that \fItp-magic-config\fP
corresponds to.
.TP 8
.B \-\-cflags
Outputs the compiler flags that \fITux Paint\fP 'Magic' tool plugins should
be compiled with. (For example, a "\-I" include path option that tells the
compiler where it can find the plugin API header file, "tp_magic_config.h",
that plugins must #include.)
.TP 8
.B \-\-pluginprefix
Outputs the directory where the installed copy of \fITux Paint\fP expects
to find 'Magic' tool plugins (".so" shared objects).
.TP 8
.B \-\-dataprefix
Outputs the directory where the installed copy of \fITux Paint\fP keeps its
global data files (e.g., "/usr/share/tuxpaint/"). This is the same value that
plugins will receive in the "data_directory" string within the
"magic_api" structure sent to the plugins' functions.
.SH SHELL EXAMPLES
gcc -shared `tp-magic-config --cflags` my_plugin.c -o my_plugin.so
.PP
sudo cp my_plugin.so `tp-magic-config \-\-pluginprefix`
.PP
sudo cp my_plugin_icon.png `tp-magic-config \-\-dataprefix`/images/magic/
.SH MAKEFILE EXAMPLE
MAGIC_CFLAGS=$(shell tp-magic-config --cflags)
.br
MAGIC_PREFIX=$(shell tp-magic-config --pluginprefix)
.br
DATA_PREFIX=$(shell tp-magic-config --dataprefix)
.PP
all: my_plugin.so
.PP
my_plugin.so: my_plugin.c
.PP $(CC) -shared $(MAGIC_CFLAGS) my_plugin.c -o my_plugin.so
.PP
install: install-so install-data
.PP
install-so:
.br
mkdir -p $(MAGIC_PREFIX)
.br
cp my_plugin.so $(MAGIC_PREFIX)/
.br
chmod 644 $(MAGIC_PREFIX)/my_plugin.so
.PP
install-data:
.br
mkdir -p $(DATA_PREFIX)
.br
cp icons/my_plugin_icon.png $(DATA_PREFIX)/images/magic/
.br
chmod 644 $(DATA_PREFIX)/images/magic/my_plugin_icon.png
.SH AUTHOR
Bill Kendrick. <bill@newbreedsoftware.com>
.SH "SEE ALSO"
.BR tuxpaint (1),
.PP
And documentation within /usr/[local/]share/doc/tuxpaint/.

View file

@ -25,11 +25,12 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# (See COPYING.txt)
# Note: "__VERSION__" and "__INCLUDE__" are replaced by values
# in Tux Paint's Makefile, via 'sed', by the 'make install-magic-plugin-dev'
# Note: "__VERSION__", "__APIVERSION__", "__INCLUDE__",
# "__PLUGINPREFIX__" and "__DATAPREFIX__" are replaced by
# values in Tux Paint's Makefile, via 'sed', by the 'make tp-magic-config'
# target.
# July 5, 2007 - July 8, 2007
# July 5, 2007 - July 31, 2007
if [ $# -ne 0 ]; then
@ -45,7 +46,15 @@ if [ $# -ne 0 ]; then
echo `sdl-config --cflags` -I__INCLUDE__
exit
fi
if [ $1 = "--dataprefix" ]; then
echo "__DATAPREFIX__"
exit
fi
if [ $1 = "--pluginprefix" ]; then
echo "__PLUGINPREFIX__"
exit
fi
fi
echo "Usage: tp-magic-config [--apiversion] [--version] [--cflags]"
echo "Usage: tp-magic-config [--apiversion | --version | --cflags | --pluginprefix | --dataprefix]"