forked from bookshelfdave/wings
-
Notifications
You must be signed in to change notification settings - Fork 2
/
make_installer
executable file
·124 lines (102 loc) · 4.03 KB
/
make_installer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#!/bin/sh
#
# Script for creating a self-contained Wings package for Unix systems.
#
# $Id: make_installer,v 1.9 2005/09/10 08:02:02 bjorng Exp $
#
# Configurable stuff.
INSTALL=/usr/bin/install
if [ -z "$ESDL_PATH" ]; then
echo "The environment variable ESDL_PATH must be set to " \
"the top of the ESDL installation." >&2
exit 1
fi
ESDL_NAME=`basename $ESDL_PATH`
ERLANG_PATH=`echo 'io:format("~s~n",[code:root_dir()]),halt().' | erl | awk 'NR==2 {print $2}'`
# End of configurable stuff.
# Copy the Wings application.
WINGS_DIR="`pwd`"
WINGS_APP=`basename "$WINGS_DIR"`
WINGS_VSN=`echo "$WINGS_APP" | sed -e 's/.*wings-//'`
OS_NAME=`uname -s | perl -pe 'tr/[A-Z]/[a-z]/'`
DEST_ROOT="wings-$WINGS_VSN-$OS_NAME"
dest="$DEST_ROOT"
$INSTALL -d "$dest"
$INSTALL -c -m 644 README AUTHORS license.terms vsn.mk "$dest"
dest="$DEST_ROOT/lib/$WINGS_APP"
$INSTALL -d "$dest" "$dest/ebin" "$dest/patches"
$INSTALL -c -m 644 ebin/* "$dest/ebin"
$INSTALL -d "$dest/fonts"
$INSTALL -d "$dest/textures"
$INSTALL -d "$dest/shaders"
$INSTALL -c -m 644 textures/* "$dest/textures"
$INSTALL -c -m 644 shaders/* "$dest/shaders"
$INSTALL -d "$dest/plugins/default" \
"$dest/plugins/accel" \
"$dest/plugins/import_export" "$dest/plugins/commands" \
"$dest/plugins/primitives" "$dest/plugins/autouv" "$dest/plugins/jpeg"
$INSTALL -c -m 644 fonts/* "$dest/fonts"
$INSTALL -c -m 644 plugins/default/wp9_dialogs* "$dest/plugins/default"
$INSTALL -c -m 644 plugins/accel/* "$dest/plugins/accel"
$INSTALL -c -m 644 plugins/fonts/* "$dest/plugins/fonts"
$INSTALL -c -m 644 plugins/import_export/* "$dest/plugins/import_export"
$INSTALL -c -m 644 plugins/commands/* "$dest/plugins/commands"
$INSTALL -c -m 644 plugins/primitives/* "$dest/plugins/primitives"
$INSTALL -c -m 644 plugins/autouv/* "$dest/plugins/autouv"
$INSTALL -c -m 644 plugins/jpeg/* "$dest/plugins/jpeg"
# Copy the relevant parts of Erlang/OTP.
src="$ERLANG_PATH"
dest="$DEST_ROOT"
erts_src=`echo "$src"/erts-*`
stdlib=`basename "$src"/lib/stdlib-*`
kernel=`basename "$src"/lib/kernel-*`
$INSTALL -d "$dest/bin" "$dest/lib/$stdlib/ebin" "$dest/lib/$kernel/ebin"
$INSTALL -c -m 644 "$src"/lib/kernel-*/ebin/* "$dest/lib/$kernel/ebin"
$INSTALL -c -m 644 "$src"/lib/stdlib-*/ebin/* "$dest/lib/$stdlib/ebin"
$INSTALL -c "$erts_src/bin/erlexec" "$dest/bin/erlexec"
$INSTALL -c "$erts_src/bin/beam" "$dest/bin/beam"
$INSTALL -c "$erts_src/bin/child_setup" "$dest/bin/child_setup"
$INSTALL -c "$erts_src/bin/inet_gethost" "$dest/bin/inet_gethost"
strip --strip-debug "$dest/bin/erlexec"
strip --strip-debug "$dest/bin/beam"
strip --strip-debug "$dest/bin/child_setup"
strip --strip-debug "$dest/bin/inet_gethost"
$INSTALL -c -m 644 "$src/bin/start.boot" "$dest/bin"
# Copy the relevant parts of ESDL.
dest="$DEST_ROOT/lib/$ESDL_NAME"
$INSTALL -d "$dest/ebin" "$dest/priv"
$INSTALL -c -m 644 "$ESDL_PATH"/ebin/* "$dest/ebin"
$INSTALL -c "$ESDL_PATH"/priv/sdl_driver.so "$dest/priv"
rm -rf "$dest/ebin/sdl_audio.beam" "$dest/ebin/sdl_joystick.beam"
strip --strip-debug --strip-unneeded "$dest/priv/sdl_driver.so"
# Copy the SDL so.
sdl_lib=`ldd "$dest/priv/sdl_driver.so" | awk '$1 ~ /^libSDL/ { print $3}'`
sdl_lib_name=`basename $sdl_lib`
if [ ! -L $sdl_lib ]; then
echo `basename $0`: "$sdl_lib expected to be a symlink"
else
lib_dir=`dirname $sdl_lib`
linkname=`readlink $sdl_lib`
$INSTALL -c $lib_dir/$linkname "$dest/priv"
rm -f $dest/priv/$sdl_lib_name
(cd $dest/priv; ln -s $linkname $sdl_lib_name)
fi
#
# Remove files from OTP not needed.
#
$WINGS_DIR/tools/wings_reduce_otp "$DEST_ROOT"
# Strip debug information from all beam files.
cd "$latest_wings"
erlc -o/tmp tools/strip.erl
cd "$DEST_ROOT"
erl -noshell -pa /tmp -run strip strip
# Package the installer.
cd $WINGS_DIR
INSTALLER="$DEST_ROOT/install_wings"
sed -e "s;%WINGS_VSN%;$WINGS_VSN;" -e "s;%ESDL_NAME%;$ESDL_NAME;" -e "s;%LIB_SDL_NAME%;$sdl_lib_name;" $WINGS_DIR/unix/install_wings.src > $INSTALLER
chmod +x $INSTALLER
dest=$DEST_ROOT
makeself.sh --bzip2 $dest $dest.bzip2.run Wings3D ./install_wings "$WINGS_VSN"
if [ -f $dest.run ]; then
cp $dest.run ..
fi