b.liu | e958203 | 2025-04-17 19:18:16 +0800 | [diff] [blame] | 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:=audit-userspace |
| 9 | PKG_VERSION:=3.1.5 |
| 10 | PKG_RELEASE:=1 |
| 11 | |
| 12 | PKG_SOURCE_PROTO:=git |
| 13 | PKG_SOURCE_URL:=https://github.com/linux-audit/$(PKG_NAME).git |
| 14 | PKG_SOURCE_VERSION:=v$(PKG_VERSION) |
| 15 | PKG_MIRROR_HASH:=1e00ac07679ba5801732a2b3ec4f6fcbd0c31901cbffbc2cab14f0953e5b2030 |
| 16 | |
| 17 | PKG_MAINTAINER:=Thomas Petazzoni <thomas.petazzoni@bootlin.com> |
| 18 | PKG_LICENSE:=GPL-2.0-or-later LGPL-2.1-or-later |
| 19 | PKG_LICENSE_FILES:=COPYING COPYING.LIB |
| 20 | PKG_CPE_ID:=cpe:/a:linux_audit_project:linux_audit |
| 21 | |
| 22 | PKG_CONFIG_DEPENDS:=CONFIG_KERNEL_IO_URING |
| 23 | PKG_FIXUP:=autoreconf |
| 24 | |
| 25 | PKG_BUILD_FLAGS:=no-mips16 |
| 26 | PKG_INSTALL:=1 |
| 27 | |
| 28 | include $(INCLUDE_DIR)/package.mk |
| 29 | include $(INCLUDE_DIR)/host-build.mk |
| 30 | |
| 31 | define Package/audit/Default |
| 32 | TITLE:=Audit |
| 33 | URL:=https://github.com/linux-audit/ |
| 34 | endef |
| 35 | |
| 36 | define Package/audit/Default/description |
| 37 | The audit package contains the user space utilities for |
| 38 | storing and searching the audit records generated by |
| 39 | the audit subsystem in the kernel. |
| 40 | endef |
| 41 | |
| 42 | define Package/libaudit |
| 43 | $(call Package/audit/Default) |
| 44 | SECTION:=libs |
| 45 | CATEGORY:=Libraries |
| 46 | TITLE+= (libaudit) |
| 47 | endef |
| 48 | |
| 49 | define Package/libaudit/description |
| 50 | $(call Package/audit/Default/description) |
| 51 | This package contains the audit shared library. |
| 52 | endef |
| 53 | |
| 54 | define Package/libauparse |
| 55 | $(call Package/audit/Default) |
| 56 | SECTION:=libs |
| 57 | CATEGORY:=Libraries |
| 58 | TITLE+= (libauparse) |
| 59 | DEPENDS:= +libaudit |
| 60 | endef |
| 61 | |
| 62 | define Package/libauparse/description |
| 63 | $(call Package/audit/Default/description) |
| 64 | This package contains the audit parsing shared library. |
| 65 | endef |
| 66 | |
| 67 | define Package/audit-utils |
| 68 | $(call Package/audit/Default) |
| 69 | SECTION:=admin |
| 70 | CATEGORY:=Administration |
| 71 | TITLE+= (utilities) |
| 72 | DEPENDS:= +libaudit +libauparse |
| 73 | endef |
| 74 | |
| 75 | define Package/audit-utils/description |
| 76 | $(call Package/audit/Default/description) |
| 77 | This package contains the audit utilities. |
| 78 | endef |
| 79 | |
| 80 | define Package/auditd |
| 81 | $(call Package/audit/Default) |
| 82 | SECTION:=admin |
| 83 | CATEGORY:=Administration |
| 84 | TITLE+= (daemon) |
| 85 | DEPENDS:= +libaudit +libauparse +audit-utils +libev |
| 86 | endef |
| 87 | |
| 88 | define Package/auditd/description |
| 89 | $(call Package/audit/Default/description) |
| 90 | This package contains the audit daemon. |
| 91 | endef |
| 92 | |
| 93 | CONFIGURE_VARS += \ |
| 94 | LDFLAGS_FOR_BUILD="$(HOST_LDFLAGS)" \ |
| 95 | CPPFLAGS_FOR_BUILD="$(HOST_CPPFLAGS)" \ |
| 96 | CFLAGS_FOR_BUILD="$(HOST_CFLAGS)" \ |
| 97 | CC_FOR_BUILD="$(HOSTCC)" |
| 98 | |
| 99 | CONFIGURE_ARGS += \ |
| 100 | --with-debug \ |
| 101 | --disable-systemd \ |
| 102 | --disable-zos-remote \ |
| 103 | --disable-gssapi-krb5 \ |
| 104 | --without-libcap-ng \ |
| 105 | --without-python \ |
| 106 | --without-python3 \ |
| 107 | --without-golang |
| 108 | |
| 109 | ifeq ($(ARCH),aarch64) |
| 110 | CONFIGURE_ARGS += --with-aarch64 |
| 111 | else ifeq ($(ARCH),arm) |
| 112 | CONFIGURE_ARGS += --with-arm |
| 113 | endif |
| 114 | |
| 115 | HOST_CONFIGURE_ARGS += \ |
| 116 | --disable-systemd \ |
| 117 | --disable-zos-remote \ |
| 118 | --disable-gssapi-krb5 \ |
| 119 | --without-libcap-ng \ |
| 120 | --without-python \ |
| 121 | --without-python3 \ |
| 122 | --without-golang |
| 123 | |
| 124 | define Host/Install |
| 125 | +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/lib $(HOST_MAKE_FLAGS) install |
| 126 | +$(HOST_MAKE_VARS) $(MAKE) $(HOST_JOBS) -C $(HOST_BUILD_DIR)/init.d $(HOST_MAKE_FLAGS) install |
| 127 | endef |
| 128 | |
| 129 | # We can't use the default, as the default passes $(MAKE_ARGS), which |
| 130 | # overrides CC, CFLAGS, etc. and defeats the *_FOR_BUILD definitions |
| 131 | # passed in CONFIGURE_VARS |
| 132 | define Build/Compile |
| 133 | $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/$(MAKE_PATH) |
| 134 | endef |
| 135 | |
| 136 | define Build/Install |
| 137 | $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/lib $(MAKE_INSTALL_FLAGS) install |
| 138 | $(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR)/init.d $(MAKE_INSTALL_FLAGS) install |
| 139 | $(call Build/Install/Default,install) |
| 140 | endef |
| 141 | |
| 142 | define Build/InstallDev |
| 143 | $(INSTALL_DIR) $(1)/usr/include |
| 144 | $(CP) $(PKG_INSTALL_DIR)/usr/include/* $(1)/usr/include/ |
| 145 | $(INSTALL_DIR) $(1)/usr/lib/pkgconfig |
| 146 | $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/*.pc $(1)/usr/lib/pkgconfig/ |
| 147 | $(INSTALL_DIR) $(1)/usr/lib |
| 148 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/* $(1)/usr/lib/ |
| 149 | endef |
| 150 | |
| 151 | define Package/libaudit/install |
| 152 | $(INSTALL_DIR) $(1)/usr/lib |
| 153 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libaudit.so* $(1)/usr/lib/ |
| 154 | $(INSTALL_DIR) $(1)/etc |
| 155 | $(CP) $(PKG_INSTALL_DIR)/etc/libaudit.conf $(1)/etc/ |
| 156 | endef |
| 157 | |
| 158 | define Package/libauparse/install |
| 159 | $(INSTALL_DIR) $(1)/usr/lib |
| 160 | $(CP) $(PKG_INSTALL_DIR)/usr/lib/libauparse.so* $(1)/usr/lib/ |
| 161 | endef |
| 162 | |
| 163 | define Package/audit-utils/install |
| 164 | $(INSTALL_DIR) $(1)/usr/bin |
| 165 | $(CP) $(PKG_INSTALL_DIR)/usr/bin/* $(1)/usr/bin/ |
| 166 | $(INSTALL_DIR) $(1)/usr/sbin |
| 167 | $(CP) \ |
| 168 | $(PKG_INSTALL_DIR)/usr/sbin/{audisp-remote,audisp-syslog,auditctl,augenrules,aureport,ausearch,autrace} \ |
| 169 | $(1)/usr/sbin/ |
| 170 | endef |
| 171 | |
| 172 | define Package/auditd/install |
| 173 | $(INSTALL_DIR) $(1)/etc/audit |
| 174 | $(CP) $(PKG_INSTALL_DIR)/etc/audit/* $(1)/etc/audit/ |
| 175 | # af_unix plugin is not installed. Remove it's .conf. |
| 176 | if [[ -f $(1)/etc/audit/plugins.d/af_unix.conf ]] ; then rm $(1)/etc/audit/plugins.d/af_unix.conf ; fi |
| 177 | $(INSTALL_DIR) $(1)/etc/init.d |
| 178 | $(INSTALL_BIN) ./files/audit.init $(1)/etc/init.d/audit |
| 179 | $(INSTALL_DIR) $(1)/usr/sbin |
| 180 | $(CP) $(PKG_INSTALL_DIR)/usr/sbin/auditd $(1)/usr/sbin/ |
| 181 | endef |
| 182 | |
| 183 | $(eval $(call HostBuild)) |
| 184 | $(eval $(call BuildPackage,libaudit)) |
| 185 | $(eval $(call BuildPackage,libauparse)) |
| 186 | $(eval $(call BuildPackage,audit-utils)) |
| 187 | $(eval $(call BuildPackage,auditd)) |