commit:     8434ce99066795b5cea05b1b812e75ca87180485
Author:     Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq <DOT> in>
AuthorDate: Sun Apr 14 14:14:30 2024 +0000
Commit:     Julien Roy <julien <AT> jroy <DOT> ca>
CommitDate: Sun Apr 14 14:34:27 2024 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=8434ce99

www-plugins/firefoxpwa: add "static" use-flag

This should be helpful for systems running fresh LibreSSL with outdated
"openssl-sys" crate.

Signed-off-by: Anna (cybertailor) Vyalkova <cyber+gentoo <AT> sysrq.in>

 www-plugins/firefoxpwa/firefoxpwa-2.11.1.ebuild | 52 +++++++++++++++----------
 www-plugins/firefoxpwa/metadata.xml             |  8 ++--
 2 files changed, 36 insertions(+), 24 deletions(-)

diff --git a/www-plugins/firefoxpwa/firefoxpwa-2.11.1.ebuild 
b/www-plugins/firefoxpwa/firefoxpwa-2.11.1.ebuild
index be36afdc9a..981cd2e048 100644
--- a/www-plugins/firefoxpwa/firefoxpwa-2.11.1.ebuild
+++ b/www-plugins/firefoxpwa/firefoxpwa-2.11.1.ebuild
@@ -324,31 +324,30 @@ SRC_URI="
        https://github.com/filips123/PWAsForFirefox/archive/v${PV}.tar.gz -> 
${P}.tar.gz
        ${CARGO_CRATE_URIS}
 "
+S="${WORKDIR}/PWAsForFirefox-${PV}/native"
 
 # Main project license
 LICENSE="MPL-2.0"
-
 # Dependent crate licenses
 LICENSE+=" Apache-2.0 BSD-2 BSD MIT MPL-2.0 Unicode-DFS-2016 ZLIB"
-
 SLOT="0"
 KEYWORDS="~amd64 ~arm ~arm64 ~x86"
-IUSE="lto custom-cflags"
+IUSE="custom-cflags lto static"
 
 # Add app-arch/bzip2 when it finally get pkg-config file
-DEPEND="dev-libs/openssl:="
+DEPEND="!static? ( dev-libs/openssl:= )"
 RDEPEND="${DEPEND}"
 # As Rust produces LLVM IR when using LTO, lld is needed to link. Furthermore,
 # as some crates contain C code, clang should be used to compile them to 
produce
 # compatible IR.
 BDEPEND="
-       virtual/pkgconfig
        lto? (
                !custom-cflags? (
                        sys-devel/clang
                        sys-devel/lld
                )
        )
+       !static? ( virtual/pkgconfig )
 "
 
 QA_FLAGS_IGNORED="
@@ -356,8 +355,6 @@ QA_FLAGS_IGNORED="
        usr/libexec/firefoxpwa-connector
 "
 
-S="${WORKDIR}/PWAsForFirefox-${PV}/native"
-
 src_prepare() {
        default
 
@@ -368,24 +365,35 @@ src_prepare() {
 }
 
 src_configure() {
-       strip-flags
-
+       # Setup toolchain
        export CARGO_PROFILE_RELEASE_LTO=$(usex lto true false)
+       strip-flags
 
        if use lto; then
                if ! use custom-cflags; then
-                       # Fix -flto[=n] not being recognized by clang.
-                       tc-is-gcc && is-flag "-flto=*" && replace-flags 
"-flto=*" "-flto"
                        CC="${CHOST}-clang"
                        CXX="${CHOST}-clang++"
                        RUSTFLAGS="-Clinker=clang -Clink-arg=-fuse-ld=lld 
${RUSTFLAGS}"
+
+                       # Fix -flto[=n] not being recognized by clang.
+                       if tc-is-clang && is-flag "-flto=*"; then
+                               replace-flags "-flto=*" "-flto"
+                       fi
                fi
        else
                filter-lto
        fi
 
-       export PKG_CONFIG_ALLOW_CROSS=1
-       export OPENSSL_NO_VENDOR=1
+       # Ask to use system dependencies
+       if ! use static; then
+               export OPENSSL_NO_VENDOR=1
+               export PKG_CONFIG_ALLOW_CROSS=1
+       fi
+
+       # Configure features
+       local myfeatures=(
+               $(usev static)
+       )
        cargo_src_configure
 }
 
@@ -425,18 +433,22 @@ src_install() {
 }
 
 pkg_postinst() {
-       echo "You have successfully installed the native part of the 
PWAsForFirefox project"
-       echo "You should also install the Firefox extension if you haven't 
already"
-       echo "Download: 
https://addons.mozilla.org/firefox/addon/pwas-for-firefox/";
+       if [[ ! ${REPLACING_VERSIONS} ]]; then
+               elog "You have successfully installed the native part of the 
PWAsForFirefox project."
+               elog "You should also install the Firefox extension if you 
haven't already."
+               elog
+               elog "Download:"
+               elog 
"\thttps://addons.mozilla.org/firefox/addon/pwas-for-firefox/";
+       fi
 
        xdg_pkg_postinst
 }
 
 pkg_postrm() {
-       if [[ ! ${REPLACING_VERSIONS} ]]; then
-               echo "Runtime, profiles and web apps are still installed in 
user directories"
-               echo "You can remove them manually after this package is 
uninstalled"
-               echo "Doing that will remove all installed web apps and their 
data"
+       if [[ ! ${REPLACED_BY_VERSION} ]]; then
+               elog "Runtime, profiles and web apps are still installed in 
user directories."
+               elog "You can remove them manually after this package is 
uninstalled."
+               elog "Doing that will remove all installed web apps and their 
data."
        fi
 
        xdg_pkg_postrm

diff --git a/www-plugins/firefoxpwa/metadata.xml 
b/www-plugins/firefoxpwa/metadata.xml
index b472562d1b..270cd1ba2a 100644
--- a/www-plugins/firefoxpwa/metadata.xml
+++ b/www-plugins/firefoxpwa/metadata.xml
@@ -5,6 +5,10 @@
                <name>John-Henry Lim</name>
                <email>[email protected]</email>
        </maintainer>
+       <maintainer type="person">
+               <name>Anna</name>
+               <email>[email protected]</email>
+       </maintainer>
        <longdescription>
                Progressive Web Apps (PWAs) are web apps that use web APIs and 
features along
                with progressive enhancement strategy to bring a native 
app-like user
@@ -20,10 +24,6 @@
                should also install the browser extension if you haven&apos;t 
already. You can
                download it from 
&lt;https://addons.mozilla.org/firefox/addon/pwas-for-firefox/&gt;.
        </longdescription>
-       <use>
-               <flag name="lto">Enable Link Time Optimization (LTO).</flag>
-               <flag name="custom-cflags">Disable the default use of clang and 
lld with LTO and all other manipulations of CFLAGS. Disabling this may cause 
the build and/or LTO to fail.</flag>
-       </use>
        <upstream>
                <maintainer>
                        <name>Filip Ć tamcar</name>

Reply via email to