commit:     6f0992baf4d8b0e686e0ca86369201da3ed66795
Author:     Vadim A. Misbakh-Soloviov <git <AT> mva <DOT> name>
AuthorDate: Fri Apr  3 16:31:45 2015 +0000
Commit:     Vadim A. Misbakh-Soloviov <mva <AT> mva <DOT> name>
CommitDate: Fri Apr  3 16:31:45 2015 +0000
URL:        https://gitweb.gentoo.org/proj/lua.git/commit/?id=6f0992ba

[dev-lang/luajit] Slotted behaviour, eselect-lua support; 
[app-eselect/eselect-lua] Slotted LuaJIT support

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

 app-eselect/eselect-lua/eselect-lua-2.ebuild |  23 ++++
 app-eselect/eselect-lua/files/lua.eselect-2  | 150 +++++++++++++++++++++++++++
 app-eselect/eselect-lua/metadata.xml         |   9 ++
 dev-lang/luajit/Manifest                     |   2 -
 dev-lang/luajit/luajit-2.0.2.ebuild          | 140 -------------------------
 dev-lang/luajit/luajit-2.0.3.ebuild          | 140 -------------------------
 dev-lang/luajit/luajit-2.0.9999.ebuild       | 109 ++++++++++---------
 dev-lang/luajit/luajit-2.1.9999.ebuild       | 108 +++++++++----------
 8 files changed, 285 insertions(+), 396 deletions(-)

diff --git a/app-eselect/eselect-lua/eselect-lua-2.ebuild 
b/app-eselect/eselect-lua/eselect-lua-2.ebuild
new file mode 100644
index 0000000..fdbcfee
--- /dev/null
+++ b/app-eselect/eselect-lua/eselect-lua-2.ebuild
@@ -0,0 +1,23 @@
+# Copyright 1999-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: 
/var/cvsroot/gentoo-x86/app-admin/eselect-lua/eselect-lua-1.ebuild,v 1.1 
2014/04/22 21:31:35 mabi Exp $
+
+EAPI=5
+
+DESCRIPTION="Lua eselect module"
+HOMEPAGE="http://www.gentoo.org";
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc 
~x86 ~amd64-fbsd ~x86-fbsd ~x86-freebsd ~amd64-linux ~ia64-linux ~x86-linux 
~ppc-macos ~x64-macos ~x86-macos"
+IUSE=""
+
+DEPEND=">=app-admin/eselect-1.2.4"
+RDEPEND="${DEPEND}"
+
+S="${WORKDIR}"
+
+src_install() {
+       insinto /usr/share/eselect/modules/
+       newins "${FILESDIR}"/lua.eselect-${PV} lua.eselect
+}

diff --git a/app-eselect/eselect-lua/files/lua.eselect-2 
b/app-eselect/eselect-lua/files/lua.eselect-2
new file mode 100644
index 0000000..87681e0
--- /dev/null
+++ b/app-eselect/eselect-lua/files/lua.eselect-2
@@ -0,0 +1,150 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 2014-2014 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+inherit config multilib
+
+DESCRIPTION="Manage lua symlinks"
+MAINTAINER="[email protected], [email protected]"
+
+HEADER_FILES="lauxlib.h luaconf.h lua.h lua.hpp lualib.h"
+
+remove_symlinks() {
+       rm -f "${EROOT}"/usr/bin/{lua,luac} &>/dev/null 
+       for dir in $(get_libdirs) ; do
+               rm -f "${EROOT}"${dir}/liblua.so &>/dev/null && \
+               rm -f "${EROOT}"${dir}/pkgconfig/lua.pc &>/dev/null
+       done
+       for f in $HEADER_FILES ; do
+               rm -f "${EROOT}"/usr/include/$f
+       done
+       rm -f "${EROOT}"/usr/share/man/man1/{lua,luac}.1{,.gz,.bz2,.lzma} 
&>/dev/null
+}
+
+set_symlinks() {
+       local ver=$1
+       ln -s "${EROOT}"/usr/bin/lua{$ver,}
+       ln -s "${EROOT}"/usr/bin/luac{$ver,}
+       for dir in $(get_libdirs) ; do
+               ln -s "${dir}"/liblua{$ver,}.so
+               ln -s "${dir}"/pkgconfig/lua{$ver,}.pc
+       done
+       for orig in "${EROOT}"/usr/share/man/man1/lua*$ver.1* ; do
+               ln -s "${orig}" "${orig//$ver}"
+       done
+       for f in $HEADER_FILES ; do
+               ln -s "${EROOT}"/usr/include/lua$ver/$f "${EROOT}"/usr/include
+       done
+}
+
+get_libdirs() {
+       local dir libdirs
+       for dir in $(list_libdirs); do
+               [[ -L ${EROOT}/usr/${dir} ]] && continue
+               ls "${EROOT}"/usr/${dir}/liblua*.* > /dev/null 2>&1 || continue
+
+               libdirs+=' '/usr/${dir}
+       done
+       echo ${libdirs:-/usr/lib}
+}
+
+find_targets() {
+       local dirs
+       local prefix="${EROOT}/usr/bin/lua"
+       for f in ${prefix}{5,jit-2}* ; do
+               dirs="${dirs} ${f##$prefix}"
+       done
+       echo $dirs
+}
+
+resolv_target() {
+       local targets=( $(find_targets) )
+       if is_number $1; then
+               [[ $1 -le ${#targets[@]} && $1 -gt 0 ]] && echo "${targets[ $(( 
$1 - 1 )) ]}"
+       elif has $1 ${targets[@]}; then
+         echo $1
+       fi
+}
+
+get_active_version() {
+       readlink -e "${EROOT}"/usr/bin/lua | sed -ne 
"s:.*/usr/bin/lua\([\d.-]*\):\1:p"
+}
+
+## Actual actions
+
+## set action
+
+describe_set() {
+       echo "Sets the current version of lua"
+}
+
+describe_set_parameters() {
+       echo '<target>'
+}
+
+describe_set_options() {
+       echo 'target:   Target name or number (from "list" action)'
+}
+
+
+do_set() {
+       local target=$(resolv_target $1)
+       if [[ -z "${target}" ]]; then
+         die -q "You need to specify a version"
+       fi
+       remove_symlinks
+       set_symlinks $target
+}
+
+## List action
+
+describe_list() {
+       echo 'Lists available lua versions'
+}
+
+do_list() {
+       local targets
+       local a
+       targets=( $(find_targets) )
+       a=$(get_active_version)
+       for (( i = 0; i < ${#targets[@]}; i++ )) ; do
+               [[ $a == ${targets[i]} ]] && targets[i]=$(highlight_marker 
"${targets[i]}")
+       done
+       write_numbered_list -m '(none found)' "${targets[@]}"
+}
+
+## Show action
+
+describe_show() {
+       echo 'Show the active lua version'
+}
+
+do_show() {
+       get_active_version
+}
+
+## update action
+
+describe_update() {
+       echo 'Automatically update the lua version'
+}
+
+describe_update_options() {
+       echo 'ifunset : Do not override existing implementation'
+}
+
+do_update() {
+       [[ -n ${1} && ! ( ${1} == ifunset || ${1} == '--if-unset' ) ]] && \
+               die -q 'Usage error'
+
+       [[ ( ${1} == ifunset || ${1} == '--if-unset' ) && -n 
$(get_active_version) ]] && \
+               return
+
+       remove_symlinks
+       
+       local targets=( $(find_targets) )
+       if [[ -n ${#targets[@]} ]] ; then
+               local target=${targets[${#targets[@]} - 1]}
+               set_symlinks $target || echo 'Nothing to update'
+       fi
+}

diff --git a/app-eselect/eselect-lua/metadata.xml 
b/app-eselect/eselect-lua/metadata.xml
new file mode 100644
index 0000000..ffbaf99
--- /dev/null
+++ b/app-eselect/eselect-lua/metadata.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd";>
+<pkgmetadata>
+       <maintainer>
+               <email>[email protected]</email>
+       </maintainer>
+       <longdescription lang="en">Lua eselect module</longdescription>
+</pkgmetadata>
+

diff --git a/dev-lang/luajit/Manifest b/dev-lang/luajit/Manifest
deleted file mode 100644
index e506193..0000000
--- a/dev-lang/luajit/Manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-DIST LuaJIT-2.0.2.tar.gz 843031 SHA256 
c05202974a5890e777b181908ac237625b499aece026654d7cc33607e3f46c38 SHA512 
c1afea13ec61a59f37d1f61fc50bcac47208d9d4f0a80689b74e901ad2b34294b6c89a0b4eef54b43f3d2db411660da61b191b0bbfba4ba2f97743a9ee4484e3
 WHIRLPOOL 
cb6e8ee6c5ac2293ca5d5452cda34769d3229e2d4681c0ce3c164659c2d2d781f8474e243747b197c10b3abc116e4145df6f5293317f1db871865f38ecd2b6cd
-DIST LuaJIT-2.0.3.tar.gz 844927 SHA256 
55be6cb2d101ed38acca32c5b1f99ae345904b365b642203194c585d27bebd79 SHA512 
7b3e3de22ac3602299b5918b60801e45a3278e547a15c16fdae7359538d4ada27ba664935d5f97c7409f330c2f8efeaae9ea03415f5e9d5a9d81e022cd5d36e0
 WHIRLPOOL 
1ba759b85048cfd57ebc02cfce477e9ddb327e7d27acd78f93fb2debfbf010a96e7b127324ebf6b81b1f35132f5a0a3a56ffca64fe0e66cba80c28b1cb49b433

diff --git a/dev-lang/luajit/luajit-2.0.2.ebuild 
b/dev-lang/luajit/luajit-2.0.2.ebuild
deleted file mode 100644
index 30252a5..0000000
--- a/dev-lang/luajit/luajit-2.0.2.ebuild
+++ /dev/null
@@ -1,140 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: This ebuild is from Lua overlay; Bumped by mva; $
-
-EAPI="5"
-
-inherit base multilib pax-utils versionator toolchain-funcs flag-o-matic 
check-reqs
-
-MY_PV="$(get_version_component_range 1-3)"
-MY_P="LuaJIT-${MY_PV}"
-if [[ $(get_version_component_range 4) != "" ]]; then
-       HOTFIX="v${PV}"
-       HOTFIX="${HOTFIX/_p/_hotfix}.patch"
-fi
-
-DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
-HOMEPAGE="http://luajit.org/";
-SRC_URI="
-       http://luajit.org/download/${MY_P}.tar.gz
-       ${HOTFIX:+http://luajit.org/download/${HOTFIX}}
-"
-
-LICENSE="MIT"
-SLOT="2"
-KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="debug lua52compat +optimization"
-
-DEPEND=""
-PDEPEND="
-       virtual/lua[luajit]
-"
-
-S="${WORKDIR}/${MY_P}"
-
-HTML_DOCS=( "doc/" )
-
-check_req() {
-       if use optimization; then
-               CHECKREQS_MEMORY="200M"
-               ewarn "Optimized (amalgamated) build wants at least 200MB of 
RAM"
-               ewarn "If you have no such RAM - try to disable 'optimization' 
flag"
-               check-reqs_pkg_${1}
-       fi
-}
-
-pkg_pretend() {
-       check_req pretend
-}
-
-pkg_setup() {
-       check_req setup 
-}
-
-src_prepare() {
-       if [[ -n ${HOTFIX} ]]; then
-               epatch "${DISTDIR}/${HOTFIX}"
-       fi
-
-       # fixing prefix and version
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|/lib|/$(get_libdir)|" \
-               -i Makefile || die "failed to fix prefix in Makefile"
-
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|lib/|$(get_libdir)/|" \
-               -i src/luaconf.h || die "failed to fix prefix in luaconf.h"
-
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|lib/|$(get_libdir)/|" \
-               -i etc/luajit.pc || die "failed to fix prefix in pkg-config 
file"
-
-       use debug && (
-               sed -r \
-                       -e 's/#(CCDEBUG= -g)/\1 -ggdb/' \
-                       -i src/Makefile || die "Failed to enable debug"
-               )
-}
-
-src_compile() {
-       local opt;
-       use optimization && opt="amalg";
-
-       if gcc-fullversion 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
-
-       emake \
-               Q= \
-               HOST_CC="$(tc-getBUILD_CC)" \
-               STATIC_CC="$(tc-getCC)" \
-               DYNAMIC_CC="$(tc-getCC) -fPIC" \
-               TARGET_LD="$(tc-getCC)" \
-               TARGET_AR="$(tc-getAR) rcus" \
-               TARGET_STRIP="true" \
-               XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" \
-               "${opt}"
-}
-
-src_install() {
-       default
-       base_src_install_docs
-
-       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${MY_PV}"
-       dosym "${PN}-${MY_PV}" "/usr/bin/${PN}"
-       dobin "${FILESDIR}/luac.jit"
-}

diff --git a/dev-lang/luajit/luajit-2.0.3.ebuild 
b/dev-lang/luajit/luajit-2.0.3.ebuild
deleted file mode 100644
index 30252a5..0000000
--- a/dev-lang/luajit/luajit-2.0.3.ebuild
+++ /dev/null
@@ -1,140 +0,0 @@
-# Copyright 1999-2013 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: This ebuild is from Lua overlay; Bumped by mva; $
-
-EAPI="5"
-
-inherit base multilib pax-utils versionator toolchain-funcs flag-o-matic 
check-reqs
-
-MY_PV="$(get_version_component_range 1-3)"
-MY_P="LuaJIT-${MY_PV}"
-if [[ $(get_version_component_range 4) != "" ]]; then
-       HOTFIX="v${PV}"
-       HOTFIX="${HOTFIX/_p/_hotfix}.patch"
-fi
-
-DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
-HOMEPAGE="http://luajit.org/";
-SRC_URI="
-       http://luajit.org/download/${MY_P}.tar.gz
-       ${HOTFIX:+http://luajit.org/download/${HOTFIX}}
-"
-
-LICENSE="MIT"
-SLOT="2"
-KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
-IUSE="debug lua52compat +optimization"
-
-DEPEND=""
-PDEPEND="
-       virtual/lua[luajit]
-"
-
-S="${WORKDIR}/${MY_P}"
-
-HTML_DOCS=( "doc/" )
-
-check_req() {
-       if use optimization; then
-               CHECKREQS_MEMORY="200M"
-               ewarn "Optimized (amalgamated) build wants at least 200MB of 
RAM"
-               ewarn "If you have no such RAM - try to disable 'optimization' 
flag"
-               check-reqs_pkg_${1}
-       fi
-}
-
-pkg_pretend() {
-       check_req pretend
-}
-
-pkg_setup() {
-       check_req setup 
-}
-
-src_prepare() {
-       if [[ -n ${HOTFIX} ]]; then
-               epatch "${DISTDIR}/${HOTFIX}"
-       fi
-
-       # fixing prefix and version
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|/lib|/$(get_libdir)|" \
-               -i Makefile || die "failed to fix prefix in Makefile"
-
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|lib/|$(get_libdir)/|" \
-               -i src/luaconf.h || die "failed to fix prefix in luaconf.h"
-
-       sed \
-               -e "s|/usr/local|/usr|" \
-               -e "s|lib/|$(get_libdir)/|" \
-               -i etc/luajit.pc || die "failed to fix prefix in pkg-config 
file"
-
-       use debug && (
-               sed -r \
-                       -e 's/#(CCDEBUG= -g)/\1 -ggdb/' \
-                       -i src/Makefile || die "Failed to enable debug"
-               )
-}
-
-src_compile() {
-       local opt;
-       use optimization && opt="amalg";
-
-       if gcc-fullversion 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
-
-       emake \
-               Q= \
-               HOST_CC="$(tc-getBUILD_CC)" \
-               STATIC_CC="$(tc-getCC)" \
-               DYNAMIC_CC="$(tc-getCC) -fPIC" \
-               TARGET_LD="$(tc-getCC)" \
-               TARGET_AR="$(tc-getAR) rcus" \
-               TARGET_STRIP="true" \
-               XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" \
-               "${opt}"
-}
-
-src_install() {
-       default
-       base_src_install_docs
-
-       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${MY_PV}"
-       dosym "${PN}-${MY_PV}" "/usr/bin/${PN}"
-       dobin "${FILESDIR}/luac.jit"
-}

diff --git a/dev-lang/luajit/luajit-2.0.9999.ebuild 
b/dev-lang/luajit/luajit-2.0.9999.ebuild
index f977eea..c663010 100644
--- a/dev-lang/luajit/luajit-2.0.9999.ebuild
+++ b/dev-lang/luajit/luajit-2.0.9999.ebuild
@@ -4,27 +4,35 @@
 
 EAPI="5"
 
-inherit base multilib pax-utils versionator toolchain-funcs flag-o-matic 
check-reqs git-r3
-
-MY_PV="2.0.2"
+inherit base eutils multilib multilib-minimal portability pax-utils 
toolchain-funcs versionator flag-o-matic check-reqs git-r3
 
 DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
 HOMEPAGE="http://luajit.org/";
 SRC_URI=""
 EGIT_REPO_URI="git://repo.or.cz/luajit-2.0.git"
+SLOT="2.0"
+#EGIT_BRANCH="v${SLOT}"
 
 LICENSE="MIT"
-SLOT="2"
 KEYWORDS=""
-IUSE="debug lua52compat +optimization"
+IUSE="debug valgrind lua52compat +optimization"
+
+RDEPEND="
+       valgrind? ( dev-util/valgrind )
+"
+DEPEND="${RDEPEND}"
 
-DEPEND=""
 PDEPEND="
        virtual/lua[luajit]
 "
 
 HTML_DOCS=( "doc/" )
 
+MULTILIB_WRAPPED_HEADERS=(
+    /usr/include/luajit-${SLOT}/luaconf.h
+)
+
+
 check_req() {
        if use optimization; then
                CHECKREQS_MEMORY="200M"
@@ -45,72 +53,59 @@ pkg_setup() {
 src_prepare(){
        # fixing prefix and version
        sed -r \
-               -e "s|( PREFIX)=.*|\1=/usr|" \
-               -e "s|( MULTILIB)=.*|\1=$(get_libdir)|" \
+               -e 's|(VERSION)=.*|\1=$(MAJVER).$(MINVER)|' \
+               -e 's|(FILE_MAN)=.*|\1='${PN}'-$(VERSION).1|' \
+               -e 's|\$\(MAJVER\)\.\$\(MINVER\)\.\$\(RELVER\)|$(VERSION)|' \
+               -e 's|(INSTALL_PCNAME)=.*|\1='${PN}'-$(VERSION).pc|' \
+               -e 's|( PREFIX)=.*|\1=/usr|' \
                -i Makefile || die "failed to fix prefix in Makefile"
+#              -e "s|( MULTILIB)=.*|\1=$(get_libdir)|" \
+
+
        use debug && (
                sed -r \
                        -e 's/#(CCDEBUG= -g)/\1 -ggdb/' \
                        -i src/Makefile || die "Failed to enable debug"
                )
+       mv "${S}"/etc/${PN}.1 "${S}"/etc/${PN}-${SLOT}.1
+
+       multilib_copy_sources
 }
 
-src_compile() {
-       local opt;
+multilib_src_compile() {
+       local opt xcflags;
        use optimization && opt="amalg";
 
-       if gcc-fullversion 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
+       tc-export CC
+#              STATIC_CC="$(tc-getCC)" \
+#              DYNAMIC_CC="$(tc-getCC) -fPIC" \
+#              TARGET_LD="$(tc-getCC)" \
+#              TARGET_AR="$(tc-getAR) rcus" \
+
+       xcflags=(
+               $(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")
+               $(usex debug "-DLUAJIT_USE_GDBJIT" "")
+               $(usex valgrind "-DLUAJIT_USE_VALGRIND" "")
+               $(usex valgrind "-DLUAJIT_USE_SYSMALLOC" "")
+       )
 
        emake \
                Q= \
-               HOST_CC="$(tc-getBUILD_CC)" \
-               STATIC_CC="$(tc-getCC)" \
-               DYNAMIC_CC="$(tc-getCC) -fPIC" \
-               TARGET_LD="$(tc-getCC)" \
-               TARGET_AR="$(tc-getAR) rcus" \
+               HOST_CC="$(tc-getCC)" \
+               CC="${CC}" \
                TARGET_STRIP="true" \
-               XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" \
-               "${opt}"
+               XCFLAGS="${xcflags[*]}" "${opt}"
 }
 
-src_install() {
-       default
+multilib_src_install() {
+       local lua_abi="5.1";
+       emake DESTDIR="${D}" MULTILIB="$(get_libdir)" install
+
        base_src_install_docs
 
-       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${MY_PV}"
-       dosym "${PN}-${MY_PV}" "/usr/bin/${PN}"
-       dobin "${FILESDIR}/luac.jit"
-}
\ No newline at end of file
+       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${SLOT}"
+       dosym "${PN}-${SLOT}" "/usr/bin/${PN}"
+       dosym "lib${PN}-${lua_abi}.so.${SLOT}" 
"/usr/$(get_libdir)/lib${PN}-${SLOT}.so" 
+       dosym "${PN}-${SLOT}.1" "/usr/share/man/man1/luacjit-${SLOT}.1"
+       newbin "${FILESDIR}/luac.jit" "luacjit-${SLOT}"
+}

diff --git a/dev-lang/luajit/luajit-2.1.9999.ebuild 
b/dev-lang/luajit/luajit-2.1.9999.ebuild
index 1898ded..e1b6393 100644
--- a/dev-lang/luajit/luajit-2.1.9999.ebuild
+++ b/dev-lang/luajit/luajit-2.1.9999.ebuild
@@ -4,20 +4,23 @@
 
 EAPI="5"
 
-inherit base multilib pax-utils versionator toolchain-funcs flag-o-matic 
check-reqs git-r3
-
-MY_PV="2.1.0-alpha"
+inherit base eutils multilib multilib-minimal portability pax-utils 
toolchain-funcs versionator flag-o-matic check-reqs git-r3
 
 DESCRIPTION="Just-In-Time Compiler for the Lua programming language"
 HOMEPAGE="http://luajit.org/";
 SRC_URI=""
 EGIT_REPO_URI="git://repo.or.cz/luajit-2.0.git"
-EGIT_BRANCH="v2.1"
+SLOT="2.1"
+EGIT_BRANCH="v${SLOT}"
 
 LICENSE="MIT"
-SLOT="2"
 KEYWORDS=""
-IUSE="debug lua52compat +optimization"
+IUSE="debug valgrind lua52compat +optimization"
+
+RDEPEND="
+       valgrind? ( dev-util/valgrind )
+"
+DEPEND="${RDEPEND}"
 
 PDEPEND="
        virtual/lua[luajit]
@@ -25,6 +28,11 @@ PDEPEND="
 
 HTML_DOCS=( "doc/" )
 
+MULTILIB_WRAPPED_HEADERS=(
+    /usr/include/luajit-${SLOT}/luaconf.h
+)
+
+
 check_req() {
        if use optimization; then
                CHECKREQS_MEMORY="200M"
@@ -45,73 +53,59 @@ pkg_setup() {
 src_prepare(){
        # fixing prefix and version
        sed -r \
-               -e "s|( PREFIX)=.*|\1=/usr|" \
-               -e "s|( MULTILIB)=.*|\1=$(get_libdir)|" \
+               -e 's|(VERSION)=.*|\1=$(MAJVER).$(MINVER)|' \
+               -e 's|(FILE_MAN)=.*|\1='${PN}'-$(VERSION).1|' \
+               -e 's|\$\(MAJVER\)\.\$\(MINVER\)\.\$\(RELVER\)|$(VERSION)|' \
+               -e 's|(INSTALL_PCNAME)=.*|\1='${PN}'-$(VERSION).pc|' \
+               -e 's|( PREFIX)=.*|\1=/usr|' \
                -i Makefile || die "failed to fix prefix in Makefile"
+#              -e "s|( MULTILIB)=.*|\1=$(get_libdir)|" \
+
 
        use debug && (
                sed -r \
                        -e 's/#(CCDEBUG= -g)/\1 -ggdb/' \
                        -i src/Makefile || die "Failed to enable debug"
                )
+       mv "${S}"/etc/${PN}.1 "${S}"/etc/${PN}-${SLOT}.1
+
+       multilib_copy_sources
 }
 
-src_compile() {
-       local opt;
+multilib_src_compile() {
+       local opt xcflags;
        use optimization && opt="amalg";
 
-       if gcc-fullversion 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
+       tc-export CC
+#              STATIC_CC="$(tc-getCC)" \
+#              DYNAMIC_CC="$(tc-getCC) -fPIC" \
+#              TARGET_LD="$(tc-getCC)" \
+#              TARGET_AR="$(tc-getAR) rcus" \
+
+       xcflags=(
+               $(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")
+               $(usex debug "-DLUAJIT_USE_GDBJIT" "")
+               $(usex valgrind "-DLUAJIT_USE_VALGRIND" "")
+               $(usex valgrind "-DLUAJIT_USE_SYSMALLOC" "")
+       )
 
        emake \
                Q= \
-               HOST_CC="$(tc-getBUILD_CC)" \
-               STATIC_CC="$(tc-getCC)" \
-               DYNAMIC_CC="$(tc-getCC) -fPIC" \
-               TARGET_LD="$(tc-getCC)" \
-               TARGET_AR="$(tc-getAR) rcus" \
+               HOST_CC="$(tc-getCC)" \
+               CC="${CC}" \
                TARGET_STRIP="true" \
-               XCFLAGS="$(usex lua52compat "-DLUAJIT_ENABLE_LUA52COMPAT" "")" \
-               "${opt}"
+               XCFLAGS="${xcflags[*]}" "${opt}"
 }
 
-src_install() {
-       default
+multilib_src_install() {
+       local lua_abi="5.1";
+       emake DESTDIR="${D}" MULTILIB="$(get_libdir)" install
+
        base_src_install_docs
 
-       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${MY_PV}"
-       dosym "${PN}-${MY_PV}" "/usr/bin/${PN}"
-       dobin "${FILESDIR}/luac.jit"
-}
\ No newline at end of file
+       host-is-pax && pax-mark m "${ED}usr/bin/${PN}-${SLOT}"
+       dosym "${PN}-${SLOT}" "/usr/bin/${PN}"
+       dosym "lib${PN}-${lua_abi}.so.${SLOT}" 
"/usr/$(get_libdir)/lib${PN}-${SLOT}.so" 
+       dosym "${PN}-${SLOT}.1" "/usr/share/man/man1/luacjit-${SLOT}.1"
+       newbin "${FILESDIR}/luac.jit" "luacjit-${SLOT}"
+}

Reply via email to