diff --git a/eclass/run-wine.eclass b/eclass/run-wine.eclass new file mode 100644 index 0000000..864da14 --- /dev/null +++ b/eclass/run-wine.eclass @@ -0,0 +1,52 @@ +# Copyright 2020-2020 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +# @ECLASS: run-wine.eclass +# @MAINTAINER: +# moog621@gmail.com +# @AUTHOR: +# moog621@gmail.com +# @SUPPORTED_EAPIS: 7 +# @BLURB: Functions and BDEPEND/RDEPEND enrichment for Windows programs. +# @DESCRIPTION: +# This eclass helps to run Windows software during ebuild stages. +# It also concentrates problematic Wine targets so they don't come up +# in repoman reports for all packages using this eclass. + +if [ -z ${INSTALLER_ABI} ]; then + export INSTALLER_ABI="abi_x86_32" +fi +if [ -z ${PROGRAM_ABI} ]; then + export PROGRAM_ABI="abi_x86_32" +fi +if [ -z ${WINEARCH} ]; then + case "${INSTALLER_ABI}" in + "abi_x86_32") export WINEARCH="win32";; + "abi_x86_64") export WINEARCH="win64";; + *) die "Unknown INSTALLER_ABI";; + esac +fi +if [ -z ${WINEPREFIX} ]; then + export WINEPREFIX="${HOME}/wineprefix" +fi + +BDEPEND+=" + virtual/wine[${INSTALLER_ABI}] + sys-apps/sed + sys-apps/coreutils + sys-apps/grep +" + +RDEPEND+=" + virtual/wine[${PROGRAM_ABI}] +" + +runwine_prepare_for_wine_run() { + local HID_DEVICES=($(ls /dev | grep ^hid | sed 's_^_/dev/_')) + einfo "Adding temporary pseudo rw to /dev/input" + addpredict /dev/input + for hid_device in ${HID_DEVICES[@]}; do + einfo "Adding temporary pseudo rw to ${hid_device}" + addpredict ${hid_device} + done +} diff --git a/eclass/windows-helper.eclass b/eclass/windows-helper.eclass new file mode 100644 index 0000000..63abbfe --- /dev/null +++ b/eclass/windows-helper.eclass @@ -0,0 +1,12 @@ +BDEPEND+=" + sys-apps/sed + sys-apps/coreutils +" + +windowshelper_convert_normal_path_to_windows_path() { + local abs_path="$1" + if ! [[ "$1" =~ '^\/' ]]; then + abs_path=$(readlink -f "$1") + fi + echo "${abs_path}" | sed 's_^_Z:_;s_/_\\_g' +} diff --git a/games-action/gta2/Manifest b/games-action/gta2/Manifest index 9e8351c..4ea061b 100644 --- a/games-action/gta2/Manifest +++ b/games-action/gta2/Manifest @@ -1,7 +1 @@ -AUX gta2 571 BLAKE2B 06c4a1b2851be15dfd49d1ea8e59f0b330b4f8ea52159735223e196aeb87ba049653ca3068bb961f8a35e04a9614824ae71cc11ab9936a135ea651f37ed63c32 SHA512 5ac15179c768d90a6db45b20d4816033a2844e1f7de6322580a4dc4ee9c241ded29503983c841f55c1e7ba09ee1bba0c2eb2930ea1a56cf4fc5230d36be1641e -AUX gta2.desktop 144 BLAKE2B 8675140b478ca671605962ba9838228f06c965279f1e4789e0f1dfd8cdb54c427a64fa0221f165c8c959e73e9ed39ad05c4571639dc9e263c0a73dcb3f351cce SHA512 39feff7b624f63fa5427c49e0a428fb3590a2345b0c1e2ad3975fd982d0ef637d7e7869f8da4c30820b278798228a600bd53d2acb345229c16f0031c0d94e48b -AUX gta2.iss 987 BLAKE2B 498abd4bdac068c511b1d4fa51b3ba19d0785807a6047f816e9e7d9c862f591f2ab1865c54795fed4296f45b1acabb76a8183a4c2f76fbb89e4cdb123b1a1379 SHA512 2996d26f2b2e426e879bab742676550d1c8d6900e1d4ffee388a971c98c7a56953b17c5b499169cabbe1887576ac96a8e448f4343b01b1db80727c8201ffec65 -AUX gta2_manager 581 BLAKE2B f84bf80acafd5d314217a03ab58f3c9547e894938eaa3cf78751abb9f56f4289168cb98143bd77ade621f9d2ef1732d432f174ac611fc99ce648be6770d7b5f5 SHA512 2595d779c7a7649eac1b21169bb24a53dfa1ed8a73292521ea76e5d6bb304d2a511f29e2213527cf97679989041f77011e62099d228bf0ebee9b6f66eb45a0e9 -AUX gta2_manager.desktop 180 BLAKE2B 5ee350c3827d51443711e99a4d1b46ebb3db9e8b620e9fc2422612e4a53f8db7d1bfd489b1da41058c1f3699a5cc6c4f8c8c66cf4ec0635662d53d7ae4934ace SHA512 eb96c723a38232c8884e2e95682c432fd0d1eb80d89163bf9025934a489d35d648ef75c3784ae4ae12e7f489b27cb3ce58ee9121be9636e12f798b0435114e0c DIST GTA2_full.zip 361630174 BLAKE2B d5dd09eabaf2b0b1e615455ed90bc27ba2640acf44ba076e9c552a32ca20aa0cd6a6ff613e34d27dd0fe658546a87478d51e0456ea6089fce6bc817ed8ee96fb SHA512 01b8dd863c90dfefc8fbb0691ac7dd9a9db44debf82d3ee902fcd661a2dec21f83cd5a9967f4f5889e4b7d55b9c9f7ac271a67d19d84f37f6854fd81f90d0bcb -EBUILD gta2-9.6-r1.ebuild 1710 BLAKE2B 4bca561d2dc117ff831fc749b06b3e321d79f6ccb2f49362bc713e8a5e8b52c33e5c3f5620a4723c90e0b6a04d7a2351857353f26dd73d895f5c04ab6765b2e0 SHA512 5ceb3cc8f0ac2a30be8492b555c6346a6028cf90beef2716da0010ec05b444674d05fb9f69c7163c94a26d0703c652b30db4e715c468054183423fccb1e39948 diff --git a/games-action/gta2/files/gta2.iss b/games-action/gta2/files/gta2.iss index 0868500..c246dba 100644 --- a/games-action/gta2/files/gta2.iss +++ b/games-action/gta2/files/gta2.iss @@ -15,7 +15,7 @@ Result=1 [{2987EE84-C4EE-4FF5-8160-32DE00D6ABC6}-SdLicense2-0] Result=1 [{2987EE84-C4EE-4FF5-8160-32DE00D6ABC6}-SdAskDestPath2-0] -szDir=C:\Program Files\Rockstar Games\GTA2 +szDir=C:\Program Files\Rockstar Games\gta2 Result=1 [{2987EE84-C4EE-4FF5-8160-32DE00D6ABC6}-SdStartCopy2-0] Result=1 diff --git a/games-action/gta2/gta2-9.6-r1.ebuild b/games-action/gta2/gta2-9.6-r2.ebuild similarity index 50% rename from games-action/gta2/gta2-9.6-r1.ebuild rename to games-action/gta2/gta2-9.6-r2.ebuild index ba8f04a..a8afd01 100644 --- a/games-action/gta2/gta2-9.6-r1.ebuild +++ b/games-action/gta2/gta2-9.6-r2.ebuild @@ -3,6 +3,9 @@ EAPI=7 +REQUIRED_USE="abi_x86_32" +inherit run-wine windows-helper + DESCRIPTION="And remember - respect is everything!" HOMEPAGE="https://www.rockstargames.com/gta2/homepage.html" SRC_URI="https://archive.org/download/pc_gta2/GTA2_full.zip" @@ -11,47 +14,38 @@ LICENSE="Rockstar_freeware_GTA2" SLOT="0" KEYWORDS="~amd64 ~x86" -BDEPEND=" - app-arch/unzip - sys-apps/sed - sys-apps/coreutils - sys-apps/grep - media-gfx/icoutils - media-gfx/imagemagick" +IUSE="+abi_x86_32" -RDEPEND=" - app-emulation/wine-vanilla[abi_x86_32] +BDEPEND+=" + app-arch/unzip + media-gfx/icoutils + media-gfx/imagemagick +" + +RDEPEND+=" app-emulation/winetricks - app-shells/bash" + app-shells/bash:0 +" DEPEND="${RDEPEND}" S=${WORKDIR} src_unpack() { - unzip ${DISTDIR}/GTA2_full.zip - export WINEPREFIX="$(pwd)/wineprefix" - export WINEARCH="win32" - export RESPONSE_FILE=$(readlink -f ${FILESDIR}/gta2.iss | sed 's_^_Z:_;s_/_\\_g') - export WINEDEBUG="-all" - export HID_DEVICES=($(ls /dev | grep ^hid | sed 's_^_/dev/_')) - einfo "Adding temporary pseudo rw to /dev/input" - addpredict /dev/input - for hid_device in ${HID_DEVICES[@]}; do - einfo "Adding temporary pseudo rw to ${hid_device}" - addpredict ${hid_device} - done - wine GTA2/GTA2.exe /s /f1"${RESPONSE_FILE}" /f2"C:\iss.log" - mv ${WINEPREFIX}/drive_c/Program\ Files/Rockstar\ Games/GTA2 gta2 - wrestool -x -t14 -n 128 -o . gta2/gta2\ manager.exe - wrestool -x -t14 -o . gta2/gta2.exe + unzip -jd . "${DISTDIR}"/GTA2_full.zip GTA2/GTA2.exe + RESPONSE_FILE=$(windowshelper_convert_normal_path_to_windows_path "${FILESDIR}/gta2.iss") + runwine_prepare_for_wine_run + wine GTA2.exe /s /f1"${RESPONSE_FILE}" /f2"C:\iss.log" + INSTALL_PATH="${WINEPREFIX}/drive_c/Program Files/Rockstar Games/gta2" + wrestool -x -t14 -n 128 -o . "${INSTALL_PATH}/gta2 manager.exe" || die + wrestool -x -t14 -o . "${INSTALL_PATH}/gta2.exe" || die convert 'gta2 manager.exe_14_128_2057.ico' gta2_manager.png convert 'gta2.exe_14_101_2057.ico' gta2.png } src_install() { insinto /usr/share/games - doins -r gta2 + doins -r "${INSTALL_PATH}" insinto /usr/share/pixmaps doins gta2_manager.png doins gta2.png