blob: ababbae95e45ae8eebc4ef9f7affc7ff9a4818d5 [file] [log] [blame]
b.liue9582032025-04-17 19:18:16 +08001#
2# This is free software, licensed under the GNU General Public License v2.
3# See /LICENSE for more information.
4#
5
6include $(TOPDIR)/rules.mk
7
8PKG_NAME:=selinux-python
9PKG_VERSION:=3.5
10PKG_RELEASE:=1
11
12PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
13PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/$(PKG_VERSION)
14PKG_HASH:=8245bb4dae59333461f19ca0c79a829081f07972fa5e3ad4c2b2b917dd71d96b
15
16PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
17PKG_LICENSE:=GPL-2.0-only
18PKG_LICENSE_FILES:=LICENSE
19
20PKG_BUILD_PARALLEL:=1
21PKG_INSTALL:=1
22PYTHON3_PKG_BUILD:=0
23
24include $(INCLUDE_DIR)/package.mk
25include ../../lang/python/python3-package.mk
26
27#
28# common definitions
29#
30
31define Package/selinux-python/Default
32 URL:=http://selinuxproject.org/page/Main_Page
33 DEPENDS:=+python3-light
34endef
35
36define Package/selinux-python/Default/python
37$(call Package/selinux-python/Default)
38 SUBMENU:=Python
39 SECTION:=lang
40 CATEGORY:=Languages
41endef
42
43define Package/selinux-python/Default/util
44$(call Package/selinux-python/Default)
45 SECTION:=utils
46 CATEGORY:=Utilities
47 TITLE:=SELinux management utility
48endef
49
50define Package/selinux-python/Default/description
51A set of SELinux tools written in Python that help with managing a
52system with SELinux enabled.
53endef
54
55MAKE_VARS = \
56 $(PYTHON3_VARS) \
57 $(HOST_PYTHON3_PIP_VARS) \
58 PYTHON_SETUP_ARGS=--no-compile
59
60define Build/Compile
61 $(call Build/Compile/Default,all)
62endef
63
64#
65# python3-seobject
66#
67
68define Package/python3-seobject
69$(call Package/selinux-python/Default/python)
70 TITLE:=SELinux seobject library
71 DEPENDS+= +python3-selinux +python3-semanage +python3-sepolicy +python3-setools
72endef
73
74define Package/python3-seobject/description
75$(call Package/selinux-python/Default/description)
76
77This package contains the seobject library.
78endef
79
80define Py3Package/python3-seobject/filespec
81+|$(PYTHON3_PKG_DIR)/seobject.py
82endef
83
84Py3Package/python3-seobject/install:=:
85
86#
87# python3-sepolgen
88#
89
90define Package/python3-sepolgen
91$(call Package/selinux-python/Default/python)
92 TITLE:=SELinux policy generation library
93 DEPENDS+= +python3-selinux
94endef
95
96define Package/python3-sepolgen/description
97$(call Package/selinux-python/Default/description)
98
99This package contains the SELinux policy generation Python library.
100endef
101
102define Package/python3-sepolgen/conffiles
103/etc/sepolgen/
104endef
105
106define Py3Package/python3-sepolgen/filespec
107+|$(PYTHON3_PKG_DIR)/sepolgen
108endef
109
110define Py3Package/python3-sepolgen/install
111 $(INSTALL_DIR) $(1)/etc/sepolgen
112 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/var/lib/sepolgen/perm_map $(1)/etc/sepolgen/
113endef
114
115#
116# python3-sepolicy
117#
118
119define Package/python3-sepolicy
120$(call Package/selinux-python/Default/python)
121 TITLE:=SELinux Policy Analyses binding
122 DEPENDS+= +python3-selinux +python3-sepolgen +python3-xml +python3-setools
123endef
124
125define Package/python3-sepolicy/description
126$(call Package/selinux-python/Default/description)
127
128This package contains a Python binding for SELinux Policy Analyses.
129endef
130
131define Py3Package/python3-sepolicy/filespec
132+|$(PYTHON3_PKG_DIR)/sepolicy
133-|$(PYTHON3_PKG_DIR)/sepolicy/gui.py
134-|$(PYTHON3_PKG_DIR)/sepolicy/sedbus.py
135+|$(PYTHON3_PKG_DIR)/sepolicy-$(PKG_VERSION).dist-info
136endef
137
138Py3Package/python3-sepolicy/install:=:
139
140#
141# selinux-audit2allow
142#
143
144define Package/selinux-audit2allow
145$(call Package/selinux-python/Default/util)
146 TITLE+= audit2allow
147 DEPENDS+= +python3-selinux +python3-sepolgen
148endef
149
150define Package/selinux-audit2allow/description
151$(call Package/selinux-python/Default/description)
152
153This package contains the audit2allow and audit2why tools.
154endef
155
156define Package/selinux-audit2allow/install
157 $(INSTALL_DIR) $(1)/usr/bin
158 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/audit2allow $(1)/usr/bin/
159 $(LN) audit2allow $(1)/usr/bin/audit2why
160endef
161
162#
163# selinux-chchat
164#
165
166define Package/selinux-chcat
167$(call Package/selinux-python/Default/util)
168 TITLE+= chcat
169 DEPENDS+= +python3-selinux +python3-seobject +selinux-semanage
170endef
171
172define Package/selinux-chcat/description
173$(call Package/selinux-python/Default/description)
174
175This package contains the chcat tool.
176endef
177
178define Package/selinux-chcat/install
179 $(INSTALL_DIR) $(1)/usr/bin
180 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/chcat $(1)/usr/bin/
181endef
182
183#
184# selinux-python
185#
186
187define Package/selinux-python
188$(call Package/selinux-python/Default/util)
189 TITLE+= meta-package
190 DEPENDS:= \
191 +selinux-audit2allow \
192 +selinux-chcat \
193 +selinux-semanage \
194 +selinux-sepolgen-ifgen \
195 +selinux-sepolicy
196endef
197
198define Package/selinux-python/description
199$(call Package/selinux-python/Default/description)
200
201This is a meta-package that installs all of the SELinux management
202utilities.
203endef
204
205Package/selinux-python/install:=:
206
207#
208# selinux-semanage
209#
210
211define Package/selinux-semanage
212$(call Package/selinux-python/Default/util)
213 TITLE+= semanage
214 DEPENDS+= +python3-seobject
215endef
216
217define Package/selinux-semanage/description
218$(call Package/selinux-python/Default/description)
219
220This package contains the semanage tool.
221endef
222
223define Package/selinux-semanage/install
224 $(INSTALL_DIR) $(1)/usr/sbin
225 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/sbin/semanage $(1)/usr/sbin/
226endef
227
228#
229# selinux-sepolgen-ifgen
230#
231
232define Package/selinux-sepolgen-ifgen
233$(call Package/selinux-python/Default/util)
234 TITLE+= sepolgen-ifgen
235 DEPENDS+= +python3-selinux +python3-sepolgen +libselinux
236endef
237
238define Package/selinux-sepolgen-iften/description
239$(call Package/selinux-python/Default/description)
240
241This package contains the sepolgen-ifgen tool.
242endef
243
244define Package/selinux-sepolgen-ifgen/install
245 $(INSTALL_DIR) $(1)/usr/bin
246 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolgen-ifgen $(1)/usr/bin/
247 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolgen-ifgen-attr-helper $(1)/usr/bin/
248endef
249
250#
251# selinux-sepolicy
252#
253
254define Package/selinux-sepolicy
255$(call Package/selinux-python/Default/util)
256 TITLE+= sepolicy
257 DEPENDS+= +python3-multiprocessing +python3-selinux +python3-sepolicy
258endef
259
260define Package/selinux-sepolicy/description
261$(call Package/selinux-python/Default/description)
262
263This package contains the sepolicy and sepolgen tools.
264endef
265
266define Package/selinux-sepolicy/install
267 $(INSTALL_DIR) $(1)/usr/bin
268 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/sepolicy $(1)/usr/bin/
269 $(LN) sepolicy $(1)/usr/bin/sepolgen
270endef
271
272$(eval $(call Py3Package,python3-seobject))
273$(eval $(call Py3Package,python3-sepolgen))
274$(eval $(call Py3Package,python3-sepolicy))
275
276$(eval $(call BuildPackage,python3-seobject))
277$(eval $(call BuildPackage,python3-sepolgen))
278$(eval $(call BuildPackage,python3-sepolicy))
279
280$(eval $(call BuildPackage,python3-seobject-src))
281$(eval $(call BuildPackage,python3-sepolgen-src))
282$(eval $(call BuildPackage,python3-sepolicy-src))
283
284$(eval $(call BuildPackage,selinux-audit2allow))
285$(eval $(call BuildPackage,selinux-chcat))
286$(eval $(call BuildPackage,selinux-python))
287$(eval $(call BuildPackage,selinux-semanage))
288$(eval $(call BuildPackage,selinux-sepolgen-ifgen))
289$(eval $(call BuildPackage,selinux-sepolicy))