-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconfigure_engines.sh
executable file
·93 lines (74 loc) · 2.82 KB
/
configure_engines.sh
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
#!/bin/bash
# Copyright (C) 2022 Giovanni Cascione <[email protected]>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Externally passed variables shall be:
# $1 [REQ] NO_HIGH_DEF [0,1]
# $2 [REQ] NO_WIP [0,1]
# $3 [REQ] STATIC_LINKING [0,1]
# $4 [OPT] LITE [0,1]
set -e
BUILD_PATH=$(pwd)
SRC_PATH="${BUILD_PATH}/scummvm"
cd "${SRC_PATH}"
# Retrieve all configure functions
sed -i.bak -e "s/exit 0/return 0/g" configure
. configure -h > /dev/null 2>&1
_parent_engines_list=""
# Collect all default engines dependencies and force to yes
tot_deps=""
for a in $_engines ; do
engine_deps_var=_engine_${a}_deps
for dep in ${!engine_deps_var} ; do
found=0
for rec_dep in $tot_deps ; do
[ $dep = $rec_dep ] && found=1
done
[ $found -eq 0 ] && tot_deps+=" $dep"
done
# Static linking support files
not_subengine_var=_engine_${a}_sub
not_wip_engine_var=_engine_${a}_build_default
if [ $3 -eq 1 ] && [ -z ${!not_subengine_var} ] ; then
good_to_go=1
# Test NO_HIGH_DEF
[ $1 -eq 1 ] && [ $((echo ${!engine_deps_var} | grep -q highres); echo $?) -eq 0 ] && good_to_go=0
[ $2 -eq 1 ] && [ $(echo ${!not_wip_engine_var} = no) ] && good_to_go=0
[ $4 -eq 1 ] && [ $((cat ${BUILD_PATH}/lite_engines.list | grep -wq ${a}); echo $?) -eq 1 ] && good_to_go=0
[ $good_to_go -eq 1 ] && _parent_engines_list+="ADDLIB libtemp/lib${a}.a"$'\n'
fi
done
[ $3 -eq 1 ] && printf "$_parent_engines_list" >> "$BUILD_PATH"/script.mri
for dep in $tot_deps ; do
eval _$dep=yes
done
# Test NO_HIGH_DEF
if [ $1 -eq 1 ] ; then
_highres=no
fi
# Test LITE
if [ $4 -eq 1 ] ; then
cp "${BUILD_PATH}"/lite_engines.list "${BUILD_PATH}"/config.mk.engines.lite
sed -i.bak -e "y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/;s/^/ENABLE_/g;s/$/ = STATIC_PLUGIN/g" "${BUILD_PATH}"/config.mk.engines.lite
rm "${BUILD_PATH}"/config.mk.engines.lite.bak
fi
# Create needed engines build files
awk -f "engines.awk" < /dev/null > /dev/null 2>&1
mkdir -p "engines"
copy_if_changed engines/engines.mk.new "engines/engines.mk"
copy_if_changed engines/detection_table.h.new "engines/detection_table.h"
copy_if_changed engines/plugins_table.h.new "engines/plugins_table.h"
# Test NO_WIP
[ $2 -ne 1 ] && sed -i.bak -e "s/# \(.*\)/\1 = STATIC_PLUGIN/g" "config.mk.engines"
echo 0