bump version
[buildroot.git] / package / sed / sed.mk
blob9a9ea9a4c3668973ea989d8b3a35b751d3e8f5ab
1 #############################################################
3 # sed
5 #############################################################
6 SED_VERSION:=4.1.5
7 SED_SOURCE:=sed-$(SED_VERSION).tar.gz
8 SED_SITE:=$(BR2_GNU_MIRROR)/sed
9 SED_CAT:=$(ZCAT)
10 SED_DIR1:=$(TOOL_BUILD_DIR)/sed-$(SED_VERSION)
11 SED_DIR2:=$(BUILD_DIR)/sed-$(SED_VERSION)
12 SED_BINARY:=sed/sed
13 SED_TARGET_BINARY:=bin/sed
14 ifeq ($(BR2_LARGEFILE),y)
15 SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64
16 endif
17 #HOST_SED_DIR:=$(STAGING_DIR)
18 HOST_SED_DIR:=$(TOOL_BUILD_DIR)
19 SED:=$(HOST_SED_DIR)/bin/sed -i -e
20 HOST_SED_BINARY=$(shell $(CONFIG_SHELL) package/sed/sedcheck.sh)
21 HOST_SED_IF_ANY=$(shell $(CONFIG_SHELL) toolchain/dependencies/check-host-sed.sh)
23 $(DL_DIR)/$(SED_SOURCE):
24 mkdir -p $(DL_DIR)
25 $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE)
27 sed-source: $(DL_DIR)/$(SED_SOURCE)
30 #############################################################
32 # build sed for use on the host system
34 #############################################################
35 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
36 mkdir -p $(TOOL_BUILD_DIR)
37 mkdir -p $(HOST_SED_DIR)/bin
38 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
39 toolchain/patch-kernel.sh $(SED_DIR1) package/sed/ configure.patch
40 touch $@
42 $(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked
43 (cd $(SED_DIR1); rm -rf config.cache; \
44 ./configure \
45 --prefix=/usr \
47 touch $@
49 $(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured
50 $(MAKE) -C $(SED_DIR1)
52 # This stuff is needed to work around GNU make deficiencies
53 build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY)
54 $(Q)if [ -L $(HOST_SED_DIR)/$(SED_TARGET_BINARY) ]; then \
55 rm -f $(HOST_SED_DIR)/$(SED_TARGET_BINARY); \
57 $(Q)if [ ! -f $(HOST_SED_DIR)/$(SED_TARGET_BINARY) \
58 -o $(HOST_SED_DIR)/$(SED_TARGET_BINARY) \
59 -ot $(SED_DIR1)/$(SED_BINARY) ]; then \
60 set -x; \
61 mkdir -p $(HOST_SED_DIR)/bin; \
62 $(MAKE) DESTDIR=$(HOST_SED_DIR) -C $(SED_DIR1) install; \
63 mv $(HOST_SED_DIR)/usr/bin/sed $(HOST_SED_DIR)/bin/; \
64 rm -rf $(HOST_SED_DIR)/share/locale; \
65 rm -rf $(HOST_SED_DIR)/usr/share/doc; \
67 ifneq ($(BR2_HAVE_INFOPAGES),y)
68 rm -rf $(HOST_SED_DIR)/usr/man/info
69 endif
70 ifneq ($(BR2_HAVE_MANPAGES),y)
71 rm -rf $(HOST_SED_DIR)/usr/share/man
72 endif
74 $(HOST_SED_DIR)/$(SED_TARGET_BINARY):
75 $(Q)if [ ! -e "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)" ]; then \
76 mkdir -p "$(HOST_SED_DIR)/bin"; \
77 rm -f "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)"; \
78 ln -sf "$(HOST_SED_IF_ANY)" \
79 "$(HOST_SED_DIR)/$(SED_TARGET_BINARY)"; \
82 .PHONY: sed host-sed use-sed-host-binary
84 use-sed-host-binary: $(HOST_SED_DIR)/$(SED_TARGET_BINARY)
86 host-sed: $(HOST_SED_BINARY)
88 ifeq ($(HOST_SED_BINARY),build-sed-host-binary)
89 host-sed-clean:
90 $(MAKE) DESTDIR=$(HOST_SED_DIR) -C $(SED_DIR1) uninstall
91 -$(MAKE) -C $(SED_DIR1) clean
93 host-sed-dirclean:
94 rm -rf $(SED_DIR1)
96 else
97 host-sed-clean host-sed-dirclean:
99 endif
101 #############################################################
103 # build sed for use on the target system
105 #############################################################
106 $(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
107 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
108 touch $(SED_DIR2)/.unpacked
110 $(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked
111 (cd $(SED_DIR2); rm -rf config.cache; \
112 $(TARGET_CONFIGURE_OPTS) \
113 $(TARGET_CONFIGURE_ARGS) \
114 CPPFLAGS="$(SED_CFLAGS)" \
115 ./configure \
116 --target=$(GNU_TARGET_NAME) \
117 --host=$(GNU_TARGET_NAME) \
118 --build=$(GNU_HOST_NAME) \
119 --prefix=/usr \
120 --exec-prefix=/usr \
121 --bindir=/usr/bin \
122 --sbindir=/usr/sbin \
123 --libdir=/lib \
124 --libexecdir=/usr/lib \
125 --sysconfdir=/etc \
126 --datadir=/usr/share \
127 --localstatedir=/var \
128 --mandir=/usr/share/man \
129 --infodir=/usr/share/info \
130 --include=$(STAGING_DIR)/usr/include \
131 $(DISABLE_NLS) \
133 touch $@
135 $(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured
136 $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2)
138 # This stuff is needed to work around GNU make deficiencies
139 sed-target_binary: $(SED_DIR2)/$(SED_BINARY)
140 @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ]; then \
141 rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); \
143 $(Q)if [ ! -f $(SED_DIR2)/$(SED_BINARY) \
144 -o $(TARGET_DIR)/$(SED_TARGET_BINARY) \
145 -ot $(SED_DIR2)/$(SED_BINARY) ]; then \
146 set -x; \
147 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \
148 mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \
149 rm -rf $(TARGET_DIR)/share/locale; \
150 rm -rf $(TARGET_DIR)/usr/share/doc; \
152 ifneq ($(BR2_HAVE_INFOPAGES),y)
153 rm -rf $(TARGET_DIR)/usr/share/info
154 endif
155 ifneq ($(BR2_HAVE_MANPAGES),y)
156 rm -rf $(TARGET_DIR)/usr/share/man
157 endif
159 sed: uclibc sed-target_binary
161 sed-clean:
162 $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) uninstall
163 -$(MAKE) -C $(SED_DIR2) clean
165 sed-dirclean:
166 rm -rf $(SED_DIR2)
169 #############################################################
171 # Toplevel Makefile options
173 #############################################################
174 ifeq ($(BR2_PACKAGE_SED),y)
175 TARGETS+=sed
176 endif