1
0
mirror of https://git.openwrt.org/feed/packages.git synced 2024-06-24 08:37:37 +02:00
openwrt-packages/libs/libzip/Makefile
Sebastian Kemper 0c381f7c7a libzip: fix musl-fts failure
musl doesn't support fts. But with the extra package musl-fts installed,
libzip picks up the fts header and fails at the linking stage:

zipcmp.c:(.text.startup+0x130): undefined reference to `fts_open'
/home/sk/tmp/openwrt/staging_dir/toolchain-mips_24kc_gcc-8.3.0_musl/lib/gcc/mips-openwrt-linux-musl/8.3.0/../../../../mips-openwrt-linux-musl/bin/ld: zipcmp.c:(.text.startup+0x172): undefined reference to `fts_read'

So with musl-fts we need to link in libfts. To address that this commits
patches the cmake setup to check if fts is available in libc itself or
in any external libfts.

So when musl-fts is installed on the system the setup will be the
following:

musl: use libfts
uclibc: use fts from libc
glibc: like uclibc

Signed-off-by: Sebastian Kemper <sebastian_ml@gmx.net>
2019-12-16 23:33:32 +01:00

136 lines
3.4 KiB
Makefile

#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libzip
PKG_VERSION:=1.5.2
PKG_RELEASE:=2
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
PKG_SOURCE_URL:=https://libzip.org/download/
PKG_HASH:=b3de4d4bd49a01e0cab3507fc163f88e1651695b6b9cb25ad174dbe319d4a3b4
PKG_MAINTAINER:=Michael Heimpold <mhei@heimpold.de>
PKG_LICENSE:=BSD-3-Clause
PKG_LICENSE_FILES:=LICENSE
PKG_BUILD_PARALLEL:=1
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libzip/Default
TITLE:=libzip ($(2))
URL:=https://libzip.org/
SECTION:=libs
CATEGORY:=Libraries
SUBMENU:=Compression
DEPENDS:=+zlib $(3)
VARIANT:=$(1)
PROVIDES:=libzip
endef
define Package/libzip-$(BUILD_VARIANT)/description
A C library for reading, creating, and modifying zip archives.
endef
Package/libzip-nossl=$(call Package/libzip/Default,nossl,w/o encryption support)
Package/libzip-openssl=$(call Package/libzip/Default,openssl,OpenSSL,+PACKAGE_libzip-openssl:libopenssl)
Package/libzip-gnutls=$(call Package/libzip/Default,gnutls,GnuTLS,+PACKAGE_libzip-gnutls:libgnutls)
Package/libzip-mbedtls=$(call Package/libzip/Default,mbedtls,mbedTLS,+PACKAGE_libzip-mbedtls:libmbedtls)
define Package/zipcmp
TITLE:=zipcmp
URL:=https://libzip.org/
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Compression
DEPENDS:=+libzip +USE_MUSL:musl-fts
endef
define Package/zipcmp/description
This package contains the command line tool zipcmp from libzip.
endef
define Package/zipmerge
TITLE:=zipmerge
URL:=https://libzip.org/
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Compression
DEPENDS:=+libzip
endef
define Package/zipmerge/description
This package contains the command line tool zipmerge from libzip.
endef
define Package/ziptool
TITLE:=ziptool
URL:=https://libzip.org/
SECTION:=utils
CATEGORY:=Utilities
SUBMENU:=Compression
DEPENDS:=+libzip
endef
define Package/ziptool/description
This package contains the command line tool ziptool from libzip.
endef
CMAKE_OPTIONS += -DENABLE_COMMONCRYPTO=OFF
ifeq ($(BUILD_VARIANT),gnutls)
CMAKE_OPTIONS += -DENABLE_GNUTLS=ON
else
CMAKE_OPTIONS += -DENABLE_GNUTLS=OFF
endif
ifeq ($(BUILD_VARIANT),openssl)
CMAKE_OPTIONS += -DENABLE_OPENSSL=ON
else
CMAKE_OPTIONS += -DENABLE_OPENSSL=OFF
endif
ifeq ($(BUILD_VARIANT),mbedtls)
CMAKE_OPTIONS += -DENABLE_MBEDTLS=ON
else
CMAKE_OPTIONS += -DENABLE_MBEDTLS=OFF
endif
CMAKE_OPTIONS += -DENABLE_BZIP2=OFF
CMAKE_OPTIONS += -DBUILD_REGRESS=OFF
CMAKE_OPTIONS += -DBUILD_EXAMPLES=OFF
CMAKE_OPTIONS += -DBUILD_DOC=OFF
CMAKE_OPTIONS += -DBUILD_TOOLS=ON
define Package/libzip-$(BUILD_VARIANT)/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libzip.so.* $(1)/usr/lib/
endef
define Package/zipcmp/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/zipcmp $(1)/usr/bin/
endef
define Package/zipmerge/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/zipmerge $(1)/usr/bin/
endef
define Package/ziptool/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/ziptool $(1)/usr/bin/
endef
$(eval $(call BuildPackage,libzip-gnutls))
$(eval $(call BuildPackage,libzip-mbedtls))
$(eval $(call BuildPackage,libzip-openssl))
$(eval $(call BuildPackage,libzip-nossl))
$(eval $(call BuildPackage,zipcmp))
$(eval $(call BuildPackage,zipmerge))
$(eval $(call BuildPackage,ziptool))