-
Notifications
You must be signed in to change notification settings - Fork 0
GOG PKGBUILD Standards
This document is in progress and a lot of it was written in retrospective. Some things may not be right. Don't trust it.
Arch Linux has its own set of packaging standards which these PKGBUILDs try very hard to meet up to as much as possible. However, due to, first and foremost, the inability to distribute the built packages we have to make some concessions and break standards.
And the thing about breaking standards is that you get to make your own! Just like that last sentence breaks the common English standard of how sentences should never start with the word 'and'. And establishes a new one wherein it's totally okay throughout this whole document to do that.
base packages (gogname-base) include only the game datafiles. That means a base package shouldn't really include anything to make the game run. Games which run totally natively don't require a base package. A base package is generally supplemented by a further package, like a dosbox or scummvm one (gogname-{scummvm,dosbox} and a metapackage which just depends on both (gogname).
If your GOG runs natively, for example it has its own binary or source port, you don't need a base package. You can just include the native binaries in the package itself. If your GOG has a utility like Adventure Game Studio to run, you will need a base package, but not a metapackage - the gogname
package will depend on the base package and provide the launcher script.
The thing about GOG is that no one's happy. Some people want to play games in DOSBox even if it works better in ScummVM and some people would rather use Wine instead of native binaries. Games are broken up to enable people to do this. Further, it allows for some portability - it's theoretically possible to play some of these games on your Raspberry Pi and it'd be pretty dumb of us to stop you from installing the game datafiles based simply on the fact that we think the game won't work on your toaster.
All packages should have the header # Part of the unofficial GOG.com PKGBUILD project: http://github.com/Tea23/arch-gog
inserted. Follow this with # Maintainer: Your Name <[email protected]>
. If you modify a PKGBUILD, you should add # Contributor:
underneath the existing Maintainer line.
Most parameters in your PKGBUILD are the same as they would be in any normal PKGBUILD. Here are a few things to note, however. First of all, there are two additional parameters used in all GOG PKGBUILDS: _gogname
and _killjunk
. _killjunk
is a simple true/false flag, it's used in the PKGBUILD to determine whether the user wants Windows-only files removing or not. More on that later. _gogname
is equivalent to the shortname of the game as per the installer; so if the installer is setup_homm2_1.3.3.7.exe
then the _gogname
is homm2
. In some cases, the installer has a stupidly long name and in these cases it's acceptable for you to use some discretion and use a shorter value, however you may want another parameter (like _gogrealname
) so you don't have to keep using the full name in the PKGBUILD.
NOTE: The GOG installer does not go into the PKGBUILD's source array! Doing this will include the installer in your package source. Remember that we cannot distribute any installers or built packages.
Onto real parameters. pkgname
will be gog-${_gogname}-packagetype
. "Packagetype" will either be base
or native
or whatever
. It depends. If it's a metapackage, then there is no value.
pkgver
is to correspond to the version number in the installer filename. Some GOGs do not have version numbers in the version filename in which case you should use whatever one is present on the GOGWiki.
pkgdesc
. Here you can use some license. As per regular standards you should endeavour to include the game's full name or just some details to make it easy to find. Be truthful, too. System Shock 2 is not a game about hitting people with dildos. It is a sci-fi thriller.
There's a few arguments about arch
. any
makes sense for base packages. Depends if it runs on Raspberry Pi or not. Oh stop listening to me. Just use 'i686' 'x86_64'
like a normal person.
The value of url
is gog.com.
license
should always be custom:gog.com
. At some point we'll include a license file.
makedepends
always includes innoextract
. Your package might have others. As for depends
, this....depends. If it's a metapackage it should depend on the base package and whatever you think normal people should use (if it's Full Throttle it'll depend on the scummvm project. No GOG doesn't have Full Throttle. If you are the person who owns the rights to Full Throttle, please put Full Throttle on GOG).
md5sums
should include the MD5 hash of the GOG installer. This can normally be found on GOGWiki but you're probably smart enough to run md5sum
yourself, too.
So your basic PKGBUILD starts off like this:
# Part of the unofficial GOG.com PKGBUILD project: http://github.com/Tea23/arch-gog
# Maintainer: Joe Davison <[email protected]>
_gogname=homm2_gold
pkgname=gog-${_gogname}-base
pkgver=2.0.0.24
pkgrel=1
pkgdesc="Fantasy turn-based strategy game, the sequel to Heroes of Might and Magic"
arch=('i686' 'x86_64')
url="http://www.gog.com"
license=('custom:gog.com')
makedepends=('innoextract')
md5sums=(b75bb495593edaf1ff785e9bcec0cac0)
_killjunk=true
PKGEXT-.pkg.tar
PKGEXT
is set because compression will take 10 years for most of these games. Also the only purpose of package compression is so you can upload and distribute them. But you're not going to upload and distribute your packages anywhere because that's against GOG's rules and you want them to stay in business.
Pretty much all PKGBUILDs will install the GOG the same way. Because we can't include the game in the source array we have to handle extraction and integrity checking ourselves. So:
build() {
# You need to be in the srcdir, man.
cd $srcdir
# Here we check if the installer exists. If it doesn't, the operation fails. If it does, we hold a party and invite all the friends we don't have.
if [ ! -f setup_${_gogname}_$pkgver.exe ]; then
error "You must have setup_${_gogname}_$pkgver.exe present in the source dir: $PWD"
# If this comment is in a live PKGBUILD, someone copy and pasted the template from the wiki. Double check this package before you run it.
error "Download the game from your GOG shelf and try again. Stopping."
return 1
else
# We have to check MD5s ourselves, so this if statement handles it. Again, the operation will stop if it's wrong.
msg "Checking file hash..."
if [[ `md5sum setup_${_gogname}_$pkgver.exe` == *$md5sums* ]]; then
msg "Passed integrity check, extracting..."
innoextract setup_${_gogname}_$pkgver.exe
else
error "Setup file is corrupted; returned wrong MD5"
error "Redownload $_gogname and try again. Stopping."
return1
fi
# Most of everything above this comment you didn't have to modify. Isn't that great?
# This is where _killjunk comes in. You should check $srcdir/app to see what files are useless and what isn't. Always delete DOSBOX/ and ScummVM/ at least, if it's there. Remember the operation will fail if you try to remove something that doesn't exist.
if [ ${_killjunk} == true ]; then
msg "Deleting Windows-specific files"
rm -rf app/{Support,gog}.ico app/DOSBOX app/GameuxInstallHelper.dll
else
msg "Not removing any Windows-only junk"
fi
fi
}