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
18 include $(INCLUDE_DIR)/package.mk
20 define Package/libmagic
24 TITLE:=Determines file type using 'magic' numbers
25 URL:=ftp://ftp.astron.com/pub/file/
32 TITLE:=Determines file type using 'magic' numbers
33 URL:=ftp://ftp.astron.com/pub/file/
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.
42 Starting with version 4, the file command is not much more than
43 a wrapper around the "magic" library.
46 TARGET_CFLAGS += $(FPIC)
52 --without-libiconv-prefix \
53 --without-libintl-prefix \
56 -C $(PKG_BUILD_DIR)/src \
57 DESTDIR="$(PKG_INSTALL_DIR)" \
61 $(call Build/Prepare/Default)
62 chmod -R u+w $(PKG_BUILD_DIR)
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/
72 define Package/libmagic/install
73 $(INSTALL_DIR) $(1)/usr/lib
74 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
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
85 $(eval $(call BuildPackage,libmagic))
86 $(eval $(call BuildPackage,file))