1#!/bin/sh
2
3#
4# make-bindist.sh - make binary distribution for the BeOS SDL port
5#
6# Written by
7#  Marco van den Heuvel <blackystardust68@yahoo.com>
8#
9# This file is part of VICE, the Versatile Commodore Emulator.
10# See README for copyright notice.
11#
12#  This program is free software; you can redistribute it and/or modify
13#  it under the terms of the GNU General Public License as published by
14#  the Free Software Foundation; either version 2 of the License, or
15#  (at your option) any later version.
16#
17#  This program is distributed in the hope that it will be useful,
18#  but WITHOUT ANY WARRANTY; without even the implied warranty of
19#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
20#  GNU General Public License for more details.
21#
22#  You should have received a copy of the GNU General Public License
23#  along with this program; if not, write to the Free Software
24#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
25#  02111-1307  USA.
26#
27# Usage: make-bindist.sh <strip> <vice-version> <cpu> <system> <--enable-arch> <zip|nozip> <xscpu64-included> <top-srcdir> <SDL-version>
28#                         $1      $2             $3    $4       $5              $6          $7                 $8           $9
29#
30
31STRIP=$1
32VICEVERSION=$2
33CPU=$3
34SYSTEM=$4
35ENABLEARCH=$5
36ZIPKIND=$6
37XSCPU64INCLUDED=$7
38TOPSRCDIR=$8
39SDLVERSION=$9
40
41EXTRAFILES="x64sc"
42
43if test x"$XSCPU64INCLUDED" = "xyes"; then
44  EXTRAFILES="$EXTRAFILES xscpu64"
45fi
46
47EMULATORS="x64 x64dtv $EXTRAFILES x128 xcbm2 xcbm5x0 xpet xplus4 xvic vsid"
48CONSOLE_TOOLS="c1541 cartconv petcat"
49EXECUTABLES="$EMULATORS $CONSOLE_TOOLS"
50
51for i in $EXECUTABLES
52do
53  if [ ! -e src/$i ]
54  then
55    echo Error: executable file\(s\) not found, do a \"make\" first
56    exit 1
57  fi
58done
59
60if test x"$CPU" = "xpowerpc" -o x"$CPU" = "xppc"; then
61  BEOSCPU=powerpc
62else
63  if test x"$CPU" = "xx86_64" -o x"$CPU" = "xamd64"; then
64    BEOSCPU=x86_64
65  else
66    BEOSCPU=x86
67  fi
68fi
69
70if test x"$SYSTEM" = "xhaiku"; then
71  if test x"$SDLVERSION" = "x2"; then
72    echo Generating Haiku SDL2 port binary distribution.
73    SDLNAME="SDL2VICE-$BEOSCPU-haiku-$VICEVERSION"
74  else
75    echo Generating Haiku SDL port binary distribution.
76    SDLNAME="SDLVICE-$BEOSCPU-haiku-$VICEVERSION"
77  fi
78else
79  if test x"$SDLVERSION" = "x2"; then
80    echo Generating BEOS SDL2 port binary distribution.
81    SDLNAME="SDL2VICE-$BEOSCPU-beos-$VICEVERSION"
82  else
83    echo Generating BEOS SDL port binary distribution.
84    SDLNAME="SDLVICE-$BEOSCPU-beos-$VICEVERSION"
85  fi
86fi
87
88rm -f -r $SDLNAME
89mkdir $SDLNAME
90for i in $EXECUTABLES
91do
92  $STRIP src/$i
93  cp src/$i $SDLNAME
94done
95cp -a $TOPSRCDIR/data/C128 $SDLNAME
96cp -a $TOPSRCDIR/data/C64 $SDLNAME
97if test x"$SCPU64INCLUDED" = "xyes"; then
98  cp -a $TOPSRCDIR/data/SCPU64 $SDLNAME
99fi
100cp -a $TOPSRCDIR/data/C64DTV $SDLNAME
101cp -a $TOPSRCDIR/data/CBM-II $SDLNAME
102cp -a $TOPSRCDIR/data/DRIVES $SDLNAME
103cp -a $TOPSRCDIR/data/PET $SDLNAME
104cp -a $TOPSRCDIR/data/PLUS4 $SDLNAME
105cp -a $TOPSRCDIR/data/PRINTER $SDLNAME
106cp -a $TOPSRCDIR/data/VIC20 $SDLNAME
107
108cp -a $TOPSRCDIR/doc/html $SDLNAME
109cp doc/html/*.html $SDLNAME/html
110rm $SDLNAME/html/checklinks.sh
111rm $SDLNAME/html/texi2html
112rm $SDLNAME/html/COPYING
113rm $SDLNAME/html/NEWS
114if test x"$SDLVERSION" = "x2"; then
115  cp $TOPSRCDIR/doc/readmes/Readme-SDL2.txt $SDLNAME
116else
117  cp $TOPSRCDIR/doc/readmes/Readme-SDL.txt $SDLNAME
118fi
119cp $TOPSRCDIR/FEEDBACK $TOPSRCDIR/README $SDLNAME
120cp $TOPSRCDIR/COPYING $TOPSRCDIR/NEWS $SDLNAME
121rm `find $SDLNAME -name "Makefile*"`
122rm `find $SDLNAME -name "*.vkm" -and ! -name "sdl*.vkm"`
123
124# just in case ...
125rm -f -r `find $SDLNAME -name ".svn"`
126
127mkdir $SDLNAME/doc
128cp $TOPSRCDIR/doc/vice.pdf $SDLNAME/doc
129
130if test x"$ZIPKIND" = "xzip"; then
131  if test x"$ZIP" = "x"; then
132    zip -r -9 -q $SDLNAME.zip $SDLNAME
133  else
134    $ZIP $SDLNAME.zip $SDLNAME
135  fi
136  rm -f -r $SDLNAME
137  if test x"$SDLVERSION" = "x2"; then
138    echo BEOS SDL2 port binary distribution archive generated as $SDLNAME.zip
139  else
140    echo BEOS SDL port binary distribution archive generated as $SDLNAME.zip
141  fi
142else
143  if test x"$SDLVERSION" = "x2"; then
144    echo BEOS SDL2 port binary distribution directory generated as $SDLNAME
145  else
146    echo BEOS SDL port binary distribution directory generated as $SDLNAME
147  fi
148fi
149if test x"$ENABLEARCH" = "xyes"; then
150  echo Warning: binaries are optimized for your system and might not run on a different system, use --enable-arch=no to avoid this
151fi
152