aboutsummaryrefslogtreecommitdiff
path: root/hello/README.txt
blob: 7f1da0bcb3ceaeb7366ef108cd566c2a2e747f56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
    README for example pd external package 'hello'

    Last updated for hello v0.01

DESCRIPTION
    The 'hello' package is an example external package intended to
    demonstrate one way of using GNU autotools (automake, autoconf,
    autoheader) to manage a Pd external distribution.

    See "HOWTO" for a developer-oriented introduction.

INSTALLATION
    Issue the following commands to the shell:

       cd PACKAGE-XX.YY  (or wherever you extracted the distribution)
       ./configure
       make
       make install

CONFIGURATION OPTIONS
    The 'configure' script supports the following options, among others:

    * --help
        Output a brief usage summary of the 'configure' script, including a
        list of supported options and influential environment variables.

    * --enable-debug , --disable-debug
        Whether to enable verbose debugging messages. Default=no.

    * --with-pd-dir=PD_DIR
        Set base Pd directory. Default PREFIX/pd

    * --with-pd-include=PD_INC
        Where to look for m_pd.h

    * --with-pd-extdir=PD_EXTERNS
        Where to install compiled externals. Default: PD_DIR/externs

    * --enable-object-externals , --disable-object-externals
        Whether to build single-object externals or only multilibs
        (default), for packages which support both.

HOWTO
    This section provides a brief developer-oriented description of how to
    use GNU autotools to manage your own Pd external package.

  Files
    $(top_srcdir)/common
        The directory common/ includes common code for the autotools
        packages. Copy it to your top-level package directory.

    $(top_srcdir)/common/m4
        Contains m4 macros for autotools. See "ax_pd_external.m4" for
        details.

    $(top_srcdir)/common/pdexternal.am
        May be included in your package's Makefile.am. See "pdexternal.am"
        for details.

    $(top_srcdir)/common/mooPdUtils.h (optional)
        The file mooPdUtils.h may be included by your C source files.
        Currently, this only provides a PDEXT_UNUSED macro to avoid annoying
        gcc warnings under -W.

  Running aclocal
    You must pass the "-I common/m4" flag to aclocal when you call it. For
    maintainer-mode rebuilding and autoreconf, you should add the following
    to your top-level Makefile.am:

     ACLOCAL_AMFLAGS = -I $(top_srcdir)/common/m4

    See the example package's autogen.sh for a useful wrapper script.

  configure.ac
    You must call the macro AX_PD_EXTERNAL from configure.ac. Before doing
    so (and before calling AC_PROG_CC), make sure that you cache the values
    of important user flags in shell variables:

     ##-- save user's CFLAGS,CPPFLAGS
     UCPPFLAGS="$CPPFLAGS"
     UCFLAGS="$CFLAGS"
     ULDFLAGS="$LDFLAGS"

     ##-- Pd external stuff
     AX_PD_EXTERNAL

    See the example package's configure.ac for a complete working example.

  Makefile.am
    You probably want to include $(top_srcdir)/common/pdexternal.am in your
    Makefile.am(s). This will allow you to build Pd externals as "_PROGRAMS"
    targets. In particular, pdext_PROGRAMS targets will be built as
    externals and installed in PDEXT_DIR (see above).

    See the example package's Makefile.am for a complete working example.

    Externals
        To build & install the external "hello.$(PDEXT)", add the following
        to Makefile.am:

         pdexterns_PROGRAMS = hello
         hello_SOURCES = hello.c mooPdUtils.h

    Abstractions
        To install the abstraction "heynow.pd", add the following to
        Makefile.am:

         pdexterns_DATA = heynow.pd

    Documentation
        To install the documentation patch "hello-help.pd", add the
        following to Makefile.am:

         pddoc_DATA = hello-help.pd

  ax_pd_external.m4
    The AX_PD_EXTERNAL macro defined in common/m4/ax_pd_external.m4 is
    intended to perform all common autoconf-level checks and substitutions
    necessary for building Pd external packages on various systems. Among
    other things, this includes:

    *   Providing --with-FEATURE and --enable-FEATURE arguments such as
        --with-pd-dir (see "CONFIGURATION OPTIONS", above).

    *   Defining automake-style "Xdir" variables for easy definition of
        package externals, abstractions, and documentation.

    *   Checking for the required header "m_pd.h".

    *   Defining platform-dependent compiler and linker flags for building
        Pd externals, and adding these to the relevant system variables
        (CPPFLAGS, CFLAGS, LDFLAGS, etc.)

    See the comments at the top of m4/ax_pd_external.m4 for more details on
    the AX_PD_EXTERNAL macro.

  pdexternal.am
    pdexternal.am is intended to be included in your package's Makefile.am.
    It redefines the automake EXEEXT to allow building Pd externals using
    automake's _PROGRAMS targets. Additionally, it defines the automake
    varibles PDEXT, SUFFIXES, EXTRA_DIST, CLEANFILES, DISTCLEANFILES, and
    MAINTAINERCLEANFILES.

  Multilibs and Single-Object Externals
    You can use automake's EXTRA_PROGRAMS variable, together with the
    pdexterns_PROGRAMS automake target, the automake conditional
    WANT_OBJECT_EXTERNALS, and the C preprocessor macro
    WANT_OBJECT_EXTERNALS to allow building single-object-externals or
    multilibs from a single source distribution.

    Makefile.am should contain something like:

     ##-- always build these externals
     pdexterns_PROGRAMS = hello

     ##-- potential single-object externals (as _PROGRAMS)
     EXTRA_PROGRAMS = goodbye

     ##-- build single-object externals?
     if WANT_OBJECT_EXTERNALS
      pdexterns_PROGRAMS += goodbye
     endif

    If single-object externals were requested by the user, then the C
    preprocessor macro WANT_OBJECT_EXTERNALS will be defined by autoheader,
    to allow you to conditionally #include<> the EXTRA_PROGRAMS sources in
    your top-level multilib source file if desired. In the above example,
    hello.c might contain:

     #ifdef HAVE_CONFIG_H
     # include "config.h"
     #endif

     #ifndef WANT_OBJECT_EXTERNALS
     /*-- Multilib build: include source for the goodbye external --*/
     # include "goodbye.c"
     #endif

     /*... local definitions etc. go here ...*/

     void hello_setup(void)
     {
      #ifndef WANT_OBJECT_EXTERNALS
       goodbye_setup();
      #endif

      /*... local setup code goes here ...*/
     }

ACKNOWLEDGEMENTS
    PD by Miller Puckette and others.

AUTHOR
    Bryan Jurish <moocow@ling.uni-potsdam.de>