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.

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