How to easily make deb packages with Melas
NOTE: As of Melas v0.11.0 release, this post is slightly obsolete. Please refer to the Melas documentation on the project site instead for up-to-date information, which also covers the Melas functionality in more detail.
Producing deb packages for a piece of software does not necessarily have to be as complicated as it sometimes seems to be. By traditional wisdom, making a deb package takes a fair amount of preparation and maintenance work, as described in (among others) the following howto’s:
- How to make deb packages
- Rolling your own Debian packages
- Make your own packages for Debian-based systems
And of course the infamous..
Based on these, it looks like creating a deb package is very difficult (at least that was my first impression).
However, if following the Debian project’s internal maintenance process is not of importance (as it probably would not be for those who are producing independent packages), creating the deb installers can be done quickly and with less pain using other tools, such as Melas.
As is described on the project site, Melas “is an uncomplicated build and packaging tool”. It is composed of a bunch of tools (mls-build, mls-patch, mls-make-deb, etc.) that can be of help when building software and/or creating installer packages. Being “uncomplicated”, Melas also doesn’t depend on much of anything except bash, tar and gz (Melas itself is written as bash scripts). Demonstrated below a couple of ways to easily produce a deb file with Melas;
1. Using mls-make-deb directly
The “mls-make-deb” tool is what Melas uses to create deb files. mls-make-deb is a “standalone” program in that it does not require the Debian tools to create the package. “tar” and “gz” apps are required to be installed, but this is usually the case with any Linux system anyway.
The syntax of mls-make-deb is as follows:
mls-make-deb [parameters] [filepath] [filepath] …
| Required parameters | |
--package= |
Define the package name |
--version= |
Define the package version |
--arch= |
Define the package architecture |
--files= |
Directory that holds the files for the package |
| Optional parameters | |
--mls |
Use standard melas build variables to fill the required parameters |
--priority= |
Priority -field in control file |
--section= |
Section -field in control file |
--maintainer= |
Maintainer -field in control file |
--depends= |
Depends -field in control file |
--desc= |
Description -field in control file |
--ext= |
Filename extension (defaults to deb) |
--output= |
Exact filename for the output |
--remove |
If set, all files that are included in the output package are deleted from the files -dir |
--help |
Show help message |
Example:
mls-make-deb --package=example --version=1.0 --arch=all \ --desc='Example application' \ --files=/tmp/example-1.0-staging
And that’s all there’s to it! In the above example, a deb file example_1.0_all.deb will be created from the contents of /tmp/example-1.0-staging.
2. Using mls-build
The “mls-build” utility is a higher level utility that uses mls-make-deb as one part of the build process. “mls-build” is intended to be able to perform the full cycle of compiling a piece of software from source code to an installer.
mls-build works on “definition files” that have the extension “.mls” - these files describe how a particular piece of software is to be compiled. mls files can be very short (two-liners) and range to as long as necessary; convenient defaults are supplied to packages that use the GNU autotools in a standard manner. Consider, for example, the following “make.mls” for building GNU Make 3.81;
version="3.81" url="http://ftp.gnu.org/gnu/make/make-3.81.tar.bz2"
The above is the complete “.mls” definition file to build GNU Make from source. To compile this, use mls-build;
mls-build make.mls --run=rebuild
This will perform the whole “usual” build cycle as follows;
- Download the source code as specified in the mls file
- Extract the source code
- Perform “./configure –prefix=/usr”
- Perform “make”
- Perform “make DESTDIR=… install”
- Perform mls-make-deb –mls
The end-result of this is make_3.81_i386.deb in the current directory. This can then be installed as usual with your favourite package manager.
The above works so simply because GNU Make follows the “usual” autotools build process very closely. If the package at hand is different, and possibly doesn’t use autotools at all (or is maybe written in Java, etc.), all necessary build rules can be written manually in the mls file.
More examples
The Igelle distribution is compiled completely using Melas. Thus, the Igelle source package, as available through the Igelle project site, provides lots of examples on how mls files can be constructed.
How to get Melas
Melas can be downloaded from the Melas project site.

paraphernalia position! fount done!
Hi, cool site, good writing