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.

100 lines
2.5 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.25
  10. PKG_RELEASE:=2
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=https://sources.lede-project.org/ \
  13. http://pkgs.fedoraproject.org/lookaside/pkgs/file/ \
  14. http://download.openpkg.org/components/cache/file/ \
  15. ftp://ftp.astron.com/pub/file/
  16. PKG_HASH:=3735381563f69fb4239470b8c51b876a80425348b8285a7cded8b61d6b890eca
  17. PKG_LICENSE:=BSD-2c
  18. PKG_LICENSE_FILES:=COPYING
  19. PKG_FIXUP:=autoreconf
  20. PKG_INSTALL:=1
  21. PKG_BUILD_PARALLEL:=1
  22. include $(INCLUDE_DIR)/package.mk
  23. define Package/file/Default
  24. TITLE:=File type determination
  25. URL:=ftp://ftp.astron.com/pub/file/
  26. MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  27. endef
  28. define Package/file
  29. $(call Package/file/Default)
  30. SECTION:=utils
  31. CATEGORY:=Utilities
  32. TITLE+= utility
  33. DEPENDS:=+libmagic
  34. endef
  35. define Package/libmagic
  36. $(call Package/file/Default)
  37. SECTION:=libs
  38. CATEGORY:=Libraries
  39. TITLE+= library
  40. DEPENDS:=+zlib
  41. endef
  42. CONFIGURE_ARGS += \
  43. --enable-shared \
  44. --enable-static \
  45. MAKE_PATH := src
  46. TARGET_CFLAGS += $(FPIC)
  47. define Build/Compile/magic
  48. ( cd $(PKG_BUILD_DIR)/magic/Magdir; \
  49. for f in `ls`; do \
  50. cat $$$${f}; \
  51. done \
  52. ) > $(PKG_BUILD_DIR)/magic/magic
  53. endef
  54. Hooks/Compile/Post += Build/Compile/magic
  55. define Build/Install/magic
  56. $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/file
  57. $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic $(PKG_INSTALL_DIR)/usr/share/file/
  58. endef
  59. Hooks/Install/Post += Build/Install/magic
  60. define Build/InstallDev
  61. $(INSTALL_DIR) $(1)/usr/include
  62. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/magic.h $(1)/usr/include/
  63. $(INSTALL_DIR) $(1)/usr/lib
  64. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
  65. endef
  66. define Package/file/install
  67. $(INSTALL_DIR) $(1)/usr/bin
  68. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin/
  69. $(INSTALL_DIR) $(1)/usr/share/misc
  70. $(SED) "/^#/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  71. $(SED) "/^$$$$/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  72. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/file/magic $(1)/usr/share/misc/
  73. # For some reason both "magic" and "magic.mgc" MUST exist
  74. ln -sf magic $(1)/usr/share/misc/magic.mgc
  75. endef
  76. define Package/libmagic/install
  77. $(INSTALL_DIR) $(1)/usr/lib
  78. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
  79. endef
  80. $(eval $(call BuildPackage,file))
  81. $(eval $(call BuildPackage,libmagic))