You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

94 lines
2.2 KiB

  1. #
  2. # Copyright (C) 2007-2014 OpenWrt.org
  3. #
  4. # This is free software, licensed under the GNU General Public License v2.
  5. # See /LICENSE for more information.
  6. #
  7. include $(TOPDIR)/rules.mk
  8. PKG_NAME:=file
  9. PKG_VERSION:=5.20
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=ftp://ftp.astron.com/pub/file/
  13. PKG_MD5SUM:=5d5e13eb3e0e13839da869a31790faf2
  14. PKG_LICENSE:=BSD-2c
  15. PKG_LICENSE_FILES:=COPYING
  16. PKG_FIXUP:=autoreconf
  17. PKG_INSTALL:=1
  18. PKG_BUILD_PARALLEL:=1
  19. include $(INCLUDE_DIR)/package.mk
  20. define Package/file/Default
  21. TITLE:=File type determination
  22. URL:=ftp://ftp.astron.com/pub/file/
  23. MAINTAINER:=Luka Perkov <luka@openwrt.org>
  24. endef
  25. define Package/file
  26. $(call package/file/Default)
  27. SECTION:=utils
  28. CATEGORY:=Utilities
  29. TITLE+= utility
  30. DEPENDS:=+libmagic
  31. endef
  32. define Package/libmagic
  33. $(call package/file/Default)
  34. SECTION:=libs
  35. CATEGORY:=Libraries
  36. TITLE+= library
  37. DEPENDS:=+zlib
  38. endef
  39. CONFIGURE_ARGS += \
  40. --enable-shared \
  41. --enable-static \
  42. MAKE_PATH := src
  43. TARGET_CFLAGS += $(FPIC)
  44. define Build/Compile/magic
  45. ( cd $(PKG_BUILD_DIR)/magic/Magdir; \
  46. for f in `ls`; do \
  47. cat $$$${f}; \
  48. done \
  49. ) > $(PKG_BUILD_DIR)/magic/magic
  50. endef
  51. Hooks/Compile/Post += Build/Compile/magic
  52. define Build/Install/magic
  53. $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/file
  54. $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic $(PKG_INSTALL_DIR)/usr/share/file/
  55. endef
  56. Hooks/Install/Post += Build/Install/magic
  57. define Build/InstallDev
  58. $(INSTALL_DIR) $(1)/usr/include
  59. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/magic.h $(1)/usr/include/
  60. $(INSTALL_DIR) $(1)/usr/lib
  61. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
  62. endef
  63. define Package/file/install
  64. $(INSTALL_DIR) $(1)/usr/bin
  65. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin/
  66. $(INSTALL_DIR) $(1)/usr/share/misc
  67. $(SED) "/^#/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  68. $(SED) "/^$$$$/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  69. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/file/magic $(1)/usr/share/misc/
  70. endef
  71. define Package/libmagic/install
  72. $(INSTALL_DIR) $(1)/usr/lib
  73. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
  74. endef
  75. $(eval $(call BuildPackage,file))
  76. $(eval $(call BuildPackage,libmagic))