packages/libs/libseccomp/Makefile
Eneas U de Queiroz 013b1895ed
Revert "libseccomp: don't build on ARC"
This reverts commit b29e609701.

Adding DEPENDS+=@!arc will cause a circular dependency, because some
packages select libseccomp based on a build option.

Commit e29483d7e ("libseccomp: workaround a recursive dependency") added
a workaround that was not properly documented, so I'll explain here.

The problem arises when libseccomp is selected depending on some config
option:

define Pakcage/foo
  DEPENDS=+FOO_SECCOMP:libseccomp

Even if the condition is correctly defined, excluding arc, such as:

define Package/foo/config
  config FOO_SECCOMP
    depends on !arc

the config generator will parse libseccomp's DEPENDS variable and
generate menuconfig statements like these:

config PACKAGE_foo
   select PACKAGE_libseccomp if FOO_SECCOMP
   depends on !FOO_SECCOMP || !arc

The last condition is always true because FOO_SECCOMP will always be
be false when arc is true.  The config generator is not able to
simplify/optimize the condition.

The circular dependecy occurs because FOO_SECCOMP depends on
PACKAGE_foo, and the redundant, always true line will make PACKAGE_foo
depend on FOO_SECCOMP.

As a workaround, we can add the 'depends on !arc' line to
Package/libseccomp/config, outside of the DEPENDS variable, so that the
redundant depends line line does not get generated.

Signed-off-by: Eneas U de Queiroz <cotequeiroz@gmail.com>
Cc: Daniel Golle <daniel@makrotopia.org>
2021-04-11 21:21:48 -03:00

95 lines
2.5 KiB
Makefile

#
# Copyright (C) 2014-2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libseccomp
PKG_VERSION:=2.5.1
PKG_RELEASE:=1
PKG_USE_MIPS16:=0
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/seccomp/libseccomp/releases/download/v$(PKG_VERSION)/
PKG_HASH:=ee307e383c77aa7995abc5ada544d51c9723ae399768a97667d4cdb3c3a30d55
PKG_MAINTAINER:=Nikos Mavrogiannopoulos <nmav@gnutls.org>
PKG_LICENSE:=LGPL-2.1-or-later
PKG_LICENSE_FILES:=LICENSE
PKG_CPE_ID:=cpe:/a:libseccomp_project:libseccomp
PKG_INSTALL:=1
PKG_BUILD_PARALLEL:=1
PKG_BUILD_DEPENDS:=gperf/host
PKG_LIBTOOL_PATHS:=. lib
PKG_CONFIG_DEPENDS:= \
CONFIG_KERNEL_SECCOMP
include $(INCLUDE_DIR)/package.mk
# This is done instead of DEPENDS:=@!arc to avoid a recursive dependency when
# the library is conditionally selected by util/lxc.
define Package/libseccomp/config
depends on !arc
endef
define Package/libseccomp/Default
SUBMENU:=
SECTION:=libs
CATEGORY:=Libraries
TITLE:=seccomp
URL:=https://github.com/seccomp/libseccomp/wiki
endef
define Package/libseccomp/Default/description
The libseccomp library provides an easy to use, platform independent, interface
to the Linux Kernel's syscall filtering mechanism. The libseccomp API is
designed to abstract away the underlying BPF based syscall filter language and
present a more conventional function-call based filtering interface that should
be familiar to, and easily adopted by, application developers.
endef
define Package/libseccomp
$(call Package/libseccomp/Default)
TITLE+= (library)
endef
define Package/scmp_sys_resolver
$(call Package/libseccomp/Default)
TITLE+= scmp_sys_resolver
DEPENDS+= libseccomp
endef
define Package/libseccomp/description
This package contains the seccomp library.
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include $(1)/usr/lib/pkgconfig
$(CP) \
$(PKG_INSTALL_DIR)/usr/include/seccomp*.h \
$(1)/usr/include/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/libseccomp.{a,so*} \
$(1)/usr/lib/
$(CP) \
$(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libseccomp.pc \
$(1)/usr/lib/pkgconfig/
endef
define Package/libseccomp/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libseccomp.so.* $(1)/usr/lib/
endef
define Package/scmp_sys_resolver/install
$(INSTALL_DIR) $(1)/usr/bin
$(CP) $(PKG_INSTALL_DIR)/usr/bin/scmp_sys_resolver $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libseccomp))
$(eval $(call BuildPackage,scmp_sys_resolver))