diff --git a/packages/linux_flatpak/README.md b/packages/linux_flatpak/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..02f7c543e2311119d5673acdf4e7c262b2c7dd16
--- /dev/null
+++ b/packages/linux_flatpak/README.md
@@ -0,0 +1,23 @@
+# Purr Data packaged for Flatpak
+
+This is a Flatpak for [Purr Data](https://www.purrdata.net/).
+
+Purr Data is a popular fork of the [Pure Data](http://puredata.info/), an open
+source visual programming language for multimedia.
+
+## How to build
+
+This Flatpak uses the standard
+[flatpak-builder](docs.flatpak.org/en/latest/flatpak-builder-command-reference.html)
+tool to build.
+
+You can run a command like the following to build the package from this repo
+and install it in your 'user' Flatpak installation:
+
+    flatpak-builder --install ./build net.purrdata.PurrData.yml --force-clean --user
+
+During development you can also run a build without installing it, like this:
+
+    flatpak-builder --run build net.purrdata.PurrData.yml pd-l2ork
+
+See the [Flatpak manual](http://docs.flatpak.org/en/latest/) for more information.
diff --git a/packages/linux_flatpak/net.purrdata.PurrData.desktop b/packages/linux_flatpak/net.purrdata.PurrData.desktop
new file mode 100644
index 0000000000000000000000000000000000000000..4b240843c3a3113f121d813b540f75c194b421e6
--- /dev/null
+++ b/packages/linux_flatpak/net.purrdata.PurrData.desktop
@@ -0,0 +1,11 @@
+[Desktop Entry]
+Name=Purr Data
+Comment=An open source visual programming language for multimedia
+Icon=net.purrdata.PurrData
+Exec=pd-wrapper.sh
+Terminal=false
+Type=Application
+Categories=Audio;AudioVideo;Development;GNOME;GTK;Midi;Music
+Keywords=Pure Data
+StartupNotify=true
+MimeType=application/x-puredata;application/x-pd-l2ork;text/x-pd-l2ork
diff --git a/packages/linux_flatpak/net.purrdata.PurrData.metainfo.xml b/packages/linux_flatpak/net.purrdata.PurrData.metainfo.xml
new file mode 100644
index 0000000000000000000000000000000000000000..73c1aa9903390c8e5dc90afa48a813c4bf73db8a
--- /dev/null
+++ b/packages/linux_flatpak/net.purrdata.PurrData.metainfo.xml
@@ -0,0 +1,58 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<component type="desktop-application">
+  <id>net.purrdata.PurrData</id>
+  <metadata_license>CC0-1.0</metadata_license>
+  <project_license>GPL-3.0+ and BSD-3-Clause</project_license>
+  <name>Purr Data</name>
+  <summary>An open source visual programming language for multimedia</summary>
+  <description>
+    <p>
+      This package contains Purr Data, which is a fork of Pure Data that
+      bundles a lot of useful extensions, and brings a modern HTML5-based
+      user interface.
+    </p>
+    <p>
+        <em>IMPORTANT</em>: Running Pure Data under Flatpak is experimental.
+        The following are known limitations.
+    </p>
+    <ul>
+      <li>Realtime priority cannot be used.</li>
+      <li>JACK audio backend cannot be used.</li>
+    </ul>
+    <p>
+      Packages from https://www.purrdata.net/ do not have these limitations.
+    </p>
+    <p>
+      Pure Data is an open source visual programming environment that runs on
+      anything from personal computers to embedded devices (ie Raspberry Pi)
+      and smartphones (via libpd, DroidParty (Android), and PdParty (iOS).
+      It is a major branch of the family of patcher programming languages
+      known as Max (Max/FTS, ISPW Max, Max/MSP, etc), originally developed
+      by Miller Puckette at IRCAM.
+    </p>
+    <p>
+      Pd enables musicians, visual artists, performers, researchers, and
+      developers to create software graphically without writing lines of
+      code. Pd can be used to process and generate sound, video, 2D/3D
+      graphics, and interface sensors, input devices, and MIDI. Pd can
+      easily work over local and remote networks to integrate wearable
+      technology, motor systems, lighting rigs, and other equipment. It
+      is suitable for learning basic multimedia processing and visual
+      programming methods as well as for realizing complex systems for
+      large-scale projects.
+    </p>
+  </description>
+  <screenshots>
+    <screenshot type="default">
+      <image type="source">https://git.purrdata.net/samthursfield/flatpak-net.purrdata.PurrData/raw/master/screenshots/pd-parody-2.png</image>
+    </screenshot>
+  </screenshots>
+  <developer_name>The Purr Data developers</developer_name>
+  <launchable type="desktop-id">net.purrdata.PurrData.desktop</launchable>
+  <url type="homepage">https://www.purrdata.net/</url>
+  <url type="bugtracker">https://git.purrdata.net/jwilkes/purr-data/issues</url>
+  <content_rating type="oars-1.1" />
+  <releases>
+    <release version="2.10.0" date="2019-10-02" />
+  </releases>
+</component>
diff --git a/packages/linux_flatpak/net.purrdata.PurrData.svg b/packages/linux_flatpak/net.purrdata.PurrData.svg
new file mode 100644
index 0000000000000000000000000000000000000000..37c1450a170f7fd378a57a15de3d33959e824e6f
--- /dev/null
+++ b/packages/linux_flatpak/net.purrdata.PurrData.svg
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+   xmlns:dc="http://purl.org/dc/elements/1.1/"
+   xmlns:cc="http://creativecommons.org/ns#"
+   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+   xmlns:svg="http://www.w3.org/2000/svg"
+   xmlns="http://www.w3.org/2000/svg"
+   width="54"
+   height="54"
+   version="1.1"
+   id="svg2">
+  <metadata
+     id="metadata17">
+    <rdf:RDF>
+      <cc:Work
+         rdf:about="">
+        <dc:format>image/svg+xml</dc:format>
+        <dc:type
+           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+        <dc:title></dc:title>
+      </cc:Work>
+    </rdf:RDF>
+  </metadata>
+  <defs
+     id="defs15" />
+  <text
+     x="17.5"
+     y="19"
+     id="7fb48d028a00LABEL label text"
+     style="font-size:10px;font-family:Monaco;fill:#000000;stroke-width:0" />
+  <rect
+     x="5"
+     y="4.5"
+     width="15"
+     height="15"
+     id="7fb48d028a00BASE"
+     style="fill:#00fc04;stroke:#000000;stroke-width:1" />
+  <circle
+     r="6.5"
+     cx="12.5"
+     cy="12"
+     id="7fb48d028a00BUT"
+     style="fill:#00fc04;stroke:#000000;stroke-width:1" />
+  <polyline
+     transform="translate(-99,-74.5)"
+     points="104.0 99.0 148.0 99.0 148.0 124.0 104.0 124.0 104.0 99.0"
+     id=".x7fb48cd26890.t7fb48cc1a7d0R obj"
+     style="fill:#ffffff;stroke:#000000;stroke-width:1;stroke-linejoin:miter;fill-opacity:1" />
+  <rect
+     transform="scale(1,-1)"
+     x="5"
+     y="-26.499998"
+     width="6.9999995"
+     height="2.0000002"
+     id=".x7fb48cd26890.t7fb48cc1a7d0i0 inlet"
+     style="fill:#000000;stroke:#000000;stroke-width:1" />
+  <rect
+     x="42"
+     y="24.5"
+     width="7"
+     height="2"
+     id=".x7fb48cd26890.t7fb48cc1a7d0i1 inlet"
+     style="fill:#000000;stroke:#000000;stroke-width:1" />
+  <text
+     x="7"
+     y="44.456055"
+     id=".x7fb48cd26890.t7fb48cc1a7d0 obj text"
+     style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:20px;line-height:125%;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';text-align:start;writing-mode:lr-tb;text-anchor:start;opacity:1;fill:#000000;stroke-width:0;fill-opacity:1;">
+    <tspan
+       id="tspan4141"
+       style="font-style:normal;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:20px;line-height:125%;font-family:'DejaVu Sans Mono';-inkscape-font-specification:'DejaVu Sans Mono, Bold';text-align:start;letter-spacing:1px;writing-mode:lr-tb;text-anchor:start;fill:#000000;fill-opacity:1;opacity:1">Pd</tspan>
+  </text>
+  <polyline
+     transform="translate(-99,-74.5)"
+     points="107.0 94.0 107.0 99.0"
+     id="l7fb48cc19700 cord"
+     style="fill:none;stroke:#000000;stroke-width:1;stroke-linejoin:round" />
+  <rect
+     style="fill:#000000;stroke:#000000;stroke-width:0.99891341"
+     id="rect4160"
+     height="2.0010867"
+     width="6.9810028"
+     y="-49.413757"
+     x="4.9994569"
+     transform="scale(1,-1)" />
+</svg>
diff --git a/packages/linux_flatpak/net.purrdata.PurrData.yml b/packages/linux_flatpak/net.purrdata.PurrData.yml
new file mode 100644
index 0000000000000000000000000000000000000000..ee18436f18390bd86edf6ade9c6592692d5a93f7
--- /dev/null
+++ b/packages/linux_flatpak/net.purrdata.PurrData.yml
@@ -0,0 +1,125 @@
+id: net.purrdata.PurrData
+runtime: org.freedesktop.Platform
+runtime-version: '19.08'
+sdk: org.freedesktop.Sdk
+default-branch: stable
+command: pd-wrapper.sh
+finish-args: [
+    # Display
+    '--share=ipc', '--socket=x11', '--socket=wayland', '--device=dri',
+    # Audio access
+    '--socket=pulseaudio',
+    # Filesystem access (pd doesn't yet work with portals)
+    '--filesystem=host',
+    # MIDI access (Flatpak doesn't yet support exposing only MIDI devices)
+    '--device=all'
+]
+modules:
+- name: purr-data
+  buildsystem: autotools
+  subdir: pd/src
+  config-opts: [ '--disable-portaudio', '--enable-alsa', '--enable-oss' ]
+  sources:
+  - type: git
+    url: https://github.com/agraef/purr-data/
+    tag: 2.10.0
+    commit: 7cf93e5e32009f033430b8bc9c7276adb272853c
+  - type: patch
+    path: patch/build-api.patch
+  - type: patch
+    path: patch/no-rsync-during-install.patch
+
+- name: pd-externals
+  buildsystem: simple
+  subdir: externals
+  build-commands:
+  - |
+    make -j $(FLATPAK_BUILDER_N_JOBS) prefix=/app \
+         adaptive arraysize autotune bassemu boids comport creb cxc cyclone earplug ekext ext13 fftease \
+         flatgui freeverb ggee hcs iem_ambi iem_bin_ambi iemlib iemguts iem_adaptfilt iemmatrix \
+         iemxmlrpc iem_delay iem_roomsim iem_spec2 iem_tab jasch_lib loaders-libdir lyonpotpourri mapping \
+         markex maxlib mjlib moonlib motex mrpeach pan pdcontainer pddp pdogg plugin pmpd \
+         rjlib sigpack smlib tof unauthorized vbap windowing
+  - |
+    make -j $(FLATPAK_BUILDER_N_JOBS) DESTDIR=/ prefix=/app \
+         adaptive_install arraysize_install autotune_install bassemu_install \
+         boids_install comport_install creb_install cxc_install cyclone_install \
+         earplug_install ekext_install ext13_install fftease_install \
+         flatgui_install freeverb_install ggee_install hcs_install \
+         iem_ambi_install iem_bin_ambi_install iemlib_install \
+         iemguts_install iem_adaptfilt_install iemmatrix_install iemxmlrpc_install \
+         iem_delay_install iem_roomsim_install iem_spec2_install iem_tab_install \
+         jasch_lib_install loaders-libdir_install lyonpotpourri_install \
+         mapping_install markex_install maxlib_install mjlib_install \
+         moonlib_install motex_install mrpeach_install \
+         pan_install pdcontainer_install pddp_install pdogg_install \
+         plugin_install pmpd_install rjlib_install sigpack_install smlib_install \
+         tof_install unauthorized_install vbap_install windowing_install
+  # The following externals from the purr-data repo are not built:
+  #
+  #   bsaylor  -- needs fftw
+  #   dsis -- segfault during configure !?
+  #   fluid - requires fluidsynth
+  #   iemgui -- requires a config.h that it doesn't have
+  #   moocow -- fails to configure
+  #   oscx -- fails to configure
+  #   pdlua -- requires Lua
+  #   zexy -- fails to configure
+  sources:
+  - type: git
+    url: https://github.com/agraef/purr-data/
+    tag: 2.10.0
+    commit: 7cf93e5e32009f033430b8bc9c7276adb272853c
+
+- name: pd-abstractions
+  buildsystem: simple
+  subdir: abstractions
+  build-commands:
+  - make -j $(FLATPAK_BUILDER_N_JOBS) DESTDIR=/ prefix=/app install
+  sources:
+  - type: git
+    url: https://github.com/agraef/purr-data/
+    tag: 2.10.0
+    commit: 7cf93e5e32009f033430b8bc9c7276adb272853c
+
+- name: purr-data-integration
+  buildsystem: simple
+  build-commands:
+  # These commands run in the 'subdir' that we set, but the sources appear at
+  # the top level hence the `../..` everywhere.
+  - mkdir -p /app/lib/pd-l2ork/bin/nw
+  - tar -x -f nwjs.tar.gz -C /app/lib/pd-l2ork/bin/nw --strip-components=1
+  # wrapper script
+  - install -m 755 pd-wrapper.sh /app/bin
+  # .desktop file (so we appear in list of applications)
+  - install -d /app/share/applications/
+  - install -m 644 net.purrdata.PurrData.desktop /app/share/applications/
+  # AppStream metadata (for app store / package manager)
+  - install -d /app/share/metainfo/
+  - install -m 644 net.purrdata.PurrData.metainfo.xml /app/share/metainfo
+  # icon (for everyone)
+  - install -d /app/share/icons/hicolor/scalable/apps
+  - install -m 644 net.purrdata.PurrData.svg /app/share/icons/hicolor/scalable/apps/
+  # add mime type to .pd files
+  - install -d /app/share/mime/packages/
+  - install -m 644 packages/linux_make/pd-l2ork.xml /app/share/mime/packages/net.purrdata.PurrData.xml
+  sources:
+  - type: git
+    url: https://github.com/agraef/purr-data/
+    tag: 2.10.0
+    commit: 7cf93e5e32009f033430b8bc9c7276adb272853c
+  - type: file
+    # Using an binary x86_64 build of nw.js makes me sad. There are ARM packages
+    # available from the nw.js website. For other platforms, it's difficult but
+    # possible to build nw.js and Chromium from source, good luck!
+    url: https://dl.nwjs.io/v0.42.3/nwjs-v0.42.3-linux-x64.tar.gz
+    sha256: 4802a3a32767ff8908aef8e91e11d81e7b515b32a09c9ab82c09edf91e49d99e
+    dest-filename: nwjs.tar.gz
+  - type: file
+    path: ./pd-wrapper.sh
+  - type: file
+    path: net.purrdata.PurrData.desktop
+  - type: file
+    path: net.purrdata.PurrData.metainfo.xml
+  - type: file
+    path: net.purrdata.PurrData.svg
diff --git a/packages/linux_flatpak/pd-wrapper.sh b/packages/linux_flatpak/pd-wrapper.sh
new file mode 100644
index 0000000000000000000000000000000000000000..541a195e12e90be7553d647283652bad0108c3ef
--- /dev/null
+++ b/packages/linux_flatpak/pd-wrapper.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+padsp -n "Pure Data (Flatpak)" pd-l2ork -oss $@
diff --git a/pd/src/autogen.sh b/pd/src/autogen.sh
new file mode 100755
index 0000000000000000000000000000000000000000..3b076d1a12c71eba41bb1e392c1d56f1ed53092f
--- /dev/null
+++ b/pd/src/autogen.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+autoreconf -ivf