0001-cross-compile-fixes.patch 5.47 KB
Correct build issues to enable cross compiling.  These changes require the
package to be auto reconfigured.

These updates were not upsteamed as the 3.3.x version has stablized and they
were only taking bug fixes.  Also the 4.0 preview has completely reworked
the build infrastructure which will require this to be revisited.

Signed-off-by Clayton Shotwell <clshotwe@rockwellcollins.com>

diff -urN a/configure.ac b/configure.ac
--- a/configure.ac	2013-01-16 10:36:24.000000000 -0600
+++ b/configure.ac	2013-07-12 08:22:10.380255248 -0500
@@ -448,8 +448,9 @@
               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]))
+   if test ! -f ${sepol_srcdir}/libsepol.a; then
+      AC_MSG_ERROR([could not find precompiled libsepol.a])
+   fi
 else
    AC_MSG_CHECKING([for compatible sepol source tree])
    sepol_version=${sepol_srcdir}/VERSION
@@ -484,8 +485,9 @@
    AC_CHECK_HEADER([sepol/policydb/policydb.h], , AC_MSG_ERROR([could not find sepol source tree]))
    CFLAGS="${sepol_src_save_CFLAGS}"
    CPPFLAGS="${sepol_src_save_CPPFLAGS}"
-   AC_CHECK_FILE([${sepol_srcdir}/libsepol.a],,
-      AC_MSG_ERROR([could not find precompiled libsepol.a]))
+   if test ! -f ${sepol_srcdir}/libsepol.a; then
+      AC_MSG_ERROR([could not find precompiled libsepol.a])
+   fi
    sepol_devel_incdir="${sepol_srcdir}/../include"
 fi
 SELINUX_CFLAGS="-I${sepol_devel_incdir} -I${selinux_devel_incdir}"
@@ -578,12 +580,13 @@
                          [AC_LANG_SOURCE([
 #include <sepol/policydb/expand.h>
 int main () {
-  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0);
+  return expand_module_avrules(NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0);
 }])],
                          AC_MSG_RESULT([yes]),
                          AC_MSG_ERROR([this version of libsepol is incompatible with SETools]))
     fi
     sepol_new_expand_boolmap="yes"
+    sepol_new_user_role_mapping="yes"
 else
     sepol_new_expand_boolmap="no"
 fi
@@ -607,7 +610,8 @@
     exit(EXIT_FAILURE);
 }])],
     sepol_policy_version_max=`cat conftest.data`,
-    AC_MSG_FAILURE([could not determine maximum libsepol policy version]))
+    AC_MSG_FAILURE([could not determine maximum libsepol policy version]),
+    sepol_policy_version_max="26")
 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}"
@@ -631,7 +635,7 @@
     changequote([,])dnl
     selinux_save_CFLAGS="${CFLAGS}"
     CFLAGS="${SELINUX_CFLAGS} ${SELINUX_LIB_FLAG} -lselinux -lsepol ${CFLAGS}"
-    gcc ${CFLAGS} -o conftest conftest.c >&5
+    ${CC} ${CFLAGS} -o conftest conftest.c >&5
     selinux_policy_dir=`./conftest`
     AC_MSG_RESULT(${selinux_policy_dir})
     CFLAGS="${selinux_save_CFLAGS}"
diff -urN a/libqpol/src/policy_define.c b/libqpol/src/policy_define.c
--- a/libqpol/src/policy_define.c	2013-01-16 10:36:24.000000000 -0600
+++ b/libqpol/src/policy_define.c	2013-07-12 08:22:10.380255248 -0500
@@ -2135,7 +2135,7 @@
 #ifdef HAVE_SEPOL_ROLE_ATTRS
 	if (role_set_expand(&roles, &e_roles, policydbp, NULL, NULL))
 #elif HAVE_SEPOL_USER_ROLE_MAPPING
-	if (role_set_expand(&roles, &e_roles, policydbp, NULL))
+	if (role_set_expand(&roles, &e_roles, policydbp, NULL, NULL))
 #else
 	if (role_set_expand(&roles, &e_roles, policydbp))
 #endif
diff -urN a/m4/ac_python_devel.m4 b/m4/ac_python_devel.m4
--- a/m4/ac_python_devel.m4	2013-01-16 10:36:22.000000000 -0600
+++ b/m4/ac_python_devel.m4	2013-07-12 08:22:10.380255248 -0500
@@ -234,7 +234,7 @@
 	AC_MSG_CHECKING([consistency of all components of python development environment])
 	AC_LANG_PUSH([C])
 	# save current global flags
-	LIBS="$ac_save_LIBS $PYTHON_LDFLAGS"
+	LIBS="$ac_save_LIBS $PYTHON_EXTRA_LIBS $PYTHON_LDFLAGS"
 	CPPFLAGS="$ac_save_CPPFLAGS $PYTHON_CPPFLAGS"
 	AC_TRY_LINK([
 		#include <Python.h>
diff -urN a/python/setools/Makefile.am b/python/setools/Makefile.am
--- a/python/setools/Makefile.am	2013-01-16 10:36:22.000000000 -0600
+++ b/python/setools/Makefile.am	2013-07-12 08:22:19.200251011 -0500
@@ -22,13 +22,13 @@
 python-build: sesearch.c seinfo.c
 	@mkdir -p setools
 	@cp __init__.py setools
-	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" INCLUDES="$(QPOL_CFLAGS) $(APOL_CFLAGS)" $(PYTHON) setup.py build
+	LIBS="$(QPOL_LIB_FLAG) $(APOL_LIB_FLAG)" LIBDIRS="$(PYTHON_LDFLAGS)" INCLUDES="$(PYTHON_CPPFLAGS) $(QPOL_CFLAGS) $(APOL_CFLAGS)" CC="$(CC)" CFLAGS="$(CFLAGS)" LDSHARED="$(CC) -shared" LDFLAGS="$(LDFLAGS)" $(PYTHON) setup.py build_ext
 
 install-exec-hook:
-	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
+	$(PYTHON) setup.py install `test -n "$(DESTDIR)" && echo --prefix=$(DESTDIR)/usr`
 
 uninstall-hook: 
-	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --root $(DESTDIR)`
+	$(PYTHON) setup.py uninstall `test -n "$(DESTDIR)" && echo --prefix=$(DESTDIR)/usr`
 
 clean-local:
 	$(PYTHON) setup.py clean -a 
--- a/python/setools/setup.py	2013-01-16 10:36:22.000000000 -0600
+++ b/python/setools/setup.py	2013-09-04 09:17:48.452916991 -0500
@@ -8,7 +8,7 @@
 try:
     inc=os.getenv("INCLUDES").split(" ")    
     INCLUDES=map(lambda x: x[2:], inc)
-    LIBDIRS=map(lambda x: "/".join(x.split("/")[:-1]), os.getenv("LIBS").split())
+    LIBDIRS=map(lambda x: "/".join(x.split("/")[:-1]), os.getenv("LIBS").split()) + map(lambda x: x[2:], os.getenv("LIBDIRS").split())
 except:
     INCLUDES=""
     LIBDIRS=""