2 # This is free software, licensed under the GNU General Public License v2.
3 # See /LICENSE for more information.
6 include $(TOPDIR
)/rules.mk
12 PKG_SOURCE
:=$(PKG_NAME
)-$(PKG_VERSION
).
tar.gz
13 PKG_SOURCE_URL
:=https
://github.com
/SELinuxProject
/selinux
/releases
/download
/$(PKG_VERSION
)
14 PKG_HASH
:=9a3a3705ac13a2ccca2de6d652b6356fead10f36fb33115c185c5ccdf29eec19
16 PKG_LICENSE
:=libselinux-1.0
17 PKG_LICENSE_FILES
:=LICENSE
18 PKG_MAINTAINER
:=Thomas Petazzoni
<thomas.petazzoni@bootlin.com
>
19 PKG_CPE_ID
:=cpe
:/a
:selinuxproject
:libselinux
21 HOST_BUILD_DEPENDS
:=libsepol
/host musl-fts
/host pcre2
/host
23 include $(INCLUDE_DIR
)/package.mk
24 include $(INCLUDE_DIR
)/host-build.mk
43 selabel_get_digests_all_partial_matches \
45 selabel_lookup_best_match \
46 selabel_partial_match \
47 selinux_check_access \
48 selinux_check_securetty_context \
63 $(eval
$(foreach a
,$(LIBSELINUX_ALTS
),ALTS_
$(a
):=300:/usr
/sbin
/$(a
):/usr
/sbin
/libselinux-
$(a
)$(newline
)))
65 define Package
/libselinux
/Default
66 TITLE
:=Runtime SELinux library
67 URL
:=http
://selinuxproject.org
/page
/Main_Page
70 define Package
/libselinux
71 $(call Package
/libselinux
/Default
)
74 DEPENDS
:=+libsepol
+libpcre2
+USE_MUSL
:musl-fts
77 define Package
/libselinux
/description
78 libselinux is the runtime SELinux library that provides
79 interfaces
(e.g. library functions for the SELinux kernel
80 APIs like getcon
(), other support functions like
81 getseuserbyname
()) to SELinux-aware applications. libselinux
82 may use the shared libsepol to manipulate the binary policy
83 if necessary
(e.g. to downgrade the policy format to an
84 older version supported by the kernel
) when loading policy.
89 $(call Package
/libselinux
/Default
)
94 SUBMENU
:=libselinux tools
95 ALTERNATIVES
:=$(ALTS_
$(2))
98 define Package
/$(1)/description
99 libselinux version of the
$(2) utility.
103 $(foreach a
,$(LIBSELINUX_UTILS
),$(eval
$(call GenUtilPkg
,libselinux-
$(a
),$(a
))))
105 # Needed to link libselinux utilities, which link against
106 # libselinux.so, which indirectly depends on libpcre.so, installed in
107 # $(STAGING_DIR_HOSTPKG).
108 HOST_LDFLAGS
+= -Wl
,-rpath
="$(STAGING_DIR_HOSTPKG)/lib"
111 PREFIX
=$(STAGING_DIR_HOSTPKG
) \
112 SHLIBDIR
=$(STAGING_DIR_HOSTPKG
)/lib \
115 ifeq ($(CONFIG_USE_MUSL
),y
)
116 MAKE_FLAGS
+= FTS_LDLIBS
=-lfts
117 TARGET_CFLAGS
+= -D_LARGEFILE64_SOURCE
125 $(call Build
/Compile
/Default
,all)
129 $(call Build
/Install
/Default
,install)
132 define Build
/InstallDev
133 $(INSTALL_DIR
) $(1)/usr
/include
134 $(CP
) $(PKG_INSTALL_DIR
)/usr
/include/* $(1)/usr
/include/
135 $(INSTALL_DIR
) $(1)/usr
/lib
136 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/* $(1)/usr
/lib
/
137 $(INSTALL_DIR
) $(1)/usr
/lib
/pkgconfig
138 $(INSTALL_DATA
) $(PKG_INSTALL_DIR
)/usr
/lib
/pkgconfig
/libselinux.
pc $(1)/usr
/lib
/pkgconfig
/
139 $(SED
) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr
/lib
/pkgconfig
/libselinux.
pc
140 $(SED
) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr
/lib
/pkgconfig
/libselinux.
pc
143 define Package
/libselinux
/install
144 $(INSTALL_DIR
) $(1)/usr
/lib
145 $(CP
) $(PKG_INSTALL_DIR
)/usr
/lib
/libselinux.so.
* $(1)/usr
/lib
/
149 define Package
/$(1)/install
150 $(INSTALL_DIR
) $$(1)/usr
/sbin
151 $(INSTALL_BIN
) $(PKG_INSTALL_DIR
)/usr
/sbin
/$(2) $$(1)/usr
/sbin
/$(if
$(ALTS_
$(2)),libselinux-
$(2),$(2))
154 $$(eval
$$(call BuildPackage
,$(1)))
157 $(eval
$(call HostBuild
))
158 $(eval
$(call BuildPackage
,libselinux
))
159 $(foreach a
,$(LIBSELINUX_UTILS
),$(eval
$(call BuildUtil
,libselinux-
$(a
),$(a
))))