#!/bin/sh
#

EXT=tcludp
TCZ=/tmp/$EXT/TCZ

sudo rm -rf /tmp/$EXT

DEPS="tcl8.6 tcl8.6-dev"

NOTFOUND=""
for a in compiletc bash file squashfs-tools $DEPS
         do tce-load -i $a || tce-load -iwl $a || NOTFOUND=x
done
test -z "$NOTFOUND" || exit

#make clean
./configure \
	|| exit

make install DESTDIR=$TCZ
chmod -R ug+w $TCZ
for a in $(find $TCZ -type f); do file -b $a | grep -q '^ELF .*not stripped$' && strip --strip-unneeded $a; done

sudo chown -R root.root $TCZ*

mksquashfs $TCZ /tmp/$EXT/$EXT.tcz -noappend

