├── .gitignore ├── .gitmodules ├── helloworld-help.pd ├── helloworld-meta.pd ├── Makefile ├── helloworld.c └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | *.pd_linux 2 | *.pd_darwin 3 | *.dll 4 | *.o 5 | *.so 6 | *.dylib 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "pd-lib-builder"] 2 | path = pd-lib-builder 3 | url = https://github.com/pure-data/pd-lib-builder.git 4 | -------------------------------------------------------------------------------- /helloworld-help.pd: -------------------------------------------------------------------------------- 1 | #N canvas 702 334 450 300 10; 2 | #X obj 16 69 helloworld; 3 | #X msg 16 37 bang; 4 | #X text 13 10 prints "Hello world!" when banged.; 5 | #X connect 1 0 0 0; 6 | -------------------------------------------------------------------------------- /helloworld-meta.pd: -------------------------------------------------------------------------------- 1 | #N canvas 966 262 200 200 10; 2 | #N canvas 19 48 420 300 META 0; 3 | #X text 10 10 META this is a prototype of a libdir meta file; 4 | #X text 10 30 NAME helloworld; 5 | #X text 10 51 AUTHOR IOhannes m zmolnig; 6 | #X text 10 90 LICENSE ?; 7 | #X text 10 110 VERSION 1.0.0; 8 | #X text 10 70 DESCRIPTION Example "hello world" external.; 9 | #X restore 10 10 pd META; 10 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | # Makefile to build class 'helloworld' for Pure Data. 2 | # Needs Makefile.pdlibbuilder as helper makefile for platform-dependent build 3 | # settings and rules. 4 | 5 | # library name 6 | lib.name = helloworld 7 | 8 | # input source file (class name == source file basename) 9 | class.sources = helloworld.c 10 | 11 | # all extra files to be included in binary distribution of the library 12 | datafiles = helloworld-help.pd helloworld-meta.pd README.md 13 | 14 | # include Makefile.pdlibbuilder from submodule directory 'pd-lib-builder' 15 | PDLIBBUILDER_DIR=pd-lib-builder/ 16 | include $(PDLIBBUILDER_DIR)/Makefile.pdlibbuilder 17 | -------------------------------------------------------------------------------- /helloworld.c: -------------------------------------------------------------------------------- 1 | #include "m_pd.h" 2 | 3 | static t_class *helloworld_class = NULL; 4 | 5 | typedef struct _helloworld { 6 | t_object x_obj; 7 | } t_helloworld; 8 | 9 | void helloworld_bang(t_helloworld *x) { 10 | (void)x; // silence unused variable warning 11 | post("Hello world!"); 12 | } 13 | 14 | void *helloworld_new(void) { 15 | t_helloworld *x = (t_helloworld *)pd_new(helloworld_class); 16 | return (void *)x; 17 | } 18 | 19 | void helloworld_setup(void) { 20 | helloworld_class = class_new(gensym("helloworld"), 21 | (t_newmethod)helloworld_new, NULL, 22 | sizeof(t_helloworld), CLASS_DEFAULT, 0); 23 | class_addbang(helloworld_class, helloworld_bang); 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | An example Pure Data external using [pd-lib-builder](https://github.com/pure-data/pd-lib-builder). You can use this project to bootstrap your own Pure Data external development. 2 | 3 | ## Usage ## 4 | 5 | Clone and build this example via: 6 | 7 | git clone --recursive https://github.com/pure-data/helloworld.git 8 | cd helloworld 9 | make 10 | 11 | Make sure you use the `--recursive` flag when checking out the repository so that the pd-lib-builder dependency is also checked out. If you forgot to add it, you can also manually fetch pd-lib-builder via: 12 | 13 | cd helloworld 14 | git submodule init 15 | git submodule update 16 | 17 | _Note: The "Download zip" option on GitHub currently does not check out dependencies so pd-lib-builder will be missing in your download. The preferred method is to use git._ 18 | 19 | ## Build ## 20 | 21 | You should have a copy of the pure-data source code - the following build command assumes it is in the `../pure-data` directory. [This page explains how you can get the pure-data source code](https://puredata.info/docs/developer/GettingPdSource). 22 | 23 | By default, pd-lib-builder will attempt to auto-locate an install of Pure Data. The following command will build the external and install the distributable files into a subdirectory called `build/helloworld`. 24 | 25 | make install pdincludepath=../pure-data/src/ objectsdir=./build 26 | 27 | See `make help` for more details. 28 | 29 | ## Distribute ## 30 | 31 | If you are using the [deken](https://github.com/pure-data/deken/) externals packaging tool you can then submit your external to the [puredata.info repository](http://puredata.info) for other people to find, like this: 32 | 33 | deken upload ./build/helloworld 34 | 35 | You will need to have an account on the site. You probably also want to have a valid GPG key to sign the package so that users can prove that it waas created by you. 36 | --------------------------------------------------------------------------------