Skip to content

Platform: LV2 Plugins

pranciskus edited this page Apr 17, 2023 · 7 revisions

Currently, the LV2 plugins section on Patchstorage (https://patchstorage.com/platform/lv2-plugins/) is dedicated to linux-amd64rpi-aarch64 & patchbox-os-arm32 plugin builds. Let us know if you would like to see support for additional targets.

At this point in time, you need to use Patchstorage API to upload and update LV2 plugins on the site. To make your life easier, we have prepared a Python CLI utility. You can download it here - patchstorage-lv2-uploader.

For building plugins, please see patchstorage-lv2-builder.

More detailed instructions are down below.

Building your LV2 plugin

patchstorage-lv2-builder helps you build your LV2 plugins for different platforms locally. It utilizes prebuilt Docker images and is derived from moddevices/mod-plugin-builder build system. Currently, the builder supports x86_64, raspberrypi3_armv8, raspberrypi4_aarch64 platforms.

The Docker builder images are available on https://hub.docker.com/repositories/patchstorage, and are pulled by the ./docker-init script as shown in the Initial setup section.

Requirements

  • Linux or MacOS-based computer (or Linux running in a VM)
  • The latest Docker Desktop or Docker Engine set up on your platform
  • Docker Compose plugin
  • git

Instructions

  1. Fork & clone https://github.com/patchstorage/patchstorage-lv2-builder

  2. Initialize Git submodules and pull prebuilt Docker LV2 builder images:

    cd patchstorage-lv2-builder
    git submodule init
    git submodule update
    ./docker-init
  3. cd plugins/package and make a subfolder for your LV2 plugin. Say we’ll be using my-plugin name: mkdir my-plugin

  4. cd my-plugin and create a .mk file with exactly the same name as the folder name touch my-plugin.mk. Open my-plugin.mk in a text editor of your choice.

  5. Depending on the build system of your lv2 plugin, open one of the existing packages to base your .mk file on:

    1. make: abgate.mk
    2. cmake: aether.mk
    3. autotools: amsynth.mk
    4. waf: blop-lv2.mk
    5. dpf: shiro-plugins.mk
    6. For anything else - refer to the Buildroot documentation linked below.

    All these .mk files conform to Buildroot package makefiles, you can find detailed documentation here.

  6. Copy the contents of one of the example .mk file that matches your plugin the closest into your own opened .mk file. Then adjust the common variable name prefix to match your folder name, like replacing every ABGATE_ occurrences with MY_PLUGIN_, then adjust the values of the variables accordingly, such as the location of your source code repository. Usually, it’s a git repository URL. It should be accessible by the network, as the builder is running in a docker instance that doesn’t have access to the rest of your file system.

    The end result of the build must install whatever is necessary into $(TARGET_DIR)/usr/lib/lv2/...

  7. Once you’re done with the .mk file, it’s time to trigger the builds, cd to the base path of patchstorage-lv2-builder, and run a command like:

    ./docker-build-all my-plugin

    It will build the plugin for every platform supported, and the results will end up in docker-workdir/<platform>/my-plugin.lv2. Keep an eye on the build messages being printed in case any errors occur that should be fixed.

  8. Once the plugin builds and loads and runs properly, submit a pull request to the main patchstorage-lv2-builder repository!

Adding additional files/overwrites from the patchstorage-lv2-data submodule

These are the steps to overwrite/add additional files (GUIs, *.ttls, etc.) to the package target directory from the patchstorage-lv2-data submodule.

  1. Update the builder repo and all the submodules.

    git pull
    git submodule init
    git submodule update
  2. Create a symbolic link from the patchstorage-lv2-data/plugins/BUNDLE_NAME.lv2 to the plugins/package/BUNDLE_NAME folder, e.g.

    cd plugins/package/aether/
    ln -s ../../../patchstorage-lv2-data/plugins/aether.lv2 aether.lv2
  3. Add an additional step to the *.mk file to copy/overwrite files in the package target directory.

    nano aether.mk
    # Add a line like this to ..._INSTALL_TARGET_CMDS:
        cp -rL $($(PKG)_PKGDIR)/aether.lv2/* $(TARGET_DIR)/usr/lib/lv2/aether.lv2/

    Note from the build root manual (https://buildroot.org/downloads/manual/manual.html):

    LIBFOO_INSTALL_TARGET_CMDS lists the actions to be performed to install the package to the target directory, when the package is a target package. 
    The package must install its files to the directory given by $(TARGET_DIR). Only the files required for execution of the package have to be 
    installed. Header files, static libraries and documentation will be removed again when the target filesystem is finalized.
    

Here is an example commit implementing patchstorage-lv2-data overwrite for the aether package - https://github.com/patchstorage/patchstorage-lv2-builder/commit/aa232e14486f2c7857c4d4d38fd663b068918d59.

Uploading your LV2 plugin

patchstorage-lv2-uploader is a utility for uploading LV2 plugins to patchstorage.com.

Targets Map

Here is the map of the corresponding patchstorage-lv2-builder and Patchstorage targets.

Builder Target Patchstorage Target
x86_64 linux-amd64
raspberrypi4_aarch64 rpi-aarch64
raspberrypi3_armv8 patchbox-os-arm32

Instructions

  1. Fork & clone https://github.com/patchstorage/patchstorage-lv2-uploader
  2. Open a terminal window and run pip install requests click rdflib
  3. Move the plugin builds you want to upload to the /plugins directory. All plugin builds should be in their corresponding folders inside the corresponding Patchstorage target folder, e.g., /patchstorage-lv2-uploader/plugins/rpi-aarch64/my-plugin.lv2/
  4. Run python ./uploader.py prepare my-plugin.lv2 - this command will generate .tar.gz and patchstorage.json files in the /dist directory. Some information may be missing, so you must modify plugins.json or licenses.json files.
  5. Check the /dist folder for the results, especially the patchstorage.json files. Make adjustments if needed.
  6. Run python ./uploader push my-plugin.lv2 --username <patchstorage_username> command and follow the instructions. After uploading a plugin, please check the resulting entry on Patchstorage.
  7. If you made any changes to the plugins.json or licenses.json files, create a pull request to this repo.