commit:     83488982f898bc6f78dbba3f427173e84bd11e8d
Author:     Denis Reva <denis7774 <AT> gmail <DOT> com>
AuthorDate: Tue Dec 27 14:20:35 2022 +0000
Commit:     Denis Reva <denis7774 <AT> gmail <DOT> com>
CommitDate: Tue Dec 27 14:20:45 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=83488982

*/*: Added LTO use flag, respecting environment

Closes: https://bugs.gentoo.org/887427
Closes: https://bugs.gentoo.org/887429
Signed-off-by: Denis Reva <denis7774 <AT> gmail.com>

 app-emulation/waydroid/files/waydroid              |  9 +++++
 .../files/quickjs-2021-03-27-respect-env.patch     | 47 ++++++++++++++++++++++
 dev-lang/quickjs/metadata.xml                      |  3 ++
 dev-lang/quickjs/quickjs-2021.03.27.ebuild         | 14 ++++++-
 4 files changed, 72 insertions(+), 1 deletion(-)

diff --git a/app-emulation/waydroid/files/waydroid 
b/app-emulation/waydroid/files/waydroid
new file mode 100644
index 000000000..d9e590592
--- /dev/null
+++ b/app-emulation/waydroid/files/waydroid
@@ -0,0 +1,9 @@
+#!/usr/bin/openrc-run
+description="Waydroid Container Manager"
+start() {
+  waydroid container start &
+}
+stop() {
+  waydroid container stop 
+  waydroid session stop
+}
\ No newline at end of file

diff --git a/dev-lang/quickjs/files/quickjs-2021-03-27-respect-env.patch 
b/dev-lang/quickjs/files/quickjs-2021-03-27-respect-env.patch
new file mode 100644
index 000000000..6c8c68171
--- /dev/null
+++ b/dev-lang/quickjs/files/quickjs-2021-03-27-respect-env.patch
@@ -0,0 +1,47 @@
+diff --git a/Makefile b/Makefile
+index 8fc7e55..03cec93 100644
+--- a/Makefile
++++ b/Makefile
+@@ -28,7 +28,7 @@ endif
+ # Windows cross compilation from Linux
+ #CONFIG_WIN32=y
+ # use link time optimization (smaller and faster executables but slower build)
+-CONFIG_LTO=y
++#CONFIG_LTO=y
+ # consider warnings as errors (for development)
+ #CONFIG_WERROR=y
+ # force 32 bit build for some utilities
+@@ -65,7 +65,7 @@ else
+ endif
+ ifdef CONFIG_CLANG
+   HOST_CC=clang
+-  CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
++  CFLAGS+=-Wall -MMD -MF $(OBJDIR)/$(@F).d
+   CFLAGS += -Wextra
+   CFLAGS += -Wno-sign-compare
+   CFLAGS += -Wno-missing-field-initializers
+@@ -82,7 +82,7 @@ ifdef CONFIG_CLANG
+   endif
+ else
+   HOST_CC=gcc
+-  CFLAGS+=-g -Wall -MMD -MF $(OBJDIR)/$(@F).d
++  CFLAGS+=-Wall -MMD -MF $(OBJDIR)/$(@F).d
+   CFLAGS += -Wno-array-bounds -Wno-format-truncation
+   ifdef CONFIG_LTO
+   else
+@@ -101,11 +101,11 @@ DEFINES+=-D__USE_MINGW_ANSI_STDIO # for standard 
snprintf behavior
+ endif
+ 
+ CFLAGS+=$(DEFINES)
+-CFLAGS_DEBUG=$(CFLAGS) -O0
+-CFLAGS_SMALL=$(CFLAGS) -Os
+-CFLAGS_OPT=$(CFLAGS) -O2
++CFLAGS_DEBUG=$(CFLAGS)
++CFLAGS_SMALL=$(CFLAGS)
++CFLAGS_OPT=$(CFLAGS)
+ CFLAGS_NOLTO:=$(CFLAGS_OPT)
+-LDFLAGS+=-g
++#LDFLAGS+=
+ ifdef CONFIG_LTO
+ CFLAGS_SMALL+=-flto
+ CFLAGS_OPT+=-flto

diff --git a/dev-lang/quickjs/metadata.xml b/dev-lang/quickjs/metadata.xml
index a9444b4d9..1d24ea465 100644
--- a/dev-lang/quickjs/metadata.xml
+++ b/dev-lang/quickjs/metadata.xml
@@ -6,4 +6,7 @@
                <name>Denis Reva</name>
                <description>rarogcmex</description>
        </maintainer>
+       <use>
+               <flag name="lto">Enable Link Time Optimizations (improves 
performance and decreases size of executables)</flag>
+       </use>
 </pkgmetadata>

diff --git a/dev-lang/quickjs/quickjs-2021.03.27.ebuild 
b/dev-lang/quickjs/quickjs-2021.03.27.ebuild
index c787f5c8a..8da61d8ed 100644
--- a/dev-lang/quickjs/quickjs-2021.03.27.ebuild
+++ b/dev-lang/quickjs/quickjs-2021.03.27.ebuild
@@ -14,8 +14,12 @@ S="${WORKDIR}/${MY_P}"
 LICENSE="MIT"
 SLOT="0"
 KEYWORDS="~amd64"
+IUSE="lto"
 
-PATCHES=( "${FILESDIR}/${PN}-2020.11.08_Remove-TTY-check-in-test.patch" )
+PATCHES=(
+       "${FILESDIR}/${PN}-2020.11.08_Remove-TTY-check-in-test.patch"
+       "${FILESDIR}/${PN}-2021-03-27-respect-env.patch"
+       )
 
 src_prepare() {
        sed -i \
@@ -34,3 +38,11 @@ src_prepare() {
 
        default
 }
+
+src_compile() {
+       if use lto; then
+               CONFIG_LTO=$(use lto) emake
+       else
+               emake
+       fi
+}

Reply via email to