update diag module
[openwrt.git] / package / sed / sed.mk
1 #############################################################
2 #
3 # sed
4 #
5 #############################################################
6 SED_VER:=4.1.2
7 SED_SOURCE:=sed-$(SED_VER).tar.gz
8 SED_SITE:=ftp://ftp.gnu.org/gnu/sed
9 SED_CAT:=zcat
10 SED_DIR1:=$(TOOL_BUILD_DIR)/sed-$(SED_VER)
11 SED_DIR2:=$(BUILD_DIR)/sed-$(SED_VER)
12 SED_BINARY:=sed/sed
13 SED_TARGET_BINARY:=bin/sed
14 ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true)
15 SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64
16 endif
17 SED:=$(STAGING_DIR)/bin/sed -i -e
18 HOST_SED_TARGET=$(shell package/sed/sedcheck.sh)
19
20 $(DL_DIR)/$(SED_SOURCE):
21 mkdir -p $(DL_DIR)
22 $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE)
23
24 sed-source: $(DL_DIR)/$(SED_SOURCE)
25
26
27 #############################################################
28 #
29 # build sed for use on the host system
30 #
31 #############################################################
32 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
33 mkdir -p $(TOOL_BUILD_DIR)
34 mkdir -p $(STAGING_DIR)/bin;
35 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
36 touch $(SED_DIR1)/.unpacked
37
38 $(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked
39 (cd $(SED_DIR1); rm -rf config.cache; \
40 ./configure \
41 --prefix=$(STAGING_DIR) \
42 --prefix=/usr \
43 );
44 touch $(SED_DIR1)/.configured
45
46 $(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured
47 $(MAKE) -C $(SED_DIR1)
48
49 # This stuff is needed to work around GNU make deficiencies
50 build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY)
51 @if [ -L $(STAGING_DIR)/$(SED_TARGET_BINARY) ] ; then \
52 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); fi;
53 @if [ ! -f $(STAGING_DIR)/$(SED_TARGET_BINARY) -o $(STAGING_DIR)/$(SED_TARGET_BINARY) \
54 -ot $(SED_DIR1)/$(SED_BINARY) ] ; then \
55 set -x; \
56 mkdir -p $(STAGING_DIR)/bin; \
57 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) install; \
58 mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \
59 rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
60 $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; fi
61
62 use-sed-host-binary:
63 @if [ -x /usr/bin/sed ]; then SED="/usr/bin/sed"; else \
64 if [ -x /bin/sed ]; then SED="/bin/sed"; fi; fi; \
65 mkdir -p $(STAGING_DIR)/bin; \
66 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); \
67 ln -s $$SED $(STAGING_DIR)/$(SED_TARGET_BINARY)
68
69 host-sed: $(HOST_SED_TARGET)
70
71 host-sed-clean:
72 -$(MAKE) -C $(SED_DIR1) clean
73
74 host-sed-toolclean:
75 rm -rf $(SED_DIR1)
76
77
78 #############################################################
79 #
80 # build sed for use on the target system
81 #
82 #############################################################
83 $(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
84 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
85 touch $(SED_DIR2)/.unpacked
86
87 $(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked
88 (cd $(SED_DIR2); rm -rf config.cache; \
89 $(TARGET_CONFIGURE_OPTS) \
90 CFLAGS="$(TARGET_CFLAGS)" \
91 CPPFLAGS="$(SED_CFLAGS)" \
92 ./configure \
93 --target=$(GNU_TARGET_NAME) \
94 --host=$(GNU_TARGET_NAME) \
95 --build=$(GNU_HOST_NAME) \
96 --prefix=/usr \
97 --exec-prefix=/usr \
98 --bindir=/usr/bin \
99 --sbindir=/usr/sbin \
100 --libexecdir=/usr/lib \
101 --sysconfdir=/etc \
102 --datadir=/usr/share \
103 --localstatedir=/var \
104 --mandir=/usr/man \
105 --infodir=/usr/info \
106 $(DISABLE_NLS) \
107 );
108 touch $(SED_DIR2)/.configured
109
110 $(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured
111 $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2)
112
113 # This stuff is needed to work around GNU make deficiencies
114 sed-target_binary: $(SED_DIR2)/$(SED_BINARY)
115 @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ] ; then \
116 rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); fi;
117
118 @if [ ! -f $(SED_DIR2)/$(SED_BINARY) -o $(TARGET_DIR)/$(SED_TARGET_BINARY) \
119 -ot $(SED_DIR2)/$(SED_BINARY) ] ; then \
120 set -x; \
121 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \
122 mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \
123 rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \
124 $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc; fi
125
126 sed: uclibc sed-target_binary
127
128 sed-clean:
129 -$(MAKE) -C $(SED_DIR2) clean
130
131 sed-dirclean:
132 rm -rf $(SED_DIR2)
133
134 ifeq ($(strip $(BR2_PACKAGE_SED)),y)
135 TARGETS+=sed
136 endif
This page took 0.058081 seconds and 5 git commands to generate.