Skip to content

Commit

Permalink
Merge pull request #13176 from lrusak/libinput
Browse files Browse the repository at this point in the history
[Linux] add libinput backend for non window system platforms
  • Loading branch information
lrusak committed Apr 25, 2018
2 parents cd6c3fa + c33044e commit d233545
Show file tree
Hide file tree
Showing 30 changed files with 1,440 additions and 1,681 deletions.
36 changes: 36 additions & 0 deletions cmake/modules/FindLibInput.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#.rst:
# FindLibinput
# --------
# Finds the libinput library
#
# This will define the following variables::
#
# LIBINPUT_FOUND - system has libinput
# LIBINPUT_INCLUDE_DIRS - the libinput include directory
# LIBINPUT_LIBRARIES - the libinput libraries
# LIBINPUT_DEFINITIONS - the libinput compile definitions
#

if(PKG_CONFIG_FOUND)
pkg_check_modules(PC_LIBINPUT libinput QUIET)
endif()

find_path(LIBINPUT_INCLUDE_DIR NAMES libinput.h
PATHS ${PC_LIBINPUT_INCLUDEDIR})

find_library(LIBINPUT_LIBRARY NAMES input
PATHS ${PC_LIBINPUT_LIBDIR})

set(LIBINPUT_VERSION ${PC_LIBINPUT_VERSION})

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(LibInput
REQUIRED_VARS LIBINPUT_LIBRARY LIBINPUT_INCLUDE_DIR
VERSION_VAR LIBINPUT_VERSION)

if(LIBINPUT_FOUND)
set(LIBINPUT_INCLUDE_DIRS ${LIBINPUT_INCLUDE_DIR}})
set(LIBINPUT_LIBRARIES ${LIBINPUT_LIBRARY})
endif()

mark_as_advanced(LIBINPUT_INCLUDE_DIR LIBINPUT_LIBRARY)
2 changes: 1 addition & 1 deletion cmake/platform/linux/aml.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set(PLATFORM_REQUIRED_DEPS OpenGLES AML EGL)
set(PLATFORM_REQUIRED_DEPS OpenGLES AML EGL LibInput Xkbcommon)
set(APP_RENDER_SYSTEM gles)
list(APPEND PLATFORM_DEFINES -DMESA_EGL_NO_X11_HEADERS)
2 changes: 1 addition & 1 deletion cmake/platform/linux/gbm.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
set(PLATFORM_REQUIRED_DEPS OpenGLES EGL GBM LibDRM)
set(PLATFORM_REQUIRED_DEPS OpenGLES EGL GBM LibDRM LibInput Xkbcommon)
set(PLATFORM_OPTIONAL_DEPS VAAPI)
set(APP_RENDER_SYSTEM gles)
list(APPEND PLATFORM_DEFINES -DMESA_EGL_NO_X11_HEADERS -DPLATFORM_SETTINGS_FILE=gbm.xml)
2 changes: 1 addition & 1 deletion cmake/platform/linux/rbpi.cmake
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
set(PLATFORM_REQUIRED_DEPS OpenGLES EGL MMAL)
set(PLATFORM_REQUIRED_DEPS OpenGLES EGL MMAL LibInput Xkbcommon)
set(APP_RENDER_SYSTEM gles)
list(APPEND PLATFORM_DEFINES -D_ARMEL -DTARGET_RASPBERRY_PI)
1 change: 1 addition & 0 deletions tools/depends/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,6 @@ config.site.native
/tools/depends/target/ffmpeg/ffmpeg-install/
/tools/depends/target/Toolchain_binaddons.cmake
/tools/depends/target/config-binaddons.site
/target/cross-file.meson
/target/libfmt/fmt-*.tar.gz
/target/rapidjson/rapidjson-*.tar.gz
3 changes: 2 additions & 1 deletion tools/depends/configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ AC_INIT([xbmc-depends], [2.00], [http://trac.xbmc.org])
:${CFLAGS=""}
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_FILES([target/config.site native/config.site.native Makefile.include target/Toolchain.cmake
target/config-binaddons.site target/Toolchain_binaddons.cmake])
target/config-binaddons.site target/Toolchain_binaddons.cmake target/cross-file.meson])
AC_CANONICAL_HOST

m4_include([m4/xbmc_arch.m4])
Expand Down Expand Up @@ -719,6 +719,7 @@ cp -vf target/config.site $prefix/$deps_dir/share
cp -vf target/config-binaddons.site $prefix/$tool_dir/share
cp -vf target/Toolchain.cmake $prefix/$deps_dir/share
cp -vf target/Toolchain_binaddons.cmake $prefix/$deps_dir/share
cp -vf target/cross-file.meson $prefix/$deps_dir/share
cp -vf native/config.site.native $prefix/$tool_dir/share/config.site


