forked from danmons/mame_raspberrypi_cross_compile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build_mame_aarch64.sh
executable file
·143 lines (130 loc) · 3.46 KB
/
build_mame_aarch64.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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
#!/bin/bash
## crosstool-ng doesn't like LD_LIBRARY_PATH set
unset LD_LIBRARY_PATH
# force qt5
export QT_SELECT=5
# set paths
export MDIR="$(pwd)"
export MXTARCH=aarch64-rpi4-linux-gnu
export MXTOOLS="${HOME}/x-tools/${MXTARCH}"
export MARCHDIR="${MDIR}/build/lib/bullseye_arm64"
export RPIARCH=aarch64-linux-gnu
source "${MDIR}/conf/settings.ini"
if [ -d "${MARCHDIR}" ]
then
echo "Found RPiOS64 libraries in ${MARCHDIR}"
else
echo "ERROR"
echo "Cannot find ${MARCHDIR}"
echo "Please run ./download_libs.sh"
exit 1
fi
if [ -d "${MXTOOLS}" ]
then
echo "Found Crosstool-NG in ${MXTOOLS}"
else
echo "ERROR"
echo "Cannot find Crosstool-NG"
echo "Please run ./build_crosstool-ng.sh"
exit 1
fi
echo "Preparing MAME..."
mkdir -p "${MDIR}/build/src"
cd "${MDIR}/build/src"
if [ -d mame ]
then
echo "Found existing MAME src, updating it..."
cd "${MDIR}/build/src/mame"
git clean -df
make clean
git reset --hard HEAD
git checkout master
git reset --hard HEAD
git pull
export MAMEVER=$(git tag | tail -n1)
git checkout "${MAMEVER}"
else
echo "No MAME src found, cloning from GitHub..."
cd "${MDIR}/build/src"
git clone 'https://github.com/mamedev/mame.git'
cd mame
export MAMEVER=$(git tag | tail -n1)
git checkout "${MAMEVER}"
fi
echo "Building MAME"
cd "${MDIR}/build/src/mame"
make \
CROSS_BUILD=1 \
TOOLS=1 \
NOWERROR=1 \
PLATFORM=arm64 \
CFLAGS+="-I ${MARCHDIR}/usr/include" \
CFLAGS+="-I ${MARCHDIR}/usr/include/${RPIARCH}" \
CFLAGS+="-L ${MARCHDIR}/usr/lib" \
CFLAGS+="-L ${MARCHDIR}/usr/lib/${RPIARCH}" \
CFLAGS+="-fsigned-char" \
CFLAGS+="-U_FORTIFY_SOURCE" \
CPPFLAGS+="-I ${MARCHDIR}/usr/include" \
CPPFLAGS+="-I ${MARCHDIR}/usr/include/${RPIARCH}" \
CPPFLAGS+="-L ${MARCHDIR}/usr/lib" \
CPPFLAGS+="-L ${MARCHDIR}/usr/lib/${RPIARCH}" \
CPPFLAGS+="-fsigned-char" \
CPPFLAGS+="-U_FORTIFY_SOURCE" \
LDFLAGS+="-L ${MARCHDIR}/usr/lib" \
LDFLAGS+="-L ${MARCHDIR}/usr/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/usr/lib" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/usr/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/lib" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/usr/lib/${RPIARCH}/pulseaudio" \
ARCHOPTS+="-Wl,-R,${MARCHDIR}/opt/vc/lib" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/usr/lib" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/usr/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/lib" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/usr/lib/${RPIARCH}/pulseaudio" \
ARCHOPTS+="-Wl,-rpath,${MARCHDIR}/opt/vc/lib" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/usr/lib" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/usr/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/lib" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/lib/${RPIARCH}" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/usr/lib/${RPIARCH}/pulseaudio" \
ARCHOPTS+="-Wl,-rpath-link,${MARCHDIR}/opt/vc/lib" \
TARGETOS=linux \
NOASM=1 \
OVERRIDE_CC="${MXTOOLS}/bin/${MXTARCH}-gcc" \
OVERRIDE_LD="${MXTOOLS}/bin/${MXTARCH}-ld" \
OVERRIDE_CXX="${MXTOOLS}/bin/${MXTARCH}-c++" \
-j${MAMECOMPILECORES}
echo "Compressing..."
7za a -t7z -m0=lzma2 -mx=9 -mfb=64 -md=128m -ms=on -mmt=on "${MDIR}/build/mame_rpi_${MAMEVER}_aarch64.7z" \
artwork \
bgfx \
castool \
chdman \
ctrlr \
docs \
floptool \
hash \
hlsl \
imgtool \
ini \
jedutil \
keymaps \
language \
ldresample \
ldverify \
mame \
nltool \
nlwav \
plugins \
pngcmp \
regrep \
romcmp \
roms \
samples \
split \
srcclean \
testkeys \
unidasm \
web \