summaryrefslogtreecommitdiffstats
path: root/package/lsof/lsof.mk
diff options
context:
space:
mode:
Diffstat (limited to 'package/lsof/lsof.mk')
-rw-r--r--package/lsof/lsof.mk96
1 files changed, 46 insertions, 50 deletions
diff --git a/package/lsof/lsof.mk b/package/lsof/lsof.mk
index 837a88c2e..05365dae3 100644
--- a/package/lsof/lsof.mk
+++ b/package/lsof/lsof.mk
@@ -3,68 +3,64 @@
# lsof
#
#############################################################
-LSOF_VERSION:=4.81
-LSOF_SOURCE:=lsof_$(LSOF_VERSION).tar.bz2
-LSOF_SITE:=ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
-LSOF_CAT:=$(BZCAT)
-LSOF_DIR:=$(BUILD_DIR)/lsof_$(LSOF_VERSION)
-LSOF_BINARY:=lsof
-LSOF_TARGET_BINARY:=bin/lsof
-LSOF_INCLUDE:=$(STAGING_DIR)/usr/include
+LSOF_VERSION = 4.84
+LSOF_SOURCE = lsof_$(LSOF_VERSION).tar.bz2
+LSOF_SITE = ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
-BR2_LSOF_CFLAGS:=
+BR2_LSOF_CFLAGS =
ifeq ($(BR2_LARGEFILE),)
-BR2_LSOF_CFLAGS+=-U_FILE_OFFSET_BITS
+BR2_LSOF_CFLAGS += -U_FILE_OFFSET_BITS
endif
ifeq ($(BR2_INET_IPV6),)
-BR2_LSOF_CFLAGS+=-UHASIPv6
+BR2_LSOF_CFLAGS += -UHASIPv6
endif
-$(DL_DIR)/$(LSOF_SOURCE):
- $(call DOWNLOAD,$(LSOF_SITE),$(LSOF_SOURCE))
-
-lsof-source: $(DL_DIR)/$(LSOF_SOURCE)
-
-lsof-unpacked: $(LSOF_DIR)/.unpacked
-
-$(LSOF_DIR)/.unpacked: $(DL_DIR)/$(LSOF_SOURCE)
- $(LSOF_CAT) $(DL_DIR)/$(LSOF_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
- (cd $(LSOF_DIR);tar xf lsof_$(LSOF_VERSION)_src.tar;rm -f lsof_$(LSOF_VERSION)_src.tar)
- toolchain/patch-kernel.sh $(LSOF_DIR) package/lsof/ \*.patch
- touch $(LSOF_DIR)/.unpacked
-
-$(LSOF_DIR)/.configured: $(LSOF_DIR)/.unpacked
- (cd $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src; echo n | $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" LSOF_INCLUDE="$(LSOF_INCLUDE)" LSOF_CFLAGS_OVERRIDE=1 ./Configure linux)
- touch $(LSOF_DIR)/.configured
-
-$(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/$(LSOF_BINARY): $(LSOF_DIR)/.configured
ifeq ($(BR2_USE_WCHAR),)
- $(SED) 's,^#define[[:space:]]*HASWIDECHAR.*,#undef HASWIDECHAR,' $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/machine.h
- $(SED) 's,^#define[[:space:]]*WIDECHARINCL.*,,' $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/machine.h
+define LSOF_CONFIGURE_WCHAR_FIXUPS
+ $(SED) 's,^#define[[:space:]]*HASWIDECHAR.*,#undef HASWIDECHAR,' \
+ $(@D)/lsof_$(LSOF_VERSION)_src/machine.h
+ $(SED) 's,^#define[[:space:]]*WIDECHARINCL.*,,' \
+ $(@D)/lsof_$(LSOF_VERSION)_src/machine.h
+endef
endif
+
ifeq ($(BR2_ENABLE_LOCALE),)
- $(SED) 's,^#define[[:space:]]*HASSETLOCALE.*,#undef HASSETLOCALE,' $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/machine.h
+define LSOF_CONFIGURE_LOCALE_FIXUPS
+ $(SED) 's,^#define[[:space:]]*HASSETLOCALE.*,#undef HASSETLOCALE,' \
+ $(@D)/lsof_$(LSOF_VERSION)_src/machine.h
+endef
endif
- $(MAKE) $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" -C $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src
-$(TARGET_DIR)/$(LSOF_TARGET_BINARY): $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/$(LSOF_BINARY)
- cp $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src/$(LSOF_BINARY) $@
- $(STRIPCMD) $@
+# The .tar.bz2 contains another .tar, which contains the source code.
+define LSOF_EXTRACT_TAR
+ $(TAR) $(TAR_STRIP_COMPONENTS)=1 -xf $(@D)/lsof_$(LSOF_VERSION)_src.tar -C $(@D)
+ rm -f $(@D)/lsof_$(LSOF_VERSION)_src.tar
+endef
-lsof: $(TARGET_DIR)/$(LSOF_TARGET_BINARY)
+LSOF_POST_EXTRACT_HOOKS += LSOF_EXTRACT_TAR
-lsof-clean:
- -rm -f $(TARGET_DIR)/$(LSOF_TARGET_BINARY)
- -$(MAKE) -C $(LSOF_DIR)/lsof_$(LSOF_VERSION)_src clean
+define LSOF_CONFIGURE_CMDS
+ (cd $(@D) ; \
+ echo n | $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" \
+ LSOF_INCLUDE="$(STAGING_DIR)/usr/include" LSOF_CFLAGS_OVERRIDE=1 ./Configure linux)
+ $(LSOF_CONFIGURE_WCHAR_FIXUPS)
+ $(LSOF_CONFIGURE_LOCALE_FIXUPS)
+endef
-lsof-dirclean:
- rm -rf $(LSOF_DIR)
+define LSOF_BUILD_CMDS
+ $(MAKE) $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" -C $(@D)
+endef
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_PACKAGE_LSOF),y)
-TARGETS+=lsof
-endif
+define LSOF_INSTALL_TARGET_CMDS
+ install -D -m 755 $(@D)/lsof $(TARGET_DIR)/bin/lsof
+endef
+
+define LSOF_UNINSTALL_TARGET_CMDS
+ rm -f $(TARGET_DIR)/bin/lsof
+endef
+
+define LSOF_CLEAN_CMDS
+ -$(MAKE) -C $(@D)/lsof_$(LSOF_VERSION)_src clean
+endef
+
+$(eval $(call GENTARGETS,package,lsof))