Expand Down
10 changes: 10 additions & 0 deletions tools/depends/native/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ ifeq ($(OS),osx)
NATIVE += xz-native tar-native
endif

ifeq ($(OS),linux)
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm))
NATIVE += meson-native ninja-native python3-native
endif
endif

ifeq ($(TARGET_PLATFORM),wayland)
NATIVE += expat-native wayland-scanner-native waylandpp-scanner-native
EXPAT = expat-native
endif

.PHONY: $(NATIVE) native
Expand All @@ -34,11 +41,14 @@ autoconf-native: m4-native
automake-native: autoconf-native
libtool-native: automake-native
libpng-native: zlib-native
meson-native: python3-native
ninja-native: python3-native
swig-native: pcre-native
distribute-native: python27-native
distutilscross-native: python27-native distribute-native
tar-native: xz-native automake-native
python27-native: zlib-native
python3-native: $(EXPAT) zlib-native
wayland-scanner-native: expat-native
waylandpp-scanner-native: cmake-native

Expand Down
35 changes: 35 additions & 0 deletions tools/depends/native/meson-native/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
include ../../Makefile.include
PLATFORM=$(NATIVEPLATFORM)
DEPS=../../Makefile.include Makefile

# lib name, version
LIBNAME=meson
VERSION=0.45.1
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

LIBDYLIB=$(PLATFORM)/build

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); $(NATIVEPREFIX)/bin/python3 setup.py config

$(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM); $(NATIVEPREFIX)/bin/python3 setup.py build

.installed-$(PLATFORM): $(LIBDYLIB)
cd $(PLATFORM); $(NATIVEPREFIX)/bin/python3 setup.py install --prefix="$(NATIVEPREFIX)"
touch $@

clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)

distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
33 changes: 33 additions & 0 deletions tools/depends/native/ninja-native/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
include ../../Makefile.include
PLATFORM=$(NATIVEPLATFORM)
DEPS= ../../Makefile.include Makefile

# lib name, version
LIBNAME=ninja
VERSION=1.8.2
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

LIBDYLIB=$(PLATFORM)/ninja

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)

$(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM); CXX="$(CXX_FOR_BUILD)" AR="$(AR_FOR_BUILD)" CFLAGS="$(NATIVE_CFLAGS)" LDFLAGS="$(NATIVE_LDFLAGS)" $(NATIVEPREFIX)/bin/python3 configure.py --bootstrap

.installed-$(PLATFORM): $(LIBDYLIB)
install $(PLATFORM)/ninja $(NATIVEPREFIX)/bin
touch $@

clean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)

distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
43 changes: 43 additions & 0 deletions tools/depends/native/python3-native/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
include ../../Makefile.include
PLATFORM=$(NATIVEPLATFORM)
DEPS= ../../Makefile.include Makefile

# lib name, version
LIBNAME=Python
VERSION=3.6.4
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.xz

CONFIGURE=./configure --prefix=$(NATIVEPREFIX) --disable-shared --disable-framework --without-ensurepip --without-pymalloc
ifeq ($(TARGET_PLATFORM),wayland)
CONFIGURE += --with-system-expat
endif

LIBDYLIB=$(PLATFORM)/python
ifeq ($(NATIVE_OS), osx)
LIBDYLIB=$(PLATFORM)/python.exe
endif

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); $(CONFIGURE)

$(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM); $(MAKE)

.installed-$(PLATFORM): $(LIBDYLIB)
cd $(PLATFORM); $(MAKE) install
touch $(LIBDYLIB)
touch $@

clean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)

distclean::
rm -rf $(PLATFORM) .installed-$(PLATFORM)
5 changes: 5 additions & 0 deletions tools/depends/target/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ ifeq ($(OS),linux)
DEPENDS += alsa-lib
ALSA_LIB = alsa-lib
CROSSGUID_DEPS = libuuid
ifeq ($(TARGET_PLATFORM),$(filter $(TARGET_PLATFORM),raspberry-pi aml gbm))
DEPENDS += libxkbcommon libinput libudev libevdev mtdev
endif
endif

ifeq ($(TARGET_PLATFORM),wayland)
Expand Down Expand Up @@ -116,6 +119,8 @@ libdvdread: $(DVDREAD_DEPS)
wayland: expat libffi
waylandpp: wayland $(WAYLANDPP_DEPS)
dbus: expat
libinput: mtdev libevdev
libevdev: libudev

.installed-$(PLATFORM): $(DEPENDS)
touch $@
Expand Down
16 changes: 16 additions & 0 deletions tools/depends/target/cross-file.meson.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[binaries]
c = '@CC@'
cpp = '@CXX@'
ar = '@AR@'
strip = '@STRIP@'
pkgconfig = '@prefix@/@tool_dir@/bin/pkg-config'

