f81eb0aed6e6247b4638441bdec753a2de760646
[packages.git] / libs / file / Makefile
1 #
2 # Copyright (C) 2007 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:=file
11 PKG_VERSION:=4.26
12 PKG_RELEASE:=1
13
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/file/
16 PKG_MD5SUM:=74cd5466416136da30a4e69f74dbc7a0
17
18 PKG_INSTALL:=1
19
20 include $(INCLUDE_DIR)/package.mk
21
22 define Package/libmagic
23   SECTION:=libs
24   CATEGORY:=Libraries
25   DEPENDS:=+zlib
26   TITLE:=Determines file type using 'magic' numbers
27   URL:=ftp://ftp.astron.com/pub/file/
28 endef
29
30 define Package/file
31   SECTION:=utils
32   CATEGORY:=Utilities
33   DEPENDS:=+libmagic
34   TITLE:=Determines file type using 'magic' numbers
35   URL:=ftp://ftp.astron.com/pub/file/
36 endef
37
38 define Package/file/description
39  File tests each argument in an attempt to classify it. There
40  are three sets of tests, performed in this order: filesystem
41  tests, magic number tests, and language tests. The first test
42  that succeeds causes the file type to be printed.
43
44  Starting with version 4, the file command is not much more than
45  a wrapper around the "magic" library.
46 endef
47
48 MAKE_PATH:=src
49
50 TARGET_CFLAGS += $(FPIC)
51
52 define Build/Configure
53         $(call Build/Configure/Default, \
54                 --enable-shared \
55                 --enable-static \
56                 --disable-rpath \
57                 --without-libiconv-prefix \
58                 --without-libintl-prefix \
59         )
60 endef
61
62 define Build/Prepare
63         $(call Build/Prepare/Default)
64         chmod -R u+w $(PKG_BUILD_DIR)
65 endef
66
67 define Build/InstallDev
68         $(INSTALL_DIR) $(1)/usr/include
69         $(CP) $(PKG_INSTALL_DIR)/usr/include/magic.h $(1)/usr/include/
70         $(INSTALL_DIR) $(1)/usr/lib
71         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
72 endef
73
74 define Package/libmagic/install
75         $(INSTALL_DIR) $(1)/usr/lib
76         $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
77 endef
78
79 define Package/file/install
80         $(INSTALL_DIR) $(1)/usr/bin
81         $(INSTALL_DIR) $(1)/usr/share/file
82         $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin
83         (cd $(PKG_BUILD_DIR)/magic/Magdir; rm -f magic.mime; for file in `ls`; do cat $$$${file} >> magic.mime; done)
84         $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/Magdir/magic.mime $(1)/usr/share/file/magic
85 endef
86
87 $(eval $(call BuildPackage,libmagic))
88 $(eval $(call BuildPackage,file))