commit:     94142d520baf78952a385c000142a38c28fa499b
Author:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
AuthorDate: Thu Jul 14 11:29:52 2022 +0000
Commit:     Bernard Cafarelli <voyageur <AT> gentoo <DOT> org>
CommitDate: Thu Jul 14 11:49:12 2022 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=94142d52

app-misc/razertool: switch to udev eclass

Also move to configure.ac, clean patches from sed, EAPI bump

Closes: https://bugs.gentoo.org/854768
Signed-off-by: Bernard Cafarelli <voyageur <AT> gentoo.org>

 app-misc/razertool/files/razertool-0.0.7-ar.patch  |  11 --
 .../files/razertool-0.0.7-configure.patch          | 212 +++++++++++++++++++++
 .../razertool/files/razertool-0.0.7-rules.patch    |   8 +
 ...l-0.0.7-r4.ebuild => razertool-0.0.7-r5.ebuild} |  29 ++-
 4 files changed, 233 insertions(+), 27 deletions(-)

diff --git a/app-misc/razertool/files/razertool-0.0.7-ar.patch 
b/app-misc/razertool/files/razertool-0.0.7-ar.patch
deleted file mode 100644
index b585205b1b92..000000000000
--- a/app-misc/razertool/files/razertool-0.0.7-ar.patch
+++ /dev/null
@@ -1,11 +0,0 @@
-diff -Naur razertool-0.0.7.orig/configure.in razertool-0.0.7/configure.in
---- razertool-0.0.7.orig/configure.in  2006-08-13 21:57:35.000000000 +0200
-+++ razertool-0.0.7/configure.in       2020-09-03 12:53:51.991020189 +0200
-@@ -10,6 +10,7 @@
- dnl checks for programs
- AC_ISC_POSIX
- AC_PROG_CC
-+AM_PROG_AR
- AM_PROG_CC_STDC
- AC_PROG_RANLIB
- AC_HEADER_STDC

