libsepol: fix build on non-Linux systems
[openwrt/openwrt.git] / package / libs / libsepol / 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:=libsepol
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:=ae6778d01443fdd38cd30eeee846494e19f4d407b09872580372f4aa4bf8a3cc
15
16 PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com>
17
18 include $(INCLUDE_DIR)/package.mk
19
20 define Package/libsepol
21 SECTION:=libs
22 CATEGORY:=Libraries
23 TITLE:=SELinux binary policy manipulation library
24 URL:=http://selinuxproject.org/page/Main_Page
25 endef
26
27 define Package/libsepol/description
28 Libsepol is the binary policy manipulation library. It doesn't
29 depend upon or use any of the other SELinux components.
30 endef #'
31
32 include $(INCLUDE_DIR)/host-build.mk
33
34 HOST_MAKE_FLAGS += \
35 PREFIX=$(STAGING_DIR_HOSTPKG) \
36 SHLIBDIR=$(STAGING_DIR_HOSTPKG)/lib
37
38 MAKE_FLAGS += \
39 SHLIBDIR=/usr/lib \
40 OS=Linux
41
42 define Build/Compile
43 $(call Build/Compile/Default,all)
44 endef
45
46 define Build/Install
47 $(call Build/Install/Default,install)
48 endef
49
50 define Build/InstallDev
51 $(INSTALL_DIR) $(1)/usr/include
52 $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/
53 $(INSTALL_DIR) $(1)/usr/lib
54 $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/
55 $(INSTALL_DIR) $(1)/usr/lib/pkgconfig
56 $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libsepol.pc $(1)/usr/lib/pkgconfig/
57 $(SED) 's,/usr/include,$$$${prefix}/include,g' $(1)/usr/lib/pkgconfig/libsepol.pc
58 $(SED) 's,/usr/lib,$$$${exec_prefix}/lib,g' $(1)/usr/lib/pkgconfig/libsepol.pc
59 endef
60
61 define Package/libsepol/install
62 $(INSTALL_DIR) $(1)/usr/lib
63 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libsepol.so.* $(1)/usr/lib/
64 endef
65
66 $(eval $(call HostBuild))
67 $(eval $(call BuildPackage,libsepol))