aboutsummaryrefslogtreecommitdiff
path: root/libs/liblz4/Makefile
blob: fa297ebc5bc45be58a2222be42f6838c0391c59f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
#
# Copyright (C) 2015 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=lz4
PKG_VERSION:=1.9.4
PKG_RELEASE:=1

PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/lz4/lz4/tar.gz/v$(PKG_VERSION)?
PKG_HASH:=0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b

PKG_MAINTAINER:=Darik Horn <dajhorn@vanadac.com>
PKG_CPE_ID:=cpe:/a:lz4_project:lz4

PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_lz4

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/meson.mk

MESON_BUILD_DIR:=$(PKG_BUILD_DIR)/contrib/meson/openwrt-build

define Package/lz4/Default
  SUBMENU:=Compression
  URL:=https://www.lz4.org/
endef

define Package/liblz4
$(call Package/lz4/Default)
  SECTION:=libs
  CATEGORY:=Libraries
  TITLE:=Extremely fast compression
  LICENSE:=BSD-2-Clause
  LICENSE_FILES:=LICENSE lib/LICENSE
  ABI_VERSION:=$(firstword $(subst .,$(space),$(PKG_VERSION)))
  MENU:=1
endef

define Package/liblz4/description
  LZ4 is a compression codec that features a very fast encoder and an
  even faster decoder. This package provides the liblz4 shared library.
endef

define Package/liblz4/config
	source "$(SOURCE)/Config.in"
endef

define Package/lz4
$(call Package/lz4/Default)
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Extremely fast compression
  LICENSE:=GPL-2.0-or-later
  LICENSE_FILES:=LICENSE programs/COPYING
  DEPENDS:=+liblz4
endef

define Package/lz4/description
  LZ4 - Fast real-time compression algorithm.
  This package provides the lz4 binaries.
endef

MESON_ARGS += \
	-Ddebug-level=0 \
	-Dunstable=false \
	-Dprograms=$(if $(CONFIG_PACKAGE_lz4),true,false) \
	-Dtests=false \
	-Dcontrib=false \
	-Dexamples=false \
	-Db_lto=false

ifeq ($(CONFIG_LZ4_OPTIMIZE_SPEED),y)
	TARGET_CFLAGS := $(filter-out -O%,$(TARGET_CFLAGS)) -O3
endif

define Build/InstallDev
	$(INSTALL_DIR) $(1)/usr/include
	$(CP) $(PKG_INSTALL_DIR)/usr/include/*.h $(1)/usr/include
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/liblz4.so* $(1)/usr/lib
	$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/liblz4.pc $(1)/usr/lib/pkgconfig
endef

define Package/liblz4/install
	$(INSTALL_DIR) $(1)/usr/lib
	$(CP) $(PKG_INSTALL_DIR)/usr/lib/liblz4.so.$(ABI_VERSION)* $(1)/usr/lib/
endef

define Package/lz4/install
	$(INSTALL_DIR) $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/bin/{lz4,lz4c,lz4cat,unlz4} $(1)/usr/bin/
endef

$(eval $(call BuildPackage,liblz4))
$(eval $(call BuildPackage,lz4))