diff --git a/app-misc/razertool/files/razertool-0.0.7-configure.patch 
b/app-misc/razertool/files/razertool-0.0.7-configure.patch
new file mode 100644
index 000000000000..3fed676a28b3
--- /dev/null
+++ b/app-misc/razertool/files/razertool-0.0.7-configure.patch
@@ -0,0 +1,212 @@
+diff -Naur razertool-0.0.7.orig/configure.ac razertool-0.0.7/configure.ac
+--- razertool-0.0.7.orig/configure.ac  1970-01-01 01:00:00.000000000 +0100
++++ razertool-0.0.7/configure.ac       2022-07-14 13:28:37.682934002 +0200
+@@ -0,0 +1,68 @@
++dnl Process this file with autoconf to produce a configure script.
++
++AC_INIT(configure.ac)
++AM_INIT_AUTOMAKE(razertool, 0.0.7)
++AM_CONFIG_HEADER(config.h)
++AM_MAINTAINER_MODE
++
++AC_ARG_ENABLE(gtk,[AS_HELP_STRING([--disable-gtk],[Don\'t build 
razertool-gtk])],[enable_gtk_force=yes],[enable_gtk_force=no;enable_gtk=yes])
++
++dnl checks for programs
++AC_ISC_POSIX
++AC_PROG_CC
++AM_PROG_AR
++AM_PROG_CC_STDC
++AC_PROG_RANLIB
++AC_HEADER_STDC
++PKG_PROG_PKG_CONFIG
++
++dnl checks for libraries
++PKG_CHECK_MODULES(libusb, [libusb >= 0.1.0])
++
++if test x$enable_gtk = xyes; then
++pkg_modules="gtk+-2.0 >= 2.8.0 librsvg-2.0 >= 2.0.0 cairo >= 1.0.0"
++PKG_CHECK_MODULES(GTKLIBS,[$pkg_modules],,[
++      AC_MSG_RESULT([no])
++      AC_MSG_WARN([
++Package requirements ($pkg_modules) were not met:
++
++$GTKLIBS_PKG_ERRORS
++
++Consider adjusting the PKG_CONFIG_PATH environment variable if you
++installed software in a non-standard prefix.
++
++Alternatively, you may set the environment variables GTKLIBS_CFLAGS
++and GTKLIBS_LIBS to avoid the need to call pkg-config.
++See the pkg-config man page for more details.
++])
++      if test x$enable_gtk_force = xyes; then
++              AC_MSG_ERROR([Aborting since --enable-gtk was used])
++      fi
++      AC_MSG_WARN([Not building razertool-gtk])
++      enable_gtk=no
++])
++fi
++
++dnl i18n
++GETTEXT_PACKAGE=razertool-gtk
++AC_SUBST(GETTEXT_PACKAGE)
++
++ALL_LINGUAS=`cat "${srcdir}/po/LINGUAS"`
++AM_GLIB_GNU_GETTEXT
++
++dnl output
++AM_CONDITIONAL(BUILD_GTK,test x$enable_gtk = xyes)
++
++AC_SUBST(libusb_CFLAGS)
++AC_SUBST(libusb_LIBS)
++AC_SUBST(GTKLIBS_CFLAGS)
++AC_SUBST(GTKLIBS_LIBS)
++
++AC_OUTPUT([Makefile src/Makefile gtk/Makefile po/Makefile.in])
++
++if test x$enable_gtk_force != xyes && test x$enable_gtk != xyes; then
++AC_MSG_WARN([
++
++*** NOT BUILDING RAZERTOOL-GTK ***
++])
++fi
+diff -Naur razertool-0.0.7.orig/configure.in razertool-0.0.7/configure.in
+--- razertool-0.0.7.orig/configure.in  2006-08-13 21:57:35.000000000 +0200
++++ razertool-0.0.7/configure.in       1970-01-01 01:00:00.000000000 +0100
+@@ -1,67 +0,0 @@
+-dnl Process this file with autoconf to produce a configure script.
+-
+-AC_INIT(configure.in)
+-AM_INIT_AUTOMAKE(razertool, 0.0.7)
+-AM_CONFIG_HEADER(config.h)
+-AM_MAINTAINER_MODE
+-
+-AC_ARG_ENABLE(gtk,[AS_HELP_STRING([--disable-gtk],[Don\'t build 
razertool-gtk])],[enable_gtk_force=yes],[enable_gtk_force=no;enable_gtk=yes])
+-
+-dnl checks for programs
+-AC_ISC_POSIX
+-AC_PROG_CC
+-AM_PROG_CC_STDC
+-AC_PROG_RANLIB
+-AC_HEADER_STDC
+-PKG_PROG_PKG_CONFIG
+-
+-dnl checks for libraries
+-PKG_CHECK_MODULES(libusb, [libusb >= 0.1.0])
+-
+-if test x$enable_gtk = xyes; then
+-pkg_modules="gtk+-2.0 >= 2.8.0 librsvg-2.0 >= 2.0.0 cairo >= 1.0.0"
+-PKG_CHECK_MODULES(GTKLIBS,[$pkg_modules],,[
+-      AC_MSG_RESULT([no])
+-      AC_MSG_WARN([
+-Package requirements ($pkg_modules) were not met:
+-
+-$GTKLIBS_PKG_ERRORS
+-
+-Consider adjusting the PKG_CONFIG_PATH environment variable if you
+-installed software in a non-standard prefix.
+-
+-Alternatively, you may set the environment variables GTKLIBS_CFLAGS
+-and GTKLIBS_LIBS to avoid the need to call pkg-config.
+-See the pkg-config man page for more details.
+-])
+-      if test x$enable_gtk_force = xyes; then
+-              AC_MSG_ERROR([Aborting since --enable-gtk was used])
+-      fi
+-      AC_MSG_WARN([Not building razertool-gtk])
+-      enable_gtk=no
+-])
+-fi
+-
+-dnl i18n
+-GETTEXT_PACKAGE=razertool-gtk
+-AC_SUBST(GETTEXT_PACKAGE)
+-
+-ALL_LINGUAS=`cat "${srcdir}/po/LINGUAS"`
+-AM_GLIB_GNU_GETTEXT
+-
+-dnl output
+-AM_CONDITIONAL(BUILD_GTK,test x$enable_gtk = xyes)
+-
+-AC_SUBST(libusb_CFLAGS)
+-AC_SUBST(libusb_LIBS)
+-AC_SUBST(GTKLIBS_CFLAGS)
+-AC_SUBST(GTKLIBS_LIBS)
+-
+-AC_OUTPUT([Makefile src/Makefile gtk/Makefile po/Makefile.in])
+-
+-if test x$enable_gtk_force != xyes && test x$enable_gtk != xyes; then
+-AC_MSG_WARN([
+-
+-*** NOT BUILDING RAZERTOOL-GTK ***
+-])
+-fi
+diff -Naur razertool-0.0.7.orig/gtk/Makefile.in razertool-0.0.7/gtk/Makefile.in
+--- razertool-0.0.7.orig/gtk/Makefile.in       2007-02-15 07:55:23.000000000 
+0100
++++ razertool-0.0.7/gtk/Makefile.in    2022-07-14 13:27:46.765830454 +0200
+@@ -1,5 +1,5 @@
+ # Makefile.in generated by automake 1.9.6 from Makefile.am.
+-# @configure_input@
++# @configure.acput@
+ 
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ # 2003, 2004, 2005  Free Software Foundation, Inc.
+@@ -40,7 +40,7 @@
+ subdir = gtk
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+-am__aclocal_m4_deps = $(top_srcdir)/configure.in
++am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+diff -Naur razertool-0.0.7.orig/Makefile.in razertool-0.0.7/Makefile.in
+--- razertool-0.0.7.orig/Makefile.in   2007-02-15 07:55:24.000000000 +0100
++++ razertool-0.0.7/Makefile.in        2022-07-14 13:27:46.765830454 +0200
+@@ -1,5 +1,5 @@
+ # Makefile.in generated by automake 1.9.6 from Makefile.am.
+-# @configure_input@
++# @configure.acput@
+ 
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ # 2003, 2004, 2005  Free Software Foundation, Inc.
+@@ -42,7 +42,7 @@
+       mkinstalldirs
+ subdir = .
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+-am__aclocal_m4_deps = $(top_srcdir)/configure.in
++am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+ am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+diff -Naur razertool-0.0.7.orig/missing razertool-0.0.7/missing
+--- razertool-0.0.7.orig/missing       2006-11-27 03:51:30.000000000 +0100
++++ razertool-0.0.7/missing    2022-07-14 13:27:46.765830454 +0200
+@@ -39,7 +39,7 @@
+ if test -f configure.ac; then
+   configure_ac=configure.ac
+ else
+-  configure_ac=configure.in
++  configure_ac=configure.ac
+ fi
+ 
+ msg="missing on your system"
+diff -Naur razertool-0.0.7.orig/src/Makefile.in razertool-0.0.7/src/Makefile.in
+--- razertool-0.0.7.orig/src/Makefile.in       2007-02-15 07:55:23.000000000 
+0100
++++ razertool-0.0.7/src/Makefile.in    2022-07-14 13:27:46.765830454 +0200
+@@ -1,5 +1,5 @@
+ # Makefile.in generated by automake 1.9.6 from Makefile.am.
+-# @configure_input@
++# @configure.acput@
+ 
+ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+ # 2003, 2004, 2005  Free Software Foundation, Inc.
+@@ -41,7 +41,7 @@
+ subdir = src
+ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+-am__aclocal_m4_deps = $(top_srcdir)/configure.in
++am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+       $(ACLOCAL_M4)
+ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs

