file: Only build in the src subdir, cause building in the magic subdir fails on Debia...
[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 # $Id$
8
9 include $(TOPDIR)/rules.mk
10
11 PKG_NAME:=file
12 PKG_VERSION:=4.19
13 PKG_RELEASE:=1
14
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
16 PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/file/
17 PKG_MD5SUM:=a61ef3aa8339d5987148089afde25f60
18
19 include $(INCLUDE_DIR)/package.mk
20
21 define Package/libmagic
22 SECTION:=libs
23 CATEGORY:=Libraries
24 DEPENDS:=+zlib
25 TITLE:=Determines file type using "magic" numbers
26 URL:=ftp://ftp.astron.com/pub/file/
27 endef
28
29 define Package/file
30 SECTION:=utils
31 CATEGORY:=Utilities
32 DEPENDS:=+libmagic
33 TITLE:=Determines file type using "magic" numbers
34 URL:=ftp://ftp.astron.com/pub/file/
35 endef
36
37 define Package/file/description
38 File tests each argument in an attempt to classify it. There
39 are three sets of tests, performed in this order: filesystem
40 tests, magic number tests, and language tests. The first test
41 that succeeds causes the file type to be printed.
42
43 Starting with version 4, the file command is not much more than
44 a wrapper around the "magic" library.
45 endef
46
47 CONFIGURE_ARGS += \
48 --enable-shared \
49 --enable-static \
50 --disable-rpath \
51 --without-libiconv-prefix \
52 --without-libintl-prefix \
53
54 MAKE_FLAGS += \
55 -C $(PKG_BUILD_DIR)/src \
56 DESTDIR="$(PKG_INSTALL_DIR)" \
57 all install \
58
59 define Build/InstallDev
60 mkdir -p $(STAGING_DIR)/usr/include
61 $(CP) $(PKG_INSTALL_DIR)/usr/include/magic.h $(STAGING_DIR)/usr/include/
62 mkdir -p $(STAGING_DIR)/usr/lib
63 $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(STAGING_DIR)/usr/lib/
64 endef
65
66 define Build/UninstallDev
67 rm -rf \
68 $(STAGING_DIR)/usr/include/magic.h \
69 $(STAGING_DIR)/usr/lib/libmagic.{a,so*}
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 $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/Magdir/linux $(1)/usr/share/file/magic
82 $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic.mime $(1)/usr/share/file/magic.mime
83 endef
84
85 $(eval $(call BuildPackage,libmagic))
86 $(eval $(call BuildPackage,file))