Index: selinux-git/libsemanage/VERSION =================================================================== --- selinux-git.orig/libsemanage/VERSION 2008-09-30 10:18:55.000000000 -0400 +++ /dev/null 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -2.0.28 Index: selinux-git/libsemanage/configure.ac =================================================================== --- selinux-git.orig/libsemanage/configure.ac 2008-10-03 16:31:36.000000000 -0400 +++ selinux-git/libsemanage/configure.ac 2008-10-03 19:34:11.000000000 -0400 @@ -2,7 +2,7 @@ # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) -AC_INIT(libsemanage, VERSION, selinux@tycho.nsa.gov) +AC_INIT(libsemanage, 2.0.28, selinux@tycho.nsa.gov) AM_INIT_AUTOMAKE AC_CONFIG_SRCDIR([src/modules.c]) AC_CONFIG_HEADER([config.h]) @@ -20,8 +20,6 @@ fi AC_PROG_INSTALL AC_PROG_LN_S -# Stop libtool from building the .a because the NSA use special -# flags for the .a and need to be set manually from the Makefile.am # Static lib is used to build checkpolicy/module AC_DISABLE_STATIC AC_PROG_LIBTOOL @@ -31,21 +29,18 @@ AM_PROG_CC_C_O # Checks for libraries. -AC_SEARCH_LIBS([selinux_init_load_policy],[selinux], +AC_CHECK_LIB([selinux],[selinux_init_load_policy], [], [AC_MSG_ERROR([[SELinux library was not found.]])] - ,[] ) -AC_SEARCH_LIBS([sepol_policydb_read],[sepol], +AC_CHECK_LIB([sepol],[sepol_policydb_read], [], [AC_MSG_ERROR([[SELinux Policy library was not found.]])] - ,[] ) -AC_SEARCH_LIBS([ustr_free],[ustr], +AC_CHECK_LIB([ustr],[ustr_free], [], [AC_MSG_ERROR([[ustr Micro String library was not found.]])] - ,[] ) # Checks for header files. @@ -58,10 +53,8 @@ sys/time.h unistd.h]) AC_CHECK_HEADER([selinux/selinux.h], - [AC_DEFINE(HAVE_SELINUX_SELINUX_H, 1, - [Define to 1 if you have .])] - , - [AC_MSG_ERROR([[SELinux headers are missing.]])] + [], + [AC_MSG_ERROR([[SELinux headers are missing.]])] ) AC_CHECK_HEADER([ustr.h], @@ -82,6 +75,35 @@ [], [with_python=no] ) + +AC_ARG_WITH([python-site], + [AC_HELP_STRING([--with-python-site=PATH], + [Optional path to python site-packages folder, + eg /usr/lib/python2.4/site-packages])], + [] +) + +AC_ARG_ENABLE([swig], + [AC_HELP_STRING([--disable-swig], + [Disable regeneration of python c interface (default=no)])], + [_enable_swig=$enableval], + [_enable_swig=yes] +) + +AC_ARG_ENABLE([tests], + [AC_HELP_STRING([--disable-tests],[Disable building tests])], + [enable_tests=$enableval], + [enable_tests=no] +) + +AM_CONDITIONAL([BUILD_tests],[test "$enable_tests" = "yes"]) + +if test "$enable_tests" = "yes" ; then + AC_CHECK_LIB([cunit],[CU_initialize_registry], + [], + [AC_MSG_ERROR([CUnit is needed to build tests. Install cunit or --disable-tests])] + ) +fi if test "$with_python" != "no" ; then AC_SUBST([PYTHON_INCLUDE_DIR],[$with_python]) @@ -98,22 +120,31 @@ AM_CONDITIONAL([enable_python], [test "$have_python" = yes]) -AC_SUBST([pythondir],[$libdir/python$with_pythonver/site-packages]) -AC_SUBST([pyexecdir],[$libdir/python$with_pythonver/site-packages]) - -AC_ARG_ENABLE([swig], - [AC_HELP_STRING([--disable-swig], - [Disable regeneration of python c interface (default=no)])], - [_enable_swig=$enableval], - [_enable_swig=yes] -) - # Hault the config if we are asked for swig, but not swig is found if test "$_enable_swig" = "yes" -a -z "$SWIG" ; then AC_MSG_ERROR([Cannot find swig interface gemerator in PATH, Disable python c-inteferace regeneration with --disable-swig]) fi +# If libpy*.so wrapper cannot be built, then do not rebuild swig interface +# even if swig is available, and do not install site-packages +if test "$have_python" != "yes" ; then + _enable_swig=no + AC_MSG_NOTICE([Swig interface does not need to be regenerated + because libpyselinux.so wrapper cannot be built]) +else + # Use what the user specified, otherwise fallback on autoconf + # internal default and display warning to user. + # autoconf default = libdir/pythonX.X/site-packages + if test -n "$with_python_site" ; then + AC_SUBST([pythondir],[$with_python_site]) + AC_SUBST([pyexecdir],[$with_python_site]) + else + AC_MSG_WARN([Python site folder not specified, guessing...]) + fi +fi + + # slip in fake swig if needed if test "$_enable_swig" != "yes" ; then AC_SUBST([SWIG],[/bin/true]) @@ -149,19 +180,16 @@ AC_CONFIG_FILES([Makefile src/Makefile include/Makefile + tests/Makefile man/Makefile]) -# Pickup the version info from the source directory if available -VERSION=`cat $srcdir/VERSION` -if test "$VERSION" = "" ; then - VERSION=git -fi AC_OUTPUT PRINT='echo -n -e ' $PRINT "\nLibsemanage Configuration Summary:\n" if test "$have_python" = "yes" ; then $PRINT "\tlibpysemanage.so\t= $have_python (Using $with_python) \n" + $PRINT "\tPython Packages folder\t= $pythondir\n" else $PRINT "\tlibpysemanage.so\t= no " $PRINT "(try --with-python=/usr/include/python$PYTHON_VERSION) \n" @@ -169,5 +197,5 @@ $PRINT "\tRegenerate py wrapper\t= $_enable_swig\n" $PRINT "\tBuilding static lib\t= $enable_static\n" $PRINT "\tBuilding shared object\t= $enable_shared\n" -$PRINT "\tPython Packages folder\t= $pythondir\n" +$PRINT "\tBuilding tests\t\t= $enable_tests\n" $PRINT "------------------------------------------------------------\n" Index: selinux-git/libsemanage/src/Makefile.am =================================================================== --- selinux-git.orig/libsemanage/src/Makefile.am 2008-09-30 10:47:06.000000000 -0400 +++ selinux-git/libsemanage/src/Makefile.am 2008-10-03 18:27:31.000000000 -0400 @@ -17,7 +17,16 @@ parse_utils.c seusers_policy.c database_file.c \ iface_record.c policy_components.c user_base_record.c \ database_join.c interfaces_file.c port_record.c \ - user_extra_record.c + user_extra_record.c \ + boolean_internal.h context_internal.h database_activedb.h \ + database_file.h database.h database_join.h \ + database_llist.h database_policydb.h debug.h \ + direct_api.h dso.h fcontext_internal.h \ + genhomedircon.h handle.h handle_internal.h \ + iface_internal.h module_internal.h modules.h \ + node_internal.h parse_utils.h policy.h \ + port_internal.h semanage_conf.h semanage_store.h \ + seuser_internal.h user_internal.h utilities.h CLEANFILES = $(BUILT_SOURCES) @@ -59,4 +68,4 @@ # allowing the configure conftest to pass but this make rule to fail. # This is why -o lex.yy.c is given here. AM_LFLAGS = -o lex.yy.c -s -sysconf_DATA = semanage.conf +dist_sysconf_DATA = semanage.conf Index: selinux-git/libsemanage/Makefile.am =================================================================== --- selinux-git.orig/libsemanage/Makefile.am 2008-09-30 10:47:06.000000000 -0400 +++ selinux-git/libsemanage/Makefile.am 2008-10-03 18:31:48.000000000 -0400 @@ -1 +1 @@ -SUBDIRS = man src include +SUBDIRS = man src include tests Index: selinux-git/libsemanage/tests/Makefile.am =================================================================== --- /dev/null 1970-01-01 00:00:00.000000000 +0000 +++ selinux-git/libsemanage/tests/Makefile.am 2008-10-03 18:41:10.000000000 -0400 @@ -0,0 +1,11 @@ +noinst_PROGRAMS = $(c_extra) +if BUILD_tests +c_extra = libsemanage-tests +else +c_extra = +endif +libsemanage_tests_SOURCES = libsemanage-tests.c test_semanage_store.c \ + test_utilities.c utilities.c + +libsemanage_tests_CFLAGS = -I$(top_srcdir) -I$(top_srcdir)/include/semanage +libsemanage_tests_LDFLAGS = -Wl,--as-needed