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.

102 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.39
  10. PKG_RELEASE:=1
  11. PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
  12. PKG_SOURCE_URL:=http://download.openpkg.org/components/cache/file/ \
  13. ftp://ftp.astron.com/pub/file/
  14. PKG_HASH:=f05d286a76d9556243d0cb05814929c2ecf3a5ba07963f8f70bfaaa70517fad1
  15. PKG_MAINTAINER:=Marko Ratkaj <marko.ratkaj@sartura.hr>
  16. PKG_LICENSE:=BSD-2-Clause
  17. PKG_LICENSE_FILES:=COPYING
  18. PKG_INSTALL:=1
  19. PKG_BUILD_PARALLEL:=1
  20. include $(INCLUDE_DIR)/package.mk
  21. define Package/file/Default
  22. TITLE:=File type determination
  23. URL:=https://darwinsys.com/file/
  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 +liblzma +libbz2
  38. endef
  39. TARGET_CFLAGS += $(FPIC)
  40. TARGET_LDFLAGS += -Wl,--gc-sections,--as-needed
  41. CONFIGURE_ARGS += \
  42. --enable-shared \
  43. --enable-static \
  44. --enable-bzlib \
  45. --enable-xzlib \
  46. --enable-zlib \
  47. --disable-libseccomp \
  48. --disable-rpath \
  49. --disable-warnings \
  50. --without-pic
  51. MAKE_PATH := src
  52. define Build/Compile/magic
  53. ( cd $(PKG_BUILD_DIR)/magic/Magdir; \
  54. for f in `ls`; do \
  55. cat $$$${f}; \
  56. done \
  57. ) > $(PKG_BUILD_DIR)/magic/magic
  58. endef
  59. Hooks/Compile/Post += Build/Compile/magic
  60. define Build/Install/magic
  61. $(INSTALL_DIR) $(PKG_INSTALL_DIR)/usr/share/file
  62. $(INSTALL_DATA) $(PKG_BUILD_DIR)/magic/magic $(PKG_INSTALL_DIR)/usr/share/file/
  63. endef
  64. Hooks/Install/Post += Build/Install/magic
  65. define Build/InstallDev
  66. $(INSTALL_DIR) $(1)/usr/include
  67. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/include/magic.h $(1)/usr/include/
  68. $(INSTALL_DIR) $(1)/usr/lib
  69. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/lib/libmagic.{a,so*} $(1)/usr/lib/
  70. endef
  71. define Package/file/install
  72. $(INSTALL_DIR) $(1)/usr/bin
  73. $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/bin/file $(1)/usr/bin/
  74. $(INSTALL_DIR) $(1)/usr/share/misc
  75. $(SED) "/^#/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  76. $(SED) "/^$$$$/d" $(PKG_INSTALL_DIR)/usr/share/file/magic
  77. $(INSTALL_DATA) $(PKG_INSTALL_DIR)/usr/share/file/magic $(1)/usr/share/misc/
  78. endef
  79. define Package/libmagic/install
  80. $(INSTALL_DIR) $(1)/usr/lib
  81. $(CP) $(PKG_INSTALL_DIR)/usr/lib/libmagic.so.* $(1)/usr/lib/
  82. endef
  83. $(eval $(call BuildPackage,file))
  84. $(eval $(call BuildPackage,libmagic))