Skip to content

Commit f6eeea9

Browse files
committed
Add explicit dependency checks in build.sh
1 parent 0f18aa7 commit f6eeea9

1 file changed

Lines changed: 31 additions & 0 deletions

File tree

build.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,37 @@ else
3030
OFF=
3131
fi
3232

33+
check_cmd()
34+
{
35+
if which $1 >/dev/null 2>&1
36+
then
37+
return
38+
fi
39+
echo -e "${RED}error${OFF}: building E9Tool/E9Patch requires \"${YELLOW}$1${OFF}\"" >&2
40+
echo -e " (hint: try installing \"${YELLOW}$1${OFF}\" with \"${YELLOW}sudo apt install $2${OFF}\")" >&2
41+
exit 1
42+
}
43+
44+
check_hdr()
45+
{
46+
if echo "#include <$1>" | gcc -E - >/dev/null 2>&1
47+
then
48+
return
49+
fi
50+
echo -e "${RED}error${OFF}: building E9Tool/E9Patch requires \"${YELLOW}$1${OFF}\"" >&2
51+
echo -e " (hint: try installing \"${YELLOW}$1${OFF}\" with \"${YELLOW}sudo apt install $2${OFF}\"" >&2
52+
exit 1
53+
}
54+
55+
check_cmd gcc build-essential
56+
check_cmd g++ build-essential
57+
check_cmd make build-essential
58+
check_cmd ar build-essential
59+
check_cmd ld build-essential
60+
check_cmd strip build-essential
61+
check_cmd xxd xxd
62+
check_hdr zlib.h zlib1g-dev
63+
3364
echo -e "${GREEN}$0${OFF}: building e9patch and e9tool..."
3465
make clean
3566
make -j$(nproc) release

0 commit comments

Comments
 (0)