forked from pool/libseccomp
Jan Engelhardt
ac4ff477c7
OBS-URL: https://build.opensuse.org/package/show/security/libseccomp?expand=0&rev=16
331 lines
9.0 KiB
Diff
331 lines
9.0 KiB
Diff
From c22e0366049884637b6f92e0f39c0d6579c7ca1f Mon Sep 17 00:00:00 2001
|
|
From: Jan Engelhardt <jengelh@inai.de>
|
|
Date: Wed, 14 Nov 2012 21:30:16 +0100
|
|
Subject: [PATCH] build: use autotools as build system
|
|
|
|
Signed-off-by: Jan Engelhardt <jengelh@inai.de>
|
|
---
|
|
.gitignore | 25 +++++++++++++++++--------
|
|
Makefile.am | 31 +++++++++++++++++++++++++++++++
|
|
autogen.sh | 5 +++++
|
|
configure.ac | 49 +++++++++++++++++++++++++++++++++++++++++++++++++
|
|
include/seccomp.h.in | 6 +++---
|
|
libseccomp.pc.in | 9 +++++----
|
|
m4/.gitignore | 2 ++
|
|
src/Makefile.am | 16 ++++++++++++++++
|
|
src/python/.gitignore | 5 +++--
|
|
src/python/Makefile.am | 24 ++++++++++++++++++++++++
|
|
src/python/setup.py | 2 +-
|
|
src/system.h | 4 ++--
|
|
tests/Makefile.am | 44 ++++++++++++++++++++++++++++++++++++++++++++
|
|
tools/Makefile.am | 9 +++++++++
|
|
14 files changed, 211 insertions(+), 20 deletions(-)
|
|
create mode 100644 Makefile.am
|
|
create mode 100755 autogen.sh
|
|
create mode 100644 configure.ac
|
|
create mode 100644 m4/.gitignore
|
|
create mode 100644 src/Makefile.am
|
|
create mode 100644 src/python/Makefile.am
|
|
create mode 100644 tests/Makefile.am
|
|
create mode 100644 tools/Makefile.am
|
|
|
|
diff --git a/Makefile.am b/Makefile.am
|
|
new file mode 100644
|
|
index 0000000..bf0a4ea
|
|
--- /dev/null
|
|
+++ b/Makefile.am
|
|
@@ -0,0 +1,31 @@
|
|
+# -*- Makefile -*-
|
|
+
|
|
+ACLOCAL_AMFLAGS = -I m4
|
|
+SUBDIRS = src tools tests
|
|
+
|
|
+pkgconfdir = ${libdir}/pkgconfig
|
|
+pkgconf_DATA = libseccomp.pc
|
|
+
|
|
+nodist_include_HEADERS = include/seccomp.h
|
|
+
|
|
+dist_man_MANS = \
|
|
+ doc/man/man1/scmp_sys_resolver.1 \
|
|
+ doc/man/man3/seccomp_arch_add.3 \
|
|
+ doc/man/man3/seccomp_arch_exist.3 \
|
|
+ doc/man/man3/seccomp_arch_native.3 \
|
|
+ doc/man/man3/seccomp_arch_remove.3 \
|
|
+ doc/man/man3/seccomp_attr_get.3 \
|
|
+ doc/man/man3/seccomp_attr_set.3 \
|
|
+ doc/man/man3/seccomp_export_bpf.3 \
|
|
+ doc/man/man3/seccomp_export_pfc.3 \
|
|
+ doc/man/man3/seccomp_init.3 \
|
|
+ doc/man/man3/seccomp_load.3 \
|
|
+ doc/man/man3/seccomp_merge.3 \
|
|
+ doc/man/man3/seccomp_release.3 \
|
|
+ doc/man/man3/seccomp_reset.3 \
|
|
+ doc/man/man3/seccomp_rule_add.3 \
|
|
+ doc/man/man3/seccomp_rule_add_exact.3 \
|
|
+ doc/man/man3/seccomp_syscall_priority.3 \
|
|
+ doc/man/man3/seccomp_syscall_resolve_name.3 \
|
|
+ doc/man/man3/seccomp_syscall_resolve_name_arch.3 \
|
|
+ doc/man/man3/seccomp_syscall_resolve_num_arch.3
|
|
diff --git a/autogen.sh b/autogen.sh
|
|
new file mode 100755
|
|
index 0000000..37e4b23
|
|
--- /dev/null
|
|
+++ b/autogen.sh
|
|
@@ -0,0 +1,5 @@
|
|
+#!/bin/sh -e
|
|
+
|
|
+autoreconf -fi;
|
|
+rm -Rf autom4te.cache;
|
|
+# do not call configure - this is unexpected
|
|
diff --git a/configure.ac b/configure.ac
|
|
new file mode 100644
|
|
index 0000000..fa7bd5b
|
|
--- /dev/null
|
|
+++ b/configure.ac
|
|
@@ -0,0 +1,49 @@
|
|
+AC_INIT([libseccomp], [2.1.0])
|
|
+AC_CONFIG_AUX_DIR([build-aux])
|
|
+AC_CONFIG_HEADERS([configure.h])
|
|
+AC_CONFIG_MACRO_DIR([m4])
|
|
+AM_INIT_AUTOMAKE([-Wall foreign subdir-objects tar-pax no-dist-gzip dist-xz])
|
|
+AC_PROG_CC
|
|
+AM_PROG_CC_C_O
|
|
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
|
|
+m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
|
|
+AC_DISABLE_STATIC
|
|
+LT_INIT
|
|
+
|
|
+AC_CHECK_HEADER([linux/seccomp.h])
|
|
+
|
|
+AM_CPPFLAGS="-I\${top_srcdir}/include"
|
|
+AM_CFLAGS="-Wall"
|
|
+AM_LDFLAGS="-Wl,-z -Wl,relro"
|
|
+AC_SUBST([AM_CPPFLAGS])
|
|
+AC_SUBST([AM_CFLAGS])
|
|
+AC_SUBST([AM_LDFLAGS])
|
|
+
|
|
+VERSION_MAJOR="${VERSION%%.*}"
|
|
+VERSION_MINOR="${VERSION#*.}"
|
|
+VERSION_MICRO="${VERSION_MINOR#*.}"
|
|
+VERSION_MINOR="${VERSION_MINOR%%.*}"
|
|
+VERSION_MICRO="${VERSION_MICRO%%.*}"
|
|
+AC_SUBST([VERSION_MAJOR])
|
|
+AC_SUBST([VERSION_MINOR])
|
|
+AC_SUBST([VERSION_MICRO])
|
|
+
|
|
+dnl AC_ARG_ENABLE([python],
|
|
+dnl [AS_HELP_STRING([--enable-python], [build the python bindings, requires cython])])
|
|
+enable_python=no
|
|
+AM_CONDITIONAL([ENABLE_PYTHON], [test "$enable_python" = yes])
|
|
+cython_ver=$(which cython >/dev/null 2>/dev/null && cython -V 2>&1 | cut -d' ' -f3)
|
|
+cython_maj=$(echo "$cython_ver" | cut -d'.' -f1)
|
|
+cython_min=$(echo "$cython_ver" | cut -d'.' -f2)
|
|
+AS_IF([test "$enable_python" = yes], [
|
|
+ recent=""
|
|
+ AS_IF([test -n "$cython_maj" -a -n "$cython_min" &&
|
|
+ ! test "$cython_maj" -eq 0 -a "$cython_min" -lt 16], [recent=yes])
|
|
+ AS_IF([test -z "$recent"], [
|
|
+ AC_MSG_ERROR([python bindings require cython 0.16 or higher])
|
|
+ ])
|
|
+])
|
|
+
|
|
+AC_CONFIG_FILES([Makefile src/Makefile src/python/Makefile tools/Makefile
|
|
+ tests/Makefile include/seccomp.h libseccomp.pc])
|
|
+AC_OUTPUT
|
|
diff --git a/include/seccomp.h.in b/include/seccomp.h.in
|
|
index 7897cbf..e14c1f5 100644
|
|
--- a/include/seccomp.h.in
|
|
+++ b/include/seccomp.h.in
|
|
@@ -35,9 +35,9 @@ extern "C" {
|
|
* version information
|
|
*/
|
|
|
|
-#define SCMP_VER_MAJOR %%VERSION_MAJOR%%
|
|
-#define SCMP_VER_MINOR %%VERSION_MINOR%%
|
|
-#define SCMP_VER_MICRO %%VERSION_MICRO%%
|
|
+#define SCMP_VER_MAJOR @VERSION_MAJOR@
|
|
+#define SCMP_VER_MINOR @VERSION_MINOR@
|
|
+#define SCMP_VER_MICRO @VERSION_MICRO@
|
|
|
|
/*
|
|
* types
|
|
diff --git a/libseccomp.pc.in b/libseccomp.pc.in
|
|
index c195831..a863351 100644
|
|
--- a/libseccomp.pc.in
|
|
+++ b/libseccomp.pc.in
|
|
@@ -19,13 +19,14 @@
|
|
# along with this library; if not, see <http://www.gnu.org/licenses>.
|
|
#
|
|
|
|
-prefix=%%INSTALL_PREFIX%%
|
|
-libdir=%%INSTALL_LIBDIR%%
|
|
-includedir=${prefix}/include
|
|
+prefix=@prefix@
|
|
+exec_prefix=@exec_prefix@
|
|
+libdir=@libdir@
|
|
+includedir=@includedir@
|
|
|
|
Name: libseccomp
|
|
Description: The enhanced seccomp library
|
|
URL: http://libseccomp.sf.net
|
|
-Version: %%VERSION_RELEASE%%
|
|
+Version: @PACKAGE_VERSION@
|
|
Cflags: -I${includedir}
|
|
Libs: -L${libdir} -lseccomp
|
|
diff --git a/m4/.gitignore b/m4/.gitignore
|
|
new file mode 100644
|
|
index 0000000..64d9bbc
|
|
--- /dev/null
|
|
+++ b/m4/.gitignore
|
|
@@ -0,0 +1,2 @@
|
|
+/libtool.m4
|
|
+/lt*.m4
|
|
diff --git a/src/Makefile.am b/src/Makefile.am
|
|
new file mode 100644
|
|
index 0000000..91b1519
|
|
--- /dev/null
|
|
+++ b/src/Makefile.am
|
|
@@ -0,0 +1,16 @@
|
|
+# -*- Makefile -*-
|
|
+
|
|
+SUBDIRS = .
|
|
+if ENABLE_PYTHON
|
|
+SUBDIRS += python
|
|
+endif
|
|
+
|
|
+lib_LTLIBRARIES = libseccomp.la
|
|
+
|
|
+libseccomp_la_SOURCES = api.c arch.c arch-x86.c arch-x86-syscalls.c \
|
|
+ arch-x86_64.c arch-x86_64-syscalls.c arch-x32.c arch-x32-syscalls.c \
|
|
+ arch-arm.c arch-arm-syscalls.c db.c hash.c gen_pfc.c gen_bpf.c \
|
|
+ \
|
|
+ arch-arm.h arch-x32.h arch-x86.h arch-x86_64.h arch.h \
|
|
+ db.h gen_bpf.h gen_pfc.h hash.h system.h
|
|
+libseccomp_la_LDFLAGS = -version-number 2:1:0
|
|
diff --git a/src/python/Makefile.am b/src/python/Makefile.am
|
|
new file mode 100644
|
|
index 0000000..400b354
|
|
--- /dev/null
|
|
+++ b/src/python/Makefile.am
|
|
@@ -0,0 +1,24 @@
|
|
+# -*- Makefile -*-
|
|
+
|
|
+PYTHON = /usr/bin/env python
|
|
+pyverbose_0 = -q
|
|
+pyverbose_ = ${pyverbose_0}
|
|
+
|
|
+PY_DISTUTILS = \
|
|
+ VERSION_RELEASE="${VERSION_RELEASE}" \
|
|
+ CFLAGS="-I\${top_srcdir}/include ${CFLAGS} ${CPPFLAGS}" \
|
|
+ LDFLAGS="${LDFLAGS}" \
|
|
+ ${PYTHON} ./setup.py
|
|
+PY_BUILD = ${PY_DISTUTILS} build ${pyverbose_${V}}
|
|
+PY_INSTALL = ${PY_DISTUTILS} install ${pyverbose_${V}}
|
|
+
|
|
+all-local: python-build
|
|
+
|
|
+python-build: ../libseccomp.la libseccomp.pxd seccomp.pyx
|
|
+ ${AM_V_GEN}${PY_DISTUTILS} build && touch $@
|
|
+
|
|
+install-exec-local:
|
|
+ ${PY_DISTUTILS} install --prefix=${DESTDIR}/${prefix}
|
|
+
|
|
+clean-local:
|
|
+ rm -Rf python-build seccomp.c
|
|
diff --git a/src/python/setup.py b/src/python/setup.py
|
|
index 872642e..62ba24a 100644
|
|
--- a/src/python/setup.py
|
|
+++ b/src/python/setup.py
|
|
@@ -40,6 +40,6 @@ setup(
|
|
cmdclass = {'build_ext': build_ext},
|
|
ext_modules = [
|
|
Extension("seccomp", ["seccomp.pyx"],
|
|
- extra_objects=["../libseccomp.a"])
|
|
+ extra_objects=["../.libs/libseccomp.so"])
|
|
]
|
|
)
|
|
diff --git a/src/system.h b/src/system.h
|
|
index cb14f65..11303cf 100644
|
|
--- a/src/system.h
|
|
+++ b/src/system.h
|
|
@@ -25,9 +25,9 @@
|
|
#include <linux/filter.h>
|
|
#include <linux/prctl.h>
|
|
|
|
-#include <configure.h>
|
|
+#include "configure.h"
|
|
|
|
-#ifdef CONF_SYSINC_SECCOMP
|
|
+#ifdef HAVE_LINUX_SECCOMP_H
|
|
|
|
/* system header file */
|
|
#include <linux/seccomp.h>
|
|
diff --git a/tests/Makefile.am b/tests/Makefile.am
|
|
new file mode 100644
|
|
index 0000000..236abee
|
|
--- /dev/null
|
|
+++ b/tests/Makefile.am
|
|
@@ -0,0 +1,44 @@
|
|
+# -*- Makefile -*-
|
|
+
|
|
+AM_LDFLAGS = -static
|
|
+LDADD = util.la ../src/libseccomp.la
|
|
+
|
|
+check_LTLIBRARIES = util.la
|
|
+util_la_SOURCES = util.c util.h
|
|
+util_la_LDFLAGS = -module
|
|
+
|
|
+TESTS = regression
|
|
+
|
|
+EXTRA_DIST = regression *.tests
|
|
+BUILT_SOURCES = 00-test.c
|
|
+
|
|
+check_PROGRAMS = \
|
|
+ 00-test \
|
|
+ 01-sim-allow \
|
|
+ 02-sim-basic \
|
|
+ 03-sim-basic_chains \
|
|
+ 04-sim-multilevel_chains \
|
|
+ 05-sim-long_jumps \
|
|
+ 06-sim-actions \
|
|
+ 07-sim-db_bug_looping \
|
|
+ 08-sim-subtree_checks \
|
|
+ 09-sim-syscall_priority_pre \
|
|
+ 10-sim-syscall_priority_post \
|
|
+ 11-basic-basic_errors \
|
|
+ 12-sim-basic_masked_ops \
|
|
+ 13-basic-attrs \
|
|
+ 14-sim-reset \
|
|
+ 15-basic-resolver \
|
|
+ 16-sim-arch_basic \
|
|
+ 17-sim-arch_merge \
|
|
+ 18-sim-basic_whitelist \
|
|
+ 19-sim-missing_syscalls \
|
|
+ 20-live-basic_die \
|
|
+ 21-live-basic_allow \
|
|
+ 22-sim-basic_chains_array \
|
|
+ 23-sim-arch_all_basic \
|
|
+ 24-live-arg_allow \
|
|
+ 25-sim-multilevel_chains_adv
|
|
+
|
|
+00-test.c:
|
|
+ if ! test -e $@; then echo "int main(void) { return 0; }" >$@; fi
|
|
diff --git a/tools/Makefile.am b/tools/Makefile.am
|
|
new file mode 100644
|
|
index 0000000..ed74f39
|
|
--- /dev/null
|
|
+++ b/tools/Makefile.am
|
|
@@ -0,0 +1,9 @@
|
|
+# -*- Makefile -*-
|
|
+
|
|
+bin_PROGRAMS = scmp_sys_resolver
|
|
+noinst_PROGRAMS = scmp_arch_detect scmp_bpf_disasm scmp_bpf_sim
|
|
+
|
|
+scmp_sys_resolver_LDADD = ../src/libseccomp.la
|
|
+scmp_arch_detect_LDADD = ../src/libseccomp.la
|
|
+
|
|
+EXTRA_DIST = bpf.h
|
|
--
|
|
1.8.2
|
|
|