LOCAL_PATH := $(call my-dir)
#
-# To update:
+# To sync with upstream:
#
+# # Update.
# git remote add toybox https://github.com/landley/toybox.git
# git fetch toybox
# git merge toybox/master
+
+# # Regenerate generated files.
+# make
+
+# # Make any necessary Android.mk changes and rebuild.
# mm -j32
-# # (Make any necessary Android.mk changes and test the new toybox.)
-# repo upload .
+
+# # Run tests.
+# ./run-tests-on-android.sh
+# # Run a single test.
+# ./run-tests-on-android.sh wc
+
+# # Upload changes.
+# git commit -a --amend
# git push aosp HEAD:refs/for/master # Push to gerrit for review.
# git push aosp HEAD:master # Push directly, avoiding gerrit.
-#
-# # Now commit any necessary Android.mk changes like normal:
-# repo start post-sync .
-# git commit -a
#
lib/xwrap.c \
main.c \
toys/android/getenforce.c \
- toys/android/getprop.c \
toys/android/load_policy.c \
toys/android/log.c \
toys/android/restorecon.c \
toys/android/setenforce.c \
toys/android/setprop.c \
toys/android/start.c \
+ toys/lsb/dmesg.c \
toys/lsb/hostname.c \
toys/lsb/killall.c \
toys/lsb/md5sum.c \
toys/other/losetup.c \
toys/other/lsattr.c \
toys/other/lsmod.c \
+ toys/other/lspci.c \
toys/other/lsusb.c \
toys/other/makedevs.c \
toys/other/mkswap.c \
toys/other/realpath.c \
toys/other/rev.c \
toys/other/rmmod.c \
+ toys/other/setfattr.c \
toys/other/setsid.c \
toys/other/stat.c \
toys/other/swapoff.c \
toys/other/yes.c \
toys/pending/dd.c \
toys/pending/diff.c \
- toys/pending/dmesg.c \
toys/pending/expr.c \
+ toys/pending/fmt.c \
toys/pending/getfattr.c \
toys/pending/gzip.c \
toys/pending/lsof.c \
toys/pending/modprobe.c \
toys/pending/more.c \
- toys/pending/setfattr.c \
+ toys/pending/stty.c \
toys/pending/tar.c \
toys/pending/tr.c \
toys/pending/traceroute.c \
toys/posix/xargs.c \
common_CFLAGS := \
- -std=c99 \
+ -std=gnu11 \
-Os \
+ -Wall -Werror \
-Wno-char-subscripts \
-Wno-gnu-variable-sized-type-not-at-end \
-Wno-missing-field-initializers \
-ffunction-sections -fdata-sections \
-fno-asynchronous-unwind-tables \
-toybox_upstream_version := $(shell sed 's/#define.*TOYBOX_VERSION.*"\(.*\)"/\1/p;d' $(LOCAL_PATH)/main.c)
-
-toybox_version := $(toybox_upstream_version)-android-$(BUILD_NUMBER_FROM_FILE)
-
toybox_libraries := liblog libselinux libcutils libcrypto libz
-common_CFLAGS += -DTOYBOX_VERSION=\"$(toybox_version)\"
+common_CFLAGS += -DTOYBOX_VENDOR=\"-android\"
# not usable on Android?: freeramdisk fsfreeze install makedevs nbd-client
# partprobe pivot_root pwdx rev rfkill vconfig
file \
find \
flock \
+ fmt \
free \
getenforce \
- getprop \
groups \
gunzip \
gzip \
ls \
lsmod \
lsof \
+ lspci \
lsusb \
md5sum \
mkdir \
stat \
stop \
strings \
+ stty \
swapoff \
swapon \
sync \
include $(BUILD_EXECUTABLE)
############################################
-# static version to be installed in /vendor
+# toybox for /vendor
############################################
-ifeq ($(PRODUCT_FULL_TREBLE),true)
include $(CLEAR_VARS)
LOCAL_MODULE := toybox_vendor
LOCAL_VENDOR_MODULE := true
LOCAL_SRC_FILES := $(common_SRC_FILES)
LOCAL_CFLAGS := $(common_CFLAGS)
-LOCAL_STATIC_LIBRARIES := $(toybox_libraries)
-# libc++_static is needed by static liblog
-LOCAL_CXX_STL := libc++_static
+LOCAL_STATIC_LIBRARIES := libcutils libcrypto libz
+LOCAL_SHARED_LIBRARIES := libselinux liblog
LOCAL_MODULE_TAGS := optional
-LOCAL_FORCE_STATIC_EXECUTABLE := true
LOCAL_POST_INSTALL_CMD := $(hide) $(foreach t,$(ALL_TOOLS),ln -sf ${LOCAL_MODULE} $(TARGET_OUT_VENDOR_EXECUTABLES)/$(t);)
include $(BUILD_EXECUTABLE)
-endif
############################################
# static version to be installed in recovery