media-video/owncast: tidy ebuild

Move to EAPI 8 (with no changes).

Add GitHub project to HOMEPAGE.

Expand PN in SRC_URI to plaintext.

Use WORKDIR and S variables to locate the prebuilt CSS file.

Remove defensive quotes around expansions of PN.

Use REPLACING_VERSIONS to determine if we are upgrading.

Package-Manager: Portage-3.0.20, Repoman-3.0.3
Signed-off-by: Karl-Johan Karlsson <creideiki+gentoo-guru@lysator.liu.se>
This commit is contained in:
Karl-Johan Karlsson
2021-07-31 19:05:59 +02:00
parent 830a048581
commit b972665f5d

View File

@@ -1,16 +1,16 @@
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
EAPI=8
inherit go-module
DESCRIPTION="A self-hosted live video and web chat server"
HOMEPAGE="https://owncast.online"
HOMEPAGE="https://owncast.online/ https://github.com/owncast/owncast"
LICENSE="MIT Apache-2.0 ISC BSD"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
KEYWORDS="~amd64"
RDEPEND="
acct-user/owncast
@@ -138,9 +138,8 @@ EGO_SUM=(
go-module_set_globals
SRC_URI="
https://github.com/${PN}/${PN}/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/${PN}/${PN}/releases/download/v${PV}/${P}-linux-64bit.zip
SRC_URI="https://github.com/owncast/owncast/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://github.com/owncast/owncast/releases/download/v${PV}/${P}-linux-64bit.zip
${EGO_SUM_SRC_URI}"
src_unpack() {
@@ -151,41 +150,35 @@ src_unpack() {
# place, but that's hopefully survivable. We need the binary
# package to get the minified CSS file, which is generated using
# NPM by upstream.
cd "${S}"
cp webroot/js/web_modules/tailwindcss/dist/tailwind.min.css "${P}"/webroot/js/web_modules/tailwindcss/dist/tailwind.min.css
cp "${WORKDIR}"/webroot/js/web_modules/tailwindcss/dist/tailwind.min.css "${S}"/webroot/js/web_modules/tailwindcss/dist/tailwind.min.css || die
}
src_compile() {
go build -v -work -x -ldflags \
"-s -w -X main.BuildVersion=${PV} -X main.BuildPlatform=gentoo" \
-o "${PN}" \
"github.com/${PN}/${PN}" || die
-o ${PN} \
github.com/${PN}/${PN} || die
}
src_install() {
dobin "${PN}"
dobin ${PN}
dodoc README.md
newinitd "${FILESDIR}"/"${PN}".initd "${PN}"
newinitd "${FILESDIR}"/${PN}.initd ${PN}
diropts -m 0755 -o owncast -g owncast
insopts -m 0644 -o owncast -g owncast
insinto "/var/lib/${PN}"
dodir /var/lib/${PN}
insinto /var/lib/${PN}
doins -r static webroot
}
pkg_preinst() {
if has_version "${CATEGORY}/${PN}" ; then
upgrading=1
fi
}
pkg_postinst() {
go-module_pkg_postinst
if [[ "${upgrading}" != "1" ]] ; then
if [[ -z "${REPLACING_VERSIONS}" ]] ; then
einfo "The admin interface at http://localhost:8080/admin/"
einfo "has default username 'admin' and password 'abc123'."
einfo "The default stream key is 'abc123'."