450bdfbf3baa817b8ef62fa5acae4667617282fa
[openwrt/openwrt.git] / package / libs / libselinux / Makefile
1 #
2 # This is free software, licensed under the GNU General Public License v2.
3 # See /LICENSE for more information.
4 #
5
6 include $(TOPDIR)/rules.mk
7
8 PKG_NAME:=libselinux
9 PKG_VERSION:=3.1
10 PKG_RELEASE:=1
11
12 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
13 PKG_SOURCE_URL:=https://github.com/SELinuxProject/selinux/releases/download/20200710
14 PKG_HASH:=ea5dcbb4d859e3f999c26a13c630da2f16dff9462e3cc8cb7b458ac157d112e7
15 HOST_BUILD_DEPENDS:=libsepol/host pcre/host
16
17 PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
18
19 include $(INCLUDE_DIR)/package.mk
20 include $(INCLUDE_DIR)/host-build.mk
21
22 define Package/libselinux
23 SECTION:=libs
24 DEPENDS:=+libsepol +libpcre +musl-fts
25 CATEGORY:=Libraries
26 TITLE:=Runtime SELinux library
27 URL:=http://selinuxproject.org/page/Main_Page
28 endef
29
30 define Package/libselinux/description
31 libselinux is the runtime SELinux library that provides
32 interfaces (e.g. library functions for the SELinux kernel
33 APIs like getcon(), other support functions like
34 getseuserbyname()) to SELinux-aware applications. libselinux
35 may use the shared libsepol to manipulate the binary policy
36 if necessary (e.g. to downgrade the policy format to an
37 older version supported by the kernel) when loading policy.
38 endef
39
40 define Package/libselinux-utils
41 SECTION:=utils
42 DEPENDS:=+libselinux
43 CATEGORY:=Utilities
44 TITLE:=Runtime SELinux utilities
45 URL:=http://selinuxproject.org/page/Main_Page
46 endef
47
48 # Needed to link libselinux utilities, which link against
49 # libselinux.so, which indirectly depends on libpcre.so, installed in
50 # $(STAGING_DIR_HOSTPKG).
51 HOST_LDFLAGS += -Wl,-rpath="$(STAGING_DIR_HOSTPKG)/lib"
52
53 HOST_MAKE_FLAGS += \
54 PREFIX=$(STAGING_DIR_HOSTPKG) \
55 SHLIBDIR=$(STAGING_DIR_HOSTPKG)/lib
56
57 MAKE_FLAGS += \
58 FTS_LDLIBS=-lfts \
59 SHLIBDIR=/usr/lib \
60 OS=Linux
61
62 define Build/Compile
63 $(call Build/Compile/Default,all)
64 endef
65
66 define Build/Install
67 $(call Build/Install/Default,install)
68 endef
69
70 define Build/InstallDev
71 $(INSTALL_DIR) $(1)/usr/include
72 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
73 $(INSTALL_DIR) $(1)/usr/lib
74 $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
75 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
76 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libselinux.pc $(1)/usr/lib/pkgconfig/
77 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libselinux.pc
78 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libselinux.pc
79 endef
80
81 define Package/libselinux/install
82 $(INSTALL_DIR) $(1)/usr/lib
83 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libselinux.so.* $(1)/usr/lib/
84 endef
85
86 define Package/libselinux-utils/install
87 $(INSTALL_DIR) $(1)/usr/sbin
88 $(CP) $(PKG_INSTALL_DIR)/usr/sbin/* $(1)/usr/sbin
89 endef
90
91 $(eval $(call HostBuild))
92 $(eval $(call BuildPackage,libselinux))
93 $(eval $(call BuildPackage,libselinux-utils))