1
0

Makefile 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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.25
  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:=e6a972d4e10d9e76407a432f4a63cd4c
  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. # For some reason both "magic" and "magic.mgc" MUST exist
  71. ln -sf magic $(1)/usr/share/misc/magic.mgc
  72. endef
  73. define Package/libmagic/install
  74. $(INSTALL_DIR) $(1)/usr/lib
  75. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
  76. endef
  77. $(eval $(call BuildPackage,file))
  78. $(eval $(call BuildPackage,libmagic))