# --- T2-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
# 
# T2 SDE: package/.../wings3d/wings3d.conf
# Copyright (C) 2004 - 2006 The T2 SDE Project
# 
# More information can be found in the files COPYING and README.
# 
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- T2-COPYRIGHT-NOTE-END ---

OTPDIR=`pkgprefix libdir erlang-otp`/erlang/lib/wings-$ver
ESDLDIR=`pkgprefix libdir esdl`/erlang/lib/esdl-`pkgprefix ver esdl`/ebin

build () {
    make $makeopt
    erlc -o/tmp tools/strip.erl
    erl -noshell -pa /tmp -run strip strip
    mkdir -p $OTPDIR
    find -name 'Makefile*' -exec rm -f '{}' \;
    for dir in ebin fonts plugins ; do
	cp -r $dir $OTPDIR
    done
}

startscript () {
    echo "erl -pa $ESDLDIR -pa $OTPDIR/bin -run wings_start start_halt \${1+\"\$@\"}" > $root/usr/bin/wings3d
    chmod 755 $root/usr/bin/wings3d
}

custmain="build"
hook_add postinstall 5 startscript