Difference between revisions of "How To Make a MPB Package"

From MOD Wiki
Jump to navigation Jump to search
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
This page describes how to make a plugin package for mod-plugin-builder (or MPB for short)
 
This page describes how to make a plugin package for mod-plugin-builder (or MPB for short)
  
Plugin packages are buildroot files. Because of that it must comply with Buildroot rules.<br>
+
Plugin packages reside in plugins/package/ directory.
A few important notes:
 
* The package name is defined by the folder name and cannot contain '.'
 
* There must be a <packagename>.mk file inside the package folder
 
* The package name and '.mk' file name must be the same
 
* Inside the '.mk' file all defined variables must start with the package name in uppercase replacing '-' with '_'
 
* You need to define the generated plugin bundle names in the <PACKAGE_NAME>_BUNDLES variable
 
* Browse through other examples so you get an idea of other variations of the makefiles (how to use cmake or waf for example)
 
* If you want to rebuild after a change to your plugin or the .mk then it is often easiest to just delete the previous build's directory for your plugin ~/mod-workdir/plugins-dep/build/<packagename>-<version>
 
  
Plugin packages reside in plugins/package/ directory.
+
== Plugin package example ==
  
 
Here's an example of a plugin package file:
 
Here's an example of a plugin package file:
 
<source lang="makefile">
 
<source lang="makefile">
######################################
+
PLUGINPKG_VERSION = 1.0.0
#
+
PLUGINPKG_SITE = http://download.sourceforge.net/myplugin/
# abgate
+
PLUGINPKG_SOURCE = myplugin-$(PLUGINPKG_VERSION).tar.gz
#
+
PLUGINPKG_BUNDLES = myplugin.lv2
######################################
 
  
ABGATE_VERSION = 1.1.7
+
$(eval $(cmake-package))
ABGATE_SITE = http://download.sourceforge.net/abgate/
+
</source>
ABGATE_SOURCE = abGate-$(ABGATE_VERSION).tar.gz
 
