install externally compiled kernel-specific packages into the kernel-specific root
[openwrt.git] / toolchain / 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 HOST_SED_TARGET=$(shell ./sedcheck.sh)
18
19 $(DL_DIR)/$(SED_SOURCE):
20 mkdir -p $(DL_DIR)
21 $(SCRIPT_DIR)/download.pl $(DL_DIR) $(SED_SOURCE) x $(SED_SITE)
22
23 sed-source: $(DL_DIR)/$(SED_SOURCE)
24
25
26 #############################################################
27 #
28 # build sed for use on the host system
29 #
30 #############################################################
31 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
32 mkdir -p $(TOOL_BUILD_DIR)
33 mkdir -p $(STAGING_DIR)/bin;
34 $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
35 touch $(SED_DIR1)/.unpacked
36
37 $(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked
38 (cd $(SED_DIR1); rm -rf config.cache; \
39 ./configure \
40 --prefix=$(STAGING_DIR) \
41 --prefix=/usr \
42 );
43 touch $(SED_DIR1)/.configured
44
45 $(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured
46 $(MAKE) -C $(SED_DIR1)
47
48 # This stuff is needed to work around GNU make deficiencies
49 build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY)
50 @if [ -L $(STAGING_DIR)/$(SED_TARGET_BINARY) ] ; then \
51 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); fi;
52 @if [ ! -f $(STAGING_DIR)/$(SED_TARGET_BINARY) -o $(STAGING_DIR)/$(SED_TARGET_BINARY) \
53 -ot $(SED_DIR1)/$(SED_BINARY) ] ; then \
54 set -x; \
55 mkdir -p $(STAGING_DIR)/bin; \
56 $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) install; \
57 mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \
58 rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
59 $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; fi
60
61 use-sed-host-binary:
62 @if [ -x /usr/bin/sed ]; then SED="/usr/bin/sed"; else \
63 if [ -x /bin/sed ]; then SED="/bin/sed"; fi; fi; \
64 mkdir -p $(STAGING_DIR)/bin; \
65 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); \
66 ln -s $$SED $(STAGING_DIR)/$(SED_TARGET_BINARY)
67
68 host-sed: $(HOST_SED_TARGET)
69
70 host-sed-clean:
71 -$(MAKE) -C $(SED_DIR1) clean
72
73 host-sed-toolclean:
74 rm -rf $(SED_DIR1)
75 rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY)
This page took 0.041133 seconds and 5 git commands to generate.