From 4f889ada561fbdffeefa1a8327d5b8939b021685 Mon Sep 17 00:00:00 2001 From: Eric Andersen Date: Wed, 19 Nov 2003 17:17:56 +0000 Subject: [PATCH] automatically detect if we have a usable version of sed installed. If not, we will now build our own version. --- Makefile | 2 +- make/bash.mk | 2 +- make/berkeleydb.mk | 2 +- make/busybox.mk | 12 +++--- make/bzip2.mk | 4 +- make/coreutils.mk | 4 +- make/fakeroot.mk | 2 +- make/gcc-2.95.mk | 20 ++++----- make/gcc-3.3.mk | 36 ++++++++--------- make/gdb.mk | 2 +- make/hostap.mk | 2 +- make/iproute2.mk | 8 ++-- make/iptables.mk | 2 +- make/libtool.mk | 4 +- make/linux.mk | 2 +- make/lrzsz.mk | 4 +- make/microcom.mk | 2 +- make/ncurses.mk | 4 +- make/netkitbase.mk | 6 +-- make/netkittelnet.mk | 6 +-- make/ntp.mk | 2 +- make/openssl.mk | 2 +- make/pcmcia.mk | 6 +-- make/perl.mk | 10 ++--- make/pppd.mk | 8 ++-- make/sed.mk | 89 ++++++++++++++++++++++++++++++++++------- make/tinylogin.mk | 8 ++-- make/tinyx.mk | 2 +- make/uclibc.mk | 22 +++++----- make/udhcp.mk | 6 +-- make/user-mode-linux.mk | 2 +- make/util-linux.mk | 4 +- sources/sedcheck.sh | 21 ++++++++++ 33 files changed, 194 insertions(+), 114 deletions(-) create mode 100755 sources/sedcheck.sh diff --git a/Makefile b/Makefile index 6aaf9fa414..78dae94e4f 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ INSTALL_LIBSTDCPP=true # The list of stuff to build for the target filesystem # ############################################################# -TARGETS:= +TARGETS:=host-sed # The toolchain comes next if we are building one ifeq ($(USE_UCLIBC_TOOLCHAIN),true) ifeq ($(GCC_2_95_TOOLCHAIN),true) diff --git a/make/bash.mk b/make/bash.mk index 8aa236ecaf..26c408fc9d 100644 --- a/make/bash.mk +++ b/make/bash.mk @@ -18,7 +18,7 @@ bash-source: $(DL_DIR)/$(BASH_SOURCE) $(BASH_DIR)/.unpacked: $(DL_DIR)/$(BASH_SOURCE) $(BASH_CAT) $(DL_DIR)/$(BASH_SOURCE) | tar -C $(BUILD_DIR) -xvf - # This is broken when -lintl is added to LIBS - sed -i -e 's,LIBS_FOR_BUILD =.*,LIBS_FOR_BUILD =,g' \ + $(SED) 's,LIBS_FOR_BUILD =.*,LIBS_FOR_BUILD =,g' \ $(BASH_DIR)/builtins/Makefile.in touch $(BASH_DIR)/.unpacked diff --git a/make/berkeleydb.mk b/make/berkeleydb.mk index ca546d2d06..5b4105a8e6 100644 --- a/make/berkeleydb.mk +++ b/make/berkeleydb.mk @@ -43,7 +43,7 @@ $(DB_DIR)/.configured: $(DB_DIR)/.dist --disable-compat185 \ --with-pic \ ); - sed -i -e 's/\.lo/.o/g' $(DB_DIR)/build_unix/Makefile + $(SED) 's/\.lo/.o/g' $(DB_DIR)/build_unix/Makefile touch $(DB_DIR)/.configured $(DB_DIR)/build_unix/.libs/libdb-4.1.so: $(DB_DIR)/.configured diff --git a/make/busybox.mk b/make/busybox.mk index e0a5058ced..09eef6d1dd 100644 --- a/make/busybox.mk +++ b/make/busybox.mk @@ -28,20 +28,20 @@ $(BUSYBOX_DIR)/.configured: $(DL_DIR)/$(BUSYBOX_SOURCE) $(BUSYBOX_CONFIG) $(BUSYBOX_UNZIP) $(DL_DIR)/$(BUSYBOX_SOURCE) | tar -C $(BUILD_DIR) -xvf - ifeq ($(USE_BUSYBOX_SNAPSHOT),true) cp $(BUSYBOX_CONFIG) $(BUSYBOX_DIR)/.config - sed -i -e "s,^CROSS.*,CROSS=$(TARGET_CROSS)\n\ + $(SED) "s,^CROSS.*,CROSS=$(TARGET_CROSS)\n\ PREFIX=$(TARGET_DIR),;" $(BUSYBOX_DIR)/Rules.mak ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) - sed -i -e "s/^.*CONFIG_LFS.*/CONFIG_LFS=y/;" $(BUSYBOX_DIR)/.config + $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=y/;" $(BUSYBOX_DIR)/.config else - sed -i -e "s/^.*CONFIG_LFS.*/CONFIG_LFS=n/;" $(BUSYBOX_DIR)/.config + $(SED) "s/^.*CONFIG_LFS.*/CONFIG_LFS=n/;" $(BUSYBOX_DIR)/.config endif $(MAKE) CC=$(TARGET_CC) CROSS="$(TARGET_CROSS)" -C $(BUSYBOX_DIR) oldconfig else # Not using snapshot cp $(BUSYBOX_CONFIG) $(BUSYBOX_DIR)/Config.h - sed -i -e "s,^CROSS.*,CROSS=$(TARGET_CROSS),;" $(BUSYBOX_DIR)/Makefile - sed -i -e "s,^PREFIX.*,PREFIX=$(TARGET_DIR),;" $(BUSYBOX_DIR)/Makefile + $(SED) "s,^CROSS.*,CROSS=$(TARGET_CROSS),;" $(BUSYBOX_DIR)/Makefile + $(SED) "s,^PREFIX.*,PREFIX=$(TARGET_DIR),;" $(BUSYBOX_DIR)/Makefile ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) - sed -i -e "s/^DOLFS.*/DOLFS=true/;" $(BUSYBOX_DIR)/Makefile + $(SED) "s/^DOLFS.*/DOLFS=true/;" $(BUSYBOX_DIR)/Makefile endif endif touch $(BUSYBOX_DIR)/.configured diff --git a/make/bzip2.mk b/make/bzip2.mk index f2e21e93ff..c16d785ac1 100644 --- a/make/bzip2.mk +++ b/make/bzip2.mk @@ -21,8 +21,8 @@ bzip2-source: $(DL_DIR)/$(BZIP2_SOURCE) $(BZIP2_DIR)/.unpacked: $(DL_DIR)/$(BZIP2_SOURCE) $(BZIP2_CAT) $(DL_DIR)/$(BZIP2_SOURCE) | tar -C $(BUILD_DIR) -xvf - - sed -i -e "s,ln \$$(,ln -sf \$$(,g" $(BZIP2_DIR)/Makefile - sed -i -e "s,ln -s (lib.*),ln -sf \$$1 ; ln -sf libbz2.so.1.0.2 libbz2.so,g" \ + $(SED) "s,ln \$$(,ln -sf \$$(,g" $(BZIP2_DIR)/Makefile + $(SED) "s,ln -s (lib.*),ln -sf \$$1 ; ln -sf libbz2.so.1.0.2 libbz2.so,g" \ $(BZIP2_DIR)/Makefile-libbz2_so touch $(BZIP2_DIR)/.unpacked diff --git a/make/coreutils.mk b/make/coreutils.mk index 33cd847e42..825c0f3549 100644 --- a/make/coreutils.mk +++ b/make/coreutils.mk @@ -46,10 +46,10 @@ $(COREUTILS_DIR)/.configured: $(COREUTILS_DIR)/.unpacked ); #Fix up the max number of open files per process, which apparently # is not set when cross compiling - sed -i -e 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \ + $(SED) 's,.*UTILS_OPEN_MAX.*,#define UTILS_OPEN_MAX 1019,g' \ $(COREUTILS_DIR)/config.h # This is undefined when crosscompiling... - sed -i -e 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \ + $(SED) 's,.*HAVE_PROC_UPTIME.*,#define HAVE_PROC_UPTIME 1,g' \ $(COREUTILS_DIR)/config.h touch $(COREUTILS_DIR)/.configured diff --git a/make/fakeroot.mk b/make/fakeroot.mk index 2922b75f65..f56105f7f8 100644 --- a/make/fakeroot.mk +++ b/make/fakeroot.mk @@ -17,7 +17,7 @@ fakeroot-source: $(DL_DIR)/$(FAKEROOT_SOURCE) $(FAKEROOT_DIR)/.unpacked: $(DL_DIR)/$(FAKEROOT_SOURCE) $(FAKEROOT_CAT) $(DL_DIR)/$(FAKEROOT_SOURCE) | tar -C $(BUILD_DIR) -xvf - # If using busybox getopt, make it be quiet. - sed -i -e "s,getopt --version,getopt --version 2>/dev/null," \ + $(SED) "s,getopt --version,getopt --version 2>/dev/null," \ $(FAKEROOT_DIR)/scripts/fakeroot touch $(FAKEROOT_DIR)/.unpacked diff --git a/make/gcc-2.95.mk b/make/gcc-2.95.mk index 8e1621c22e..2d2ae8e939 100644 --- a/make/gcc-2.95.mk +++ b/make/gcc-2.95.mk @@ -67,40 +67,40 @@ $(GCC_DIR)/.gcc2_95_build_hacks: $(GCC_DIR)/.patched # (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ if [ -n "$$LIST" ] ; then \ - sed -i -e "s,-dynamic-linker.*\.so[\.0-9]*},\ + $(SED) "s,-dynamic-linker.*\.so[\.0-9]*},\ -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); # # Prevent system glibc start files from leaking in uninvited... # - sed -i -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ + $(SED) "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - sed -i -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ + $(SED) "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; # # Prevent system glibc include files from leaking in uninvited... # - sed -i -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ + $(SED) "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - sed -i -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ + $(SED) "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - sed -i -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ + $(SED) "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ \"$(STAGING_DIR)/include\",;" $(GCC_DIR)/gcc/cppdefault.h; # # Prevent system glibc libraries from being found by collect2 # when it calls locatelib() and rummages about the system looking # for libraries with the correct name... # - sed -i -e "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c - sed -i -e "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c + $(SED) "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c + $(SED) "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c # # Prevent gcc from using the unwind-dw2-fde-glibc code # - sed -i -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ + $(SED) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; # # Use atexit() directly, rather than cxa_atexit # - sed -i -e "s,int flag_use_cxa_atexit = 1;,int flag_use_cxa_atexit = 0;,g;"\ + $(SED) "s,int flag_use_cxa_atexit = 1;,int flag_use_cxa_atexit = 0;,g;"\ $(GCC_DIR)/gcc/cp/decl2.c; # # We do not wish to build the libstdc++ library provided with gcc, diff --git a/make/gcc-3.3.mk b/make/gcc-3.3.mk index b552351219..8ae0c4dd9a 100644 --- a/make/gcc-3.3.mk +++ b/make/gcc-3.3.mk @@ -80,35 +80,35 @@ $(GCC_DIR)/.gcc3_3_build_hacks: $(GCC_DIR)/.patched # (cd $(GCC_DIR); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ if [ -n "$$LIST" ] ; then \ - sed -i -e "s,-dynamic-linker.*\.so[\.0-9]*},\ + $(SED) "s,-dynamic-linker.*\.so[\.0-9]*},\ -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); # # Prevent system glibc start files from leaking in uninvited... # - sed -i -e "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ + $(SED) "s,standard_startfile_prefix_1 = \".*,standard_startfile_prefix_1 =\ \"$(STAGING_DIR)/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; - sed -i -e "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ + $(SED) "s,standard_startfile_prefix_2 = \".*,standard_startfile_prefix_2 =\ \"$(STAGING_DIR)/usr/lib/\";,;" $(GCC_DIR)/gcc/gcc.c; # # Prevent system glibc include files from leaking in uninvited... # - sed -i -e "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ + $(SED) "s,^NATIVE_SYSTEM_HEADER_DIR.*,NATIVE_SYSTEM_HEADER_DIR=\ $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - sed -i -e "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ + $(SED) "s,^CROSS_SYSTEM_HEADER_DIR.*,CROSS_SYSTEM_HEADER_DIR=\ $(STAGING_DIR)/include,;" $(GCC_DIR)/gcc/Makefile.in; - sed -i -e "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ + $(SED) "s,^#define.*STANDARD_INCLUDE_DIR.*,#define STANDARD_INCLUDE_DIR \ \"$(STAGING_DIR)/include\",;" $(GCC_DIR)/gcc/cppdefault.h; # # Prevent system glibc libraries from being found by collect2 # when it calls locatelib() and rummages about the system looking # for libraries with the correct name... # - sed -i -e "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c - sed -i -e "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c + $(SED) "s,\"/lib,\"$(STAGING_DIR)/lib,g;" $(GCC_DIR)/gcc/collect2.c + $(SED) "s,\"/usr/,\"$(STAGING_DIR)/usr/,g;" $(GCC_DIR)/gcc/collect2.c # # Prevent gcc from using the unwind-dw2-fde-glibc code # - sed -i -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ + $(SED) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ #ifndef inhibit_libc,g;" $(GCC_DIR)/gcc/unwind-dw2-fde-glibc.c; touch $(GCC_DIR)/.gcc3_3_build_hacks @@ -193,10 +193,10 @@ $(GCC_DIR)/.g++_build_hacks: $(GCC_DIR)/.patched # # Hack up the soname for libstdc++ # - sed -i -e "s,\.so\.1,.so.0.9.9,g;" $(GCC_DIR)/gcc/config/t-slibgcc-elf-ver; - sed -i -e "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ + $(SED) "s,\.so\.1,.so.0.9.9,g;" $(GCC_DIR)/gcc/config/t-slibgcc-elf-ver; + $(SED) "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ $(GCC_DIR)/libstdc++-v3/src/Makefile.am $(GCC_DIR)/libstdc++-v3/src/Makefile.in; - sed -i -e "s,3\.0\.0,9.9.0,g;" $(GCC_DIR)/libstdc++-v3/acinclude.m4 \ + $(SED) "s,3\.0\.0,9.9.0,g;" $(GCC_DIR)/libstdc++-v3/acinclude.m4 \ $(GCC_DIR)/libstdc++-v3/aclocal.m4 $(GCC_DIR)/libstdc++-v3/configure; touch $(GCC_DIR)/.g++_build_hacks @@ -365,21 +365,21 @@ $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks: $(GCC_BUILD_DIR3)/.patched # (cd $(GCC_BUILD_DIR3); set -e; export LIST=`grep -lr -- "-dynamic-linker.*\.so[\.0-9]*" *`;\ if [ -n "$$LIST" ] ; then \ - sed -i -e "s,-dynamic-linker.*\.so[\.0-9]*},\ + $(SED) "s,-dynamic-linker.*\.so[\.0-9]*},\ -dynamic-linker /lib/ld-uClibc.so.0},;" $$LIST; fi); # # Prevent gcc from using the unwind-dw2-fde-glibc code # - sed -i -e "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ + $(SED) "s,^#ifndef inhibit_libc,#define inhibit_libc\n\ #ifndef inhibit_libc,g;" $(GCC_BUILD_DIR3)/gcc/unwind-dw2-fde-glibc.c; # # Hack up the soname for libstdc++ # - sed -i -e "s,\.so\.1,.so.0.9.9,g;" $(GCC_BUILD_DIR3)/gcc/config/t-slibgcc-elf-ver; - sed -i -e "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ + $(SED) "s,\.so\.1,.so.0.9.9,g;" $(GCC_BUILD_DIR3)/gcc/config/t-slibgcc-elf-ver; + $(SED) "s,-version-info.*[0-9]:[0-9]:[0-9],-version-info 9:9:0,g;" \ $(GCC_BUILD_DIR3)/libstdc++-v3/src/Makefile.am \ $(GCC_BUILD_DIR3)/libstdc++-v3/src/Makefile.in; - sed -i -e "s,3\.0\.0,9.9.0,g;" $(GCC_BUILD_DIR3)/libstdc++-v3/acinclude.m4 \ + $(SED) "s,3\.0\.0,9.9.0,g;" $(GCC_BUILD_DIR3)/libstdc++-v3/acinclude.m4 \ $(GCC_BUILD_DIR3)/libstdc++-v3/aclocal.m4 \ $(GCC_BUILD_DIR3)/libstdc++-v3/configure; touch $(GCC_BUILD_DIR3)/.gcc3_3_build_hacks @@ -431,7 +431,7 @@ $(TARGET_DIR)/usr/bin/gcc: $(GCC_BUILD_DIR3)/.compiled # A nasty hack to work around g++ adding -lgcc_eh to the link -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION)/ ; ln -s libgcc.a libgcc_eh.a) # Make sure gcc does not think we are cross compiling - sed -i -e "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION)/specs + $(SED) "s/^1/0/;" $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION)/specs -(cd $(TARGET_DIR)/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) -(cd $(TARGET_DIR)/usr/bin; find -type f | xargs $(STRIP) > /dev/null 2>&1) -(cd $(TARGET_DIR)/usr/lib/gcc-lib/$(ARCH)-linux/$(GCC_VERSION); $(STRIP) cc1 cc1plus collect2 > /dev/null 2>&1) diff --git a/make/gdb.mk b/make/gdb.mk index 932f17d4a4..06a75f682a 100644 --- a/make/gdb.mk +++ b/make/gdb.mk @@ -45,7 +45,7 @@ $(GDB_DIR)/.configured: $(GDB_DIR)/.unpacked --without-included-gettext \ ); ifeq ($(ENABLE_LOCALE),true) - -sed -i -e "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile + -$(SED) "s,^INTL *=.*,INTL = -lintl,g;" $(GDB_DIR)/gdb/Makefile endif touch $(GDB_DIR)/.configured diff --git a/make/hostap.mk b/make/hostap.mk index bc33393e47..9d4ac1b7c6 100644 --- a/make/hostap.mk +++ b/make/hostap.mk @@ -19,7 +19,7 @@ $(HOSTAP_DIR)/.unpacked: $(DL_DIR)/$(HOSTAP_SOURCE) touch $(HOSTAP_DIR)/.unpacked $(HOSTAP_DIR)/.configured: $(HOSTAP_DIR)/.unpacked - sed -i -e "s,/.*#define PRISM2_DOWNLOAD_SUPPORT.*/,#define PRISM2_DOWNLOAD_SUPPORT,g" \ + $(SED) "s,/.*#define PRISM2_DOWNLOAD_SUPPORT.*/,#define PRISM2_DOWNLOAD_SUPPORT,g" \ $(HOSTAP_DIR)/driver/modules/hostap_config.h touch $(HOSTAP_DIR)/.configured diff --git a/make/iproute2.mk b/make/iproute2.mk index 9819fdbad5..7a33034b62 100644 --- a/make/iproute2.mk +++ b/make/iproute2.mk @@ -29,14 +29,14 @@ $(IPROUTE2_DIR)/.unpacked: $(DL_DIR)/$(IPROUTE2_SOURCE) #$(DL_DIR)/$(IPROUTE2_PA touch $(IPROUTE2_DIR)/.unpacked $(IPROUTE2_DIR)/.configured: $(IPROUTE2_DIR)/.unpacked - sed -i -e "s,-I/usr/include/db3,," $(IPROUTE2_DIR)/Makefile - sed -i -e "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \ + $(SED) "s,-I/usr/include/db3,," $(IPROUTE2_DIR)/Makefile + $(SED) "s,^KERNEL_INCLUDE.*,KERNEL_INCLUDE=$(LINUX_DIR)/include," \ $(IPROUTE2_DIR)/Makefile - sed -i -e "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \ + $(SED) "s,^LIBC_INCLUDE.*,LIBC_INCLUDE=$(STAGING_DIR)/include," \ $(IPROUTE2_DIR)/Makefile # For now disable compiling of the misc directory because it seems to fail rm -rf $(IPROUTE2_DIR)/misc - sed -i -e "s, misc,," $(IPROUTE2_DIR)/Makefile + $(SED) "s, misc,," $(IPROUTE2_DIR)/Makefile touch $(IPROUTE2_DIR)/.configured $(IPROUTE2_DIR)/tc/tc: $(IPROUTE2_DIR)/.configured diff --git a/make/iptables.mk b/make/iptables.mk index 1fe0e7f438..edebaff78b 100644 --- a/make/iptables.mk +++ b/make/iptables.mk @@ -15,7 +15,7 @@ $(IPTABLES_BUILD_DIR)/.unpacked: $(DL_DIR)/$(IPTABLES_SOURCE) touch $(IPTABLES_BUILD_DIR)/.unpacked $(IPTABLES_BUILD_DIR)/.configured: $(IPTABLES_BUILD_DIR)/.unpacked - sed -i -e "s@shell.*YES.*@shell grep -q '__UCLIBC_HAS_IPV6__.*1' \ + $(SED) "s@shell.*YES.*@shell grep -q '__UCLIBC_HAS_IPV6__.*1' \ $(BUILD_DIR)/uClibc/include/bits/uClibc_config.h && \ echo YES\), YES\)@;" $(IPTABLES_BUILD_DIR)/Makefile touch $(IPTABLES_BUILD_DIR)/.configured diff --git a/make/libtool.mk b/make/libtool.mk index 47f23aaf4a..fbe1fb663f 100644 --- a/make/libtool.mk +++ b/make/libtool.mk @@ -61,8 +61,8 @@ $(TARGET_DIR)/$(LIBTOOL_TARGET_BINARY): $(LIBTOOL_DIR)/$(LIBTOOL_BINARY) includedir=$(TARGET_DIR)/usr/include \ -C $(LIBTOOL_DIR) install; $(STRIP) $(TARGET_DIR)//usr/lib/libltdl.so.*.*.* > /dev/null 2>&1 - sed -i -e "s,^CC.*,CC=\"/usr/bin/gcc\"," $(TARGET_DIR)/usr/bin/libtool - sed -i -e "s,^LD.*,LD=\"/usr/bin/ld\"," $(TARGET_DIR)/usr/bin/libtool + $(SED) "s,^CC.*,CC=\"/usr/bin/gcc\"," $(TARGET_DIR)/usr/bin/libtool + $(SED) "s,^LD.*,LD=\"/usr/bin/ld\"," $(TARGET_DIR)/usr/bin/libtool rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc diff --git a/make/linux.mk b/make/linux.mk index 39caf81341..d57d59007e 100644 --- a/make/linux.mk +++ b/make/linux.mk @@ -65,7 +65,7 @@ $(LINUX_KCONFIG): fi; $(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured: $(LINUX_DIR)/.unpacked $(LINUX_KCONFIG) - sed -i -e "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile + $(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile -cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config $(MAKE) -C $(LINUX_DIR) oldconfig include/linux/version.h touch $(LINUX_DIR)/.configured diff --git a/make/lrzsz.mk b/make/lrzsz.mk index 9334187272..222d64a712 100644 --- a/make/lrzsz.mk +++ b/make/lrzsz.mk @@ -54,8 +54,8 @@ $(LRZSZ_DIR)/.configured: $(LRZSZ_DIR)/.unpacked $(DISABLE_NLS) \ --disable-timesync \ ); - sed -i -e "s/-lnsl//;" $(LRZSZ_DIR)/src/Makefile - sed -i -e "s~\(#define ENABLE_SYSLOG.*\)~/* \1 */~;" $(LRZSZ_DIR)/config.h + $(SED) "s/-lnsl//;" $(LRZSZ_DIR)/src/Makefile + $(SED) "s~\(#define ENABLE_SYSLOG.*\)~/* \1 */~;" $(LRZSZ_DIR)/config.h touch $(LRZSZ_DIR)/.configured $(LRZSZ_DIR)/src/lrz: $(LRZSZ_DIR)/.configured diff --git a/make/microcom.mk b/make/microcom.mk index 9c1e662e2d..bf01cf3d7f 100644 --- a/make/microcom.mk +++ b/make/microcom.mk @@ -40,7 +40,7 @@ $(MICROCOM_DIR)/.unpacked: $(DL_DIR)/$(MICROCOM_SOURCE) touch $(MICROCOM_DIR)/.unpacked $(MICROCOM_DIR)/.configured: $(MICROCOM_DIR)/.unpacked - sed -i -e 's~gcc~${TARGET_CC}~' $(MICROCOM_DIR)/Makefile + $(SED) 's~gcc~${TARGET_CC}~' $(MICROCOM_DIR)/Makefile touch $(MICROCOM_DIR)/.configured $(MICROCOM_DIR)/microcom: $(MICROCOM_DIR)/.configured diff --git a/make/ncurses.mk b/make/ncurses.mk index 03f60a8e5d..d0e401a6ba 100644 --- a/make/ncurses.mk +++ b/make/ncurses.mk @@ -5,7 +5,7 @@ # ############################################################# # Copyright (C) 2002 by Ken Restivo -# $Id: ncurses.mk,v 1.31 2003/11/18 07:18:25 andersen Exp $ +# $Id: ncurses.mk,v 1.32 2003/11/19 17:17:54 andersen Exp $ # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU Library General Public License as @@ -33,7 +33,7 @@ $(DL_DIR)/$(NCURSES_SOURCE): $(NCURSES_DIR)/.dist: $(DL_DIR)/$(NCURSES_SOURCE) gunzip -c $(DL_DIR)/$(NCURSES_SOURCE) | tar -C $(BUILD_DIR) -xvf - #use the local tic and not whatever the build system was going to find. - sed -i -e 's~\$$srcdir/shlib tic\$$suffix~/usr/bin/tic~' \ + $(SED) 's~\$$srcdir/shlib tic\$$suffix~/usr/bin/tic~' \ $(NCURSES_DIR)/misc/run_tic.in touch $(NCURSES_DIR)/.dist diff --git a/make/netkitbase.mk b/make/netkitbase.mk index 13d1fee584..cb2a023e00 100644 --- a/make/netkitbase.mk +++ b/make/netkitbase.mk @@ -18,9 +18,9 @@ netkitbase-source: $(DL_DIR)/$(NETKITBASE_SOURCE) $(NETKITBASE_DIR)/.unpacked: $(DL_DIR)/$(NETKITBASE_SOURCE) $(NETKITBASE_CAT) $(DL_DIR)/$(NETKITBASE_SOURCE) | tar -C $(BUILD_DIR) -xvf - # use ANSI syntax - sed -i -e "s/main()/main(void)/;" $(NETKITBASE_DIR)/configure + $(SED) "s/main()/main(void)/;" $(NETKITBASE_DIR)/configure # don't try to run cross compiled binaries while configuring things - sed -i -e "s~./__conftest~#./__conftest~;" $(NETKITBASE_DIR)/configure + $(SED) "s~./__conftest~#./__conftest~;" $(NETKITBASE_DIR)/configure touch $(NETKITBASE_DIR)/.unpacked $(NETKITBASE_DIR)/.configured: $(NETKITBASE_DIR)/.unpacked @@ -39,7 +39,7 @@ $(TARGET_DIR)/$(NETKITBASE_TARGET_BINARY): $(NETKITBASE_DIR)/$(NETKITBASE_BINARY cp $(NETKITBASE_DIR)/$(NETKITBASE_BINARY) $(TARGET_DIR)/$(NETKITBASE_TARGET_BINARY) mkdir -p $(TARGET_DIR)/etc cp $(NETKITBASE_DIR)/etc.sample/inetd.conf $(TARGET_DIR)/etc/ - sed -i -e "s/^\([a-z]\)/#\1/;" $(TARGET_DIR)/etc/inetd.conf + $(SED) "s/^\([a-z]\)/#\1/;" $(TARGET_DIR)/etc/inetd.conf #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITBASE_DIR) install #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc diff --git a/make/netkittelnet.mk b/make/netkittelnet.mk index b59f29fc91..401b885cab 100644 --- a/make/netkittelnet.mk +++ b/make/netkittelnet.mk @@ -19,9 +19,9 @@ netkittelnet-source: $(DL_DIR)/$(NETKITTELNET_SOURCE) $(NETKITTELNET_DIR)/.unpacked: $(DL_DIR)/$(NETKITTELNET_SOURCE) $(NETKITTELNET_CAT) $(DL_DIR)/$(NETKITTELNET_SOURCE) | tar -C $(BUILD_DIR) -xvf - # use ANSI syntax - sed -i -e "s/main()/main(void)/;" $(NETKITTELNET_DIR)/configure + $(SED) "s/main()/main(void)/;" $(NETKITTELNET_DIR)/configure # Disable termcap support - sed -i -e "s~\(.*termcap\.h.*\)~/* \1 */~;" $(NETKITTELNET_DIR)/telnetd/telnetd.c + $(SED) "s~\(.*termcap\.h.*\)~/* \1 */~;" $(NETKITTELNET_DIR)/telnetd/telnetd.c # don't try to run cross compiled binaries while configuring things cat $(NETKITTELNET_PATCH) | patch -p1 -d $(NETKITTELNET_DIR) touch $(NETKITTELNET_DIR)/.unpacked @@ -42,7 +42,7 @@ $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY): $(NETKITTELNET_DIR)/$(NETKITTELNET_ rm -f $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY) cp $(NETKITTELNET_DIR)/$(NETKITTELNET_BINARY) $(TARGET_DIR)/$(NETKITTELNET_TARGET_BINARY) # Enable telnet in inetd - sed -i -e "s~^#telnet.*~telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\t/usr/sbin/telnetd~;" $(TARGET_DIR)/etc/inetd.conf + $(SED) "s~^#telnet.*~telnet\tstream\ttcp\tnowait\troot\t/usr/sbin/telnetd\t/usr/sbin/telnetd~;" $(TARGET_DIR)/etc/inetd.conf #$(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(NETKITTELNET_DIR) install #rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ # $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc diff --git a/make/ntp.mk b/make/ntp.mk index a13e99b55f..f4cfaf365c 100644 --- a/make/ntp.mk +++ b/make/ntp.mk @@ -18,7 +18,7 @@ ntp-source: $(DL_DIR)/$(NTP_SOURCE) $(NTP_DIR)/.unpacked: $(DL_DIR)/$(NTP_SOURCE) $(NTP_CAT) $(DL_DIR)/$(NTP_SOURCE) | tar -C $(BUILD_DIR) -xvf - - sed -i -e "s,^#if.*__GLIBC__.*_BSD_SOURCE.*$$,#if 0," \ + $(SED) "s,^#if.*__GLIBC__.*_BSD_SOURCE.*$$,#if 0," \ $(NTP_DIR)/ntpd/refclock_pcf.c; touch $(NTP_DIR)/.unpacked diff --git a/make/openssl.mk b/make/openssl.mk index 50d3cf6bba..aa9f9f06e6 100644 --- a/make/openssl.mk +++ b/make/openssl.mk @@ -17,7 +17,7 @@ $(OPENSSL_DIR)/.unpacked: $(DL_DIR)/$(OPENSSL_SOURCE) $(OPENSSL_PATCH) gunzip -c $(DL_DIR)/$(OPENSSL_SOURCE) | tar -C $(BUILD_DIR) -xvf - cat $(OPENSSL_PATCH) | patch -p1 -d $(OPENSSL_DIR) # sigh... we have to resort to this just to set a gcc flag. - sed -i -e 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \ + $(SED) 's,/CFLAG=,/CFLAG= $(TARGET_SOFT_FLOAT) ,g' \ $(OPENSSL_DIR)/Configure touch $(OPENSSL_DIR)/.unpacked diff --git a/make/pcmcia.mk b/make/pcmcia.mk index 3508bc067b..e5067ab0bb 100644 --- a/make/pcmcia.mk +++ b/make/pcmcia.mk @@ -45,9 +45,9 @@ $(PCMCIA_DIR)/.configured: $(PCMCIA_DIR)/.patched --rcdir=/etc --arch=$(ARCH) --trust --srctree --nocardbus \ --sysv --kcc=$(KERNEL_CROSS)gcc --ucc=$(TARGET_CC) --ld=$(TARGET_CROSS)ld \ --target=$(TARGET_DIR)) - sed -i -e "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network - sed -i -e "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config - sed -i -e "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config + $(SED) "s/pump/udhcpc/" $(PCMCIA_DIR)/etc/network + $(SED) "s/ide_cs/ide-cs/" $(PCMCIA_DIR)/etc/config + $(SED) "s/bind \"wvlan_cs\"/bind \"orinoco_cs\"/g" $(PCMCIA_DIR)/etc/config touch $(PCMCIA_DIR)/.configured $(PCMCIA_DIR)/cardmgr/cardmgr: $(PCMCIA_DIR)/.configured diff --git a/make/perl.mk b/make/perl.mk index 3a9223c801..de04df7025 100644 --- a/make/perl.mk +++ b/make/perl.mk @@ -22,11 +22,11 @@ $(PERL_DIR)/.unpacked: $(DL_DIR)/$(PERL_SOURCE) $(PERL_CAT) $(DL_DIR)/$(PERL_SOURCE) | tar -C $(BUILD_DIR) -xvf - $(PERL_CAT) $(PERL_SOURCE_2) | tar -C $(PERL_DIR) -xvf - cat $(PERL_PATCH) | patch -p1 -d $(PERL_DIR) - sed -i -e "s,^ARCH.*,ARCH=$(ARCH)," $(PERL_DIR)/cross/config - sed -i -e "s,^CONFIG_TARGET_.*,\#," $(PERL_DIR)/cross/config - sed -i -e "s,^export CROSS=.*,export CROSS=$(TARGET_CROSS)," $(PERL_DIR)/cross/Makefile - sed -i -e "s,TARGET_ARCH,$(ARCH)," $(PERL_DIR)/cross/config.sh.uclibc - sed -i -e "s,TARGET_CROSS,$(TARGET_CROSS)," $(PERL_DIR)/cross/config.sh.uclibc + $(SED) "s,^ARCH.*,ARCH=$(ARCH)," $(PERL_DIR)/cross/config + $(SED) "s,^CONFIG_TARGET_.*,\#," $(PERL_DIR)/cross/config + $(SED) "s,^export CROSS=.*,export CROSS=$(TARGET_CROSS)," $(PERL_DIR)/cross/Makefile + $(SED) "s,TARGET_ARCH,$(ARCH)," $(PERL_DIR)/cross/config.sh.uclibc + $(SED) "s,TARGET_CROSS,$(TARGET_CROSS)," $(PERL_DIR)/cross/config.sh.uclibc touch $(PERL_DIR)/.unpacked $(PERL_DIR)/.configured: $(PERL_DIR)/.unpacked diff --git a/make/pppd.mk b/make/pppd.mk index cf25ac8bea..217f5fae7f 100644 --- a/make/pppd.mk +++ b/make/pppd.mk @@ -18,10 +18,10 @@ pppd-source: $(DL_DIR)/$(PPPD_SOURCE) $(PPPD_DIR)/.unpacked: $(DL_DIR)/$(PPPD_SOURCE) $(PPPD_CAT) $(DL_DIR)/$(PPPD_SOURCE) | tar -C $(BUILD_DIR) -xvf - - sed -i -e 's/ -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP//' $(PPPD_DIR)/pppd/Makefile.linux - sed -i -e 's/$(INSTALL) -s/$(INSTALL)/' $(PPPD_DIR)/*/Makefile.linux - sed -i -e 's/ -o root//' $(PPPD_DIR)/*/Makefile.linux - sed -i -e 's/ -g daemon//' $(PPPD_DIR)/*/Makefile.linux + $(SED) 's/ -DIPX_CHANGE -DHAVE_MULTILINK -DHAVE_MMAP//' $(PPPD_DIR)/pppd/Makefile.linux + $(SED) 's/$(INSTALL) -s/$(INSTALL)/' $(PPPD_DIR)/*/Makefile.linux + $(SED) 's/ -o root//' $(PPPD_DIR)/*/Makefile.linux + $(SED) 's/ -g daemon//' $(PPPD_DIR)/*/Makefile.linux touch $(PPPD_DIR)/.unpacked $(PPPD_DIR)/.configured: $(PPPD_DIR)/.unpacked diff --git a/make/sed.mk b/make/sed.mk index c643f5b174..cb4379d76d 100644 --- a/make/sed.mk +++ b/make/sed.mk @@ -3,27 +3,85 @@ # sed # ############################################################# -SED_SOURCE:=sed-3.02.tar.gz +SED_SOURCE:=sed-4.0.8.tar.gz SED_SITE:=ftp://ftp.gnu.org/gnu/sed SED_CAT:=zcat -SED_DIR:=$(BUILD_DIR)/sed-3.02 +SED_DIR1:=$(TOOL_BUILD_DIR)/sed-4.0.8 +SED_DIR2:=$(BUILD_DIR)/sed-4.0.8 SED_BINARY:=sed/sed SED_TARGET_BINARY:=bin/sed ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64 endif +SED:=$(STAGING_DIR)/bin/sed -i -e + +HOST_SED_TARGET=$(shell ./sources/sedcheck.sh) $(DL_DIR)/$(SED_SOURCE): $(WGET) -P $(DL_DIR) $(SED_SITE)/$(SED_SOURCE) sed-source: $(DL_DIR)/$(SED_SOURCE) -$(SED_DIR)/.unpacked: $(DL_DIR)/$(SED_SOURCE) + +############################################################# +# +# build sed for use on the host system +# +############################################################# +$(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE) + $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOL_BUILD_DIR) -xvf - + touch $(SED_DIR1)/.unpacked + +$(SED_DIR1)/.configured: $(SED_DIR1)/.unpacked + (cd $(SED_DIR1); rm -rf config.cache; \ + ./configure \ + --prefix=$(STAGING_DIR) \ + --prefix=/usr \ + ); + touch $(SED_DIR1)/.configured + +$(SED_DIR1)/$(SED_BINARY): $(SED_DIR1)/.configured + $(MAKE) -C $(SED_DIR1) + +# This stuff is needed to work around GNU make deficiencies +build-sed-host-binary: $(SED_DIR1)/$(SED_BINARY) + @if [ -L $(STAGING_DIR)/$(SED_TARGET_BINARY) ] ; then \ + rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); fi; + @if [ $(STAGING_DIR)/$(SED_TARGET_BINARY) -ot $(SED_DIR1)/$(SED_BINARY) ] ; then \ + set -x; \ + $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) install; \ + mv $(STAGING_DIR)/usr/bin/sed $(STAGING_DIR)/bin/; \ + rm -rf $(STAGING_DIR)/share/locale $(STAGING_DIR)/usr/info \ + $(STAGING_DIR)/usr/man $(STAGING_DIR)/usr/share/doc; fi + +use-sed-host-binary: + @if [ -x /usr/bin/sed ]; then SED="/usr/bin/sed"; else \ + if [ -x /bin/sed ]; then SED="/bin/sed"; fi; fi; \ + mkdir -p $(STAGING_DIR)/bin; \ + rm -f $(STAGING_DIR)/$(SED_TARGET_BINARY); \ + ln -s $$SED $(STAGING_DIR)/$(SED_TARGET_BINARY) + +host-sed: $(HOST_SED_TARGET) + +host-sed-clean: + $(MAKE) DESTDIR=$(STAGING_DIR) -C $(SED_DIR1) uninstall + -sed -C $(SED_DIR1) clean + +host-sed-dirclean: + rm -rf $(SED_DIR1) + + +############################################################# +# +# build sed for use on the target system +# +############################################################# +$(SED_DIR2)/.unpacked: $(DL_DIR)/$(SED_SOURCE) $(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(BUILD_DIR) -xvf - - touch $(SED_DIR)/.unpacked + touch $(SED_DIR2)/.unpacked -$(SED_DIR)/.configured: $(SED_DIR)/.unpacked - (cd $(SED_DIR); rm -rf config.cache; \ +$(SED_DIR2)/.configured: $(SED_DIR2)/.unpacked + (cd $(SED_DIR2); rm -rf config.cache; \ $(TARGET_CONFIGURE_OPTS) \ CFLAGS="$(TARGET_CFLAGS)" \ CPPFLAGS="$(SED_CFLAGS)" \ @@ -43,18 +101,18 @@ $(SED_DIR)/.configured: $(SED_DIR)/.unpacked --infodir=/usr/info \ $(DISABLE_NLS) \ ); - touch $(SED_DIR)/.configured + touch $(SED_DIR2)/.configured -$(SED_DIR)/$(SED_BINARY): $(SED_DIR)/.configured - $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR) +$(SED_DIR2)/$(SED_BINARY): $(SED_DIR2)/.configured + $(MAKE) CC=$(TARGET_CC) -C $(SED_DIR2) # This stuff is needed to work around GNU make deficiencies -sed-target_binary: $(SED_DIR)/$(SED_BINARY) +sed-target_binary: $(SED_DIR2)/$(SED_BINARY) @if [ -L $(TARGET_DIR)/$(SED_TARGET_BINARY) ] ; then \ rm -f $(TARGET_DIR)/$(SED_TARGET_BINARY); fi; - @if [ $(TARGET_DIR)/$(SED_TARGET_BINARY) -ot $(SED_DIR)/$(SED_BINARY) ] ; then \ + @if [ $(TARGET_DIR)/$(SED_TARGET_BINARY) -ot $(SED_DIR2)/$(SED_BINARY) ] ; then \ set -x; \ - $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR) install; \ + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) install; \ mv $(TARGET_DIR)/usr/bin/sed $(TARGET_DIR)/bin/; \ rm -rf $(TARGET_DIR)/share/locale $(TARGET_DIR)/usr/info \ $(TARGET_DIR)/usr/man $(TARGET_DIR)/usr/share/doc; fi @@ -62,9 +120,10 @@ sed-target_binary: $(SED_DIR)/$(SED_BINARY) sed: uclibc sed-target_binary sed-clean: - $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR) uninstall - -sed -C $(SED_DIR) clean + $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(SED_DIR2) uninstall + -sed -C $(SED_DIR2) clean sed-dirclean: - rm -rf $(SED_DIR) + rm -rf $(SED_DIR2) + diff --git a/make/tinylogin.mk b/make/tinylogin.mk index 82faddc50b..d15aa49b1b 100644 --- a/make/tinylogin.mk +++ b/make/tinylogin.mk @@ -24,12 +24,12 @@ tinylogin-source: $(DL_DIR)/$(TINYLOGIN_SOURCE) $(TINYLOGIN_DIR)/Config.h: $(DL_DIR)/$(TINYLOGIN_SOURCE) bzcat $(DL_DIR)/$(TINYLOGIN_SOURCE) | tar -C $(BUILD_DIR) -xvf - - sed -i -e "s/\`id -u\` -ne 0/0 == 1/" \ + $(SED) "s/\`id -u\` -ne 0/0 == 1/" \ $(TINYLOGIN_DIR)/install.sh - sed -i -e "s/4755 --owner=root --group=root/755/" \ + $(SED) "s/4755 --owner=root --group=root/755/" \ $(TINYLOGIN_DIR)/install.sh - sed -i -e "s/^DOSTATIC.*/DOSTATIC=false/g;" $(TINYLOGIN_DIR)/Makefile - sed -i -e "s/^DODEBUG.*/DODEBUG=false/g;" $(TINYLOGIN_DIR)/Makefile + $(SED) "s/^DOSTATIC.*/DOSTATIC=false/g;" $(TINYLOGIN_DIR)/Makefile + $(SED) "s/^DODEBUG.*/DODEBUG=false/g;" $(TINYLOGIN_DIR)/Makefile # date test this one touch $(TINYLOGIN_DIR)/Config.h diff --git a/make/tinyx.mk b/make/tinyx.mk index 4bbe266484..6c57e881fb 100644 --- a/make/tinyx.mk +++ b/make/tinyx.mk @@ -75,7 +75,7 @@ $(TINYX_DIR)/.configure: $(DL_DIR)/$(TINYX_SOURCE) $(DL_DIR)/cross.def $(DL_DIR) cat $(TINYX_PATCH) | patch -d $(TINYX_DIR) -p1 cp $(DL_DIR)/host.def $(TINYX_CF)/host.def cp $(DL_DIR)/cross.def $(TINYX_CF)/cross.def - sed -i -e 's:REPLACE_STAGING_DIR:$(STAGING_DIR):g' \ + $(SED) 's:REPLACE_STAGING_DIR:$(STAGING_DIR):g' \ $(TINYX_CF)/cross.def \ $(TINYX_LDIR)/X11/Xlib.h touch $(TINYX_DIR)/.configure diff --git a/make/uclibc.mk b/make/uclibc.mk index faf6de9db0..ed56446b9f 100644 --- a/make/uclibc.mk +++ b/make/uclibc.mk @@ -37,33 +37,33 @@ $(UCLIBC_DIR)/.unpacked: $(DL_DIR)/$(UCLIBC_SOURCE) touch $(UCLIBC_DIR)/.unpacked $(UCLIBC_DIR)/.configured: $(UCLIBC_DIR)/.unpacked $(LINUX_DIR)/.configured - sed -i -e 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak + $(SED) 's,^CROSS=.*,CROSS=$(TARGET_CROSS),g' $(UCLIBC_DIR)/Rules.mak ifeq ($(ENABLE_LOCALE),true) cp $(SOURCE_DIR)/uClibc.config-locale $(UCLIBC_DIR)/.config else cp $(SOURCE_DIR)/uClibc.config $(UCLIBC_DIR)/.config endif - sed -i -e 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \ + $(SED) 's,^.*TARGET_$(UCLIBC_TARGET_ARCH).*,TARGET_$(UCLIBC_TARGET_ARCH)=y,g' \ $(UCLIBC_DIR)/.config - sed -i -e 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config - sed -i -e 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ + $(SED) 's,^TARGET_ARCH.*,TARGET_ARCH=\"$(UCLIBC_TARGET_ARCH)\",g' $(UCLIBC_DIR)/.config + $(SED) 's,^KERNEL_SOURCE=.*,KERNEL_SOURCE=\"$(LINUX_DIR)\",g' \ $(UCLIBC_DIR)/.config - sed -i -e 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \ + $(SED) 's,^RUNTIME_PREFIX=.*,RUNTIME_PREFIX=\"/\",g' \ $(UCLIBC_DIR)/.config - sed -i -e 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \ + $(SED) 's,^DEVEL_PREFIX=.*,DEVEL_PREFIX=\"/usr/\",g' \ $(UCLIBC_DIR)/.config - sed -i -e 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \ + $(SED) 's,^SHARED_LIB_LOADER_PREFIX=.*,SHARED_LIB_LOADER_PREFIX=\"/lib\",g' \ $(UCLIBC_DIR)/.config ifeq ($(strip $(BUILD_WITH_LARGEFILE)),true) - sed -i -e "s/^.*UCLIBC_HAS_LFS.*/UCLIBC_HAS_LFS=y/;" \ + $(SED) "s/^.*UCLIBC_HAS_LFS.*/UCLIBC_HAS_LFS=y/;" \ $(UCLIBC_DIR)/.config else - sed -i -e "s/^.*UCLIBC_HAS_LFS.*/UCLIBC_HAS_LFS=n/;" \ + $(SED) "s/^.*UCLIBC_HAS_LFS.*/UCLIBC_HAS_LFS=n/;" \ $(UCLIBC_DIR)/.config endif - sed -i -e 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config + $(SED) 's,.*UCLIBC_HAS_WCHAR.*,UCLIBC_HAS_WCHAR=y,g' $(UCLIBC_DIR)/.config if [ -n "$(strip $(TARGET_SOFT_FLOAT))" ] ; then \ - sed -i -e 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' \ + $(SED) 's,.*HAS_FPU.*,HAS_FPU=n\nUCLIBC_HAS_FLOATS=y\nUCLIBC_HAS_SOFT_FLOAT=y,g' \ $(UCLIBC_DIR)/.config; \ fi $(MAKE) -C $(UCLIBC_DIR) PREFIX=$(STAGING_DIR) headers install_dev; diff --git a/make/udhcp.mk b/make/udhcp.mk index d92dd5c2b8..46cb203d0f 100644 --- a/make/udhcp.mk +++ b/make/udhcp.mk @@ -44,9 +44,9 @@ $(UDHCP_DIR)/udhcpc: $(UDHCP_DIR)/.unpacked $(MAKE) CROSS_COMPILE="$(TARGET_CROSS)" prefix="$(TARGET_DIR)" -C $(UDHCP_DIR) $(TARGET_DIR)/sbin/udhcpc: $(UDHCP_DIR)/udhcpc - sed -i -e 's/pump/udhcpc/' $(TARGET_DIR)/etc/pcmcia/network* - sed -i -e 's/PUMP/UDHCPC/' $(TARGET_DIR)/etc/pcmcia/network* - sed -i -e 's/DHCP="n"/DHCP="y"/' $(TARGET_DIR)/etc/pcmcia/network* + $(SED) 's/pump/udhcpc/' $(TARGET_DIR)/etc/pcmcia/network* + $(SED) 's/PUMP/UDHCPC/' $(TARGET_DIR)/etc/pcmcia/network* + $(SED) 's/DHCP="n"/DHCP="y"/' $(TARGET_DIR)/etc/pcmcia/network* mkdir -p $(TARGET_DIR)/sbin rm -f $(TARGET_DIR)/sbin/udhcpc cp $(UDHCP_DIR)/udhcpc $(TARGET_DIR)/sbin/ diff --git a/make/user-mode-linux.mk b/make/user-mode-linux.mk index 1572cefb92..e84541c03e 100644 --- a/make/user-mode-linux.mk +++ b/make/user-mode-linux.mk @@ -35,7 +35,7 @@ $(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked touch $(LINUX_DIR)/.patched $(LINUX_DIR)/.set_arch: $(LINUX_DIR)/.patched - sed -i -e "s/^ARCH :=.*/ARCH:=um/g;" $(LINUX_DIR)/Makefile + $(SED) "s/^ARCH :=.*/ARCH:=um/g;" $(LINUX_DIR)/Makefile touch $(LINUX_DIR)/.set_arch $(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured: $(LINUX_DIR)/.set_arch $(LINUX_KCONFIG) diff --git a/make/util-linux.mk b/make/util-linux.mk index 48dd32d1fb..d1ac18ccad 100644 --- a/make/util-linux.mk +++ b/make/util-linux.mk @@ -34,9 +34,9 @@ $(UTIL-LINUX_DIR)/.configured: $(UTIL-LINUX_DIR)/.unpacked --infodir=/usr/info \ $(DISABLE_NLS) \ ); - sed -i -e "s,^INSTALLSUID=.*,INSTALLSUID=\\$$\(INSTALL\) -m \\$$\(BINMODE\)," \ + $(SED) "s,^INSTALLSUID=.*,INSTALLSUID=\\$$\(INSTALL\) -m \\$$\(BINMODE\)," \ $(UTIL-LINUX_DIR)/MCONFIG - sed -i -e "s,^USE_TTY_GROUP=.*,USE_TTY_GROUP=no," $(UTIL-LINUX_DIR)/MCONFIG + $(SED) "s,^USE_TTY_GROUP=.*,USE_TTY_GROUP=no," $(UTIL-LINUX_DIR)/MCONFIG touch $(UTIL-LINUX_DIR)/.configured $(UTIL-LINUX_BINARY): $(UTIL-LINUX_DIR)/.configured diff --git a/sources/sedcheck.sh b/sources/sedcheck.sh new file mode 100755 index 0000000000..f6fcebd949 --- /dev/null +++ b/sources/sedcheck.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ -x /usr/bin/sed ]; then + SED="/usr/bin/sed"; +else + if [ -x /bin/sed ]; then + SED="/bin/sed"; + fi; +fi; + +echo "HELLO" > .sedtest +$SED -i -e "s/HELLO/GOODBYE/" .sedtest >/dev/null 2>&1 + +if [ $? != 0 ] ; then + rm -f .sedtest + echo build-sed-host-binary +fi; +rm -f .sedtest +echo use-sed-host-binary + + -- 2.30.2