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 BE78315812D for ; Sat, 04 Jan 2025 21:26:39 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F18D5E05AC; Sat, 04 Jan 2025 21:26:38 +0000 (UTC) Received: from mx0.riseup.net (mx0.riseup.net [198.252.153.6]) (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 9F1F7E05AC for ; Sat, 04 Jan 2025 21:26:38 +0000 (UTC) Received: from fews01-sea.riseup.net (fews01-sea-pn.riseup.net [10.0.1.109]) (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 mx0.riseup.net (Postfix) with ESMTPS id 4YQYRK4YQCz9w5v for ; Sat, 4 Jan 2025 21:26:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=riseup.net; s=squak; t=1736025997; bh=PzvoWYPvAX3U15bd8Hb6rIXrqSVHXMRN5fOYlnZb4Ng=; h=Date:From:To:Subject:From; b=EfttSzVnFHiQOdXaoOnW1+vrxpVE9ysgC34a+FOM7xn4o7etsGN+x51xwPQt7XOqn mUQqfAdtZjA3+2tVMenec2UR620OO7W04/9Dbsd4Pq8X7xUibYh2alQajJqtY6vwna Xyb6RVKOSL0eGStFgrPNP1LhWVAtDatvhNiI00Bk= X-Riseup-User-ID: D49BDB56168D69331DA42714FC0B9856D2CAF9F5B9C7850CB5AF896EF2CA0986 Received: from [127.0.0.1] (localhost [127.0.0.1]) by fews01-sea.riseup.net (Postfix) with ESMTPSA id 4YQYRJ6zPXzJrTS for ; Sat, 4 Jan 2025 21:26:36 +0000 (UTC) Date: Sat, 4 Jan 2025 22:26:30 +0100 From: =?iso-8859-1?Q?Ho=EBl_B=E9zier?= To: gentoo-devhelp@lists.gentoo.org Subject: [gentoo-devhelp] Questions on a Warcraft I ebuild Message-ID: 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="hmYO7O7zS/JpY5ww" Content-Disposition: inline Content-Transfer-Encoding: 8bit X-Archives-Salt: b1d41d60-4350-4fe9-9abd-a62bba4bd1ba X-Archives-Hash: 249967622aa139bf9a2433b4c8b589a3 --hmYO7O7zS/JpY5ww Content-Type: text/plain; charset=utf-8; format=flowed Content-Disposition: inline Content-Transfer-Encoding: 8bit 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. 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? > +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. > +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. 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 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. > + 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. 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? 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? If you don’t have much to say about this, do you think this is fit to be uploaded to GURU? Thanks for reading, Hoël --hmYO7O7zS/JpY5ww 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..f9b69e3 --- /dev/null +++ b/games-strategy/warcraft/Manifest @@ -0,0 +1,5 @@ +AUX warcraft-1 634 BLAKE2B f0084ac142757b712d02fcf59792db2232e1ebee1ae9967d7a5ef43e985251f1820f690f85bfa4bddca1efe0374e38d376aaa4d8f6af6c93ee9712ca3ada7e14 SHA512 6350687da904642a3a4f9d9325d3e5e799c0e08a0ba9718127f7ccd89fd8286ffd7c02bc15f6b49c8fc27305f69b9c1a9579441b3d2780a92fae0082b76d2998 +AUX warcraft1-dosbox.conf 1383 BLAKE2B 3ad2135fd5829e7c5cf52afacda23ab6d681b59ee6fdeb6c813eaaa60b4bd61e1185ae9423c3412e566b2357f7deb0c443258a3368f7af0341debea4463473a0 SHA512 714cb66baa42f1b26a0e4671cb63b1dfe9e84183c6007b9da042ca625a12f09f089e11850e787f48b6d7920fe44953beb07247f43d79383213af84b665a7bd9b +DIST setup_warcraft_orcs__humans_1.2_(28330).exe 517514432 BLAKE2B 8b4f5257a5f745604b48d1079f9bec09c5fefe33a4fc1e49aaed60bfe5fbacd7d689fa9f677bc0baf518af3cc0492c5a3fcfb9ee5d7cb9273c29aa97d5077b78 SHA512 15aec94c95aba3269e7b85891432db71084e60e99375d5a9f4ca20607b36e109393b824bf51f71232c1186cf7015c29a527838bc94bdb0fe07cc7fe695b72ffa +EBUILD warcraft-1.2.28330-r2.ebuild 1150 BLAKE2B be35ed3af9ba5314773f96ff732575fd8b443700113706d85f4ab029786cd6f326c8dcfba020b5350ae19f249246e6b3b9c72a536b9bb7ad5fe3879eb2b35bea SHA512 9dbb309ba6e1f758aacbedb82d7dbb66083b400d81bbcda53c56989a70b4aaf5606d621eaf3c2ec4c6b4fded6a620d7152265a97bc87d78863f20e812b985442 +MISC metadata.xml 251 BLAKE2B 19c151f5703da8ebf54919c481478b9d57a1eae77b2d74febf1cddb49172e6d4b738519579e872b0ae60741d15a729e90042a38b2c5a4cb79844fd3c833e784b SHA512 6465fbacaf70f1a1c5a0c8d825bd99c2eb81c67451193d8c2bfb6d2cbdd9d6821726695ed289200aab6aa736a3baccd42d1fd31bed709e6c2ae51c392c67056c diff --git a/games-strategy/warcraft/files/warcraft-1 b/games-strategy/warcraft/files/warcraft-1 new file mode 100644 index 0000000..c4a65e5 --- /dev/null +++ b/games-strategy/warcraft/files/warcraft-1 @@ -0,0 +1,21 @@ +#!/bin/sh + +set -eu + +PN=warcraft-1 + +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}/" \; diff --git a/games-strategy/warcraft/files/warcraft1-dosbox.conf b/games-strategy/warcraft/files/warcraft1-dosbox.conf new file mode 100644 index 0000000..ea5ef7a --- /dev/null +++ b/games-strategy/warcraft/files/warcraft1-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/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-r2.ebuild b/games-strategy/warcraft/warcraft-1.2.28330-r2.ebuild new file mode 100644 index 0000000..5c4f0cf --- /dev/null +++ b/games-strategy/warcraft/warcraft-1.2.28330-r2.ebuild @@ -0,0 +1,51 @@ +# 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="1" +KEYWORDS="~amd64" +RESTRICT="bindist fetch splitdebug" + +BDEPEND=" + app-arch/innoextract + app-arch/unzip +" + +RDEPEND=" + games-emulation/dosbox +" + +DIR="/opt/${PN}-${SLOT}" +QA_PREBUILT="${DIR#/}/*" + +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 "${DIR}" + doexe *.exe + + insinto "${DIR}" + doins -r data drivers *.bin *.cue *.war icon.png + newins "${FILESDIR}/warcraft1-dosbox.conf" dosbox.conf + + dobin "${FILESDIR}/${PN}-${SLOT}" + make_desktop_entry "${PN}-${SLOT}" "Warcraft: Orcs & Humans" "${EPREFIX}/${DIR}/icon.png" +} --hmYO7O7zS/JpY5ww--