projectmoon-overlay/www-plugins/firefox-pwa-connector/firefox-pwa-connector-2.4.1...

76 lines
2.4 KiB
Bash
Raw Normal View History

# Copyright 2023 Gentoo Authors, projectmoon
2023-03-16 09:19:15 +00:00
# Distributed under the terms of the GNU General Public License v2
EAPI=8
# Empty because of vendor tarball.
CRATES=" "
# This is apparently necessary even with vendor tarball?
declare -A GIT_CRATES=(
[data-url]="https://github.com/filips123/rust-url;0032b9e8328f1a7ce2773f71adf316542ee8ddc9;rust-url-%commit%/data-url"
[web_app_manifest]="https://github.com/filips123/WebAppManifestRS;89ee187e6300bbd2d6f773651a4fcc07e4e7ede6;WebAppManifestRS-%commit%/"
[mime]="https://github.com/filips123/mime;57416f447a10c3343df7fe80deb0ae8a7c77cf0a"
)
2023-03-16 09:19:15 +00:00
inherit cargo
DESCRIPTION="The native part of the PWAsForFirefox project"
HOMEPAGE="https://github.com/filips123/PWAsForFirefox"
RESTRICT="mirror"
2023-03-16 09:19:15 +00:00
SRC_URI="
$(cargo_crate_uris)
https://github.com/filips123/PWAsForFirefox/archive/refs/tags/v${PV}.tar.gz -> ${P}.tar.gz
https://git.agnos.is/projectmoon/projectmoon-overlay-files/media/branch/main/www-plugins/firefox-pwa-connector/vendor-${PV}.tar.gz -> vendor.tar.gz
2023-03-16 09:19:15 +00:00
"
LICENSE="MPL-2.0"
2023-03-16 09:19:15 +00:00
SLOT="0"
KEYWORDS="~amd64"
DEPEND=""
RDEPEND="${DEPEND}"
# Needed as source is in a subdirectory
S="${WORKDIR}/PWAsForFirefox-${PV}/native"
2023-03-16 09:19:15 +00:00
# rust does not use *FLAGS from make.conf, silence portage warning
# update with proper path to binaries this crate installs, omit leading /
QA_FLAGS_IGNORED="usr/bin/${PN}"
src_prepare() {
# Link vendored cargo deps in.
ln -s "${WORKDIR}/vendor/"* "${CARGO_HOME}/gentoo/"
2023-03-16 21:31:57 +00:00
# Patch files according to upstream from-source install
# instructions.
2023-03-16 09:19:15 +00:00
sed -i "s/version = \"0.0.0\"/version = \"${PV}\"/g" Cargo.toml \
|| die 'could not set Cargo.toml version'
sed -i "s/DISTRIBUTION_VERSION = '0.0.0'/DISTRIBUTION_VERSION = '${PV}'/g" \
"${S}"/userchrome/profile/chrome/pwa/chrome.jsm || die 'could not set chrome.jsm version'
default
2023-03-16 09:19:15 +00:00
}
src_install() {
# Upstream uses cargo-make, but this is not packaged in Gentoo, nor
2023-03-16 21:31:37 +00:00
# does it support DESTDIR, so portage sandbox violations occur. The
# makefile installation instructions are very simple, so replicate
# them here.
# Actual binaries
into /usr
dobin target/release/firefoxpwa
exeinto /usr/libexec/
doexe target/release/firefoxpwa-connector
# Install native messaging host
2023-03-16 21:31:37 +00:00
insinto /usr/$(get_libdir)/mozilla/native-messaging-hosts/
newins manifests/linux.json firefoxpwa.json
# Copy the userchrome directory to the correct location
insinto /usr/share/firefoxpwa/userchrome/
doins -r userchrome/*
2023-03-16 09:19:15 +00:00
}