[properties]
cargs = ['@platform_cflags@', '@platform_includes@', '-isystem @prefix@/@deps_dir@/include']
c_link_args = ['-L@prefix@/@deps_dir@/lib', '-L@prefix@/@deps_dir@/lib64', '@platform_ldflags@']

[host_machine]
system = ''
cpu_family = ''
cpu = ''
endian = ''
37 changes: 37 additions & 0 deletions tools/depends/target/libevdev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
include ../../Makefile.include
DEPS=../../Makefile.include Makefile

# lib name, version
LIBNAME=libevdev
VERSION=1.5.8
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.xz

# configuration settings
CONFIGURE=./configure --prefix=$(PREFIX) --disable-shared --enable-static --disable-tests

LIBDYLIB=$(PLATFORM)/libevdev/.libs/libevdev.la

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); $(CONFIGURE)

$(LIBDYLIB): $(PLATFORM)
$(MAKE) -C $(PLATFORM)

.installed-$(PLATFORM): $(LIBDYLIB)
$(MAKE) -C $(PLATFORM) install
touch $@

clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)

distclean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)
55 changes: 55 additions & 0 deletions tools/depends/target/libinput/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
include ../../Makefile.include
DEPS=../../Makefile.include Makefile

# lib name, version
LIBNAME=libinput
VERSION=1.10.5
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.xz

# configuration settings
CONFIGURE= $(NATIVEPREFIX)/bin/python3 $(NATIVEPREFIX)/bin/meson \
--prefix=$(PREFIX) \
--libdir=lib \
-Ddebug-gui=false \
-Ddocumentation=false \
-Dlibwacom=false \
-Dtests=false

ifeq ($(CROSS_COMPILING), yes)
CONFIGURE += --cross-file $(PREFIX)/share/cross-file.meson
export CC=$(CC_FOR_BUILD)
export CXX=$(CXX_FOR_BUILD)
export CFLAGS=$(CFLAGS_FOR_BUILD)
export CXXFLAGS=$(CXXFLAGS_FOR_BUILD)
else
export CC CXX CFLAGS CXXFLAGS
endif
export PKG_CONFIG_LIBDIR=$(PREFIX)/lib/pkgconfig

LIBDYLIB=$(PLATFORM)/build/libinput.a

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); rm -rf build; mkdir -p build
cd $(PLATFORM); $(CONFIGURE) . build

$(LIBDYLIB): $(PLATFORM)
cd $(PLATFORM)/build; $(NATIVEPREFIX)/bin/ninja -v

.installed-$(PLATFORM): $(LIBDYLIB)
cd $(PLATFORM)/build; $(NATIVEPREFIX)/bin/ninja -v install
touch $@

clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)

distclean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)
38 changes: 38 additions & 0 deletions tools/depends/target/libudev/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
include ../../Makefile.include
DEPS=../../Makefile.include Makefile

# lib name, version
LIBNAME=libudev
VERSION=3.2.5
SOURCE=$(LIBNAME)-$(VERSION)
ARCHIVE=$(SOURCE).tar.gz

# configuration settings
CONFIGURE=./configure --prefix=$(PREFIX) --disable-shared --enable-static --enable-introspection=no --disable-programs --disable-blkid --disable-selinux --disable-manpages --disable-kmod --disable-mtd_probe

LIBDYLIB=$(PLATFORM)/src/libudev/.libs/libudev.la

all: .installed-$(PLATFORM)

$(TARBALLS_LOCATION)/$(ARCHIVE):
cd $(TARBALLS_LOCATION); $(RETRIEVE_TOOL) $(RETRIEVE_TOOL_FLAGS) $(BASE_URL)/$(ARCHIVE)

$(PLATFORM): $(TARBALLS_LOCATION)/$(ARCHIVE) $(DEPS)
rm -rf $(PLATFORM)/*; mkdir -p $(PLATFORM)
cd $(PLATFORM); $(ARCHIVE_TOOL) $(ARCHIVE_TOOL_FLAGS) $(TARBALLS_LOCATION)/$(ARCHIVE)
cd $(PLATFORM); $(AUTORECONF) -vif
cd $(PLATFORM); $(CONFIGURE)

$(LIBDYLIB): $(PLATFORM)
$(MAKE) -C $(PLATFORM)

.installed-$(PLATFORM): $(LIBDYLIB)
$(MAKE) -C $(PLATFORM) install
touch $@

clean:
$(MAKE) -C $(PLATFORM) clean
rm -f .installed-$(PLATFORM)

distclean:
rm -rf $(PLATFORM) .installed-$(PLATFORM)
Loading

0 comments on commit d233545

Please sign in to comment.