add missing copyright
[openwrt.git] / toolchain / sed / Makefile
1
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 include $(TOPDIR)/rules.mk
8
9 PKG_NAME := sed
10 PKG_VERSION := 4.1.2
11 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
12 PKG_SOURCE_URL:=ftp://ftp.gnu.org/gnu/$(PKG_NAME)
13 PKG_MD5SUM:=928f0e06422f414091917401f1a834d0
14 PKG_CAT:=zcat
15
16 PKG_BUILD_DIR:=$(TOOL_BUILD_DIR)/sed-$(PKG_VERSION)
17
18 HOST_SED_TARGET=$(strip $(shell ./sedcheck.sh))
19
20 ifneq ($(HOST_SED_TARGET),build-sed-host-binary)
21   PKG_SOURCE:=
22   PKG_CAT:=
23 endif
24
25 include $(INCLUDE_DIR)/host-build.mk
26
27 ifeq ($(HOST_SED_TARGET),build-sed-host-binary)
28   define Build/Configure
29         (cd $(PKG_BUILD_DIR); rm -rf config.cache; \
30                 ./configure \
31                 --prefix=$(STAGING_DIR) \
32                 --prefix=/usr \
33         );
34   endef
35
36   define Build/Compile
37         $(MAKE) -C $(PKG_BUILD_DIR)
38   endef
39
40   define Build/Install
41         @if [ -L $(STAGING_DIR)/bin/sed ] ; then \
42                 rm -f $(STAGING_DIR)/bin/sed; fi;
43         @if [ ! -f $(STAGING_DIR)/bin/sed -o $(STAGING_DIR)/bin/sed -ot $(PKG_BUILD_DIR)/sed/sed ]; then \
44             set -x; \
45             mkdir -p $(STAGING_DIR)/bin; \
46             $(MAKE) DESTDIR=$(STAGING_DIR) -C $(PKG_BUILD_DIR) install; \
47             mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \
48             rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \
49                     $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; \
50         fi
51   endef
52 else
53   define Build/Compile
54   endef
55   define Build/Install
56     rm -rf $(STAGING_DIR)/bin/sed
57         mkdir -p $(STAGING_DIR)/bin
58         ln -s `which sed` $(STAGING_DIR)/bin/sed
59   endef
60 endif
61
62 $(eval $(call HostBuild))