diff --git a/app-misc/razertool/files/razertool-0.0.7-rules.patch 
b/app-misc/razertool/files/razertool-0.0.7-rules.patch
new file mode 100644
index 000000000000..b04357e17029
--- /dev/null
+++ b/app-misc/razertool/files/razertool-0.0.7-rules.patch
@@ -0,0 +1,8 @@
+diff -Naur razertool-0.0.7.orig/razertool.rules.example 
razertool-0.0.7/razertool.rules.example
+--- razertool-0.0.7.orig/razertool.rules.example       2007-02-15 
06:09:41.000000000 +0100
++++ razertool-0.0.7/razertool.rules.example    2022-07-14 13:23:13.519271582 
+0200
+@@ -1,2 +1,2 @@
+-ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1532", SYSFS{idProduct}=="0101", 
MODE="0660", GROUP="plugdev"
+-ACTION=="add", BUS=="usb", SYSFS{idVendor}=="1532", SYSFS{idProduct}=="0009", 
MODE="0660", GROUP="plugdev"
++SUBSYSTEMS=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0101", 
MODE="0660", GROUP="usb"
++SUBSYSTEMS=="usb", ATTRS{idVendor}=="1532", ATTRS{idProduct}=="0009", 
MODE="0660", GROUP="usb"

diff --git a/app-misc/razertool/razertool-0.0.7-r4.ebuild 
b/app-misc/razertool/razertool-0.0.7-r5.ebuild
similarity index 75%
rename from app-misc/razertool/razertool-0.0.7-r4.ebuild
rename to app-misc/razertool/razertool-0.0.7-r5.ebuild
index c4a446040f4f..d650ed16d3ba 100644
--- a/app-misc/razertool/razertool-0.0.7-r4.ebuild
+++ b/app-misc/razertool/razertool-0.0.7-r5.ebuild
@@ -1,9 +1,9 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
-EAPI=6
+EAPI=8
 
