commit:     0467b30c56b1a345d6740182b21794b183ef1b5b
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Wed Feb 17 20:10:25 2016 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Wed Feb 17 20:11:03 2016 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=0467b30c

app-admin/setools: fix cross-compiling

 .../files/setools-3.3.8-no-check-file.patch        | 15 +++++++++++
 .../setools/files/setools-3.3.8-policy-max.patch   | 29 ++++++++++++++++++++++
 app-admin/setools/setools-3.3.8-r7.ebuild          |  3 +++
 3 files changed, 47 insertions(+)

diff --git a/app-admin/setools/files/setools-3.3.8-no-check-file.patch 
b/app-admin/setools/files/setools-3.3.8-no-check-file.patch
new file mode 100644
index 0000000..31848e9
--- /dev/null
+++ b/app-admin/setools/files/setools-3.3.8-no-check-file.patch
@@ -0,0 +1,15 @@
+there's no real need to run AC_CHECK_FILE to see if a file exists.  if the
+static link fails later on, then the static lib didn't exist.  this also
+breaks cross-compiling.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -448,8 +448,6 @@
+               sepol_srcdir="")
+ if test "x${sepol_srcdir}" = "x"; then
+    sepol_srcdir=${sepol_devel_libdir}
+-   AC_CHECK_FILE([${sepol_srcdir}/libsepol.a],,
+-      AC_MSG_ERROR([make sure libsepol-static is installed]))
+ else
+    AC_MSG_CHECKING([for compatible sepol source tree])
+    sepol_version=${sepol_srcdir}/VERSION

diff --git a/app-admin/setools/files/setools-3.3.8-policy-max.patch 
b/app-admin/setools/files/setools-3.3.8-policy-max.patch
new file mode 100644
index 0000000..cf6917a
--- /dev/null
+++ b/app-admin/setools/files/setools-3.3.8-policy-max.patch
@@ -0,0 +1,29 @@
+trying to run compiled code fails when cross-compiling.
+probe the value using the preprocessor instead.
+
+--- a/configure.ac
++++ b/configure.ac
+@@ -621,21 +621,8 @@
+               sepol_new_errcodes="yes",
+                 sepol_new_errcodes="no")
+ 
+-AC_RUN_IFELSE(
+-   [AC_LANG_SOURCE([
+-#include <sepol/policydb/policydb.h>
+-#include <stdio.h>
+-#include <stdlib.h>
+-int main(void) {
+-    FILE *f = fopen("conftest.data", "w");
+-    if (f != NULL && fprintf(f, "%d", POLICYDB_VERSION_MAX) > 0) {
+-       fclose(f);
+-       exit(EXIT_SUCCESS);
+-    }
+-    exit(EXIT_FAILURE);
+-}])],
+-    sepol_policy_version_max=`cat conftest.data`,
+-    AC_MSG_FAILURE([could not determine maximum libsepol policy version]))
++printf "#include <sepol/policydb/policydb.h>\nPOLICYDB_VERSION_MAX\n" > 
conftest.c
++sepol_policy_version_max=`${CPP} -E -P ${CPPFLAGS} conftest.c | tail -1`
+ AC_DEFINE_UNQUOTED(SEPOL_POLICY_VERSION_MAX, ${sepol_policy_version_max}, 
[maximum policy version supported by libsepol])
+ CFLAGS="${sepol_save_CFLAGS}"
+ CPPFLAGS="${sepol_save_CPPFLAGS}"

diff --git a/app-admin/setools/setools-3.3.8-r7.ebuild 
b/app-admin/setools/setools-3.3.8-r7.ebuild
index 69b4c7c..d719849 100644
--- a/app-admin/setools/setools-3.3.8-r7.ebuild
+++ b/app-admin/setools/setools-3.3.8-r7.ebuild
@@ -58,6 +58,9 @@ src_prepare() {
        EPATCH_FORCE="yes" \
        epatch
 
+       epatch "${FILESDIR}"/${PN}-3.3.8-no-check-file.patch
+       epatch "${FILESDIR}"/${PN}-3.3.8-policy-max.patch
+
        # Fix build failure due to double __init__.py installation
        sed -e "s/^wrappedpy_DATA = qpol.py \$(pkgpython_PYTHON)/wrappedpy_DATA 
= qpol.py/" -i libqpol/swig/python/Makefile.am || die
        # Disable broken check for SWIG version. Bug #542032

Reply via email to