blob: 74f2ab5608f3f718d3b1c84b4b43df022645cbf6 [file] [log] [blame]
LOCAL_PATH := $(call my-dir)
include $(CLEAR_AUTOTOOLS_VARS)
LANGINFO_DIR := $(shell mktemp -d)
.PHONY: generate-langinfo regen-aclocal
# regenerate autotools files with our tool's versions
regen-aclocal: PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
regen-aclocal:
cd $(PRIVATE_LOCAL_PATH) && autoreconf -ivf
# langinfo does not present in Android.
# Create a faik header to build libedit
generate-langinfo:
echo "/* Hack to build "libedit". */" > $(LANGINFO_DIR)/langinfo.h
echo "#define CODESET 1" >> $(LANGINFO_DIR)/langinfo.h
echo '#define nl_langinfo(i) ((i == CODESET) ? (char*) "UTF-8" : NULL)' >> $(LANGINFO_DIR)/langinfo.h
# $(1): autotools build dir
# $(2): output dir for module
# $(3): install dir for module
# $(4): export_includes file
# $(5): export_pkgconfig file
define libedit_cb
cd $(1)/out/system/include && \
ln -sf editline readline && \
ln -sf ../histedit.h readline/history.h
cd $(2) && \
ln -sf libedit.so libreadline.so && \
ln -sf libedit.so libedit.so.0
cd $(3) && \
ln -sf libedit.so libreadline.so && \
ln -sf libedit.so libedit.so.0
endef
LOCAL_MODULE := libedit
LOCAL_SHARED_LIBRARIES := libncurses
LOCAL_ADDITIONAL_DEPENDENCIES := generate-langinfo regen-aclocal
LOCAL_CFLAGS := -D__STDC_ISO_10646__=201103L -I $(LANGINFO_DIR)
# clean up everything which we created before
LOCAL_POST_INSTALL_CMD := rm -f $(LANGINFO_DIR)/* && rmdir $(LANGINFO_DIR)
# create a symlink: system/include/editline -> system/include/readline
LOCAL_AUTOTOOLS_POST_INSTALL_CALLBACK := libedit_cb
include $(BUILD_AUTOTOOLS_SHARED_LIBRARY)