[Mono-devel-list] MonoDevelop autopackage example

Mike Hearn m.hearn at signal.QinetiQ.com
Fri Jul 29 05:09:08 EDT 2005


Hi,

Last night I put together a basic autopackage of MonoDevelop. I also wrote a
simple C stub program to replace the startup shell script, so it can be fully
relocatable.

I haven't tested the package extensively, beyond a simple "does it install and
run?" check. A MonoDevelop developer would be the best person to create such a
package, as they understand their own software better than I ever will.

Nonetheless, I wanted to show that it's really not hard at all.
To create the package, you feed the specfile to the "makeinstaller" program,
and out pops a package, same as RPM or NSIS or any similar system.

Please note: I haven't been able to upload the package anywhere, as I only
have web/email access during the week, no ssh or FTP. I'll upload the actual
binary package for people to play with at the weekend.

OK, here is the specfile:

----------------------------------------------------------------------------


# -*-shell-script-*-

[Meta]
RootName: @monodevelop.com/monodevelop:$SOFTWAREVERSION
DisplayName: MonoDevelop Integrated Development Environment
ShortName: monodevelop
Maintainer: Todd Berman <tberman at off.net>
Packager: Mike Hearn <mike at plan99.net>
Summary: MonoDevelop is a development environment for the .NET platform
URL: http://www.monodevelop.com/
License: GNU General Public License, Version 2
SoftwareVersion: 0.7
PackageVersion: 1
AutopackageTarget: 1.0

# Only uncomment InterfaceVersion if your package exposes interfaces
# to other software, for instance if it includes DSOs or python/perl
# modules. See the developer guide for more info, or ask on
# autopackage-dev if you don't understand interface versioning.
#
# FIXME: MonoDevelop has a plugin interface of some kind so we should set this.
#
# InterfaceVersion: 0.0

[BuildPrepare]
prepareBuild

# this stub program should really come with autopackage, and be easier
# to integrate. for for a proof of concept we will compile it
# ourselves. the stub takes care of making us binary relocatable.

cd $source_dir/autopackage
gcc -Os -o monodevelop -DPREFIXPATH=\"lib/monodevelop/bin/MonoDevelop.exe\" monostub.c binreloc.c
cd -

[BuildUnprepare]
unprepareBuild

[Imports]
# replace the shell script with a nice C wrapper
rm bin/monodevelop
cp $source_dir/autopackage/monodevelop bin/monodevelop

# we want to ship everything
echo '*' | import

[Prepare]
#
# Dependency handling here is interesting. Technically I guess
# we should check for GTK#, GNOME#, Gecko# blah blah blah.
#
# What'd be much better is if the Mono team defined the "Mono
# Desktop Platform" to include all of these things, so we can
# depend on everything M-D needs with a single dependency.
#
# That saves us work, because we don't need to specify everything.
#
# It saves the user work because they can download the MDP in
# one go and not have to wait while extra stuff is installed
# later.
#
# And it saves the developer work: on the website it can just
# have a little "MDP 1.1" button or badge, instead of a huge list
# of separately enumerated dependencies.
#
#
#
# For now let's cheat, and only check that Mono itself is available.

require @mono-project.org/runtime 1.0

[Install]
installExe bin/monodevelop
copyFiles lib/monodevelop "$PREFIX/lib"

installPkgconfig lib/pkgconfig/*
installDesktop "Programming" share/applications/*.desktop
installLocale share/locale
installMime share/mime/packages/*.xml

# MD should use the icon theme spec really (and have an SVG icon!)
copyFile share/pixmaps/monodevelop.png "$PREFIX/share/pixmaps/monodevelop.png"

[Uninstall]
# Usually just the following line is enough to uninstall everything
uninstallFromLog

----------------------------------------------------------------------------


A few notes:

* It may look quite long, but most of it is metadata and comments to
   show you what each bit does. A real specfile could be much shorter.
   I think 95% of it is also very obvious.

* You don't have to write all that. The bulk of it is automatically
   generated by the following command:

   "makeinstaller --mkspec >default.apspec"

   Then you just customize it to fit your project.

* As you can see, it only does one dependency check, on the Mono runtime
   itself. Really it should check for all the dependencies, but that
   would have taken longer to do and as it says in the comments, what we
   really need is for you guys to define a Mono Desktop Platform. I'm keen on
   desktop platforms. We need more of them.

* A lot of the specfile could be trivially auto-generated on the fly,
   as it can be written mechanically. But nobody wrote the patches to
   do that yet. Certainly it'd be easier to simplify writing autopackage
   specfiles than to create a dedicated Mono installer!

This file is normally put in a dedicated "autopackage" directory in your
source tree, but it doesn't have to be. In this case, you need to put the
attached files in that directory too so the C stub program can be compiled
and shipped.

OK, so what do you guys think? Application developers - can you see yourselves
building such packages? If not, what can we do to convince you?

thanks -mike
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: monostub.c
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050729/149013da/attachment.c 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binreloc.c
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050729/149013da/attachment-0001.c 
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: binreloc.h
Url: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20050729/149013da/attachment.h 


More information about the Mono-devel-list mailing list