First Commit
[librecmc/package-feed.git] / utils / tar / Makefile
1 #
2 # Copyright (C) 2008-2016 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=tar
11 PKG_VERSION:=1.29
12 PKG_RELEASE:=2
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
15 PKG_SOURCE_URL:=@GNU/$(PKG_NAME)
16 PKG_MD5SUM:=955cd533955acb1804b83fd70218da51
17 PKG_MAINTAINER:=Álvaro Fernández Rojas <noltari@gmail.com>
18
19 PKG_LICENSE:=GPL-3.0
20 PKG_LICENSE_FILES:=COPYING
21
22 PKG_INSTALL:=1
23
24 BUILD_DEPENDS:=xz
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define Package/tar
29   SECTION:=utils
30   CATEGORY:=Utilities
31   DEPENDS:=+PACKAGE_TAR_POSIX_ACL:libacl +PACKAGE_TAR_XATTR:libattr +PACKAGE_TAR_BZIP2:bzip2
32   EXTRA_DEPENDS:=$(if $(CONFIG_PACKAGE_TAR_XZ),xz)
33   TITLE:=GNU tar
34   URL:=http://www.gnu.org/software/tar/
35   MENU:=1
36 endef
37
38 define Package/tar/config
39         if PACKAGE_tar
40                 config PACKAGE_TAR_POSIX_ACL
41                         bool "tar: Enable POSIX ACL support"
42                         default y if USE_FS_ACL_ATTR
43                         default n
44
45                 config PACKAGE_TAR_XATTR
46                         bool "tar: Enable extended attribute (xattr) support"
47                         default y if USE_FS_ACL_ATTR
48                         default n
49
50                 config PACKAGE_TAR_GZIP
51                         bool "tar: Enable seamless gzip support"
52                         default y
53
54                 config PACKAGE_TAR_BZIP2
55                         bool "tar: Enable seamless bzip2 support"
56                         default y
57
58                 config PACKAGE_TAR_XZ
59                         bool "tar: Enable seamless xz support"
60                         select PACKAGE_xz-utils
61                         select PACKAGE_xz
62                         default y
63         endif
64 endef
65
66 define Package/tar/description
67         Tar is a program for packaging a set of files as a
68         single archive in tar format.
69 endef
70
71 define Package/tar/postinst
72 #!/bin/sh
73 if [ -e $${IPKG_INSTROOT}/bin/tar ]; then
74   rm -r $${IPKG_INSTROOT}/bin/tar;
75 fi
76 ln -sf /usr/bin/tar $${IPKG_INSTROOT}/bin/tar
77 endef
78
79 define Package/tar/postrm
80 #!/bin/sh
81 rm $${IPKG_INSTROOT}/bin/tar
82 ln -s busybox $${IPKG_INSTROOT}/bin/tar
83 $${IPKG_INSTROOT}/bin/tar 2>&1 | grep 'applet not found' > /dev/null 2>&1 && rm $${IPKG_INSTROOT}/bin/tar
84 exit 0
85 endef
86
87 CONFIGURE_ARGS += \
88         $(if $(CONFIG_PACKAGE_TAR_POSIX_ACL),--with,--without)-posix-acls \
89         $(if $(CONFIG_PACKAGE_TAR_XATTR),--with,--without)-xattrs \
90         $(if $(CONFIG_PACKAGE_TAR_GZIP),--with-gzip=gzip,--without-gzip) \
91         $(if $(CONFIG_PACKAGE_TAR_BZIP2),--with-bzip2=bzip2,--without-bzip2) \
92         $(if $(CONFIG_PACKAGE_TAR_XZ),--with-xz=xz,--without-xz) \
93         --without-compress \
94         --without-lzip \
95         --without-lzma \
96         --without-lzop \
97         --without-selinux
98
99 MAKE_FLAGS += \
100         CFLAGS="$(TARGET_CFLAGS)" \
101         LDFLAGS="$(TARGET_LDLAGS)"
102
103 define Package/tar/install
104         $(INSTALL_DIR) $(1)/usr/bin/
105         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/$(PKG_NAME) $(1)/usr/bin/
106 endef
107
108 $(eval $(call BuildPackage,tar))