Difference between revisions of "How To Build and Deploy LV2 Plugin to MOD Duo"

From MOD Wiki
Jump to navigation Jump to search
Line 1: Line 1:
 
== Introduction ==
 
== Introduction ==
  
In order to have a LV2 plugin running in a MOD Device you'll need the following:
+
This is a quick start guide to get a LV2 plugin running in a MOD Duo Device.
 +
Let's cut the chatter and get started.
  
# LV2 Basics
+
== LV2 Basics ==
# Get the LV2 plugin source code
 
# Get the build tools
 
# Create your project make files
 
# Compile it
 
# Deploy it
 
# Publish it
 
 
 
Let's dive in.
 
  
== LV2 Basics ==
+
This information is well described elsewhere.
  
 
* [http://www.nongnu.org/ll-plugins/lv2pftci/ LV2 programming for the complete idiot]
 
* [http://www.nongnu.org/ll-plugins/lv2pftci/ LV2 programming for the complete idiot]
Line 19: Line 12:
 
* [http://harryhaaren.blogspot.com/2012/06/writing-lv2-plugins-lv2-overview.html Writing Lv2 plugins : An Lv2 Overview]
 
* [http://harryhaaren.blogspot.com/2012/06/writing-lv2-plugins-lv2-overview.html Writing Lv2 plugins : An Lv2 Overview]
  
== Get the LV2 plugin source code ==
+
== Prepare build tools ==
 
 
For this guide we'll be using an example from the [https://github.com/drobilla/lv2 lv2 project] itself but any example would do.
 
The example we'll use is [https://github.com/drobilla/lv2/tree/master/plugins/eg-amp.lv2 eg-amp.lv2].
 
 
 
So we need to clone this repo:
 
  
<source lang="console">
+
A LV2 plugin is just a binary. However in order to run in a MOD Device it must be compiled using a cross-compiler targeting our hardware and software.
$ cd
 
$ git clone https://github.com/drobilla/lv2
 
</source>
 
 
 
For this guide we'll include a source code tarball along with the .mk file, so let's create it.
 
 
 
<source lang="console">
 
$ cd lv2/plugins/eg-amp.lv2
 
$ tar -cf ../eg-amp-source.tar *.c *.ttl* wscript
 
</source>
 
 
 
== Get the build tools ==
 
 
 
A LV2 plugin is just a binary. However to run in a MOD Device it must be compiled using a cross-compiler targeting our hardware and software.
 
 
MOD Duo for example uses an ARM processor running a special flavor of Linux containing a specific set of libraries (dependencies).
 
MOD Duo for example uses an ARM processor running a special flavor of Linux containing a specific set of libraries (dependencies).
  
Luckily this process has been simplified. All you need is to clone [https://github.com/moddevices/mod-plugin-builder MOD Plugin Builder] and follow the [https://github.com/moddevices/mod-plugin-builder/blob/master/README.md instructions].
+
We currently provide a custom cross-compiler that will take care of building LV2 plugins that will run in a MOD Duo.
 +
Just clone [https://github.com/moddevices/mod-plugin-builder MOD Plugin Builder] and follow the [https://github.com/moddevices/mod-plugin-builder/blob/master/README.md instructions].
  
 
In summary:
 
In summary:
Line 55: Line 30:
 
Once the process is finished you should have local binary called <code>build</code>.
 
Once the process is finished you should have local binary called <code>build</code>.
  
== Create your project make files ==
+
== Get source code and create a .mk file ==
 +
 
 +
If you have an existing LV2 Plugin you just need to create a .mk file that will be used to build it. In case you haven't started your LV2 plugin yet just follow through the links above from [[#LV2 Basics]].
 +
 
 +
We have a few samples available [https://github.com/moddevices/mod-lv2-examples/ here]. For this guide we'll use the eg-amp.lv2 example.
  
The build process is based on [https://buildroot.org/ Buildroot] which requires you to create make files that indicate how you plugin should be built.
+
The build script is based on [https://buildroot.org/ Buildroot] which requires you to create a new package under <code>plugins/package/</code> and add a make file <code><plugin-name>.mk</code>.
So let's create a new project folder and the necessary configuration files.
 
The folder defines a package name so you must use the project name and then replace <code>.</code> with <code>-</code>.
 
  
 
<source lang="console">
 
<source lang="console">
$ cd ~/mod-plugin-builder/plugins/package
+
$ cd
$ mkdir eg-amp-lv2
+
$ git clone git://github.com/moddevices/mod-lv2-examples
$ cp ~/lv2/plugins/eg-amp-source.tar eg-amp-lv2/
+
$ cp -R mod-lv2-examples/package/eg-amp-lv2 mod-plugin-builder/plugins/package/
$ touch eg-amp-lv2/eg-amp-lv2.mk
 
 
</source>
 
</source>
  
The content of the .mk file for our eg-amp example should be:
+
== Compile it ==
  
<source>
+
We're all set to compile.
######################################
 
#
 
# eg-amp-lv2
 
#
 
######################################
 
  
EG_AMP_LV2_VERSION = 1.0
+
<source lang="console">
EG_AMP_LV2_SITE_METHOD = file
+
$ cd ~/mod-plugin-builder/
EG_AMP_LV2_SITE = $(BR2_EXTERNAL)/package/eg-amp-lv2
+
$ ./build eg-amp-lv2
EG_AMP_LV2_SOURCE = eg-amp-$(EG_AMP_LV2_VERSION).tar
+
</source>
EG_AMP_LV2_DEPENDENCIES =
 
EG_AMP_LV2_BUNDLES = eg-amp
 
 
 
EG_AMP_LV2_TARGET_WAF = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(HOST_DIR)/usr/bin/python ./waf
 
  
define EG_AMP_LV2_CONFIGURE_CMDS
+
== Deploy it ==
        (cd $(@D); $(EG_AMP_LV2_TARGET_WAF) configure --prefix=/usr)
 
endef
 
  
define EG_AMP_LV2_BUILD_CMDS
 
        (cd $(@D); $(EG_AMP_LV2_TARGET_WAF) build -j $(PARALLEL_JOBS))
 
endef
 
  
define EG_AMP_LV2_INSTALL_TARGET_CMDS
 
        (cd $(@D); $(EG_AMP_LV2_TARGET_WAF) install --destdir=$(TARGET_DIR))
 
endef
 
  
$(eval $(generic-package))
+
== Publish it ==
 
 
</source>
 
 
 
== Compile it ==
 
 
 
<source lang="console">
 
$ cd ~/mod-plugin-builder/
 
$
 
</source>
 

Revision as of 17:27, 6 May 2016

Introduction

This is a quick start guide to get a LV2 plugin running in a MOD Duo Device. Let's cut the chatter and get started.

LV2 Basics

This information is well described elsewhere.

Prepare build tools

A LV2 plugin is just a binary. However in order to run in a MOD Device it must be compiled using a cross-compiler targeting our hardware and software. MOD Duo for example uses an ARM processor running a special flavor of Linux containing a specific set of libraries (dependencies).

We currently provide a custom cross-compiler that will take care of building LV2 plugins that will run in a MOD Duo. Just clone MOD Plugin Builder and follow the instructions.

In summary:

$ cd
$ git clone https://github.com/moddevices/mod-plugin-builder
$ ./bootstrap.sh

Once the process is finished you should have local binary called build.

Get source code and create a .mk file

If you have an existing LV2 Plugin you just need to create a .mk file that will be used to build it. In case you haven't started your LV2 plugin yet just follow through the links above from #LV2 Basics.

We have a few samples available here. For this guide we'll use the eg-amp.lv2 example.

The build script is based on Buildroot which requires you to create a new package under plugins/package/ and add a make file <plugin-name>.mk.

$ cd
$ git clone git://github.com/moddevices/mod-lv2-examples
$ cp -R mod-lv2-examples/package/eg-amp-lv2 mod-plugin-builder/plugins/package/

Compile it

We're all set to compile.

$ cd ~/mod-plugin-builder/
$ ./build eg-amp-lv2

Deploy it

Publish it