Skip to contentSkip to conversation

Install policy headers and include them in the refpolicy dev package.

meta-selinux Philip Tricca 1 participant 3 messages Sep 18, 2013 – Sep 19, 2013

lore
Share & tools
lore
#0 lore raw

This patch is pretty straight forward: All we do is call the 'install-headers' make target at the end of do_install. We then add the interface 'include' directory to the dev package. This allows projects that ship their own SELinux policy (not in the refpolicy) to build against the refpolicy headers / interface files by using the Makefile supplied by refpolicy.

---
 recipes-security/refpolicy/refpolicy_common.inc |    6 +++++-                 
 1 file changed, 5 insertions(+), 1 deletion(-)                                
recipes-security/refpolicy/refpolicy_common.inc +5 -1
index 2c8891a..0f9f83b 100644
@@ -12,7 +12,8 @@ SRC_URI += "file://customizable_types \
 S = "${WORKDIR}/refpolicy"
 
 FILES_${PN} = "${sysconfdir}/selinux/${POLICY_NAME}/ \
-       ${datadir}/selinux/${POLICY_NAME}/"
+       ${datadir}/selinux/${POLICY_NAME}/*.pp"
+FILES_${PN}-dev =+ "${datadir}/selinux/${POLICY_NAME}/include/"
 
 DEPENDS += "checkpolicy-native policycoreutils-native m4-native"
 RDEPENDS_${PN} += "policycoreutils selinux-config"
@@ -75,4 +76,7 @@ EOF
 
        cat ${WORKDIR}/customizable_types >> \
                ${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/customizable_types
+
+       # install policy headers
+       oe_runmake install-headers DESTDIR=${D}
 }
Signature · 1 line
1.7.10.4
#1 lore raw
Quoted 6 lines · Philip Tricca

This patch is pretty straight forward: All we do is call the 'install-headers' make target at the end of do_install. We then add the interface 'include' directory to the dev package. This allows projects that ship their own SELinux policy (not in the refpolicy) to build against the refpolicy headers / interface files by using the Makefile supplied by refpolicy.

Apologies, I let my MUA mangle that last patch something awful. Fixed below:

---
 recipes-security/refpolicy/refpolicy_common.inc |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-security/refpolicy/refpolicy_common.inc +5 -1
index 2c8891a..07c05aa 100644
@@ -12,7 +12,8 @@ SRC_URI += "file://customizable_types \
 S = "${WORKDIR}/refpolicy"
 
 FILES_${PN} = "${sysconfdir}/selinux/${POLICY_NAME}/ \
-	${datadir}/selinux/${POLICY_NAME}/"
+	${datadir}/selinux/${POLICY_NAME}/*.pp"
+FILES_${PN}-dev =+ "${datadir}/selinux/${POLICY_NAME}/include/""
 
 DEPENDS += "checkpolicy-native policycoreutils-native m4-native"
 RDEPENDS_${PN} += "policycoreutils selinux-config"
@@ -75,4 +76,7 @@ EOF
 
 	cat ${WORKDIR}/customizable_types >> \
 		${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/customizable_types
+
+	# install policy headers
+	oe_runmake install-headers DESTDIR=${D}
 }
Signature · 1 line
1.7.10.
#2 lore raw
Quoted 20 lines · Philip Tricca
Quoted 6 lines · Philip Tricca

This patch is pretty straight forward: All we do is call the 'install-headers' make target at the end of do_install. We then add the interface 'include' directory to the dev package. This allows projects that ship their own SELinux policy (not in the refpolicy) to build against the refpolicy headers / interface files by using the Makefile supplied by refpolicy.

Apologies, I let my MUA mangle that last patch something awful. Fixed below:

---
 recipes-security/refpolicy/refpolicy_common.inc |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
recipes-security/refpolicy/refpolicy_common.inc +0 -0
index 2c8891a..07c05aa 100644

recipes-security/refpolicy/refpolicy_common.inc SRC_URI += "file://customizable_types \ · line 16

Quoted 6 lines
recipes-security/refpolicy/refpolicy_common.inc +2 -1
@@ -12,7 +12,8 @@ SRC_URI += "file://customizable_types \
 S = "${WORKDIR}/refpolicy"
 
 FILES_${PN} = "${sysconfdir}/selinux/${POLICY_NAME}/ \
-	${datadir}/selinux/${POLICY_NAME}/"
+	${datadir}/selinux/${POLICY_NAME}/*.pp"
+FILES_${PN}-dev =+ "${datadir}/selinux/${POLICY_NAME}/include/""

That last quote in the FILES_${PN}-dev line needs to go. Can resubmit if requested.

Quoted 12 lines
recipes-security/refpolicy/refpolicy_common.inc +3 -0
 DEPENDS += "checkpolicy-native policycoreutils-native m4-native"
 RDEPENDS_${PN} += "policycoreutils selinux-config"
@@ -75,4 +76,7 @@ EOF
 
 	cat ${WORKDIR}/customizable_types >> \
 		${D}${sysconfdir}/selinux/${POLICY_NAME}/contexts/customizable_types
+
+	# install policy headers
+	oe_runmake install-headers DESTDIR=${D}
 }