lsof.mk 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. ################################################################################
  2. #
  3. # lsof
  4. #
  5. ################################################################################
  6. LSOF_VERSION = 4.87
  7. LSOF_SOURCE = lsof_$(LSOF_VERSION).tar.bz2
  8. LSOF_SITE = ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
  9. LSOF_LICENSE = lsof license
  10. # License is repeated in each file, this is a relatively small one.
  11. # It is also defined in 00README, but that contains a lot of other cruft.
  12. LSOF_LICENSE_FILES = dialects/linux/dproto.h
  13. # Make certain full-blown lsof gets built after the busybox version (1.20+)
  14. LSOF_DEPENDENCIES += $(if $(BR2_PACKAGE_BUSYBOX),busybox)
  15. BR2_LSOF_CFLAGS =
  16. ifeq ($(BR2_LARGEFILE),)
  17. BR2_LSOF_CFLAGS += -U_FILE_OFFSET_BITS
  18. endif
  19. ifeq ($(BR2_INET_IPV6),)
  20. BR2_LSOF_CFLAGS += -UHASIPv6
  21. endif
  22. ifeq ($(BR2_USE_WCHAR),)
  23. define LSOF_CONFIGURE_WCHAR_FIXUPS
  24. $(SED) 's,^#define[[:space:]]*HASWIDECHAR.*,#undef HASWIDECHAR,' \
  25. $(@D)/machine.h
  26. endef
  27. endif
  28. ifeq ($(BR2_ENABLE_LOCALE),)
  29. define LSOF_CONFIGURE_LOCALE_FIXUPS
  30. $(SED) 's,^#define[[:space:]]*HASSETLOCALE.*,#undef HASSETLOCALE,' \
  31. $(@D)/machine.h
  32. endef
  33. endif
  34. # The .tar.bz2 contains another .tar, which contains the source code.
  35. define LSOF_EXTRACT_CMDS
  36. $(call suitable-extractor,$(LSOF_SOURCE)) $(DL_DIR)/$(LSOF_SOURCE) | \
  37. $(TAR) -O $(TAR_OPTIONS) - lsof_$(LSOF_VERSION)/lsof_$(LSOF_VERSION)_src.tar | \
  38. $(TAR) $(TAR_STRIP_COMPONENTS)=1 -C $(LSOF_DIR) $(TAR_OPTIONS) -
  39. endef
  40. define LSOF_CONFIGURE_CMDS
  41. (cd $(@D) ; \
  42. echo n | $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" \
  43. LSOF_INCLUDE="$(STAGING_DIR)/usr/include" LSOF_CFLAGS_OVERRIDE=1 \
  44. LINUX_CLIB=-DGLIBCV=2 ./Configure linux)
  45. $(LSOF_CONFIGURE_WCHAR_FIXUPS)
  46. $(LSOF_CONFIGURE_LOCALE_FIXUPS)
  47. endef
  48. define LSOF_BUILD_CMDS
  49. $(MAKE) $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" -C $(@D)
  50. endef
  51. define LSOF_INSTALL_TARGET_CMDS
  52. $(INSTALL) -D -m 755 $(@D)/lsof $(TARGET_DIR)/usr/bin/lsof
  53. endef
  54. $(eval $(generic-package))