2023-03-16 19:03:36 +00:00
# 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
2023-03-16 19:03:36 +00:00
# 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"
# Double check the homepage as the cargo_metadata crate
# does not provide this value so instead repository is used
HOMEPAGE = "https://github.com/filips123/PWAsForFirefox"
SRC_URI = "
$( cargo_crate_uris)
https://github.com/filips123/PWAsForFirefox/archive/refs/tags/v${ PV } .zip -> ${ P } .zip
2023-03-16 19:03:36 +00:00
https://git.agnos.is/projectmoon/projectmoon-overlay-files/media/branch/main/www-plugins/firefox-pwa-connector/vendor-2.4.1.tar.gz -> vendor.tar.gz
2023-03-16 09:19:15 +00:00
"
LICENSE = "0BSD Apache-2.0 Apache-2.0-with-LLVM-exceptions BSD BSD-2 Boost-1.0 LGPL-3+ MIT MPL-2.0 Unicode-DFS-2016 Unlicense ZLIB"
SLOT = "0"
KEYWORDS = "~amd64"
DEPEND = ""
RDEPEND = " ${ DEPEND } "
2023-03-16 19:03:36 +00:00
BDEPEND = "dev-util/cargo-make" # from guru
# 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( ) {
2023-03-16 19:03:36 +00:00
# Link vendored cargo deps in.
ln -s " ${ WORKDIR } /vendor/ " * " ${ CARGO_HOME } /gentoo/ "
# Patch makefile according to 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'
2023-03-16 19:03:36 +00:00
sed -i 's/SUDO=$(which sudo) || $(echo "")/SUDO=""/' Makefile.toml
# patch makefile to respect DESTDIR
sed -i 's/\/usr\/bin\/firefoxpwa/$DESTDIR\/usr\/bin\/firefoxpwa/g' Makefile.toml
sed -i 's/\/usr\/libexec\/firefoxpwa-connector/$DESTDIR\/usr\/libexec\/firefoxpwa-connector/g' Makefile.toml
sed -i 's/\/usr\/lib\/mozilla\/native-messaging-hosts\/firefoxpwa.json/$DESTDIR\/usr\/lib\/mozilla\/native-messaging-hosts\/firefoxpwa.json/g' Makefile.toml
sed -i 's/\/usr\/lib64\/mozilla\/native-messaging-hosts\/firefoxpwa.json/$DESTDIR\/usr\/lib64\/mozilla\/native-messaging-hosts\/firefoxpwa.json/g' Makefile.toml
sed -i 's/\/usr\/share\/firefoxpwa\/userchrome/$DESTDIR\/usr\/share\/firefoxpwa\/userchrome/g' Makefile.toml
2023-03-16 09:19:15 +00:00
2023-03-16 19:03:36 +00:00
default
2023-03-16 09:19:15 +00:00
}
src_install( ) {
2023-03-16 19:03:36 +00:00
export DESTDIR = " ${ D } "
2023-03-16 09:19:15 +00:00
makers install
}