commit:     db595876a93d194b2ac98c9e1804d0772edb1635
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Aug  5 08:04:54 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Aug  5 08:04:54 2015 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=db595876

gcc.eselect: add an eselect module

This wraps gcc-config so that people can use the standard eselect
interface to manage gcc profiles.

URL: https://bugs.gentoo.org/507870
Reported-by: Ulrich Müller <ulm <AT> gentoo.org>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 Makefile    |  5 ++++-
 gcc.eselect | 45 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index db14af9..e20f9f8 100644
--- a/Makefile
+++ b/Makefile
@@ -10,12 +10,14 @@ P = $(PN)-$(PV)
 
 PREFIX = $(EPREFIX)/usr
 BINDIR = $(PREFIX)/bin
+ESELECTDIR = $(PREFIX)/share/eselect/modules
 SUBLIBDIR = lib
 LIBDIR = $(PREFIX)/$(SUBLIBDIR)
 LIBEXECDIR = $(LIBDIR)/misc
 
 MKDIR_P = mkdir -p -m 755
 INSTALL_EXE = install -m 755
+INSTALL_DATA = install -m 644
 
 all: .gcc-config wrapper
 
@@ -32,9 +34,10 @@ clean:
        chmod a+rx $@
 
 install: all
-       $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR)
+       $(MKDIR_P) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBEXECDIR) 
$(DESTDIR)$(ESELECTDIR)
        $(INSTALL_EXE) wrapper $(DESTDIR)$(LIBEXECDIR)/$(PN)
        $(INSTALL_EXE) .gcc-config $(DESTDIR)$(BINDIR)/gcc-config
+       $(INSTALL_DATA) gcc.eselect $(DESTDIR)$(ESELECTDIR)
 
 test check: .gcc-config
        cd tests && ./run_tests

diff --git a/gcc.eselect b/gcc.eselect
new file mode 100644
index 0000000..02606dc
--- /dev/null
+++ b/gcc.eselect
@@ -0,0 +1,45 @@
+# -*-eselect-*-  vim: ft=eselect
+# Copyright 2005-2015 Gentoo Foundation
+# Distributed under the terms of the GNU GPL version 2 or later
+
+DESCRIPTION="Manage installed versions of sys-devel/gcc"
+MAINTAINER="toolch...@gentoo.org"
+
+### list action
+
+describe_list() {
+       echo "List all installed version of gcc"
+}
+
+do_list() {
+       gcc-config -l
+}
+
+### set action
+
+describe_set() {
+       echo "Activate one of the installed gcc"
+}
+
+describe_set_parameters() {
+       echo "<target>"
+}
+
+describe_set_options() {
+       echo "target : Target name or number (from 'list' action)"
+}
+
+do_set() {
+       [[ $# -eq 1 ]] || die -q "Please specify exactly one version to 
activate!"
+       gcc-config "$1"
+}
+
+### show action
+
+describe_show() {
+       echo "Print the currently active gcc version"
+}
+
+do_show() {
+       gcc-config -c
+}

Reply via email to