1TP-MAGIC-CONFIG(1) tp-magic-config TP-MAGIC-CONFIG(1)
2
3
4
6 tp-magic-config -- Helps creating 'Magic' tool plugins for Tux Paint(1)
7
8
10 tp-magic-config [--apiversion | --version | --cflags | --pluginprefix |
11 --plugindocprefix | --dataprefix | --localpluginprefix | --localdat‐
12 aprefix]
13
14
16 tp-magic-config is a simple shell script that responds with various
17 pieces of information about the currently-installed version of Tux
18 Paint(1) that are useful when building 'Magic' tool plugins.
19
20
22 --apiversion
23 Outputs the version of the Tux Paint 'Magic' tool plugin API
24 that the installed copy of Tux Paint supports. (For API compat‐
25 ibility testing.)
26
27 --version
28 Outputs the version of Tux Paint that tp-magic-config corre‐
29 sponds to.
30
31 --cflags
32 Outputs the compiler flags that Tux Paint 'Magic' tool plugins
33 should be compiled with. (For example, a "-I" include path
34 option that tells the compiler where it can find the plugin API
35 header file, "tp_magic_config.h", that plugins must #include.)
36
37 --pluginprefix
38 Outputs the system directory where the installed copy of Tux
39 Paint expects to find 'Magic' tool plugins (".so" shared
40 objects). (e.g., "/usr/share/tuxpaint/plugins")
41
42 --localpluginprefix
43 Outputs the user directory where the installed copy of Tux
44 Paint expects to find 'Magic' tool plugins (".so" shared
45 objects). (e.g., "/home/username/.tuxpaint/plugins")
46
47 --plugindocprefix
48 Outputs the directory where the installed copy of Tux Paint
49 expects to find documentation for 'Magic' tool plugins (".html"
50 and ".txt" files). Tux Paint's main documentation includes a
51 link to this directory under the section on "Magic" tools.
52
53 --dataprefix
54 Outputs the system directory where the installed copy of Tux
55 Paint keeps its global data files (e.g., "/usr/share/tux‐
56 paint/"). This is the same value that plugins installed system-
57 wide will receive in the "data_directory" string within the
58 "magic_api" structure sent to the plugins' functions.
59
60 --localdataprefix
61 Outputs the user directory where the installed copy of Tux
62 Paint expects plugins to install their local data files.
63 (e.g., "/home/username/.tuxpaint/plugins/data"). This is the
64 same value that plugins installed locally will receive in the
65 "data_directory" string within the "magic_api" structure sent
66 to the plugins' functions.
67
68
70 $ gcc -shared `tp-magic-config --cflags` my_plugin.c -o my_plugin.so
71 # cp my_plugin.so `tp-magic-config --pluginprefix`
72 # cp my_plugin_icon.png `tp-magic-config --dataprefix`/images/magic
73 # cp my_plugin.html `tp-magic-config --plugindocrefix`/html
74 # cp my_plugin.txt `tp-magic-config --plugindocrefix`
75
76
78 $ gcc -shared `tp-magic-config --cflags` my_plugin.c -o my_plugin.so
79 $ mkdir -p `tp-magic-config --localpluginprefix`
80 $ cp my_plugin.so `tp-magic-config --localpluginprefix`
81 $ mkdir -p `tp-magic-config --localdataprefix`/images/magic
82 $ cp my_plugin_icon.png `tp-magic-config --localdatapre‐
83 fix`/images/magic
84
85
87 MAGIC_CFLAGS=$(shell tp-magic-config --cflags)
88 MAGIC_PREFIX=$(shell tp-magic-config --pluginprefix)
89 MAGIC_DOC_PREFIX=$(shell tp-magic-config --plugindocprefix)
90 DATA_PREFIX=$(shell tp-magic-config --dataprefix)
91
92 all: my_plugin.so
93
94 my_plugin.so: my_plugin.c
95
96 install: install-so install-data install-docs
97
98 install-so:
99 mkdir -p $(MAGIC_PREFIX)
100 cp my_plugin.so $(MAGIC_PREFIX)/
101 chmod 644 $(MAGIC_PREFIX)/my_plugin.so
102
103 install-data:
104 mkdir -p $(DATA_PREFIX)
105 cp icons/my_plugin_icon.png $(DATA_PREFIX)/images/magic/
106 chmod 644 $(DATA_PREFIX)/images/magic/my_plugin_icon.png
107
108 install-docs:
109 mkdir -p $(MAGIC_DOC_PREFIX)
110 cp docs/my_plugin.html $(MAGIC_DOC_PREFIX)/html/
111 chmod 644 $(MAGIC_DOC_PREFIX)/html/my_plugin.html
112 cp docs/my_plugin.txt $(MAGIC_DOC_PREFIX)/
113 chmod 644 $(MAGIC_DOC_PREFIX)/my_plugin.txt
114
115
117 Bill Kendrick. <bill@newbreedsoftware.com>
118
119
120
122 tuxpaint(1),
123
124 And documentation within /usr/[local/]share/doc/tuxpaint/.
125
126
127
128
1292007.08.07 07 August 2007 TP-MAGIC-CONFIG(1)