# Copyright 2023 Gentoo Authors, projectmoon # 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" ) inherit cargo DESCRIPTION="The native part of the PWAsForFirefox project" HOMEPAGE="https://github.com/filips123/PWAsForFirefox" 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 " LICENSE="MPL-2.0" SLOT="0" KEYWORDS="~amd64" DEPEND="" RDEPEND="${DEPEND}" # Needed as source is in a subdirectory S="${WORKDIR}/PWAsForFirefox-${PV}/native" # 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/" # Patch makefile according to upstream from-source install # instructions. 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 } src_install() { # Upstream uses cargo-make, but this is not packaged in Gentoo, nor # does it support DESTDIR, so portage sandboxes 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 insinto /usr/lib/mozilla/native-messaging-hosts/ newins manifests/linux.json firefoxpwa.json insinto /usr/lib64/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/* }