summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSam James <sam@gentoo.org>2022-06-10 04:50:36 +0100
committerSam James <sam@gentoo.org>2022-06-10 04:50:36 +0100
commitbbaeaf9218b0bc5665b657155625e677e512161a (patch)
tree6e88909cb399897ea5a33f282749095eeaf5d67e /app-laptop
parentmedia-libs/tg_owt: fix build with GCC 12 (diff)
downloadgentoo-bbaeaf9218b0bc5665b657155625e677e512161a.tar.gz
gentoo-bbaeaf9218b0bc5665b657155625e677e512161a.tar.bz2
gentoo-bbaeaf9218b0bc5665b657155625e677e512161a.zip
app-laptop/msi-keyboard: fix build with GCC 12; respect CXX
Closes: https://bugs.gentoo.org/840329 Closes: https://bugs.gentoo.org/722324 Signed-off-by: Sam James <sam@gentoo.org>
Diffstat (limited to 'app-laptop')
-rw-r--r--app-laptop/msi-keyboard/files/msi-keyboard-1.0-gcc12.patch9
-rw-r--r--app-laptop/msi-keyboard/files/msi-keyboard-1.0-r1-makefile.patch24
-rw-r--r--app-laptop/msi-keyboard/msi-keyboard-1.0-r1.ebuild39
3 files changed, 72 insertions, 0 deletions
diff --git a/app-laptop/msi-keyboard/files/msi-keyboard-1.0-gcc12.patch b/app-laptop/msi-keyboard/files/msi-keyboard-1.0-gcc12.patch
new file mode 100644
index 000000000000..a1d9e3f1151c
--- /dev/null
+++ b/app-laptop/msi-keyboard/files/msi-keyboard-1.0-gcc12.patch
@@ -0,0 +1,9 @@
+https://bugs.gentoo.org/840329
+--- a/main.cpp
++++ b/main.cpp
+@@ -1,4 +1,5 @@
+ #include "Keyboard.h"
++#include <cstring>
+ #include <regex>
+ #include <iostream>
+
diff --git a/app-laptop/msi-keyboard/files/msi-keyboard-1.0-r1-makefile.patch b/app-laptop/msi-keyboard/files/msi-keyboard-1.0-r1-makefile.patch
new file mode 100644
index 000000000000..7588494501e9
--- /dev/null
+++ b/app-laptop/msi-keyboard/files/msi-keyboard-1.0-r1-makefile.patch
@@ -0,0 +1,24 @@
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,7 @@
+-CC=g++
+-CFLAGS=-c -Wall
+-LDFLAGS=-lhidapi-libusb
++CXX?=g++
++COMMON_FLAGS=-Wall
++CXXFLAGS+=$(COMMON_FLAGS)
++LIBS=-lhidapi-libusb
+ SOURCES=main.cpp Keyboard.cpp Color.cpp
+ OBJECTS=$(SOURCES:.cpp=.o)
+ EXECUTABLE=msi-keyboard
+@@ -11,8 +12,8 @@ clean:
+ rm $(OBJECTS) $(EXECUTABLE)
+
+ $(EXECUTABLE): $(OBJECTS)
+- $(CC) $(LDFLAGS) $(OBJECTS) -o $@
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS) $(OBJECTS) $(LIBS) -o $@
+
+ .cpp.o:
+- $(CC) $(CFLAGS) $< -o $@
++ $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
+
diff --git a/app-laptop/msi-keyboard/msi-keyboard-1.0-r1.ebuild b/app-laptop/msi-keyboard/msi-keyboard-1.0-r1.ebuild
new file mode 100644
index 000000000000..65aff6060bd4
--- /dev/null
+++ b/app-laptop/msi-keyboard/msi-keyboard-1.0-r1.ebuild
@@ -0,0 +1,39 @@
+# Copyright 1999-2022 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+inherit toolchain-funcs udev
+
+DESCRIPTION="Control backlight of MSI laptop keyboards"
+HOMEPAGE="https://github.com/makkarpov/msi-keyboard"
+SRC_URI="https://github.com/makkarpov/msi-keyboard/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="GPL-3"
+SLOT="0"
+KEYWORDS="~amd64"
+
+RDEPEND="dev-libs/hidapi"
+DEPEND="${RDEPEND}"
+
+PATCHES=(
+ "${FILESDIR}"/${P}-r1-makefile.patch
+ "${FILESDIR}"/${P}-gcc12.patch
+)
+
+src_configure() {
+ tc-export CXX
+}
+
+src_install() {
+ udev_dorules 99-msi-keyboard.rules
+ dobin msi-keyboard
+}
+
+pkg_prerm() {
+ udev_reload
+}
+
+pkg_postrm() {
+ udev_reload
+}