aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Reva <denis7774@gmail.com>2022-12-27 19:20:35 +0500
committerDenis Reva <denis7774@gmail.com>2022-12-27 19:20:45 +0500
commit83488982f898bc6f78dbba3f427173e84bd11e8d (patch)
treea6894bd9d70bec6cd0a3a8866f4082250a0958e6 /dev-lang
parentdev-lang/quickjs: unorphaned (diff)
downloadguru-83488982f898bc6f78dbba3f427173e84bd11e8d.tar.gz
guru-83488982f898bc6f78dbba3f427173e84bd11e8d.tar.bz2
guru-83488982f898bc6f78dbba3f427173e84bd11e8d.zip
*/*: Added LTO use flag, respecting environment
Closes: https://bugs.gentoo.org/887427 Closes: https://bugs.gentoo.org/887429 Signed-off-by: Denis Reva <denis7774@gmail.com>
Diffstat (limited to 'dev-lang')
-rw-r--r--dev-lang/quickjs/files/quickjs-2021-03-27-respect-env.patch47
-rw-r--r--dev-lang/quickjs/metadata.xml3
-rw-r--r--dev-lang/quickjs/quickjs-2021.03.27.ebuild14
3 files changed, 63 insertions, 1 deletions
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
+}