ABGATE_BUNDLES = abGate.lv2
 
  
ABGATE_TARGET_MAKE = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
+
We're using PLUGINPKG as a generic name, '''you must use your package name in uppercase''' here.<br>
 +
Let's divide this into small pieces...
  
define ABGATE_BUILD_CMDS
+
=== Version and download location ===
$(ABGATE_TARGET_MAKE)
+
 
 +
First we define the version, plus the download location and filename to download the source code from.<br>
 +
 
 +
<source lang="makefile">
 +
PLUGINPKG_VERSION = 1.0.0
 +
PLUGINPKG_SITE = http://download.sourceforge.net/myplugin/
 +
PLUGINPKG_SOURCE = myplugin-$(PLUGINPKG_VERSION).tar.gz
 +
</source>
 +
 
 +
If you rather use a git repository, use something like this:
 +
 
 +
<source lang="makefile">
 +
PLUGINPKG_VERSION = 25451be928b69c288f6978fb3b3fcf202dbd1ee1
 +
PLUGINPKG_SITE = git://github.com/myself/myplugin
 +
PLUGINPKG_SITE_METHOD = git
 +
</source>
 +
 
 +
=== LV2 bundles ===
 +
 
 +
Moving on, we define which bundles to use.<br>
 +
Your build system can install more bundles than what's defined here, but only the defined ones will be picked up to be published locally and on the cloud.<br>
 +
Use a space to separate the bundle names. Newline escaping is not supported, everything must be in the same line.<br>
 +
(Note: they must be installed to $DESTDIR/usr/lib/lv2/)
 +
 
 +
<source lang="makefile">
 +
PLUGINPKG_BUNDLES = mybundle1.lv2 mybundle2.lv2
 +
</source>
 +
 
 +
=== Build rules ===
 +
 
 +
Finally, we defined the steps to build the package.<br>
 +
If you're using autotools or cmake, buildroot has this covered for you already.<br>
 +
Using other build systems means you have to specify how to configure, build and install the code.
 +
 
 +
==== autotools ====
 +
 
 +
For autotools, use:
 +
 
 +
<source lang="makefile">
 +
$(eval $(autotools-package))
 +
</source>
 +
 
 +
==== cmake ====
 +
 
 +
For cmake, use:
 +
<source lang="makefile">
 +
$(eval $(cmake-package))
 +
</source>
 +
 
 +
==== waf ====
 +
 
 +
Here's an example for waf:
 +
 
 +
<source lang="makefile">
 +
PLUGINPKG_TARGET_WAF = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(HOST_DIR)/usr/bin/python ./waf
 +
 
 +
define PLUGINPKG_CONFIGURE_CMDS
 +
(cd $(@D); $(PLUGINPKG_TARGET_WAF) configure --prefix=/usr)
 +
endef
 +
 
 +
define PLUGINPKG_BUILD_CMDS
 +
(cd $(@D); $(PLUGINPKG_TARGET_WAF) build -j $(PARALLEL_JOBS))
 +
endef
 +
 
 +
define PLUGINPKG_INSTALL_TARGET_CMDS
 +
(cd $(@D); $(PLUGINPKG_TARGET_WAF) install --destdir=$(TARGET_DIR))
 +
endef
 +
 
 +
$(eval $(generic-package))
 +
</source>
 +
 
 +
==== raw makefile ====
 +
 
 +
And here's an example for raw makefiles:
 +
 
 +
<source lang="makefile">
 +
PLUGINPKG_TARGET_MAKE = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)
 +
 
 +
define PLUGINPKG_BUILD_CMDS
 +
$(PLUGINPKG_TARGET_MAKE)
 
endef
 
endef
  
define ABGATE_INSTALL_TARGET_CMDS
+
define PLUGINPKG_INSTALL_TARGET_CMDS
$(ABGATE_TARGET_MAKE) install DESTDIR=$(TARGET_DIR)
+
$(PLUGINPKG_TARGET_MAKE) install DESTDIR=$(TARGET_DIR)
 
endef
 
endef
  
 
$(eval $(generic-package))
 
$(eval $(generic-package))
 
</source>
 
</source>
 +
 +
== Tips and tricks ==
 +
 +
If using autotools or cmake and you need to specify options during configure, use something like this:
 +
 +
<source lang="makefile">
 +
PLUGINPKG_CONF_OPTS=-DBUILD_GUI=OFF
 +
</source>
 +
 +
If using autotools without an existing 'configure' script (ie, autogen.sh needs to be run first), use this:
 +
 +
<source lang="makefile">
 +
PLUGINPKG_AUTORECONF = YES
 +
</source>
 +
 +
If using autotools, cmake or raw makefiles and multiple jobs breaks your build, use this:
 +
 +
<source lang="makefile">
 +
PLUGINPKG_MAKE = $(MAKE1)
 +
</source>
 +
 +
== Final notes ==
 +
 +
Plugin packages are buildroot files. Because of that it must comply with Buildroot rules.<br>
 +
A few important notes:
 +
* The package name is defined by the folder name and cannot contain '.'
 +
* There must be a <packagename>.mk file inside the package folder
 +
* The package name and '.mk' file name must be the same
 +
* Inside the '.mk' file all defined variables must start with the package name in uppercase replacing '-' with '_'
 +
 +
Browse through other examples so you get an idea of variations of project files.

Latest revision as of 21:49, 13 September 2017

This page describes how to make a plugin package for mod-plugin-builder (or MPB for short)

Plugin packages reside in plugins/package/ directory.

Plugin package example

Here's an example of a plugin package file:

PLUGINPKG_VERSION = 1.0.0
PLUGINPKG_SITE = http://download.sourceforge.net/myplugin/
PLUGINPKG_SOURCE = myplugin-$(PLUGINPKG_VERSION).tar.gz
PLUGINPKG_BUNDLES = myplugin.lv2

$(eval $(cmake-package))

We're using PLUGINPKG as a generic name, you must use your package name in uppercase here.
Let's divide this into small pieces...

Version and download location

First we define the version, plus the download location and filename to download the source code from.

PLUGINPKG_VERSION = 1.0.0
PLUGINPKG_SITE = http://download.sourceforge.net/myplugin/
PLUGINPKG_SOURCE = myplugin-$(PLUGINPKG_VERSION).tar.gz

If you rather use a git repository, use something like this:

PLUGINPKG_VERSION = 25451be928b69c288f6978fb3b3fcf202dbd1ee1
PLUGINPKG_SITE = git://github.com/myself/myplugin
PLUGINPKG_SITE_METHOD = git

LV2 bundles

Moving on, we define which bundles to use.
Your build system can install more bundles than what's defined here, but only the defined ones will be picked up to be published locally and on the cloud.
Use a space to separate the bundle names. Newline escaping is not supported, everything must be in the same line.
(Note: they must be installed to $DESTDIR/usr/lib/lv2/)

PLUGINPKG_BUNDLES = mybundle1.lv2 mybundle2.lv2

Build rules

Finally, we defined the steps to build the package.
If you're using autotools or cmake, buildroot has this covered for you already.
Using other build systems means you have to specify how to configure, build and install the code.

autotools

For autotools, use:

$(eval $(autotools-package))

cmake

For cmake, use:

$(eval $(cmake-package))

waf

Here's an example for waf:

PLUGINPKG_TARGET_WAF = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(HOST_DIR)/usr/bin/python ./waf

define PLUGINPKG_CONFIGURE_CMDS
	(cd $(@D); $(PLUGINPKG_TARGET_WAF) configure --prefix=/usr)
endef

define PLUGINPKG_BUILD_CMDS
	(cd $(@D); $(PLUGINPKG_TARGET_WAF) build -j $(PARALLEL_JOBS))
endef

define PLUGINPKG_INSTALL_TARGET_CMDS
	(cd $(@D); $(PLUGINPKG_TARGET_WAF) install --destdir=$(TARGET_DIR))
endef

$(eval $(generic-package))

raw makefile

And here's an example for raw makefiles:

PLUGINPKG_TARGET_MAKE = $(TARGET_MAKE_ENV) $(TARGET_CONFIGURE_OPTS) $(MAKE) -C $(@D)

define PLUGINPKG_BUILD_CMDS
	$(PLUGINPKG_TARGET_MAKE)
endef

define PLUGINPKG_INSTALL_TARGET_CMDS
	$(PLUGINPKG_TARGET_MAKE) install DESTDIR=$(TARGET_DIR)
endef

$(eval $(generic-package))

Tips and tricks

If using autotools or cmake and you need to specify options during configure, use something like this:

PLUGINPKG_CONF_OPTS=-DBUILD_GUI=OFF

If using autotools without an existing 'configure' script (ie, autogen.sh needs to be run first), use this:

PLUGINPKG_AUTORECONF = YES

If using autotools, cmake or raw makefiles and multiple jobs breaks your build, use this:

PLUGINPKG_MAKE = $(MAKE1)

Final notes

Plugin packages are buildroot files. Because of that it must comply with Buildroot rules.
A few important notes:

  • The package name is defined by the folder name and cannot contain '.'
  • There must be a <packagename>.mk file inside the package folder
  • The package name and '.mk' file name must be the same
  • Inside the '.mk' file all defined variables must start with the package name in uppercase replacing '-' with '_'

Browse through other examples so you get an idea of variations of project files.