aboutsummaryrefslogtreecommitdiff
path: root/package/lsof/lsof.mk
blob: 05365dae3801adbf3e27e499766a48f22a7ee6fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#############################################################
#
# lsof
#
#############################################################
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 =
ifeq ($(BR2_LARGEFILE),)
BR2_LSOF_CFLAGS += -U_FILE_OFFSET_BITS
endif
ifeq ($(BR2_INET_IPV6),)
BR2_LSOF_CFLAGS += -UHASIPv6
endif

ifeq ($(BR2_USE_WCHAR),)
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),)
define LSOF_CONFIGURE_LOCALE_FIXUPS
	$(SED) 's,^#define[[:space:]]*HASSETLOCALE.*,#undef HASSETLOCALE,' \
		$(@D)/lsof_$(LSOF_VERSION)_src/machine.h
endef
endif

# 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_POST_EXTRACT_HOOKS += LSOF_EXTRACT_TAR

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

define LSOF_BUILD_CMDS
	$(MAKE) $(TARGET_CONFIGURE_OPTS) DEBUG="$(TARGET_CFLAGS) $(BR2_LSOF_CFLAGS)" -C $(@D)
endef

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))