#!/bin/sh

# This script is called by ROX-Filer-src.xml. It builds the filer
# against the GTK 2.4 headers, using the gtk-2.4 compatibility environment.

# This should already exist for releases, but is needed for Git checkouts
if [ ! -f "$SRCDIR/literocks/src/configure" ]; then
  (cd "$SRCDIR/literocks/src" && autoconf) || exit 1
fi

# This should already exist for releases, but is needed for Git checkouts
if [ ! -f "$SRCDIR/literocks.1" ]; then
  (make -C "$SRCDIR/literocks/src/Docs") || exit 1
fi

if [ ! -f Makefile ]; then
  "$SRCDIR/literocks/src/configure" "$@" || exit 1
fi

[ -d "$DISTDIR/literocks" ] || mkdir "$DISTDIR/literocks" || exit 1

make "PLATFORM_DIR=$DISTDIR/literocks"|| exit 1

(cd "$SRCDIR" && cp -r Choices README README-es literocks.xml literocks.1 "$DISTDIR") || exit 1
(cd "$SRCDIR/literocks" && cp -r Help images Messages AppRun Options.xml style.css Templates.ui "$DISTDIR/literocks") || exit 1
find "$DISTDIR" -name '.svn' -type d |xargs rm -rf

# Remove debugging symbols, if any
rm -f "$DISTDIR/literocks/literocks.dbg"
