mirror of
https://github.com/RetroPie/RetroPie-Setup.git
synced 2025-04-02 10:51:41 -04:00
With gcc10 and newer, the `-fno-common` option is the default, causing issues for global variables with multiple declarations that are missing the `external` initializer. See https://wiki.gentoo.org/wiki/Project:Toolchain/Gcc_10_porting_notes/fno_common for a summary. Added a couple of patches to fix building for older `advmame` versions: * for `advmame-1.4`, pick https://github.com/amadvance/advancemame/commit/f8688cae05 * for `advmame-0.94`, created a separate patch As a minor modification, used the scriptmodule `md_path` variable to calculate the patch folder location.
65 lines
2.4 KiB
Bash
65 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# This file is part of The RetroPie Project
|
|
#
|
|
# The RetroPie Project is the legal property of its developers, whose names are
|
|
# too numerous to list here. Please refer to the COPYRIGHT.md file distributed with this source.
|
|
#
|
|
# See the LICENSE.md file at the top-level directory of this distribution and
|
|
# at https://raw.githubusercontent.com/RetroPie/RetroPie-Setup/master/LICENSE.md
|
|
#
|
|
|
|
rp_module_id="advmame-1.4"
|
|
rp_module_desc="AdvanceMAME v1.4"
|
|
rp_module_help="ROM Extension: .zip\n\nCopy your AdvanceMAME roms to either $romdir/mame-advmame or\n$romdir/arcade"
|
|
rp_module_licence="GPL2 https://raw.githubusercontent.com/amadvance/advancemame/master/COPYING"
|
|
rp_module_repo="file $__archive_url/advancemame-1.4.tar.gz"
|
|
rp_module_section="opt"
|
|
rp_module_flags="!mali !kms"
|
|
|
|
function depends_advmame-1.4() {
|
|
local depends=(libsdl1.2-dev)
|
|
getDepends "${depends[@]}"
|
|
}
|
|
|
|
function _sources_patch_advmame-1.4() {
|
|
# update internal names to separate out config files (due to incompatible options)
|
|
sed -i "s/advmame\.rc/$md_id.rc/" advance/v/v.c advance/cfg/cfg.c
|
|
|
|
if grep -q "ADVANCE_NAME" advance/osd/emu.h; then
|
|
sed -i "s/ADVANCE_NAME \"advmame\"/ADVANCE_NAME \"$md_id\"/" advance/osd/emu.h
|
|
else
|
|
sed -i "s/ADV_NAME \"advmame\"/ADV_NAME \"$md_id\"/" advance/osd/emu.h
|
|
fi
|
|
|
|
if isPlatform "rpi"; then
|
|
if grep -q "MAP_FIXED" advance/linux/vfb.c; then
|
|
sed -i 's/MAP_SHARED | MAP_FIXED,/MAP_SHARED,/' advance/linux/vfb.c
|
|
fi
|
|
|
|
# patch advmame to use a fake generated mode with the exact dimensions for fb - avoids need for configuring monitor / clocks.
|
|
# the pi framebuffer doesn't use any of the framebuffer timing configs - it hardware scales from chosen dimensions to actual size
|
|
applyPatch "${md_path%/*}/advmame/01_rpi_framebuffer.diff"
|
|
fi
|
|
}
|
|
|
|
function sources_advmame-1.4() {
|
|
downloadAndExtract "$md_repo_url" "$md_build" --strip-components 1
|
|
_sources_patch_advmame-1.4 1.4
|
|
# Fix the global vars missing the 'external' qualifier, needed for gcc > 10
|
|
applyPatch "${md_path%/*}/advmame/02_fix_extern_globals_1_4.diff"
|
|
}
|
|
|
|
function build_advmame-1.4() {
|
|
./configure CFLAGS="$CFLAGS -fsigned-char -fno-stack-protector" LDFLAGS="-s -lm -Wl,--no-as-needed" --prefix="$md_inst"
|
|
make clean
|
|
make
|
|
}
|
|
|
|
function install_advmame-1.4() {
|
|
make install
|
|
}
|
|
|
|
function configure_advmame-1.4() {
|
|
configure_advmame
|
|
}
|