1#!/bin/sh
2#
3# This script has been (or is hereby) released into the public domain by
4# its author, Karl J. Runge <runge@karlrunge.com>. This applies worldwide.
5#
6# In case this is not legally possible: Karl J. Runge grants anyone the
7# right to use this work for any purpose, without any conditions, unless
8# such conditions are required by law.
9
10ldir="../../../libvncserver"
11
12fail=""
13if [ ! -f "./tight.c" ]; then
14	fail=1
15fi
16if [ ! -f "./turbojpeg.h" ]; then
17	fail=1
18fi
19if [ ! -f "./convert" ]; then
20	fail=1
21fi
22if [ ! -f "$ldir/tight.c" ]; then
23	ls -l "$ldir/tight.c"
24	fail=1
25fi
26if [ ! -f "$ldir/rfbserver.c" ]; then
27	ls -l "$ldir/rfbserver.c"
28	fail=1
29fi
30if [ "X$fail" = "X1" ]; then
31	echo "Must be run from inside the directory containing 'apply_turbovnc'"
32	exit 1
33fi
34
35set -x
36if [ ! -f "$ldir/tight.c.ORIG" ]; then
37	cp -p "$ldir/tight.c" "$ldir/tight.c.ORIG"
38fi
39if [ ! -f "$ldir/rfbserver.c.ORIG" ]; then
40	cp -p "$ldir/rfbserver.c" "$ldir/rfbserver.c.ORIG"
41fi
42
43perl ./convert ./tight.c > "$ldir/tight.c"
44perl ./convert_rfbserver $ldir/rfbserver.c.ORIG > "$ldir/rfbserver.c"
45cp -p ./turbojpeg.h "$ldir"
46ls -l $ldir/tight.c* $ldir/rfbserver.c* $ldir/turbojpeg.h
47