Files
packages/utils/tar/Makefile
T
Daniel Dickinson 488be84075 utils/tar: Make compression, acl, and xattr support configuration options
This patch make building tar with POSIX ACL and XATTR
support configuration options.  It also makes building
seamless (e.g. -z -J -j) compression support a configuration
option for each compression program available in OpenWrt.

It also makes POSIX ACL support disabled by default
(by default OpenWrt doesn't build POSIX ACL support
into the kernel, never mind allowing to mount with it
enabled).  Also XATTR support is disabled by
default as this seems to be the standard default for packages
in OpenWrt.

Finally Bzip2, Gzip, and XZ seamless support are made
available by default and appropriate dependencies
are added based on the configuration choice.

Signed-off-by: Daniel Dickinson <openwrt@daniel.thecshore.com>
2016-05-16 04:23:30 -04:00

105 lines
2.5 KiB
Makefile

#
# Copyright (C) 2008-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:=tar
PKG_VERSION:=1.28
PKG_RELEASE:=3
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
PKG_MD5SUM:=8f32b2bc1ed7ddf4cf4e4a39711341b0
PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=COPYING
PKG_INSTALL:=1
BUILD_DEPENDS:=xz
include $(INCLUDE_DIR)/package.mk
define Package/tar
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+PACKAGE_TAR_POSIX_ACL:libacl +PACKAGE_TAR_XATTR:libattr +PACKAGE_TAR_BZIP2:bzip2
EXTRA_DEPENDS:=$(if $(CONFIG_PACKAGE_TAR_XZ),xz)
TITLE:=GNU tar
URL:=http://www.gnu.org/software/tar/
MENU:=1
endef
define Package/tar/config
config PACKAGE_TAR_POSIX_ACL
bool "tar: Enable POSIX ACL support" if PACKAGE_tar
default n
config PACKAGE_TAR_XATTR
bool "tar: Enable extended attribute (xattr) support" if PACKAGE_tar
default n
config PACKAGE_TAR_GZIP
bool "tar: Enable seamless gzip support" if PACKAGE_tar
default y
config PACKAGE_TAR_BZIP2
bool "tar: Enable seamless bzip2 support" if PACKAGE_tar
default y
config PACKAGE_TAR_XZ
bool "tar: Enable seamless xz support" if PACKAGE_tar
select PACKAGE_xz-utils
select PACKAGE_xz
default y
endef
define Package/tar/description
Tar is a program for packaging a set of files as a
single archive in tar format.
endef
define Package/tar/postinst
#!/bin/sh
if [ -e $${IPKG_INSTROOT}/bin/tar ]; then
rm -r $${IPKG_INSTROOT}/bin/tar;
fi
ln -sf /usr/bin/tar $${IPKG_INSTROOT}/bin/tar
endef
define Package/tar/postrm
#!/bin/sh
rm $${IPKG_INSTROOT}/bin/tar
ln -s busybox $${IPKG_INSTROOT}/bin/tar
$${IPKG_INSTROOT}/bin/tar 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/tar
exit 0
endef
CONFIGURE_ARGS += \
$(if $(CONFIG_PACKAGE_TAR_POSIX_ACL),--with,--without)-posix-acls \
$(if $(CONFIG_PACKAGE_TAR_XATTR),--with,--without)-xattrs \
$(if $(CONFIG_PACKAGE_TAR_GZIP),--with-gzip=gzip,--without-gzip) \
$(if $(CONFIG_PACKAGE_TAR_BZIP2),--with-bzip2=bzip2,--without-bzip2) \
$(if $(CONFIG_PACKAGE_TAR_XZ),--with-xz=xz,--without-xz) \
--without-compress \
--without-lzip \
--without-lzma \
--without-lzop \
--without-selinux
MAKE_FLAGS += \
CFLAGS="$(TARGET_CFLAGS)" \
LDFLAGS="$(TARGET_LDLAGS)"
define Package/tar/install
$(INSTALL_DIR) $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
endef
$(eval $(call BuildPackage,tar))