#!/bin/sh

# This script is called by arox-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/arox/src/configure" ]; then
  (cd "$SRCDIR/arox/src" && autoconf) || exit 1
fi

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

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

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

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

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

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