Merge pull request #6500 from lrusak/bpf-gcc

compile bpf programs from scratch
This commit is contained in:
CvH 2022-05-21 09:37:22 +02:00 committed by GitHub
commit 5e1733b6e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 144 additions and 57 deletions

View File

@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="binutils-bpf"
PKG_VERSION="$(get_pkg_version binutils)"
PKG_LICENSE="GPL"
PKG_URL=""
PKG_DEPENDS_HOST="toolchain:host"
PKG_LONGDESC="A GNU collection of binary utilities for 64-bit ARM."
PKG_DEPENDS_UNPACK+=" binutils"
PKG_PATCH_DIRS+=" $(get_pkg_directory binutils)/patches"
PKG_CONFIGURE_OPTS_HOST="--target=bpf \
--with-sysroot=${SYSROOT_PREFIX} \
--with-lib-path=${SYSROOT_PREFIX}/lib:${SYSROOT_PREFIX}/usr/lib \
--without-ppl \
--enable-static \
--without-cloog \
--disable-werror \
--disable-multilib \
--disable-libada \
--disable-libssp \
--enable-version-specific-runtime-libs \
--enable-plugins \
--enable-gold \
--enable-ld=default \
--enable-lto \
--disable-nls"
unpack() {
mkdir -p ${PKG_BUILD}
tar --strip-components=1 -xf ${SOURCES}/binutils/binutils-${PKG_VERSION}.tar.xz -C ${PKG_BUILD}
}
pre_configure_host() {
unset CPPFLAGS
unset CFLAGS
unset CXXFLAGS
unset LDFLAGS
}
make_host() {
make configure-host
make
}
makeinstall_host() {
cp -v ../include/libiberty.h ${SYSROOT_PREFIX}/usr/include
make -C bfd install # fix parallel build with libctf requiring bfd
make install
}

View File

@ -0,0 +1,54 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2009-2016 Stephan Raue (stephan@openelec.tv)
# Copyright (C) 2018-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="gcc-bpf"
PKG_VERSION="$(get_pkg_version gcc)"
PKG_LICENSE="GPL-2.0-or-later"
PKG_URL=""
PKG_DEPENDS_HOST="toolchain:host ccache:host autoconf:host binutils-bpf:host gmp:host mpfr:host mpc:host zstd:host"
PKG_LONGDESC="This package contains the GNU Compiler Collection for 64-bit ARM."
PKG_DEPENDS_UNPACK+=" gcc"
PKG_PATCH_DIRS+=" $(get_pkg_directory gcc)/patches"
PKG_CONFIGURE_OPTS_HOST="--target=bpf \
--with-sysroot=${SYSROOT_PREFIX} \
--with-gmp=${TOOLCHAIN} \
--with-mpfr=${TOOLCHAIN} \
--with-mpc=${TOOLCHAIN} \
--with-zstd=${TOOLCHAIN} \
--with-gnu-as \
--with-gnu-ld \
--with-newlib \
--without-ppl \
--without-headers \
--without-cloog \
--enable-__cxa_atexit \
--enable-checking=release \
--enable-gold \
--enable-languages=c \
--enable-ld=default \
--enable-lto \
--enable-plugin \
--enable-static \
--disable-decimal-float \
--disable-gcov \
--disable-libada \
--disable-libatomic \
--disable-libgomp \
--disable-libitm \
--disable-libmpx \
--disable-libmudflap \
--disable-libquadmath \
--disable-libquadmath-support \
--disable-libsanitizer \
--disable-libssp \
--disable-multilib \
--disable-nls \
--disable-shared \
--disable-threads"
unpack() {
mkdir -p ${PKG_BUILD}
tar --strip-components=1 -xf ${SOURCES}/gcc/gcc-${PKG_VERSION}.tar.xz -C ${PKG_BUILD}
}

View File

