2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(TOPDIR)/rules.mk
14 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
15 PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/file/
16 PKG_MD5SUM:=74cd5466416136da30a4e69f74dbc7a0
20 include $(INCLUDE_DIR)/package.mk
22 define Package/libmagic
26 TITLE:=Determines file type using 'magic' numbers
27 URL:=ftp://ftp.astron.com/pub/file/
34 TITLE:=Determines file type using 'magic' numbers
35 URL:=ftp://ftp.astron.com/pub/file/
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.
44 Starting with version 4, the file command is not much more than
45 a wrapper around the "magic" library.
50 TARGET_CFLAGS += $(FPIC)
52 define Build/Configure
53 $(call Build/Configure/Default, \
57 --without-libiconv-prefix \
58 --without-libintl-prefix \
63 $(call Build/Prepare/Default)
64 chmod -R u+w $(PKG_BUILD_DIR)
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/
74 define Package/libmagic/install
75 $(INSTALL_DIR) $(1)/usr/lib
76 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
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
87 $(eval $(call BuildPackage,libmagic))
88 $(eval $(call BuildPackage,file))