From be7199889a1aad973abedf7a4ba5dd7fd8013cfb Mon Sep 17 00:00:00 2001 From: G Derber Date: Wed, 11 Sep 2024 10:15:31 -0400 Subject: [PATCH] Create ET:Legacy Installation script --- scriptmodules/ports/etlegacy.sh | 102 +++++++++++++++++++++++++++++ scriptmodules/ports/etlegacy_64.sh | 61 +++++++++++++++++ 2 files changed, 163 insertions(+) create mode 100644 scriptmodules/ports/etlegacy.sh create mode 100644 scriptmodules/ports/etlegacy_64.sh diff --git a/scriptmodules/ports/etlegacy.sh b/scriptmodules/ports/etlegacy.sh new file mode 100644 index 00000000..6d826827 --- /dev/null +++ b/scriptmodules/ports/etlegacy.sh @@ -0,0 +1,102 @@ +#!/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="etlegacy" +rp_module_desc="etlegacy - ET: Legacy - A Fully compatable Wolfenstein: Enemy Territory Client and Server" +rp_module_licence="GPL3 https://raw.githubusercontent.com/etlegacy/etlegacy/master/COPYING.txt" +rp_module_help="Fix Me!" +rp_module_section="exp" +rp_module_repo="git https://github.com/etlegacy/etlegacy.git master :_get_branch_etlegacy" +rp_module_flags="!64bit" + +function _get_branch_etlegacy() { + # Tested tag was 2.82.1 commit 0a24c70 + # manual: + # 'curl https://api.github.com/repos/etlegacy/etlegacy/tags | grep -m 1 sha | cut -d\" -f4 | cut -dv -f2' + + download https://api.github.com/repos/etlegacy/etlegacy/tags - | grep -m 1 sha | cut -d\" -f4 | cut -dv -f2 +} + +function _arch_etlegacy() { + # exact parsing from Makefile + echo "$(uname -m | sed -e 's/i.86/x86/' | sed -e 's/^arm.*/arm/')" +} + +function depends_etlegacy() { + getDepends cmake #libsdl1-dev libopenal-dev libc6-dev-i386 libx11-dev:i386 libgl1-mesa-dev:i386 +} + +function sources_etlegacy() { + gitPullOrClone +} + +function build_etlegacy() { + local params=(-DCMAKE_BUILD_TYPE=Release) + + if isPlatform "64bit"; then + params+=(-DCROSS_COMPILE32=1) + git submodule init + git submodule update + fi + + if isPlatform "rpi"; then + params+=(-DARM=1) + fi + + mkdir "$md_build/build" + cd "$md_build/build" + + if isPlatform "64bit"; then + # The added CC= and CXX= is to ensure that 64 bit libraries are not used during + # compilation of the 32 bit version + CC="gcc -m32" CXX="g++ -m32" cmake "${params[@]}" .. + else + cmake "${params[@]}" .. + fi + make clean + make + + md_ret_require="$md_build/build/etl.$(_arch_etlegacy)" +} + +function install_etlegacy() { + md_ret_files=( + "build/etl.$(_arch_etlegacy)" + "build/etlded.$(_arch_etlegacy)" + "build/librenderer_opengl1_$(_arch_etlegacy).so" + "build/legacy/cgame.mp.$(_arch_etlegacy).so" + "build/legacy/ui.mp.$(_arch_etlegacy).so" + "build/legacy/qagame.mp.$(_arch_etlegacy).so" + ) +} + +function game_data_etlegacy() { + downloadAndExtract "https://cdn.splashdamage.com/downloads/games/wet/et260b.x86_full.zip" "$md_build" + cd $md_build + ./et260b.x86_keygen_V03.run --noexec --target tmp + cd $md_build/tmp/etmain + + cp *.pk3 $romdir/ports/etlegacy +} + +function configure_etlegacy() { + addPort "$md_id" "etlegacy" "Wolfenstein - Enemy Territory" "$md_inst/etl.$(_arch_etlegacy)" + + mkRomDir "ports/etlegacy" + + moveConfigDir "$md_inst/etmain" "$romdir/ports/etlegacy" + [[ "$md_mode" == "install" ]] && game_data_etlegacy + + mkdir $md_inst/legacy + mv $md_inst/cgame.mp.$(_arch_etlegacy).so $md_inst/legacy/ + mv $md_inst/ui.mp.$(_arch_etlegacy).so $md_inst/legacy/ + mv $md_inst/qagame.mp.$(_arch_etlegacy).so $md_inst/legacy/ +} diff --git a/scriptmodules/ports/etlegacy_64.sh b/scriptmodules/ports/etlegacy_64.sh new file mode 100644 index 00000000..209dcca8 --- /dev/null +++ b/scriptmodules/ports/etlegacy_64.sh @@ -0,0 +1,61 @@ +#!/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="etlegacy_64" +rp_module_desc="etlegacy_64 - ET: Legacy - A Fully compatable Wolfenstein: Enemy Territory Client and Server" +rp_module_licence="https://raw.githubusercontent.com/etlegacy/etlegacy/master/COPYING.txt" +rp_module_help="" +rp_module_section="exp" +rp_module_repo="git https://github.com/etlegacy/etlegacy.git master :_get_branch_etlegacy" +rp_module_flags="!all 64bit" + +function _get_branch_etlegacy_64() { + download https://api.github.com/repos/etlegacy/etlegacy/tags - | grep -m 1 sha | cut -d\" -f4 | cut -dv -f2 +} + +function depends_etlegacy_64() { + getDepends cmake libsdl2-dev libopenal-dev +} + +function sources_etlegacy_64() { + sources_etlegacy +} + +function build_etlegacy_64() { + local params=(-DCMAKE_BUILD_TYPE=Release) + params+=(-DCROSS_COMPILE32=0) + + if isPlatform "rpi"; then + params+=(-DARM=1) + fi + + mkdir "$md_build/build" + cd "$md_build/build" + cmake "${params[@]}" .. + + make clean + make + + md_ret_require="$md_build/build/etl.$(_arch_etlegacy)" + +} + +function install_etlegacy_64() { + install_etlegacy +} + +function game_data_etlegacy_64() { + game_data_etlegacy +} + +function configure_etlegacy_64() { + configure_etlegacy +}