From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 11E8B15812D for ; Mon, 06 Jan 2025 17:36:30 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 480DAE07C5; Mon, 06 Jan 2025 17:36:29 +0000 (UTC) Received: from mx1.riseup.net (mx1.riseup.net [198.252.153.129]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id EF55DE07C5 for ; Mon, 06 Jan 2025 17:36:28 +0000 (UTC) Received: from fews02-sea.riseup.net (fews02-sea-pn.riseup.net [10.0.1.112]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx1.riseup.net (Postfix) with ESMTPS id 4YRhDr054hzDq8s for ; Mon, 6 Jan 2025 17:36:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1736184988; bh=DAX4ztFASk3bLYJs4TFUQvoOKyuDJl/T8GBwk4qsLQs=; h=Date:From:To:Subject:References:In-Reply-To:From; b=N2toC6W1MdPY6LK4b/9ZqF+E4QPQ7HBPK4qtwob+sOe9WAh4R38VuXR0fup63LHe2 7NFnGEkpW3qb5/awISGi+LKGwamKPpuHdngEk+9PChX06B0VXuroXvWbBdlieQXDoG pLNl6YnR8y7RWYvI5u+jl5P4brS8DYJtEFx5ORRQ= X-Riseup-User-ID: 12F63F9C907EF96B6F07B36789ACEBFE88366F9763FFDFC59A6FE3ED40C49CAD Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews02-sea.riseup.net (Postfix) with ESMTPSA id 4YRhDc2z8mzFtWc for ; Mon, 6 Jan 2025 17:36:16 +0000 (UTC) Date: Mon, 6 Jan 2025 18:36:11 +0100 From: =?iso-8859-1?Q?Ho=EBl_B=E9zier?= To: gentoo-devhelp@lists.gentoo.org Subject: Re: [gentoo-devhelp] Questions on a Warcraft I ebuild Message-ID: References: <7df49a0c-2702-4ea1-bf73-7fa8b63dc8a9@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Development-related help X-BeenThere: gentoo-devhelp@gentoo.org X-BeenThere: gentoo-devhelp@lists.gentoo.org Reply-To: gentoo-devhelp@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="pT01q6pFYtDuSZpi" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7df49a0c-2702-4ea1-bf73-7fa8b63dc8a9@gmail.com> X-Archives-Salt: 4080bc92-9ad2-44e5-a736-4a8b3d0a76cd X-Archives-Hash: 11438618ce8bebc3569c71c1a474f065 --pT01q6pFYtDuSZpi Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit Hi Andrew, Thanks a lot for the quick and thorough answer! I’ve mostly followed all your advices. I’ve attached the new diff if anyone’s interested. Am So, Jan 05, 2025 am 06:28:58 -0500 schrieb Andrew Udvare: >On 04/01/2025 16:26, Hoël Bézier wrote: >> Hi, >> >> I have written an ebuild for Warcraft I. This game used to be sold on >> GOG.com, so the ebuild allows installation from the installer you could >> download there. >> >> The full patch is attached. It includes the ebuild, the Manifest, the >> metadata.xml, the dosbox configuration file and a shell script meant to >> be installed in PATH. > >It's an interesting idea. I don't think it will gain wide acceptance but >you could make an overlay of dosbox-gog stuff. >> >> I have a few questions about the decisions I took when writing these. >> Feel free to also point out anything that seems of interest to you. >> >>> +SLOT="1" >> >> At first I had named the package warcraft-1, but then when I added the >> version it gave me a weird filename (warcraft-1-1.2.28330.ebuild), so I >> figured I would call the package warcraft, and use SLOT to differentiate >> between ebuilds for warcraft I, II and III. >> >> I’m pretty sure the SLOT system has not been thought for this, but it >> works quite well. Are there any reasons I should NOT do that? > >I would not do that. Game suffixes are really not the same as different >versions of the same software. There can be Warcraft 1 1.0, Warcraft 2 >1.0, etc. New game releases of a series are rarely considered an >'upgrade' from the prior game. They are basically separate. The only >case I know of historically is RollerCoaster Tycoon where RCT2 actually >gets marked as version 2.0. > >I would just use warcraft, warcraft2, etc as the package names. That’s a very good idea, I’ll do just that. >> >>> +DIR="/opt/${PN}-${SLOT}" >> >> Since I’m installing prebuilt binaries, I put them all into /opt/${PN}- >> ${SLOT}. Most similar packages install into /opt/${PN}, but if I did >> that, I wouldn’t be able to install files for the three different slots >> simultaneously. > >You can also put this stuff in /usr/share/${PN} since it's just random >non-source content, nor is it Linux-native binaries. Uhm, right. I felt like pre-distributed stuff should be kept as-is and put into /opt, but I guess /usr/share/${PN} is fine too. Also, this answers my questions about the icon and the dosbox config. >> >>> +src_unpack() { >>> +    innoextract -Lms -d "${S}" "${DISTDIR}/${A}" || die >>> +    unzip -c "${S}/app/webcache.zip" >>> 4fae796ad7d4bd7357fa49e5013e6aa881b6fcfcd37a1de052adab337fd0b236.png > >>> "${S}/icon.png" || die >>> +} >> >> unpack doesn’t support extracting Inno Setup installers, so it seems I’m >> left with using innoextract directly. > >This is fine. > >> However the only icon included in the installer is in .ico format, which >> isn’t supported by make_desktop_entry from desktop.eclass, so I’m left >> with either converting it using ImageMagick or extracting the icon from >> the app/webcache.zip file which contains it in a usable format. I >> decided for the latter. My question is, should I try to have several >> sizes of that icon, which I can obtain either by converting the .ico >> file or by extracting all files from the zip? >> >>> +    insinto "${DIR}" >>> +    doins -r data drivers *.bin *.cue *.war icon.png > >I would not bother with making different sizes. If there is only one >size and you don't specify the size to doicon then it goes in pixmaps. > >> >> This results in the icon being installed in /opt. Should I instead >> install it using newicon in /usr/share/icons, especially if I install >> several sizes of it? It feels weird to me to have only the icon be >> installed in /usr and the rest of the package in /opt: I feel I should >> either install the package in system files, or stay nicely contained >> in /opt. > >Does not matter if placement of files is mixed. > >Definitely make use of newicon to install the icon properly as ${PN}. >Then you can remove the full path argument from make_desktop_entry. I did that too. > >> >>> +    newins "${FILESDIR}/warcraft1-dosbox.conf" dosbox.conf >> >> Warcraft I is run with dosbox, which means I use a dosbox configuration >> file. I install it, like everything else, in /opt. Should I put it >> somewhere else, like /usr/share/warcraft-1/dosbox.conf, /etc/warcraft-1/ >> dosbox.conf, /etc/dosbox/warcraft-1.conf? I have the same feeling >> regarding this file as I have regarding the icon. > >Put it in /usr/share. > >> Let’s switch to the shell script now. >> >>> +if ! test -d "${HOME}/.local/share/${PN}" >>> +then >>> +    mkdir -p "${HOME}/.local/share/${PN}" >>> +    cp /opt/${PN}/*.war "${HOME}/.local/share/${PN}" >>> +fi >>> + >>> +mkdir -p "${HOME}/.cache/${PN}" >>> +ln -sft "${HOME}/.cache/${PN}" /opt/${PN}/* >>> +ln -sft "${HOME}/.cache/${PN}" ${HOME}/.local/share/${PN}/* >>> +ln -sft "${HOME}/.cache/${PN}" ${HOME}/.config/${PN}/* 2>/dev/null || >>> true >>> +rm -f "${HOME}/.cache/${PN}/*" # Might be created by the previous >>> commands >>> >>> +dosbox -conf "${HOME}/.cache/${PN}/dosbox.conf" -exit >>> "${HOME}/.cache/${PN}/war.exe" >>> + >>> +find "${HOME}/.cache/${PN}" -type f -execdir mv '{}' "${HOME}/.local/ >>> share/${PN}/" \; >> >> So, Warcraft being a DOS game, it expects to be able to write files in >> its installation directory, whether it be editing existing files or >> creating new ones. >> >> This is obviously not possible here, unless you play as root which is >> not recommended. >> >> We can work around this by making copies of files the game wants to edit >> in the user’s homedir, then linking everything into a temporary >> directory in which the user has write permissions so that they can >> create new files, and running the game from this temporary directory >> instead of the system installation directory. >> >> I additionally link the user’s ~/.config/warcraft-1 into that temporary >> directory, so that they may overwrite the dosbox.conf if so they wish. >> (They actually can overwrite any file they want, but most users won’t.) >> >> After the game has run, any file in this temporary directory is a file >> which has been created by the game (since before that everything is a >> symlink), so we move that to a persistent directory. >> >> Are there any better ways to solve this problem, or do you have examples >> of similar games solving this in a different fashion? > >This is probably the best course of action for this. Most games of the >time are not designed with ACLs in mind. FAT12/32 had none. The game >does not take up a lot of space so it is fine. >> >> >> Regarding dependencies of the package, I have put dosbox because it is >> used in the shell script, but in order to have music, you also need a >> midi server running. Is there any way I can express that somewhere? The >> game, nor my shell script, can’t be responsible for setting this up and >> running it, so I don’t feel I should have one in RDEPEND, but >> nevertheless the user should be made aware they need one. How can I go >> about that? > >IUSE="midi" and RDPEEND="midi? ( midi-server-package1 || >midi-server-package2 )" is a quick solution for this. > >Which server would you put there? I know two: timidity++ and fluidsynth. I’m currently using timidity++ and it works like a charm. >> >> >> If you don’t have much to say about this, do you think this is fit to be >> uploaded to GURU? > >I wouldn't without more input. You should consider putting it into an >overlay that focuses on Dosbox conversions. Should I create one, or do you already know about one that could accept this ebuild? > >Also there are other Dosbox packages like Dosbox-staging and Dosbox-X >(my overlay). You should RDEPEND on either: RDEPEND="( >games-emulation/dosbox || games-emulation/dosbox-staging )" Good catch, I’ve changed that. > >Also I don't think QA_PREBUILT is necessary for non-Linux binary data. Right, I removed it. > >-- >Andrew > --pT01q6pFYtDuSZpi Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: attachment; filename="warcraft.patch" Content-Transfer-Encoding: 8bit diff --git a/games-strategy/warcraft/Manifest b/games-strategy/warcraft/Manifest new file mode 100644 index 0000000..f23b790 --- /dev/null +++ b/games-strategy/warcraft/Manifest @@ -0,0 +1,5 @@ +AUX dosbox.conf 1383 BLAKE2B 3ad2135fd5829e7c5cf52afacda23ab6d681b59ee6fdeb6c813eaaa60b4bd61e1185ae9423c3412e566b2357f7deb0c443258a3368f7af0341debea4463473a0 SHA512 714cb66baa42f1b26a0e4671cb63b1dfe9e84183c6007b9da042ca625a12f09f089e11850e787f48b6d7920fe44953beb07247f43d79383213af84b665a7bd9b +AUX warcraft 644 BLAKE2B 519507c97e786546cfdd37a531c213592bbd43de9ced6690c45c456eb72f3a1a3b73f84c1a0bcf3a77b212c15f117c2605afb7d84fdbd6009fef6741036dda2a SHA512 58b6251b3bdd742937a8e7d56853bbd928559987b0512a3a82908418189e815361b9b517df83aff2bd059c00cb6f8e53a57e2f2f204f3c5ea8e4f8fa3bcbb896 +DIST setup_warcraft_orcs__humans_1.2_(28330).exe 517514432 BLAKE2B 8b4f5257a5f745604b48d1079f9bec09c5fefe33a4fc1e49aaed60bfe5fbacd7d689fa9f677bc0baf518af3cc0492c5a3fcfb9ee5d7cb9273c29aa97d5077b78 SHA512 15aec94c95aba3269e7b85891432db71084e60e99375d5a9f4ca20607b36e109393b824bf51f71232c1186cf7015c29a527838bc94bdb0fe07cc7fe695b72ffa +EBUILD warcraft-1.2.28330-r4.ebuild 1179 BLAKE2B a807e8b9cd65c5284ebe0940dcef1c5d5e7e76ab55358facdbf9638a1db3a03906d97751e134f050ed8881b13fa4238ecffaeb49a6e1b14461927099c66af691 SHA512 be4971200d38042baf7264e584e9b322a6314cc7e14ce352fe96265f893fc54231d46470c8dd2ceb5ba542b328f9352341b211f7ff539c3ac0698198a1a5786d +MISC metadata.xml 251 BLAKE2B 19c151f5703da8ebf54919c481478b9d57a1eae77b2d74febf1cddb49172e6d4b738519579e872b0ae60741d15a729e90042a38b2c5a4cb79844fd3c833e784b SHA512 6465fbacaf70f1a1c5a0c8d825bd99c2eb81c67451193d8c2bfb6d2cbdd9d6821726695ed289200aab6aa736a3baccd42d1fd31bed709e6c2ae51c392c67056c diff --git a/games-strategy/warcraft/files/dosbox.conf b/games-strategy/warcraft/files/dosbox.conf new file mode 100644 index 0000000..ea5ef7a --- /dev/null +++ b/games-strategy/warcraft/files/dosbox.conf @@ -0,0 +1,91 @@ +[sdl] +fullscreen = true +fulldouble = false +fullresolution = desktop +windowresolution = original +output = overlay +autolock = true +sensitivity = 100 +waitonerror = true +priority = higher,normal +mapperfile = mapper-SVN.map +usescancodes = true + +[dosbox] +language = +machine = svga_s3 +captures = capture +memsize = 16 + +[render] +frameskip = 0 +aspect = true +scaler = normal2x + +[cpu] +core = auto +cputype = auto +cycles = fixed 30000 +cycleup = 1000 +cycledown = 1000 + +[mixer] +nosound = false +rate = 44100 +blocksize = 1024 +prebuffer = 25 + +[midi] +mpu401 = intelligent +mididevice = default +midiconfig = 128:0 + +[sblaster] +sbtype = sb16 +sbbase = 220 +irq = 7 +dma = 1 +hdma = 5 +sbmixer = true +oplmode = auto +oplemu = default +oplrate = 44100 + +[gus] +gus = false +gusrate = 44100 +gusbase = 240 +gusirq = 5 +gusdma = 3 +ultradir = C:\ULTRASND + +[speaker] +pcspeaker = true +pcrate = 44100 +tandy = auto +tandyrate = 44100 +disney = true + +[joystick] +joysticktype = auto +timed = true +autofire = false +swap34 = false +buttonwrap = false +circularinput = false +deadzone = 10 + +[serial] +serial1 = dummy +serial2 = dummy +serial3 = disabled +serial4 = disabled + +[dos] +xms = true +ems = true +umb = true +keyboardlayout = auto + +[ipx] +ipx = false diff --git a/games-strategy/warcraft/files/warcraft b/games-strategy/warcraft/files/warcraft new file mode 100644 index 0000000..ba504d4 --- /dev/null +++ b/games-strategy/warcraft/files/warcraft @@ -0,0 +1,21 @@ +#!/bin/sh + +set -eu + +PN=warcraft + +if ! test -d "${HOME}/.local/share/${PN}" +then + mkdir -p "${HOME}/.local/share/${PN}" + cp /usr/share/${PN}/*.war "${HOME}/.local/share/${PN}" +fi + +mkdir -p "${HOME}/.cache/${PN}" +ln -sft "${HOME}/.cache/${PN}" /usr/share/${PN}/* +ln -sft "${HOME}/.cache/${PN}" ${HOME}/.local/share/${PN}/* +ln -sft "${HOME}/.cache/${PN}" ${HOME}/.config/${PN}/* 2>/dev/null || true +rm -f "${HOME}/.cache/${PN}/*" # Might be created by the previous commands + +dosbox -conf "${HOME}/.cache/${PN}/dosbox.conf" -exit "${HOME}/.cache/${PN}/war.exe" + +find "${HOME}/.cache/${PN}" -type f -execdir mv '{}' "${HOME}/.local/share/${PN}/" \; diff --git a/games-strategy/warcraft/metadata.xml b/games-strategy/warcraft/metadata.xml new file mode 100644 index 0000000..00298a3 --- /dev/null +++ b/games-strategy/warcraft/metadata.xml @@ -0,0 +1,8 @@ + + + + + hoelbezier@riseup.net + Hoël Bézier + + diff --git a/games-strategy/warcraft/warcraft-1.2.28330-r4.ebuild b/games-strategy/warcraft/warcraft-1.2.28330-r4.ebuild new file mode 100644 index 0000000..f8e2eb4 --- /dev/null +++ b/games-strategy/warcraft/warcraft-1.2.28330-r4.ebuild @@ -0,0 +1,50 @@ +# Copyright 1999-2022 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +inherit desktop xdg + +MY_PV="$(ver_cut 1-2)_($(ver_cut 3))" + +DESCRIPTION="Warcraft: Orcs & Humans" +HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage" +SRC_URI="setup_warcraft_orcs__humans_${MY_PV}.exe" + +LICENSE="GOG-EULA" +SLOT="0" +KEYWORDS="~amd64" +RESTRICT="bindist fetch splitdebug" + +IUSE="midi" + +BDEPEND=" + app-arch/innoextract + app-arch/unzip +" + +RDEPEND=" + || ( games-emulation/dosbox games-emulation/dosbox-staging ) + midi? ( || ( media-sound/timidity++ media-sound/fluidsynth ) ) +" + +pkg_nofetch() { + einfo "Please buy and download ${SRC_URI}" + einfo "and move it to your distfiles directory." +} + +src_unpack() { + innoextract -Lms -d "${S}" "${DISTDIR}/${A}" || die + unzip -c "${S}/app/webcache.zip" 4fae796ad7d4bd7357fa49e5013e6aa881b6fcfcd37a1de052adab337fd0b236.png > "${S}/icon.png" || die +} + +src_install() { + exeinto "/usr/share/${PN}" + doexe *.exe + insinto "/usr/share/${PN}" + doins -r data drivers *.bin *.cue *.war "${FILESDIR}/dosbox.conf" + newicon icon.png "${PN}.png" + + dobin "${FILESDIR}/${PN}" + make_desktop_entry "${PN}" "Warcraft: Orcs & Humans" +} --pT01q6pFYtDuSZpi--