mirror of
https://github.com/topjohnwu/ndk-box-kitchen.git
synced 2024-11-23 11:29:45 +00:00
Several fixes
This commit is contained in:
parent
15c31a85a5
commit
8b40dbe70e
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,4 +1,4 @@
|
||||
busybox
|
||||
libs
|
||||
obj
|
||||
patch
|
||||
osm0sis_patch
|
||||
|
@ -3,13 +3,13 @@ BB_VER = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := busybox
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
LOCAL_DISABLE_FATAL_LINKER_WARNINGS=true
|
||||
LOCAL_DISABLE_FATAL_LINKER_WARNINGS := true
|
||||
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH)/include
|
||||
include $(LOCAL_PATH)/Android_src.mk
|
||||
|
||||
LOCAL_LDFLAGS := -static
|
||||
LOCAL_CFLAGS := -w -DBB_VER=\"$(BB_VER)\" -DBB_BT=AUTOCONF_TIMESTAMP
|
||||
LOCAL_DISABLE_FORMAT_STRING_CHECKS := true
|
||||
|
||||
include $(BUILD_EXECUTABLE)
|
||||
|
104
gen_makefile.sh
104
gen_makefile.sh
@ -1,15 +1,13 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# Clone busybox, check out to desired tag, cherry-pick / apply patches for NDK, then run this script
|
||||
[ ! -d busybox ] && exit 1
|
||||
|
||||
[ "$1" = "--commit" ] && COMMIT=true || COMMIT=false
|
||||
|
||||
progress() {
|
||||
echo -e "\033[44m\n${1}\n\033[0m"
|
||||
}
|
||||
|
||||
parse_kbuild() {
|
||||
# Load config into shell variables
|
||||
eval `grep -o 'CONFIG[_A-Z0-9]* 1' include/autoconf.h | sed 's/ 1/=1/g'`
|
||||
|
||||
for KBUILD in `find . -type f -name Kbuild`; do
|
||||
DIR=${KBUILD#./}
|
||||
DIR=${DIR%/*}
|
||||
@ -18,48 +16,86 @@ parse_kbuild() {
|
||||
CONFIG=`echo ${LINE%+=*} | grep -o '$(.*)' | cut -d\( -f2 | cut -d\) -f1`
|
||||
eval [ -z \"$CONFIG\" -o \"\$$CONFIG\" = \"1\" ] && INCL=true || INCL=false
|
||||
if $INCL; then
|
||||
for FILE in `echo $FILE_LIST | grep -o '\b[a-zA-Z0-9_\-]*\.o\b'`; do
|
||||
echo $DIR/$FILE | sed 's/.o$/.c \\/g'
|
||||
for FILE in `echo $FILE_LIST | grep -o '\S*\.o\b'`; do
|
||||
readlink -f $DIR/$FILE | sed "s:${CWD}/::" | sed 's/.o$/.c \\/g'
|
||||
done
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
cd busybox
|
||||
generate_files() {
|
||||
# Copy config and make config
|
||||
progress "Generating configuration files"
|
||||
cp ../ndk_busybox.config .config
|
||||
yes n | make oldconfig >/dev/null 2>&1
|
||||
|
||||
# Copy config and make config
|
||||
progress "Generating configuration files"
|
||||
cp ../ndk_busybox.config .config
|
||||
yes n | make oldconfig >/dev/null 2>&1
|
||||
# Generate headers
|
||||
gcc applets/applet_tables.c -o applets/applet_tables
|
||||
applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
|
||||
gcc applets/usage.c -o applets/usage -Iinclude
|
||||
applets/usage_compressed include/usage_compressed.h applets
|
||||
scripts/mkconfigs include/bbconfigopts.h include/bbconfigopts_bz2.h
|
||||
scripts/generate_BUFSIZ.sh include/common_bufsiz.h
|
||||
|
||||
# Generate headers
|
||||
gcc applets/applet_tables.c -o applets/applet_tables
|
||||
applets/applet_tables include/applet_tables.h include/NUM_APPLETS.h
|
||||
gcc applets/usage.c -o applets/usage -Iinclude
|
||||
applets/usage_compressed include/usage_compressed.h applets
|
||||
scripts/mkconfigs include/bbconfigopts.h include/bbconfigopts_bz2.h
|
||||
scripts/generate_BUFSIZ.sh include/common_bufsiz.h
|
||||
progress "Generating Android_src.mk based on configs"
|
||||
|
||||
progress "Generating Android_src.mk based on configs"
|
||||
# Process Kbuild files
|
||||
echo "LOCAL_SRC_FILES := \\" > Android_src.mk
|
||||
parse_kbuild | sort -u >> Android_src.mk
|
||||
|
||||
# Load config into shell variables
|
||||
eval `grep -o 'CONFIG[_A-Z0-9]* 1' include/autoconf.h | sed 's/ 1/=1/g'`
|
||||
# Build Android.mk
|
||||
echo 'LOCAL_PATH := $(call my-dir)' > Android.mk
|
||||
cat Makefile | head -n 3 >> Android.mk
|
||||
cat ../busybox.mk >> Android.mk
|
||||
|
||||
# Process Kbuild files
|
||||
echo "LOCAL_SRC_FILES := \\" > Android_src.mk
|
||||
parse_kbuild | sort -u >> Android_src.mk
|
||||
if $COMMIT; then
|
||||
progress "Commit headers and makefiles"
|
||||
git add -f include
|
||||
git add *.mk
|
||||
git commit -m "Add generated files for ndk-build" -m "Auto generated by ndk-busybox-kitchen"
|
||||
fi
|
||||
}
|
||||
|
||||
# Build Android.mk
|
||||
echo 'LOCAL_PATH := $(call my-dir)' > Android.mk
|
||||
cat Makefile | head -n 3 >> Android.mk
|
||||
cat ../busybox.mk >> Android.mk
|
||||
# git clone https://github.com/osm0sis/android-busybox-ndk osm0sis_patch
|
||||
apply_patches() {
|
||||
if [ ! -d ../osm0sis_patch ]; then
|
||||
progress "Please clone https://github.com/osm0sis/android-busybox-ndk to osm0sis_patch"
|
||||
exit 1
|
||||
fi
|
||||
for p in ../osm0sis_patch/patches/*; do
|
||||
case $p in
|
||||
*000*|*001*|*002* )
|
||||
# We don't need the Makefile patches and Cygwin patches
|
||||
continue
|
||||
;;
|
||||
* )
|
||||
MSG="[PATCH]`cat $p | grep 'Subject' | sed 's/.*]//'`"
|
||||
progress "$MSG"
|
||||
patch -p1 < $p
|
||||
git add .
|
||||
git commit -m "$MSG"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
}
|
||||
|
||||
if $COMMIT; then
|
||||
progress "Commit headers and makefiles"
|
||||
git add -f include
|
||||
git add *.mk
|
||||
git commit -m "Add generated files for ndk-build" -m "Auto generated by ndk-busybox-kitchen"
|
||||
if [ ! -d busybox ]; then
|
||||
progress "Please clone busybox, checkout to desired tag, apply patches, then run this script"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cd busybox
|
||||
CWD=`pwd`
|
||||
|
||||
case "$1" in
|
||||
generate )
|
||||
[ "$2" = "--commit" ] && COMMIT=true || COMMIT=false
|
||||
generate_files
|
||||
;;
|
||||
patch )
|
||||
apply_patches
|
||||
;;
|
||||
esac
|
||||
|
||||
cd ..
|
||||
|
@ -1,3 +1,4 @@
|
||||
APP_ABI := armeabi-v7a x86
|
||||
APP_PLATFORM := android-9
|
||||
APP_SHORT_COMMANDS := true
|
||||
NDK_TOOLCHAIN_VERSION := clang
|
||||
|
Loading…
Reference in New Issue
Block a user