• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3function except() {
4case $1 in
5    selinux_file_context_cmp) # ignore
6    ;;
7    *)
8echo "
9%exception $1 {
10  \$action
11  if (result < 0) {
12     PyErr_SetFromErrno(PyExc_OSError);
13     SWIG_fail;
14  }
15}"
16;;
17esac
18}
19
20# Make sure that selinux.h is included first in order not to depend on the order
21# in which "#include <selinux/selinux.h>" appears in other files.
22FILE_LIST=(
23    ../include/selinux/selinux.h
24    ../include/selinux/avc.h
25    ../include/selinux/context.h
26    ../include/selinux/get_context_list.h
27    ../include/selinux/get_default_type.h
28    ../include/selinux/label.h
29    ../include/selinux/restorecon.h
30)
31if ! cat "${FILE_LIST[@]}" | ${CC:-gcc} -x c -c -I../include -o temp.o - -aux-info temp.aux
32then
33    # clang does not support -aux-info so fall back to gcc
34    cat "${FILE_LIST[@]}" | gcc -x c -c -I../include -o temp.o - -aux-info temp.aux
35fi
36for i in `awk '/<stdin>.*extern int/ { print $6 }' temp.aux`; do except $i ; done
37rm -f -- temp.aux temp.o
38