summaryrefslogtreecommitdiff
path: root/games-rpg/shipwright/shipwright-8.0.6.ebuild
blob: 4b686e5885ddaf7e55342cae087adbe4f959e338 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Copyright 1999-2024 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

EAPI=8
inherit desktop

DESCRIPTION="Modern PC port of Ocarina of Time"
HOMEPAGE="https://github.com/HarbourMasters/Shipwright"
SRC_URI="https://github.com/HarbourMasters/Shipwright/releases/download/${PV}/SoH-MacReady-Golf-Linux-Compatibility.zip -> ${P}.zip"

RDEPEND="
	system? (
		media-libs/libsdl2
		media-libs/sdl2-net
		media-libs/libglvnd
		media-libs/glew
		sys-libs/zlib
		app-arch/bzip2
		media-libs/libpulse
		media-libs/libpng
	)
	gnome-extra/zenity
"
BDEPEND="app-arch/unzip dev-util/patchelf"

LICENSE="all-rights-reserved"
SLOT="0"
KEYWORDS="~amd64"
IUSE="+system"

QA_PREBUILT="opt/${PN}/*"
RESTRICT="bindist mirror"

src_unpack() {
	default
	chmod +x soh.appimage
	mkdir -p "${S}" || die
	cd "${S}" || die
	"${WORKDIR}"/soh.appimage --appimage-extract || die
}

src_prepare() {
	default
	sed -e 's/Name=SOH/Name=Ship of Harkinian/' \
		-e 's/Exec=soh.sh/Exec=soh/' \
		-e 's/Icon=sohIcon/Icon=soh/' \
		-e '/X-AppImage-Integrate/d' \
		-i squashfs-root/usr/share/applications/soh.desktop || die
	cat >> squashfs-root/usr/share/applications/soh.desktop <<-EOF
		StartupWMClass=soh.elf
	EOF
}

src_install() {
	cd squashfs-root || die

	if use system; then
		patchelf --replace-needed libGLEW.so.2.1 libGLEW.so usr/bin/soh.elf
	fi

	mkdir -p "${ED}/opt/${PN}/usr/{bin,lib}"
	cp -r usr/bin "${ED}/opt/${PN}/usr/bin"

	newicon -s 512 usr/share/icons/hicolor/512x512/apps/sohIcon.png soh.png
	domenu usr/share/applications/soh.desktop

	if ! use system; then
		cp -r usr/lib "${ED}/opt/${PN}/usr/lib"
		dodoc -r usr/share/doc/*
	fi

	cat > soh <<-EOF || die
		#!/bin/sh

		if [[ -z "\${XDG_DATA_HOME+x}" ]]; then
			SHIP_HOME="\${HOME}/.local/share/shipwright"
		else
			SHIP_HOME="\${XDG_DATA_HOME}/shipwright"
		fi
		export SHIP_HOME

		exec "${EPREFIX}/opt/${PN}/usr/bin/soh.sh"
	EOF
	dobin soh
}