-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·73 lines (58 loc) · 2.05 KB
/
install.sh
File metadata and controls
executable file
·73 lines (58 loc) · 2.05 KB
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
#!/usr/bin/env bash
# Install script for xecorelib
#
# Aiden Isik, 2025
#
# To the extent possible under law, the author(s) have dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
# See <https://creativecommons.org/publicdomain/zero/1.0/> for a copy of the
# CC0 Public Domain Dedication, which applies to this software.
# Canonicalised prefix & binary directory
PREFIX="$(realpath ${PREFIX:-sysroot})"
BINDIR="$(realpath ${BINDIR:-${PREFIX}/bin})"
fail_build()
{
echo -e "Failed to build!"
exit 1
}
echo -e "Building xecorelib."
# Make sure arg 0 is the path to this script
if [[ ! -d "$(dirname $0)" ]]; then
echo -e "Error: Invalid value for arg 0 \"$0\"."
fail_build
fi
PROJROOTDIR="$(dirname $0)"
# Make sure we have the xam and xboxkrnl subdirs
if [[ ! -d "${PROJROOTDIR}/xboxkrnl" || ! -d "${PROJROOTDIR}/xam" ]]; then
echo -e "Error: Missing xam/xboxkrnl subdirectories. Please try cloning this repository again."
fail_build
fi
# Build the stubs
echo -e "Building the xboxkrnl stub library."
${BINDIR}/llvm-dlltool -m xbox360 -d ${PROJROOTDIR}/xboxkrnl/xboxkrnl.def -l xboxkrnl.a || fail_build
echo -e "Building the xam stub library."
${BINDIR}/llvm-dlltool -m xbox360 -d ${PROJROOTDIR}/xam/xam.def -l xam.a || fail_build
echo -e "Building the hv stub library."
${BINDIR}/clang -c ${PROJROOTDIR}/hv/hv.s -o hv.o
${BINDIR}/llvm-ar rc hv.a hv.o
# Combine the stubs into a single library (xecore.lib)
echo -e "Creating the final library (xecorelib.a)."
cat > xecorelib.mri << "EOF"
create xecorelib.a
addlib xboxkrnl.a
addlib xam.a
addlib hv.a
save
end
EOF
${BINDIR}/llvm-ar -M <xecorelib.mri || fail_build
# Install everything
echo -e "Installing headers and library to ${PREFIX}."
mkdir -p ${PREFIX}/include/xecore ${PREFIX}/lib
cp -r ${PROJROOTDIR}/xboxkrnl/*.h ${PREFIX}/include/xecore
cp -r ${PROJROOTDIR}/xam/*.h ${PREFIX}/include/xecore
cp -r ${PROJROOTDIR}/hv/*.h ${PREFIX}/include/xecore
cp -r xecorelib.a ${PREFIX}/lib
echo -e "Done!"