public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Vadim A. Misbakh-Soloviov" <mva@mva.name>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/lua:master commit in: dev-lang/luajit/
Date: Sun, 26 May 2013 22:01:59 +0000 (UTC)	[thread overview]
Message-ID: <1369605701.e56daa8f6ad249645ad73ed48d8e04b13b883fec.mva@gentoo> (raw)

commit:     e56daa8f6ad249645ad73ed48d8e04b13b883fec
Author:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
AuthorDate: Sun May 26 22:01:41 2013 +0000
Commit:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
CommitDate: Sun May 26 22:01:41 2013 +0000
URL:        http://git.overlays.gentoo.org/gitweb/?p=proj/lua.git;a=commit;h=e56daa8f

[dev-lang/luajit] added lua52compat useflag + rare-case compilation failure fix

Signed-off-by: Vadim A. Misbakh-Soloviov <mva <AT> mva.name>

---
 dev-lang/luajit/luajit-2.0.1.ebuild |   43 ++++++++++++++++++++++++++++++---
 dev-lang/luajit/luajit-9999.ebuild  |   45 +++++++++++++++++++++++++++++++----
 2 files changed, 79 insertions(+), 9 deletions(-)

diff --git a/dev-lang/luajit/luajit-2.0.1.ebuild b/dev-lang/luajit/luajit-2.0.1.ebuild
index 2c71761..fe44275 100644
--- a/dev-lang/luajit/luajit-2.0.1.ebuild
+++ b/dev-lang/luajit/luajit-2.0.1.ebuild
@@ -4,7 +4,7 @@
 
 EAPI="5"
 
-inherit eutils multilib check-reqs pax-utils
+inherit eutils multilib flag-o-matic check-reqs pax-utils
 
 MY_P="LuaJIT-${PV/_/-}"
 DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
@@ -17,9 +17,6 @@ LICENSE="MIT"
 SLOT="2"
 IUSE="emacs +optimization +interactive"
 
-#CDEPEND="
-#		|| ( =dev-lang/lua-headers-5.1* dev-lang/lua )
-#"
 DEPEND="
 	${CDEPEND}
 	emacs? ( app-emacs/lua-mode )