@ -1,16 +0,0 @@
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2020-present Team LibreELEC (https://libreelec.tv)
PKG_NAME="ir-bpf-decoders"
PKG_VERSION="1.22.0"
PKG_SHA256="9743e49dd725f9fb7d0410f3481931156d69fd8305184baa883ed94038fc79fc"
PKG_LICENSE="GPLv2+"
PKG_SITE="https://linuxtv.org/"
PKG_URL="https://github.com/LibreELEC/ir-bpf-decoders/archive/v4l-utils-${PKG_VERSION}.tar.gz"
PKG_LONGDESC="ir-bpf-decoders: precompiled binaries of IR BPF decoders from v4l-utils utils/keytable/bpf_protocols"
PKG_TOOLCHAIN="manual"
makeinstall_target() {
mkdir -p ${INSTALL}/usr/lib/udev/rc_keymaps/protocols
cp ${PKG_BUILD}/*.o ${INSTALL}/usr/lib/udev/rc_keymaps/protocols
}

View File

@ -10,7 +10,7 @@ PKG_SHA256="65c6fbe830a44ca105c443b027182c1b2c9053a91d1e72ad849dfab388b94e31"
PKG_LICENSE="GPL"
PKG_SITE="http://linuxtv.org/"
PKG_URL="http://linuxtv.org/downloads/v4l-utils/${PKG_NAME}-${PKG_VERSION}.tar.bz2"
PKG_DEPENDS_TARGET="toolchain alsa-lib elfutils ir-bpf-decoders libbpf systemd zlib"
PKG_DEPENDS_TARGET="toolchain alsa-lib elfutils gcc-bpf:host libbpf systemd zlib"
PKG_LONGDESC="Linux V4L2 and DVB API utilities and v4l libraries (libv4l)."
PKG_TOOLCHAIN="autotools"

View File

@ -1,40 +0,0 @@
From ff65aa88a1ff3f02cc10e5a6e2af865b0c97f4fc Mon Sep 17 00:00:00 2001
From: Matthias Reichl <hias@horus.com>
Date: Sat, 8 Feb 2020 21:42:06 +0100
Subject: [PATCH] disable bpf decoder build and drop bpf dependency on clang
Signed-off-by: Matthias Reichl <hias@horus.com>
---
configure.ac | 2 +-
utils/keytable/Makefile.am | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/configure.ac b/configure.ac
index 3bb1d2a5..7b633473 100644
--- a/configure.ac
+++ b/configure.ac
@@ -565,7 +565,7 @@
AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno])
AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes])
PKG_CHECK_MODULES([LIBBPF], [libbpf], [bpf_pc=yes], [bpf_pc=no])
-AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang -a x$bpf_pc = xyes])
+AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$bpf_pc = xyes])
# append -static to libtool compile and link command to enforce static libs
AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])
diff --git a/utils/keytable/Makefile.am b/utils/keytable/Makefile.am
index 4724897e..1c209fe2 100644
--- a/utils/keytable/Makefile.am
+++ b/utils/keytable/Makefile.am
@@ -23,7 +23,7 @@
if WITH_BPF
ir_keytable_LDFLAGS += $(LIBELF_LIBS) $(LIBBPF_LIBS)
ir_keytable_CFLAGS = $(LIBBPF_CFLAGS)
-SUBDIRS = bpf_protocols
+# SUBDIRS = bpf_protocols
endif
EXTRA_DIST = 70-infrared.rules 50-rc_keymap.conf rc_keymaps rc_keymaps_userspace gen_input_events.pl gen_keytables.pl ir-keytable.1 rc_maps.cfg rc_keymap.5
--
2.20.1

View File

@ -0,0 +1,37 @@
diff -Naur a/configure.ac b/configure.ac
--- a/configure.ac 2021-10-23 08:11:21.000000000 -0700
+++ b/configure.ac 2022-05-16 15:39:52.312875449 -0700
@@ -177,7 +177,7 @@
AC_SUBST([LIBELF_CFLAGS])
AC_SUBST([LIBELF_LIBS])
if test "x$libelf_pkgconfig" = "xyes"; then
- AC_CHECK_PROG([CLANG], clang, clang)
+ AC_CHECK_PROG([BPFGCC], bpf-gcc, bpf-gcc)
else
AC_MSG_WARN(libelf library not available)
fi
@@ -565,7 +565,7 @@
AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_LIBV4L], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_libv4l} != xno])
AM_CONDITIONAL([WITH_V4L2_COMPLIANCE_32], [test x$ac_cv_func_fork = xyes -a x${enable_v4l2_compliance_32} = xyes])
PKG_CHECK_MODULES([LIBBPF], [libbpf], [bpf_pc=yes], [bpf_pc=no])
-AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$CLANG = xclang -a x$bpf_pc = xyes])
+AM_CONDITIONAL([WITH_BPF], [test x$enable_bpf != xno -a x$libelf_pkgconfig = xyes -a x$BPFGCC = xbpf-gcc -a x$bpf_pc = xyes])
# append -static to libtool compile and link command to enforce static libs
AS_IF([test x$enable_libdvbv5 = xno], [AC_SUBST([ENFORCE_LIBDVBV5_STATIC], ["-static"])])
diff -Naur a/utils/keytable/bpf_protocols/Makefile.am b/utils/keytable/bpf_protocols/Makefile.am
--- a/utils/keytable/bpf_protocols/Makefile.am 2020-05-14 02:23:59.000000000 -0700
+++ b/utils/keytable/bpf_protocols/Makefile.am 2022-05-16 15:41:14.089649162 -0700
@@ -4,11 +4,8 @@
#
# Use '-idirafter': Don't interfere with include mechanics except where the
# build would have failed anyways.
-CLANG_SYS_INCLUDES := $(shell $(CLANG) -v -E - </dev/null 2>&1 \
- | sed -n '/<...> search starts here:/,/End of search list./{ s| \(/.*\)|-idirafter \1|p }')
-
%.o: %.c bpf_helpers.h
- $(CLANG) $(CLANG_SYS_INCLUDES) -D__linux__ -I$(top_srcdir)/include -target bpf -O2 -c $<
+ $(BPFGCC) -D__linux__ -I$(top_srcdir)/include -O2 -mxbpf -c $<
PROTOCOLS = grundig.o pulse_distance.o pulse_length.o rc_mm.o manchester.o xbox-dvd.o imon_rsc.o raw.o samsung36.o