From c55c90b608dbda44985ea0c9a4c19fce8ca6fb61 Mon Sep 17 00:00:00 2001 From: Maksim Gamarnik Date: Tue, 13 Sep 2016 15:21:40 +0300 Subject: [PATCH] GNUIntl wip (not done) --- build/android/Makefile | 110 ++++++++++++++++++++++++++--------- build/android/jni/Android.mk | 30 ++++++++-- src/defaultsettings.cpp | 3 + src/gettext.h | 1 + 4 files changed, 110 insertions(+), 34 deletions(-) diff --git a/build/android/Makefile b/build/android/Makefile index 93576d552..13f8503d9 100644 --- a/build/android/Makefile +++ b/build/android/Makefile @@ -24,17 +24,17 @@ VERSION_PATCH := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \ # toolchain config for ARMv7 ################################################################################ -# TARGET_HOST = arm-linux -# TARGET_HOST2 = arm-linux -# TARGET_ABI = armeabi-v7a-hard -# TARGET_LIBDIR = armeabi-v7a -# TARGET_TOOLCHAIN = arm-linux-androideabi -# TARGET_CFLAGS_ADDON = -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -# TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections -lm_hard -# TARGET_ARCH = armv7 -# CROSS_PREFIX = arm-linux-androideabi- -# COMPILER_VERSION = 4.9 +TARGET_HOST = arm-linux +TARGET_HOST2 = arm-linux +TARGET_ABI = armeabi-v7a-hard +TARGET_LIBDIR = armeabi-v7a +TARGET_TOOLCHAIN = arm-linux-androideabi +TARGET_CFLAGS_ADDON = -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fgraphite-identity +TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) +TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections -lm_hard +TARGET_ARCH = armv7 +CROSS_PREFIX = arm-linux-androideabi- +COMPILER_VERSION = 4.9 ################################################################################ # toolchain config for ARMv8 @@ -56,17 +56,17 @@ VERSION_PATCH := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \ # toolchain config for x86 ################################################################################ -TARGET_HOST = x86-linux -TARGET_HOST2 = x86-linux -TARGET_ABI = x86 -TARGET_LIBDIR = x86 -TARGET_TOOLCHAIN = x86 -TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) -TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections -TARGET_ARCH = x86 -CROSS_PREFIX = i686-linux-android- -COMPILER_VERSION = 4.9 +# TARGET_HOST = x86-linux +# TARGET_HOST2 = x86-linux +# TARGET_ABI = x86 +# TARGET_LIBDIR = x86 +# TARGET_TOOLCHAIN = x86 +# TARGET_CFLAGS_ADDON = -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden +# TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) +# TARGET_LDFLAGS_ADDON = -Wl,--no-warn-mismatch,--gc-sections +# TARGET_ARCH = x86 +# CROSS_PREFIX = i686-linux-android- +# COMPILER_VERSION = 4.9 ################################################################################ @@ -102,7 +102,7 @@ OPENSSL_TIMESTAMP = $(OPENSSL_DIR)/timestamp OPENSSL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openssl_timestamp OPENSSL_URL = https://www.openssl.org/source/openssl-$(OPENSSL_VERSION).tar.gz -CURL_VERSION = 7.50.1 +CURL_VERSION = 7.50.2 CURL_DIR = $(ANDR_ROOT)/deps/curl CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a CURL_TIMESTAMP = $(CURL_DIR)/timestamp @@ -116,7 +116,7 @@ MPIR_TIMESTAMP = $(MPIR_DIR)/timestamp MPIR_TIMESTAMP_INT = $(ANDR_ROOT)/deps/mpir_timestamp MPIR_URL_HTTP = http://mpir.org/mpir-$(MPIR_VERSION).tar.bz2 -FREETYPE_VERSION = 2.6.5 +FREETYPE_VERSION = 2.7 FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype FREETYPE_LIB = $(FREETYPE_DIR)/objs/.libs/libfreetype.a FREETYPE_TIMESTAMP = $(FREETYPE_DIR)/timestamp @@ -130,7 +130,7 @@ ICONV_TIMESTAMP = $(ICONV_DIR)/timestamp ICONV_TIMESTAMP_INT = $(ANDR_ROOT)/deps/iconv_timestamp ICONV_URL_HTTP = https://ftp.gnu.org/pub/gnu/libiconv/libiconv-$(ICONV_VERSION).tar.gz -SQLITE3_VERSION = 3140100 +SQLITE3_VERSION = 3140200 SQLITE3_DIR = $(ANDR_ROOT)/deps/sqlite SQLITE3_URL = https://www.sqlite.org/2016/sqlite-amalgamation-$(SQLITE3_VERSION).zip @@ -141,6 +141,12 @@ LUAJIT_TIMESTAMP = $(LUAJIT_DIR)/timestamp LUAJIT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/luajit_timestamp LUAJIT_URL_GIT = https://github.com/LuaJIT/LuaJIT.git +#GNUINTL_DIR = $(ANDR_ROOT)/deps/gnuintl +#GNUINTL_LIB = $(LUAJIT_DIR)src/gnuintl.a +#GNUINTL_TIMESTAMP = $(GNUINTL_DIR)/timestamp +#GNUINTL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/gnuintl_timestamp +#GNUINTL_URL_GIT = https://github.com/LuaJIT/LuaJIT.git + ################################################################################ ANDROID_SDK = $(shell grep '^sdk\.dir' local.properties | sed 's/^.*=[[:space:]]*//') @@ -153,13 +159,15 @@ NDK_MODULE_PATH = $(ANDROID_NDK)/toolchains clean_assets assets sqlite3_download \ freetype_download clean_freetype freetype \ luajit_download clean_luajit luajit \ +# gnuintl_download clean_gnuintl gnuintl \ apk clean_apk \ clean_all clean prep_srcdir \ install_debug install_release envpaths all \ $(ASSETS_TIMESTAMP) $(LUAJIT_TIMESTAMP) \ $(OPENAL_TIMESTAMP) $(VORBIS_TIMESTAMP) \ $(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \ - #$(OPENSSL_TIMESTAMP) \ +# $(OPENSSL_TIMESTAMP) \ +# $(GNUINTL_TIMESTAMP) \ $(ANDR_ROOT)/jni/src/android_version.h \ $(ANDR_ROOT)/jni/src/android_version_githash.h @@ -435,7 +443,6 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP) mkdir -p ${ICONV_DIR}; \ echo "changed timestamp for iconv detected building..."; \ cd ${ICONV_DIR}; \ - \ export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-iconv; \ ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ --toolchain=${TARGET_TOOLCHAIN}-${COMPILER_VERSION} \ @@ -457,7 +464,6 @@ $(ICONV_LIB) : $(ICONV_TIMESTAMP) else \ echo "nothing to be done for iconv"; \ fi - clean_iconv : $(RM) -rf ${ICONV_DIR} @@ -723,6 +729,54 @@ $(LUAJIT_LIB): $(LUAJIT_TIMESTAMP) clean_luajit: $(RM) -R deps/luajit +$(GNUINTL_TIMESTAMP) : gnuintl_download + @LAST_MODIF=$$(find ${GNUINTL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ + touch ${GNUINTL_TIMESTAMP}; \ + fi + +gnuintl_download : + @if [ ! -d "${GNUINTL_DIR}" ] ; then \ + echo "gnuintl sources missing, downloading..."; \ +# mkdir -p ${ANDR_ROOT}/deps; \ +# cd deps; \ +# wget ${MPIR_URL_HTTP} || exit 1; \ +# tar -xjf gnuintl-${MPIR_VERSION}.tar.bz2 || exit 1; \ +# rm gnuintl-${MPIR_VERSION}.tar.bz2; \ +# mv gnuintl-${MPIR_VERSION} gnuintl; \ + fi + +gnuintl : $(GNUINTL_LIB) + +$(GNUINTL_LIB): $(GNUINTL_TIMESTAMP) + @REFRESH=0; \ + if [ ! -e ${GNUINTL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -e ${GNUINTL_LIB} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${GNUINTL_TIMESTAMP} -nt ${GNUINTL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + mkdir -p ${GNUINTL_DIR}; \ + echo "changed timestamp for gnuintl detected building..."; \ + cd ${GNUINTL_DIR}; \ + ${ANDROID_NDK}/ndk-build NDEBUG=${NDEBUG} \ + NDK_MODULE_PATH=${NDK_MODULE_PATH} \ + APP_ABI=${TARGET_ABI} APP_PLATFORM=${APP_PLATFORM} || exit 1; \ + touch ${GNUINTL_TIMESTAMP}; \ + touch ${GNUINTL_TIMESTAMP_INT}; \ + $(RM) -rf $${TOOLCHAIN}; \ + else \ + echo "nothing to be done for gnuintl"; \ + fi + + +clean_gnuintl: + $(RM) -R sqlite + assets : $(ASSETS_TIMESTAMP) @REFRESH=0; \ if [ ! -e ${ASSETS_TIMESTAMP} ] ; then \ diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk index 50c22b9bb..8c04c3479 100644 --- a/build/android/jni/Android.mk +++ b/build/android/jni/Android.mk @@ -42,6 +42,22 @@ LOCAL_MODULE := LuaJIT LOCAL_SRC_FILES := deps/luajit/src/libluajit.a include $(PREBUILT_STATIC_LIBRARY) +#include $(CLEAR_VARS) +#LOCAL_MODULE := GNUIntl +#LOCAL_SRC_FILES := deps/gnuintl/obj/local/$(APP_ABI)/libgnuintl.so +#LOCAL_CFLAGS := -DHAVE_CONFIG_H +#LOCAL_CFLAGS += -DDEPENDS_ON_LIBICONV=1 +#LOCAL_CFLAGS += -Drelocate=libintl_relocate +#LOCAL_CFLAGS += -Dset_relocation_prefix=libintl_set_relocation_prefix +#LOCAL_CFLAGS += -DNO_XMALLOC +#LOCAL_CFLAGS += -DIN_LIBRARY +#LOCAL_CFLAGS += -DENABLE_RELOCATABLE=1 +#LOCAL_CFLAGS += -DIN_LIBINTL +#LOCAL_CFLAGS += -DBUILDING_DLL +#LOCAL_CFLAGS += -DBUILDING_LIBINTL +#LOCAL_CFLAGS += -DLOCALE_ALIAS_PATH=\"/sdcard/Android/data/mobi.MultiCraft/files\" +#include $(PREBUILT_SHARED_LIBRARY) + include $(CLEAR_VARS) LOCAL_MODULE := multicraft @@ -56,14 +72,15 @@ LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \ -DUSE_FREETYPE=1 \ $(GPROF_DEF) \ -pipe -fstrict-aliasing +# -DUSE_GETTEXT=1 ifndef NDEBUG LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a-hard) -LOCAL_CFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fno-fast-math -funsafe-math-optimizations -fno-trapping-math -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -LOCAL_CXXFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden +LOCAL_CFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fno-fast-math -funsafe-math-optimizations -fno-trapping-math -ffinite-math-only -fno-rounding-math -fno-signaling-nans -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fgraphite-identity +LOCAL_CXXFLAGS += -mfpu=vfpv3-d16 -D_NDK_MATH_NO_SOFTFP=1 -mhard-float -march=armv7-a -Ofast -fdata-sections -ffunction-sections -fmodulo-sched -fmodulo-sched-allow-regmoves -fvisibility=hidden -fgraphite-identity LOCAL_LDFLAGS = -Wl,--no-warn-mismatch,--gc-sections -lm_hard endif @@ -94,7 +111,9 @@ LOCAL_C_INCLUDES := \ deps/libvorbis-android/jni/include \ deps/mpir \ deps/sqlite/ \ - deps/luajit/src + deps/luajit/src \ +# deps/gnuintl/jni/include \ +# deps/gnuintl/jni/src LOCAL_SRC_FILES := \ jni/src/ban.cpp \ @@ -221,7 +240,7 @@ LOCAL_SRC_FILES := \ jni/src/client/clientlauncher.cpp \ jni/src/client/tile.cpp \ jni/src/util/sha256.c -# jni/src/content_cso.cpp +# jni/src/content_cso.cpp # Network LOCAL_SRC_FILES += \ @@ -275,7 +294,6 @@ LOCAL_SRC_FILES += \ # Freetype2 LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp - # SQLite3 LOCAL_SRC_FILES += deps/sqlite/sqlite3.c @@ -290,6 +308,7 @@ LOCAL_SRC_FILES += \ LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl iconv LuaJIT openal vorbis mpir android_native_app_glue $(PROFILER_LIBS) +#LOCAL_SHARED_LIBRARIES := GNUIntl LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid -lOpenSLES @@ -299,4 +318,3 @@ ifdef GPROF $(call import-module,android-ndk-profiler) endif $(call import-module,android/native_app_glue) - diff --git a/src/defaultsettings.cpp b/src/defaultsettings.cpp index 03bed69e6..71075111b 100644 --- a/src/defaultsettings.cpp +++ b/src/defaultsettings.cpp @@ -359,6 +359,9 @@ void set_default_settings(Settings *settings) settings->setDefault("active_block_range", "1"); settings->setDefault("chunksize", "3"); settings->setDefault("directional_colored_fog", "false"); + settings->setDefault("gui_scaling_filter", "false"); + settings->setDefault("gui_scaling_filter_txr2img", "false"); + settings->setDefault("max_simultaneous_block_sends_per_client", "5"); settings->setDefault("viewing_range", "25"); settings->setDefault("inventory_image_hack", "false"); diff --git a/src/gettext.h b/src/gettext.h index 75aa9af19..a00c260fc 100644 --- a/src/gettext.h +++ b/src/gettext.h @@ -23,6 +23,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "config.h" // for USE_GETTEXT #if USE_GETTEXT +// #include #include #else #define gettext(String) String