@@ -56,6 +53,10 @@ src_prepare(){
 		-e "s|lib/|$(get_libdir)/|" \
 		-i src/luaconf.h || die "failed to fix prefix in luaconf.h"
 
+	use lua52compat && sed \
+		-e "/LUAJIT_ENABLE_LUA52COMPAT/s|#||" \
+		-i src/Makefile || die
+
 	# removing strip
 	sed -e '/$(Q)$(TARGET_STRIP)/d' -i src/Makefile \
 		|| die "failed to remove forced strip"
@@ -67,6 +68,40 @@ src_prepare(){
 }
 
 src_compile() {
+	if has_version '=sys-devel/gcc-4.7.3' && gcc-specs-pie && has ccache ${FEATURES}; then
+		# It is three ways to avoid compilation breaking
+		# in case, when user use gcc-4.7.3+pie+ccache:
+		# a) append -fPIC to CFLAGS, to use it even for temporary
+		# build-time only static host/* bins and luajit binary itself.
+		# b) append -nopie to LDFLAGS
+		#    (for same binaries and same reason)
+		# c) disable ccache (even in per-package basis).
+		#    This will slow down amalgamated build, but is prefered and
+		#    recommended by upstream method.
+		# So, since it is impossible to use method "c" directly from
+		# ebuild, I choose method "a"
+		# (since it is more secure on hardened systems, imho) +
+		# + ewarn user, that he really should disable ccache.
+
+#	       append-ldflags -nopie
+		append-cflags -fPIC
+		ewarn "As we detected, that you're using gcc-4.7.3+pie+ccache,"
+		ewarn "we need to either:"
+		ewarn "  a) add -fPIC to CFLAGS, or"
+		ewarn "  b) add -nopie to LDFLAGS, or"
+		ewarn "  c) disable ccache (even on per-package basis)."
+		ewarn ""
+		ewarn "We suggest you to use variant 'c' and disable it via"
+		ewarn "/etc/portage/{,package.}env (read portage manual)"
+		ewarn ""
+		ewarn "But, since we can't do that from ebuild, we'll continue"
+		ewarn "with -fPIC (variant 'a') for now, since it gives more security"
+		ewarn "on hardened systems (in our opinion)."
+		ewarn ""
+		ewarn "But, anyway, we still *HIGHLY* recommend you"
+		ewarn "to disable ccache instead."
+	fi
+
 	if use optimization; then
 		emake amalg || die "emake failed!"
 	else

diff --git a/dev-lang/luajit/luajit-9999.ebuild b/dev-lang/luajit/luajit-9999.ebuild
index dfeaf1c..bda8a63 100644
--- a/dev-lang/luajit/luajit-9999.ebuild
+++ b/dev-lang/luajit/luajit-9999.ebuild
@@ -4,7 +4,7 @@
 
 EAPI="5"
 
-inherit eutils multilib check-reqs pax-utils git-2
+inherit eutils multilib flag-o-matic check-reqs pax-utils git-2
 
 DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
 HOMEPAGE="http://luajit.org/"
@@ -14,11 +14,8 @@ EGIT_REPO_URI="http://luajit.org/git/luajit-2.0.git"
 LICENSE="MIT"
 SLOT="2"
 KEYWORDS=""
-IUSE="emacs +optimization +interactive"
+IUSE="emacs +optimization +interactive lua52compat"
 
-#CDEPEND="
-#		|| ( =dev-lang/lua-headers-5.1* dev-lang/lua )
-#"
 DEPEND="
 	${CDEPEND}
 	emacs? ( app-emacs/lua-mode )
@@ -53,6 +50,10 @@ src_prepare(){
 		-e "s|lib/|$(get_libdir)/|" \
 		-i src/luaconf.h || die "failed to fix prefix in luaconf.h"
 
+	use lua52compat && sed \
+		-e "/LUAJIT_ENABLE_LUA52COMPAT/s|#||" \
+		-i src/Makefile || die
+
 	# removing strip
 	sed -e '/$(Q)$(TARGET_STRIP)/d' -i src/Makefile \
 		|| die "failed to remove forced strip"
@@ -62,6 +63,40 @@ src_prepare(){
 }
 
 src_compile() {
+	if has_version '=sys-devel/gcc-4.7.3' && gcc-specs-pie && has ccache ${FEATURES}; then
+		# It is three ways to avoid compilation breaking
+		# in case, when user use gcc-4.7.3+pie+ccache:
+		# a) append -fPIC to CFLAGS, to use it even for temporary
+		# build-time only static host/* bins and luajit binary itself.
+		# b) append -nopie to LDFLAGS
+		#    (for same binaries and same reason)
+		# c) disable ccache (even in per-package basis).
+		#    This will slow down amalgamated build, but is prefered and
+		#    recommended by upstream method.
+		# So, since it is impossible to use method "c" directly from
+		# ebuild, I choose method "a"
+		# (since it is more secure on hardened systems, imho) +
+		# + ewarn user, that he really should disable ccache.
+
+#		append-ldflags -nopie
+		append-cflags -fPIC
+		ewarn "As we detected, that you're using gcc-4.7.3+pie+ccache,"
+		ewarn "we need to either:"
+		ewarn "  a) add -fPIC to CFLAGS, or"
+		ewarn "  b) add -nopie to LDFLAGS, or"
+		ewarn "  c) disable ccache (even on per-package basis)."
+		ewarn ""
+		ewarn "We suggest you to use variant 'c' and disable it via"
+		ewarn "/etc/portage/{,package.}env (read portage manual)"
+		ewarn ""
+		ewarn "But, since we can't do that from ebuild, we'll continue"
+		ewarn "with -fPIC (variant 'a') for now, since it gives more security"
+		ewarn "on hardened systems (in our opinion)."
+		ewarn ""
+		ewarn "But, anyway, we still *HIGHLY* recommend you"
+		ewarn "to disable ccache instead."
+	fi
+
 	if use optimization; then
 		emake amalg || die "emake failed!"
 	else


             reply	other threads:[~2013-05-26 22:02 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-26 22:01 Vadim A. Misbakh-Soloviov [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-07-14 15:49 [gentoo-commits] proj/lua:master commit in: dev-lang/luajit/ Vadim A. Misbakh-Soloviov
2017-11-02  7:21 Vadim A. Misbakh-Soloviov
2017-11-01 11:43 Vadim A. Misbakh-Soloviov
2017-11-01  7:58 Vadim A. Misbakh-Soloviov
2016-04-30  6:51 Vadim A. Misbakh-Soloviov
2015-10-31 23:52 Vadim A. Misbakh-Soloviov
2015-06-08  6:52 Vadim A. Misbakh-Soloviov
2015-06-08  6:26 Vadim A. Misbakh-Soloviov
2015-04-07  3:45 Vadim A. Misbakh-Soloviov
2015-04-04 12:07 Vadim A. Misbakh-Soloviov
2015-04-04 12:02 Vadim A. Misbakh-Soloviov
2014-06-16 15:32 Vadim A. Misbakh-Soloviov
2014-01-21 20:15 Vadim A. Misbakh-Soloviov
2013-12-29 12:13 Vadim A. Misbakh-Soloviov
2013-12-18 18:27 Vadim A. Misbakh-Soloviov
2013-12-18 11:58 Vadim A. Misbakh-Soloviov
2013-05-27 20:30 Vadim A. Misbakh-Soloviov
2013-05-27 19:42 Vadim A. Misbakh-Soloviov
2013-05-27 18:49 Vadim A. Misbakh-Soloviov
2013-05-27 18:35 Vadim A. Misbakh-Soloviov
2013-05-27  7:52 Vadim A. Misbakh-Soloviov
2013-05-26  8:31 Vadim A. Misbakh-Soloviov
2013-05-10  8:53 Vadim A. Misbakh-Soloviov
2013-03-19  7:31 Vadim A. Misbakh-Soloviov
2012-08-08 20:38 Misbakh-Soloviev Vadim A.
2012-08-08 13:01 Misbakh-Soloviev Vadim A.
2012-08-08 12:39 Misbakh-Soloviev Vadim A.
2012-08-08 12:32 Misbakh-Soloviev Vadim A.
2012-07-13 18:27 Misbakh-Soloviev Vadim A.
2012-07-13  2:31 Misbakh-Soloviev Vadim A.
2012-07-13  1:55 Misbakh-Soloviev Vadim A.
2012-07-12 22:46 Misbakh-Soloviev Vadim A.
2012-05-09  5:48 Misbakh-Soloviev Vadim A.

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1369605701.e56daa8f6ad249645ad73ed48d8e04b13b883fec.mva@gentoo \
    --to=mva@mva.name \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox