--- /dev/null
+#!/usr/bin/perl
+
+use MDK::Common;
+
+system('rm -rf build');
+system('mkdir build');
+
+#- copy stuff and remove unneeded
+system('cp -a ../* build');
+system('mv build/ext/libadds.so build/lib/booh');
+system('rm -rf build/ext build/icons');
+
+#- need a version.rb file
+output('build/lib/booh/version.rb', q{
+module Booh
+ $VERSION = IO.readlines("#{ENV['BOOH_TOPDIR']}/VERSION").join.chomp
+end});
+
+#- need a config.rb file to locate data through FPATH
+output('build/lib/booh/config.rb', q{
+module Booh
+ $FPATH = ENV['BOOH_TOPDIR'] + '/data/booh'
+end});
+
+#- launch all programs with "launch.sh" to properly set the topdir and libdir
+output('build/launch.sh', q{#!/bin/sh
+
+echo '********* WARNING ********
+* To run properly, you first need to install ruby, ruby-gettext (libgettext-ruby),
+* ruby-gtk2 (libgtk2-ruby), exif, libexiv2, convert/identify (ImageMagick),
+* mplayer, and gimp.
+*
+* You will see some failure now (or during startup check) if some are missing.
+**************************
+'
+
+bin=`echo $0 | sed -e 's|.*/||'`
+export BOOH_TOPDIR=`readlink -f "$0" | sed -re 's|/[^/]+$||'`
+
+ruby -I $BOOH_TOPDIR/lib $BOOH_TOPDIR/bin/$bin $*
+});
+chmod 0755, 'build/launch.sh';
+
+foreach my $binary (glob('build/bin/*')) {
+ $binary =~ s|.*/||;
+ system("ln -s launch.sh build/$binary");
+}
+
+#- find other binaries and MO files
+substInFile { s|call_backend\("booh-backend|call_backend(ENV['BOOH_TOPDIR'] + "/booh-backend| } 'build/bin/booh';
+substInFile { s|cmd = "booh-|cmd = ENV['BOOH_TOPDIR'] + "/booh-| } 'build/lib/booh/booh-lib.rb';
+-f 'build/data/locale/fr/LC_MESSAGES/booh.mo' or die "MO files missing";
+substInFile { s|bindtextdomain\("booh"\)|bindtextdomain("booh", { :path => ENV['BOOH_TOPDIR'] + '/data/locale' })| } 'build/lib/booh/booh-lib.rb';