Andrew Geissler | 90fd73c | 2021-03-05 15:25:55 -0600 | [diff] [blame] | 1 | [PATCH] bindings/python: Allow hardcoded path to capability.h to be overridden |
| 2 | |
| 3 | Currently the path to capability.h is hardcoded. When cross compiling |
| 4 | the host capabiity.h may be different to the target copy, leading |
| 5 | to different options being encoded in the python bindings than |
| 6 | expected. This causes a reproducibility issue amongst other potential |
| 7 | problems. |
| 8 | |
| 9 | Add a configure option to optionally specify the right path to the |
| 10 | correct header as its probably safer/more reliable than trying to |
| 11 | query the compiler to get the header path. |
| 12 | |
| 13 | Signed-off-by: Richard Purdie richard.purdie@linuxfoundation.org |
| 14 | Upstream-Status: Submitted [https://github.com/stevegrubb/libcap-ng/pull/30] |
| 15 | |
| 16 | Index: libcap-ng-0.8.2/configure.ac |
| 17 | =================================================================== |
| 18 | --- libcap-ng-0.8.2.orig/configure.ac |
| 19 | +++ libcap-ng-0.8.2/configure.ac |
| 20 | @@ -63,6 +63,13 @@ AC_CHECK_HEADERS(sys/vfs.h, [ |
| 21 | AC_CHECK_HEADERS(linux/magic.h, [] [AC_MSG_WARN(linux/magic.h is required in order to verify procfs.)]) |
| 22 | ], [AC_MSG_WARN(sys/vfs.h is required in order to verify procfs.)]) |
| 23 | |
| 24 | + |
| 25 | +AC_ARG_WITH([capability_header], |
| 26 | + [AS_HELP_STRING([--with-capability_header=path : path to cpapbility.h])], |
| 27 | + [CAPABILITY_HEADER=$withval], |
| 28 | + [CAPABILITY_HEADER=/usr/include/linux/capability.h]) |
| 29 | +AC_SUBST(CAPABILITY_HEADER) |
| 30 | + |
| 31 | AC_C_CONST |
| 32 | AC_C_INLINE |
| 33 | AM_PROG_CC_C_O |
| 34 | Index: libcap-ng-0.8.2/bindings/python3/Makefile.am |
| 35 | =================================================================== |
| 36 | --- libcap-ng-0.8.2.orig/bindings/python3/Makefile.am |
| 37 | +++ libcap-ng-0.8.2/bindings/python3/Makefile.am |
| 38 | @@ -41,7 +41,7 @@ nodist__capng_la_SOURCES = capng_wrap.c |
| 39 | capng.py capng_wrap.c: ${srcdir}/../src/capng_swig.i caps.h capng.h |
| 40 | swig -o capng_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} ${srcdir}/../src/capng_swig.i |
| 41 | caps.h: |
| 42 | - cat /usr/include/linux/capability.h | grep '^#define CAP' | grep -v '[()]' > caps.h |
| 43 | + cat $(CAPABILITY_HEADER) | grep '^#define CAP' | grep -v '[()]' > caps.h |
| 44 | capng.h: |
| 45 | cat ${top_srcdir}/src/cap-ng.h | grep -v '_state' > capng.h |
| 46 | |
| 47 | Index: libcap-ng-0.8.2/bindings/python/Makefile.am |
| 48 | =================================================================== |
| 49 | --- libcap-ng-0.8.2.orig/bindings/python/Makefile.am |
| 50 | +++ libcap-ng-0.8.2/bindings/python/Makefile.am |
| 51 | @@ -38,7 +38,7 @@ nodist__capng_la_SOURCES = capng_wrap.c |
| 52 | capng.py capng_wrap.c: ${srcdir}/../src/capng_swig.i caps.h capng.h |
| 53 | swig -o capng_wrap.c ${SWIG_FLAGS} ${SWIG_INCLUDES} ${srcdir}/../src/capng_swig.i |
| 54 | caps.h: |
| 55 | - cat /usr/include/linux/capability.h | grep '^#define CAP' | grep -v '[()]' > caps.h |
| 56 | + cat $(CAPABILITY_HEADER) | grep '^#define CAP' | grep -v '[()]' > caps.h |
| 57 | capng.h: |
| 58 | cat ${top_srcdir}/src/cap-ng.h | grep -v '_state' > capng.h |
| 59 | |