-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathbuild.sh
executable file
·104 lines (90 loc) · 2.87 KB
/
build.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
94
95
96
97
98
99
100
101
102
103
#!/bin/bash
#
# Copyright (C) 2023 National University of Singapore
#
# 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/>.
if [ -t 1 ]
then
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
BOLD="\033[1m"
OFF="\033[0m"
else
RED=
GREEN=
YELLOW=
BOLD=
OFF=
fi
set -e
E9_VERSION=e0f0d3ca39bda13097421d831e4e62527de3a54c
LIB_VERSION=31b2917ea5665e3d4b614ddca1198413f5c9da5e
# STEP (1): install dependencies if necessary:
if [ ! -x e9patch-$E9_VERSION/e9patch ]
then
if [ ! -f e9patch-$E9_VERSION.zip ]
then
echo -e "${GREEN}$0${OFF}: downloading e9patch-$E9_VERSION.zip..."
wget -O e9patch-$E9_VERSION.zip https://github.com/GJDuck/e9patch/archive/$E9_VERSION.zip
fi
echo -e "${GREEN}$0${OFF}: extracting e9patch-$E9_VERSION.zip..."
unzip e9patch-$E9_VERSION.zip
echo -e "${GREEN}$0${OFF}: building e9patch..."
cd e9patch-$E9_VERSION
./build.sh
cd ..
rm -f E9PATCH
ln -f -s e9patch-$E9_VERSION E9PATCH
echo -e "${GREEN}$0${OFF}: e9patch has been built..."
else
echo -e "${GREEN}$0${OFF}: using existing e9patch..."
fi
if [ ! -x libredfat-$LIB_VERSION/libredfat.so ]
then
if [ ! -f libredfat-$LIB_VERSION.zip ]
then
echo -e "${GREEN}$0${OFF}: downloading libredfat-$LIB_VERSION.zip..."
wget -O libredfat-$LIB_VERSION.zip https://github.com/GJDuck/libredfat/archive/$LIB_VERSION.zip
fi
echo -e "${GREEN}$0${OFF}: extracting libredfat-$LIB_VERSION.zip..."
unzip libredfat-$LIB_VERSION.zip
echo -e "${GREEN}$0${OFF}: building libredfat..."
(cd libredfat-$LIB_VERSION/; ./build.sh)
rm -f runtime
ln -f -s libredfat-$LIB_VERSION runtime
echo -e "${GREEN}$0${OFF}: libredfat has been built..."
else
echo -e "${GREEN}$0${OFF}: using existing libredfat..."
fi
# STEP (2): build the binaries
echo -e "${GREEN}$0${OFF}: building the redfat.bin binaries..."
make clean
make redfat.bin
make RedFatPlugin.so
make redfat-rt
rm -rf install
mkdir -p install
mv redfat.bin install
ln -f -s install/redfat.bin
ln -f -s install/redfat.bin redfat
cd install/
ln -f -s ../e9patch-$E9_VERSION/e9patch
ln -f -s ../e9patch-$E9_VERSION/e9tool
ln -f -s ../libredfat-$LIB_VERSION/libredfat.so
ln -f -s ../RedFatPlugin.so
ln -f -s ../redfat-rt
cd ..
ln -f -s install/libredfat.so
echo -e "${GREEN}$0${OFF}: done!"