#!/bin/sh

PKG_NAME=sin_msdos_`date -u +%Y%m%d`.7z
rm -f $PKG_NAME

./cleanall.sh
./makeall.sh $*

. ./cross_defs.dj

echo $TARGET-strip sin.exe
$TARGET-strip sin.exe || exit 1

mkdir -p _build || exit 1

cp -p sin.exe _build
cp -p ref_soft/ref_soft.dxe _build
cp -p ref_gl/ref_gl.dxe _build
cp -pr dos/3rdparty/lib_dxe/* _build
cp -p dos/CWSDPMI.EXE _build
cp -p readme.txt _build
cp -p readme.fx _build
cp -p status-djgpp.txt _build

mkdir -p _build/base
cp -p game/gamex86.dxe _build/base
mkdir -p _build/ctf
cp -p game/gamex86.dxe _build/ctf
mkdir -p _build/2015
cp -p 2015/gamex86.dxe _build/2015

# copy a default gl.dxe
cp -p dos/3rdparty/lib_dxe/opengl/fxmesa/gl.dxe _build

cd _build || exit 1
unix2dos -k readme.txt
unix2dos -k readme.fx
unix2dos -k status-djgpp.txt
find * -type d|xargs chmod 755
find * -type f|xargs chmod 644
7z a ../$PKG_NAME *

