chromeos-base/libevdev: Rename output .so

Renamed libevdev.so to libevdev-cros.so

There is a well known upstream library libevdev which
collides with this internal version.
https://github.com/freedesktop/libevdev
The libraries wrap the same ioctls but that's where
the similarity ends.

The internal version libevdev-cros is used only via
pkg_config, save for mttools/mtreplay so renaming the
output should be safe.

BUG=b:190088895,chromium:1222854,b:191824146
TEST=emerge-tatl chromeos-base/libevdev

Cq-Depend: chromium:2981013,chromium:2991329
Change-Id: I9953869a51a95e1591c6127cf7baa1f8f1499cc8
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/libevdev/+/2981012
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Reviewed-by: Daniel Kurtz <djkurtz@chromium.org>
Tested-by: Nicholas Verne <nverne@chromium.org>
Commit-Queue: Fergus Dall <sidereal@google.com>
diff --git a/Makefile b/Makefile
index 6a59a7f..f04d56f 100644
--- a/Makefile
+++ b/Makefile
@@ -6,8 +6,8 @@
 
 LIBDIR ?= /usr/lib
 
-all: CC_LIBRARY(src/libevdev.so.0)
-clean: CLEAN(src/libevdev.so.0) CLEAN(src/libevdev_hollow.so.0)
+all: CC_LIBRARY(src/libevdev-cros.so.0)
+clean: CLEAN(src/libevdev-cros.so.0) CLEAN(src/libevdev_hollow.so.0)
 install: install-lib install-header
 
 in-place: CC_LIBRARY(src/libevdev_hollow.so.0)
diff --git a/include/module.mk b/include/module.mk
index 4c7aa8c..d00a482 100644
--- a/include/module.mk
+++ b/include/module.mk
@@ -4,7 +4,7 @@
 
 include common.mk
 
-install-header: CC_LIBRARY(src/libevdev.so.0)
+install-header: CC_LIBRARY(src/libevdev-cros.so.0)
 	set -e; \
 	for h in libevdev.h libevdev_event.h libevdev_mt.h libevdev_log.h; do \
 		install -D -m 0644 $(SRC)/include/libevdev/$$h \
diff --git a/libevdev-cros.pc b/libevdev-cros.pc
index 768e36a..d87cbf9 100644
--- a/libevdev-cros.pc
+++ b/libevdev-cros.pc
@@ -7,4 +7,4 @@
 Description: The libevdev library (ChromeOS version)
 Version: 0
 Cflags: -I${includedir}
-Libs: -L${libdir} -levdev
+Libs: -L${libdir} -levdev-cros
diff --git a/src/module.mk b/src/module.mk
index 63f9783..c35e376 100644
--- a/src/module.mk
+++ b/src/module.mk
@@ -5,23 +5,28 @@
 
 CFLAGS += -std=gnu99 -fvisibility=default
 CPPFLAGS += -I$(SRC)/include
+SONAME=libevdev-cros.so.0
+SONAME_HOLLOW=libevdev_hollow.so.0
 
-CC_LIBRARY(src/libevdev_hollow.so.0): CFLAGS += -DEVDEV_HOLLOW
-CC_LIBRARY(src/libevdev_hollow.so.0): src/libevdev.o \
+CC_LIBRARY(src/$(SONAME_HOLLOW)): CPPFLAGS += -DEVDEV_HOLLOW
+CC_LIBRARY(src/$(SONAME_HOLLOW)): LDFLAGS += -Wl,-soname,$(SONAME_HOLLOW)
+CC_LIBRARY(src/$(SONAME_HOLLOW)): src/libevdev.o \
 	src/libevdev_mt.o \
 	src/libevdev_event.o
 
-CC_LIBRARY(src/libevdev.so.0): src/libevdev.o \
+CC_LIBRARY(src/$(SONAME)): LDFLAGS += -Wl,-soname,$(SONAME)
+CC_LIBRARY(src/$(SONAME)): src/libevdev.o \
 	src/libevdev_mt.o \
 	src/libevdev_event.o
 
-install-lib: CC_LIBRARY(src/libevdev.so.0)
-	install -D -m 0755 src/libevdev.so.0 $(DESTDIR)$(LIBDIR)/libevdev.so.0
-	ln -f -s libevdev.so.0 $(DESTDIR)$(LIBDIR)/libevdev.so
+install-lib: CC_LIBRARY(src/$(SONAME))
+	install -D -m 0755 src/$(SONAME) \
+			$(DESTDIR)$(LIBDIR)/$(SONAME)
+	ln -f -s $(SONAME) $(DESTDIR)$(LIBDIR)/libevdev-cros.so
 	install -D -m 0644 $(SRC)/libevdev-cros.pc \
 			$(DESTDIR)$(LIBDIR)/pkgconfig/libevdev-cros.pc
 
 setup-lib-in-place:
 	mkdir -p $(SRC)/in-place || true
-	ln -sf $(SRC)/src/libevdev_hollow.so.0 $(SRC)/in-place/libevdev.so
-	ln -sf $(SRC)/src/libevdev_hollow.so.0 $(SRC)/in-place/libevdev.so.0
+	ln -sf $(SRC)/src/$(SONAME_HOLLOW) $(SRC)/in-place/libevdev-cros.so
+	ln -sf $(SRC)/src/$(SONAME_HOLLOW) $(SRC)/in-place/libevdev-cros.so.0