File: configure_engines.sh

package info (click to toggle)
scummvm 2.9.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 450,580 kB
  • sloc: cpp: 4,299,825; asm: 28,322; python: 12,901; sh: 11,302; java: 9,289; xml: 7,895; perl: 2,639; ansic: 2,465; yacc: 1,670; javascript: 1,020; makefile: 933; lex: 578; awk: 275; objc: 82; sed: 11; php: 1
file content (98 lines) | stat: -rwxr-xr-x 2,377 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

 # Copyright (C) 2022 Giovanni Cascione <ing.cascione@gmail.com>
 #
 # 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] BUILD_PATH
# $2     [REQ] SCUMMVM_PATH
# $3     [REQ] NO_WIP [0,1]
# $4     [REQ] STATIC_LINKING [0,1]
# $5     [REQ] LITE [0,1,2]
# $[...] [OPT] Engines dependencies not available

set -e

# Exit if in parameters are not provided
if [ -z $1 ] || [ -z $2 ] || [ -z $3 ] || [ -z $4 ] || [ -z $5 ] ; then
	exit 1
fi

# Get parameters
BUILD_PATH="$1"
shift
SCUMMVM_PATH="$1"
shift
NO_WIP=$1
shift
STATIC_LINKING=$1
shift
LITE=$1
shift
no_deps=$@

cd "${SCUMMVM_PATH}"

# Retrieve all configure functions
sed -i.bak -e "s/exit 0/return 0/g" configure
. configure -h > /dev/null 2>&1
mv configure.bak configure > /dev/null 2>&1

_parent_engines_list=""
tot_deps=""

# Test NO_WIP
[ $NO_WIP -ne 1 ] && engine_enable_all

# Test LITE
[ $LITE -ne 0 ] && engine_disable_all

if [ $LITE -eq 1 ] ; then
	for eng in $(cat "${BUILD_PATH}"/lite_engines.list) ; do
		engine_enable "$eng"
	done
fi

# Define engines list
for a in $_engines ; do
	# Collect all default engines dependencies and force to yes
	for dep in $(get_var _engine_${a}_deps) ; do
		found=0
		for rec_dep in $tot_deps ; do
			[ $dep = $rec_dep ] && found=1
		done
		[ $found -eq 0 ] && append_var tot_deps "$dep"
	done
done

for dep in $tot_deps ; do
	eval _$dep=yes
done

for dep in $no_deps ; do
	eval _$dep=no
done

# 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"

echo 0