packages/utils/xxhash/Makefile
Jeffery To 2f4b161e28
xxhash: Fix pkg-config metadata file
Currently, Build/InstallDev installs libxxhash.pc.in, which is the
template for libxxhash.pc and does not contain the correct information.
(pkg-config also does not recognize this file name.)

This uses PKG_INSTALL:=1 so that libxxhash.pc is generated (by 'make
install').

This also removes the need to override Build/Prepare by setting the
correct command in PKG_UNPACK.

Signed-off-by: Jeffery To <jeffery.to@gmail.com>
2023-04-24 16:18:13 +08:00

93 lines
2.6 KiB
Makefile

#
# Copyright (C) 2022 Julien Malik <julien.malik@paraiso.me>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
# initial implementation kindly stolen from (and then updated) :
# https://forum.openwrt.org/t/xxhash-makefile/118426
include $(TOPDIR)/rules.mk
PKG_NAME:=xxhash
PKG_VERSION:=0.8.1
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)_$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/Cyan4973/xxHash/archive/v$(PKG_VERSION)
PKG_HASH:=3bb6b7d6f30c591dd65aaaff1c8b7a5b94d81687998ca9400082c739a690436c
# The source for the library (xxhash.c and xxhash.h) is BSD
# The source for the command line tool (xxhsum.c) is GPLv2+
PKG_LICENSE:=BSD-2-Clause,GPL-2.0-or-later
PKG_LICENSE_FILES:=LICENSE,cli/COPYING
PKG_MAINTAINER:=Julien Malik <julien.malik@paraiso.me>
PKG_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
PKG_UNPACK:=$(HOST_TAR) -C "$(PKG_BUILD_DIR)" --strip-components=1 -xzf "$(DL_DIR)/$(PKG_SOURCE)"
define Package/xxhash/Default
TITLE:=Extremely fast hash algorithm
URL:=https://cyan4973.github.io/xxHash/
endef
define Package/xxhash/Default/description
xxHash is an Extremely fast Hash algorithm, running at RAM speed
limits. It successfully completes the SMHasher test suite which
evaluates collision, dispersion and randomness qualities of hash
functions. Code is highly portable, and hashes are identical on all
platforms (little / big endian).
endef
define Package/libxxhash
$(call Package/xxhash/Default)
SECTION:=libs
CATEGORY:=Libraries
endef
define Package/libxxhash/description
$(call Package/xxhash/Default/description)
This package contains the shared library.
endef
define Package/xxhash
$(call Package/xxhash/Default)
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:= +libxxhash
endef
define Package/xxhash/description
$(call Package/xxhash/Default/description)
This package contains the executables.
endef
MAKE_FLAGS += PREFIX=/usr
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/libxxhash.{a,so*} $(1)/usr/lib/
$(INSTALL_DIR) $(1)/usr/lib/pkgconfig
$(CP) $(PKG_INSTALL_DIR)/usr/lib/pkgconfig/libxxhash.pc $(1)/usr/lib/pkgconfig/
endef
define Package/libxxhash/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libxxhash.so.* $(1)/usr/lib/
endef
define Package/xxhash/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/xxh*sum $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libxxhash))
$(eval $(call BuildPackage,xxhash))