-inherit autotools desktop
+inherit autotools desktop udev
 
 DESCRIPTION="Unofficial tool for controlling the Razer Copperhead mouse"
 HOMEPAGE="http://razertool.sourceforge.net/";
@@ -16,6 +16,7 @@ IUSE="gtk"
 
 RDEPEND="dev-libs/glib:2
        virtual/libusb:0
+       virtual/udev
        gtk? (
                dev-libs/atk
                >=gnome-base/librsvg-2.0
@@ -28,20 +29,11 @@ DEPEND="${RDEPEND}
 
 DOCS=( AUTHORS ChangeLog NEWS README )
 
-PATCHES=( "${FILESDIR}"/${P}-ar.patch )
+PATCHES=( "${FILESDIR}"/${P}-configure.patch
+       "${FILESDIR}"/${P}-rules.patch )
 
 src_prepare() {
        default
-
-       sed -i razertool.rules.example \
-               -e 's:ACTION=="add", ::;s:BUS=:SUBSYSTEMS=:;s:SYSFS{:ATTRS{:g' \
-               || die
-
-       # plugdev group may not exist (created by hal), default to usb
-       sed -i razertool.rules.example \
-               -e 's:plugdev:usb:' \
-               || die
-
        eautoreconf
 }
 
@@ -52,8 +44,7 @@ src_configure() {
 src_install() {
        default
 
-       insinto /lib/udev/rules.d
-       newins razertool.rules.example 90-razertool.rules
+       udev_newrules razertool.rules.example 90-razertool.rules
 
        # Icon and desktop entry
        if use gtk; then
@@ -63,6 +54,8 @@ src_install() {
 }
 
 pkg_postinst() {
+       udev_reload
+
        elog "Razer Copperhead mice need firmware version 6.20 or higher"
        elog "to work properly. Running ${PN} on mice with older firmwares"
        elog "might lead to random USB-disconnects."
@@ -72,3 +65,7 @@ pkg_postinst() {
        elog "   /etc/udev/rules.d/90-razertool.rules"
        elog "Then unplug and plug in the mouse."
 }
+
+pkg_postrm() {
+       udev_reload
+}

Reply via email to