Difference between revisions of "How To Build and Deploy LV2 Plugin to MOD Duo"
Line 3: | Line 3: | ||
In order to have a LV2 plugin running in a MOD Device you'll need the following: | In order to have a LV2 plugin running in a MOD Device you'll need the following: | ||
− | # | + | # LV2 Basics |
− | # | + | # Get the LV2 plugin source code |
# Get the build tools | # Get the build tools | ||
# Create your project make files | # Create your project make files | ||
Line 13: | Line 13: | ||
Let's dive in. | Let's dive in. | ||
− | == Basics | + | == LV2 Basics == |
* [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] | ||
− | * [http://lv2plug.in/ LV2 | + | * [http://lv2plug.in/book/ LV2 Book] |
* [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 == |
− | + | 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"> | ||
+ | $ 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 == | == 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 | + | 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. |
− | Luckily this process has been | + | 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]. | ||
+ | |||
+ | In summary: | ||
<source lang="console"> | <source lang="console"> | ||
+ | $ cd | ||
$ git clone https://github.com/moddevices/mod-plugin-builder | $ git clone https://github.com/moddevices/mod-plugin-builder | ||
$ ./bootstrap.sh | $ ./bootstrap.sh | ||
</source> | </source> | ||
+ | |||
+ | Once the process is finished you should have local binary called <code>build</code>. | ||
== Create your project make files == | == Create your project make files == | ||
− | + | 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. | |
− | + | 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"> | ||
+ | $ cd ~/mod-plugin-builder/plugins/package | ||
+ | $ mkdir eg-amp-lv2 | ||
+ | $ cp ~/lv2/plugins/eg-amp-source.tar eg-amp-lv2/ | ||
+ | $ touch eg-amp-lv2/eg-amp-lv2.mk | ||
+ | </source> | ||
+ | |||
+ | The content of the .mk file for our eg-amp example should be: | ||
+ | |||
+ | <source> | ||
+ | ###################################### | ||
+ | # | ||
+ | # eg-amp-lv2 | ||
+ | # | ||
+ | ###################################### | ||
+ | |||
+ | EG_AMP_LV2_VERSION = 1.0 | ||
+ | EG_AMP_LV2_SITE_METHOD = file | ||
+ | EG_AMP_LV2_SITE = $(BR2_EXTERNAL)/package/eg-amp-lv2 | ||
+ | EG_AMP_LV2_SOURCE = eg-amp-$(EG_AMP_LV2_VERSION).tar | ||
+ | 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 | ||
+ | (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)) | ||
+ | |||
+ | </source> | ||
+ | |||
+ | == Compile it == | ||
+ | |||
+ | <source lang="console"> | ||
+ | $ cd ~/mod-plugin-builder/ | ||
+ | $ | ||
+ | </source> |
Revision as of 05:15, 5 May 2016
Contents
Introduction
In order to have a LV2 plugin running in a MOD Device you'll need the following:
- 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
Get the LV2 plugin source code
For this guide we'll be using an example from the lv2 project itself but any example would do. The example we'll use is eg-amp.lv2.
So we need to clone this repo:
$ cd
$ git clone https://github.com/drobilla/lv2
For this guide we'll include a source code tarball along with the .mk file, so let's create it.
$ cd lv2/plugins/eg-amp.lv2
$ tar -cf ../eg-amp-source.tar *.c *.ttl* wscript
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).
Luckily this process has been simplified. All you need is to 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
.
Create your project make files
The build process is based on Buildroot which requires you to create make files that indicate how you plugin should be built.
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 .
with -
.
$ cd ~/mod-plugin-builder/plugins/package
$ mkdir eg-amp-lv2
$ cp ~/lv2/plugins/eg-amp-source.tar eg-amp-lv2/
$ touch eg-amp-lv2/eg-amp-lv2.mk
The content of the .mk file for our eg-amp example should be:
######################################
#
# eg-amp-lv2
#
######################################
EG_AMP_LV2_VERSION = 1.0
EG_AMP_LV2_SITE_METHOD = file
EG_AMP_LV2_SITE = $(BR2_EXTERNAL)/package/eg-amp-lv2
EG_AMP_LV2_SOURCE = eg-amp-$(EG_AMP_LV2_VERSION).tar
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
(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))
Compile it
$ cd ~/mod-plugin-builder/
$