diff --git a/classes/enable-audit.bbclass b/classes/enable-audit.bbclass new file mode 100644 index 0000000..5820a38 --- /dev/null +++ b/classes/enable-audit.bbclass @@ -0,0 +1,5 @@ +# There is still no audit DISTRO_FEATURE, so enable audit when selinux feature enabled. +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d, 'audit')}" +PACKAGECONFIG[audit] = "--enable-audit,--disable-audit,audit," diff --git a/classes/enable-selinux.bbclass b/classes/enable-selinux.bbclass new file mode 100644 index 0000000..de2a124 --- /dev/null +++ b/classes/enable-selinux.bbclass @@ -0,0 +1,4 @@ +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d)}" +PACKAGECONFIG[selinux] = "--enable-selinux,--disable-selinux,libselinux," diff --git a/classes/selinux.bbclass b/classes/selinux.bbclass new file mode 100644 index 0000000..87d4d59 --- /dev/null +++ b/classes/selinux.bbclass @@ -0,0 +1,12 @@ +def target_selinux(d, truevar = 'selinux', falsevar = ''): + if not base_contains("DISTRO_FEATURES", "selinux", True, False, d): + return falsevar + + pn = d.getVar("PN", True) + type = pn.replace(d.getVar("BPN", True), "") + if type in ("-native", "-nativesdk", "-cross", "-crosssdk"): + return falsevar + + return truevar + +LIBSELINUX = "${@target_selinux(d, 'libselinux')}" diff --git a/classes/with-audit.bbclass b/classes/with-audit.bbclass new file mode 100644 index 0000000..0c15312 --- /dev/null +++ b/classes/with-audit.bbclass @@ -0,0 +1,5 @@ +# There is still no audit DISTRO_FEATURE, so enable audit when selinux feature enabled. +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d, 'audit')}" +PACKAGECONFIG[audit] = "--with-audit,--without-audit,audit," diff --git a/classes/with-selinux.bbclass b/classes/with-selinux.bbclass new file mode 100644 index 0000000..7873d9b --- /dev/null +++ b/classes/with-selinux.bbclass @@ -0,0 +1,4 @@ +inherit selinux + +PACKAGECONFIG_append = " ${@target_selinux(d)}" +PACKAGECONFIG[selinux] = "--with-selinux,--without-selinux,libselinux,"