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