diff options
author | 2018-06-26 20:46:03 -0500 | |
---|---|---|
committer | 2018-06-26 20:46:03 -0500 | |
commit | cad2582ec45f28ead97a2cbba1fd2d20327cb22f (patch) | |
tree | 5a4acc8f3e197541acea197036a637f4c7cad77f | |
parent | removed slotted luajit, as there is no eselect-luajit package (yet) (diff) | |
download | ag-ops-cad2582ec45f28ead97a2cbba1fd2d20327cb22f.tar.gz ag-ops-cad2582ec45f28ead97a2cbba1fd2d20327cb22f.tar.bz2 ag-ops-cad2582ec45f28ead97a2cbba1fd2d20327cb22f.zip |
added `app-eselect/eselect-luajit`
-rw-r--r-- | app-eselect/eselect-luajit/eselect-luajit-1.ebuild | 22 | ||||
-rw-r--r-- | app-eselect/eselect-luajit/files/luajit.eselect-1 | 149 | ||||
-rw-r--r-- | app-eselect/eselect-luajit/metadata.xml | 11 |
3 files changed, 182 insertions, 0 deletions
diff --git a/app-eselect/eselect-luajit/eselect-luajit-1.ebuild b/app-eselect/eselect-luajit/eselect-luajit-1.ebuild new file mode 100644 index 0000000..20d8ad7 --- /dev/null +++ b/app-eselect/eselect-luajit/eselect-luajit-1.ebuild @@ -0,0 +1,22 @@ +# Copyright 1999-2017 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +EAPI=5 + +DESCRIPTION="Luajit eselect module" +HOMEPAGE="https://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 ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris" +IUSE="" + +DEPEND=">=app-admin/eselect-1.2.4" +RDEPEND="${DEPEND}" + +S="${WORKDIR}" + +src_install() { + insinto /usr/share/eselect/modules/ + newins "${FILESDIR}"/luajit.eselect-${PV} luajit.eselect +} diff --git a/app-eselect/eselect-luajit/files/luajit.eselect-1 b/app-eselect/eselect-luajit/files/luajit.eselect-1 new file mode 100644 index 0000000..aff487b --- /dev/null +++ b/app-eselect/eselect-luajit/files/luajit.eselect-1 @@ -0,0 +1,149 @@ +# -*-eselect-*- vim: ft=eselect +# Copyright 2014-2015 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +inherit config multilib + +DESCRIPTION="Manage luajit symlinks" +MAINTAINER="ilmostro7@gmail.com" + +HEADER_FILES="lauxlib.h luaconf.h lua.h lua.hpp luajit.h lualib.h" + +remove_symlinks() { + unlink "${EROOT}"/usr/bin/{luajit} &>/dev/null + for dir in $(get_libdirs) ; do + unlink "${EROOT}"${dir}/libluajit.so &>/dev/null && \ + unlink "${EROOT}"${dir}/pkgconfig/luajit.pc &>/dev/null + done + for f in $HEADER_FILES ; do + unlink "${EROOT}"/usr/include/$f + done + unlink "${EROOT}"/usr/share/man/man1/{luajit}.1{,.gz,.bz2,.lzma} &>/dev/null +} + +set_symlinks() { + local ver=$1 + ln -s "${EROOT}"/usr/bin/luajit{$ver,} + for dir in $(get_libdirs) ; do + ln -s "${dir}"/libluajit{$ver,}.so + ln -s "${dir}"/pkgconfig/luajit{$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/luajit$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}/libluajit*.* > /dev/null 2>&1 || continue + + libdirs+=' '${EPREFIX}/usr/${dir} + done + echo ${libdirs:-${EPREFIX}/usr/lib} +} + +find_targets() { + local dirs + local prefix="${EROOT}/usr/bin/luajit" + for f in ${prefix}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/luajit | sed -ne "s:.*/usr/bin/lua\([\d.-]*\):\1:p" +} + +## Actual actions + +## set action + +describe_set() { + echo "Sets the current version of luajit" +} + +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 luajit 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 luajit version' +} + +do_show() { + get_active_version +} + +## update action + +describe_update() { + echo 'Automatically update the luajit 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-luajit/metadata.xml b/app-eselect/eselect-luajit/metadata.xml new file mode 100644 index 0000000..957e568 --- /dev/null +++ b/app-eselect/eselect-luajit/metadata.xml @@ -0,0 +1,11 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd"> +<pkgmetadata> + <maintainer type="person"> + <email>ilmostro7@gmail.com</email> + <name>ILMostro</name> + </maintainer> + <longdescription lang="en"> + Luajit eselect module + </longdescription> +</pkgmetadata> |