public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-lua/files/, app-eselect/eselect-lua/
@ 2020-09-22  5:33 Vadim Misbakh-Soloviov
  0 siblings, 0 replies; only message in thread
From: Vadim Misbakh-Soloviov @ 2020-09-22  5:33 UTC (permalink / raw
  To: gentoo-commits

commit:     aea12f354eecdb2685bfbc4448cc8755b18fe06f
Author:     Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 22 05:32:05 2020 +0000
Commit:     Vadim Misbakh-Soloviov <mva <AT> gentoo <DOT> org>
CommitDate: Tue Sep 22 05:32:05 2020 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=aea12f35

app-eselect/eselect-lua: update to new version

Package-Manager: Portage-3.0.6, Repoman-3.0.1
Signed-off-by: Vadim Misbakh-Soloviov <mva <AT> gentoo.org>

 app-eselect/eselect-lua/eselect-lua-2.ebuild |  36 ++++++
 app-eselect/eselect-lua/files/lua.eselect-2  | 172 +++++++++++++++++++++++++++
 app-eselect/eselect-lua/metadata.xml         |   4 +
 3 files changed, 212 insertions(+)

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 00000000000..f9013c396ac
--- /dev/null
+++ b/app-eselect/eselect-lua/eselect-lua-2.ebuild
@@ -0,0 +1,36 @@
+# Copyright 1999-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+DESCRIPTION="Lua eselect module"
+HOMEPAGE="https://wiki.gentoo.org/wiki/No_homepage"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sparc ~x86 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
+IUSE=""
+
+DEPEND="
+	!dev-lang/lua:0
+	|| (
+		dev-lang/lua:5.1
+		dev-lang/lua:5.2
+		dev-lang/lua:5.3
+		(
+			dev-lang/luajit:2
+			app-eselect/eselect-luajit
+		)
+	)
+	>=app-admin/eselect-1.2.4
+"
+#		dev-lang/lua:5.4
+# TODO: ^
+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 00000000000..02a942788b9
--- /dev/null
+++ b/app-eselect/eselect-lua/files/lua.eselect-2
@@ -0,0 +1,172 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 2014-2020 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+inherit config multilib
+
+DESCRIPTION="Manage lua symlinks"
+MAINTAINER="mva@gentoo.org"
+
+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
+}
+
+_dup() {
+	dirname ${1}/.
+}
+
+set_symlinks() {
+	local ver=$1
+	ln -s lua${ver} $(_dup "${EROOT}"/usr/bin/lua)
+	ln -s luac${ver} $(_dup "${EROOT}"/usr/bin/luac)
+	for dir in $(get_libdirs) ; do
+		if has 'jit*' ${ver}; then
+			type -p lua${ver} &>/dev/null || die -q "It's something wrong with your lua${ver} installation: it's binary leads to broken symlink"
+			local abi=$(lua${ver} -e 'print(_VERSION:match("%d.%d"))')
+			local libname=libluajit-${abi}.so.${ver##jit-}
+			test -f "${EROOT}/${dir}/${libname}" || die -q "Can't find libluajit for lua${ver} (lua abi: ${abi})"
+			ln -s ${libname} $(_dup "${EROOT}/${dir}"/liblua.so)
+		else
+			ln -s liblua${ver}.so $(_dup "${EROOT}/${dir}"/liblua.so)
+		fi
+		ln -s lua${ver}.pc $(_dup "${EROOT}/${dir}"/pkgconfig/lua.pc)
+	done
+	for manpage in "${EROOT}"/usr/share/man/man1/lua*${ver}.1* ; do
+		test -f ${manpage} &&
+		ln -s $(basename "${manpage}") $(_dup "${manpage//${ver}}")
+	done
+	for header in $HEADER_FILES ; do
+		local hdr;
+		if has 'jit*' ${ver}; then
+			type -p lua${ver} &>/dev/null || die -q "lua${ver} binary is missing (or leads to broken symlink)"
+			local jit_v=$(lua${ver} -e 'print(jit.version:match("%d.%d"))')
+			hdr=luajit-${jit_v}/${header};
+		else
+			hdr=lua${ver}/${header};
+		fi
+		test -f "${EROOT}/usr/include/${hdr}" || die -q "Missing header: ${header}"
+		ln -s "${hdr}" $(_dup "${EROOT}"/usr/include/${header})
+	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
+		[[ -f "${f}" ]] && 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\([\w.-]*\):\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
index c36c37139fa..c4df8c7ed36 100644
--- a/app-eselect/eselect-lua/metadata.xml
+++ b/app-eselect/eselect-lua/metadata.xml
@@ -1,6 +1,10 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
 <pkgmetadata>
+	<maintainer type="person">
+		<email>mva@gentoo.org</email>
+		<name>Vadim Misbakh-Soloviov</name>
+	</maintainer>
 	<maintainer type="person">
 		<email>williamh@gentoo.org</email>
 		<name>William Hubbs</name>


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2020-09-22  5:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-22  5:33 [gentoo-commits] repo/gentoo:master commit in: app-eselect/eselect-lua/files/, app-eselect/eselect-lua/ Vadim Misbakh-Soloviov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox