Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d20218e0 authored by Elliott Hughes's avatar Elliott Hughes
Browse files

Build BSD grep separately from toolbox.

Also move the dd-only library code into the dd section (so a future
maintainer will know to keep/remove them as a block) and fix the one
build warning remaining.

Change-Id: Ibf6b28ef05e4cbb70b9308b0f4387f5af5b7fa94
parent 1dee489c
Loading
Loading
Loading
Loading
+21 −24
Original line number Original line Diff line number Diff line
@@ -7,10 +7,6 @@ common_cflags := \
    -I$(LOCAL_PATH)/upstream-netbsd/include/ \
    -I$(LOCAL_PATH)/upstream-netbsd/include/ \
    -include bsd-compatibility.h \
    -include bsd-compatibility.h \


# Temporary, remove after cleanup. b/18632512
common_cflags += -Wno-unused-variable \
                 -Wno-unused-but-set-variable



include $(CLEAR_VARS)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
LOCAL_SRC_FILES := \
@@ -19,7 +15,12 @@ LOCAL_SRC_FILES := \
    upstream-netbsd/bin/dd/dd.c \
    upstream-netbsd/bin/dd/dd.c \
    upstream-netbsd/bin/dd/dd_hostops.c \
    upstream-netbsd/bin/dd/dd_hostops.c \
    upstream-netbsd/bin/dd/misc.c \
    upstream-netbsd/bin/dd/misc.c \
    upstream-netbsd/bin/dd/position.c
    upstream-netbsd/bin/dd/position.c \
    upstream-netbsd/lib/libc/gen/getbsize.c \
    upstream-netbsd/lib/libc/gen/humanize_number.c \
    upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
    upstream-netbsd/lib/libc/string/swab.c \
    upstream-netbsd/lib/libutil/raise_default_signal.c
LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
LOCAL_CFLAGS += $(common_cflags) -Dmain=dd_main -DNO_CONV
LOCAL_MODULE := libtoolbox_dd
LOCAL_MODULE := libtoolbox_dd
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
@@ -32,25 +33,12 @@ LOCAL_MODULE := libtoolbox_du
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
include $(BUILD_STATIC_LIBRARY)
include $(BUILD_STATIC_LIBRARY)


include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
    upstream-netbsd/usr.bin/grep/fastgrep.c \
    upstream-netbsd/usr.bin/grep/file.c \
    upstream-netbsd/usr.bin/grep/grep.c \
    upstream-netbsd/usr.bin/grep/queue.c \
    upstream-netbsd/usr.bin/grep/util.c
LOCAL_CFLAGS += $(common_cflags) -Dmain=grep_main
LOCAL_MODULE := libtoolbox_grep
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
include $(BUILD_STATIC_LIBRARY)



include $(CLEAR_VARS)
include $(CLEAR_VARS)


BSD_TOOLS := \
BSD_TOOLS := \
    dd \
    dd \
    du \
    du \
    grep \


OUR_TOOLS := \
OUR_TOOLS := \
    df \
    df \
@@ -89,14 +77,9 @@ OUR_TOOLS := \
ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)
ALL_TOOLS = $(BSD_TOOLS) $(OUR_TOOLS)


LOCAL_SRC_FILES := \
LOCAL_SRC_FILES := \
    upstream-netbsd/lib/libc/gen/getbsize.c \
    upstream-netbsd/lib/libc/gen/humanize_number.c \
    upstream-netbsd/lib/libc/stdlib/strsuftoll.c \
    upstream-netbsd/lib/libc/string/swab.c \
    upstream-netbsd/lib/libutil/raise_default_signal.c \
    dynarray.c \
    dynarray.c \
    $(patsubst %,%.c,$(OUR_TOOLS)) \
    toolbox.c \
    toolbox.c \
    $(patsubst %,%.c,$(OUR_TOOLS)) \


LOCAL_CFLAGS += $(common_cflags)
LOCAL_CFLAGS += $(common_cflags)


@@ -134,3 +117,17 @@ LOCAL_MODULE := r
LOCAL_MODULE_TAGS := debug
LOCAL_MODULE_TAGS := debug
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk
include $(BUILD_EXECUTABLE)
include $(BUILD_EXECUTABLE)


# We build BSD grep separately, so it can provide egrep and fgrep too.
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
    upstream-netbsd/usr.bin/grep/fastgrep.c \
    upstream-netbsd/usr.bin/grep/file.c \
    upstream-netbsd/usr.bin/grep/grep.c \
    upstream-netbsd/usr.bin/grep/queue.c \
    upstream-netbsd/usr.bin/grep/util.c
LOCAL_CFLAGS += $(common_cflags)
LOCAL_MODULE := grep
LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,egrep fgrep,ln -sf grep $(TARGET_OUT)/bin/$(t);)
include $(BUILD_EXECUTABLE)
+2 −0
Original line number Original line Diff line number Diff line
@@ -78,7 +78,9 @@ static inline int
grep_refill(struct file *f)
grep_refill(struct file *f)
{
{
	ssize_t nr;
	ssize_t nr;
#ifndef __ANDROID__
	int bzerr;
	int bzerr;
#endif


	bufpos = buffer;
	bufpos = buffer;
	bufrem = 0;
	bufrem = 0;