mirror of
https://github.com/minetest/minetest.git
synced 2024-08-19 04:54:18 +02:00
Add LibGMP
Uses system provided libgmp if found, if not it falls back to mini-gmp.
This commit is contained in:
parent
58eae43322
commit
181f7baa45
2
.gitignore
vendored
2
.gitignore
vendored
@ -60,6 +60,8 @@ src/cguittfont/CMakeFiles/
|
||||
src/cguittfont/libcguittfont.a
|
||||
src/cguittfont/cmake_install.cmake
|
||||
src/cguittfont/Makefile
|
||||
src/gmp/CMakeFiles/
|
||||
src/gmp/libgmp.a
|
||||
src/json/CMakeFiles/
|
||||
src/json/libjsoncpp.a
|
||||
src/sqlite/CMakeFiles/*
|
||||
|
@ -103,7 +103,7 @@ Compiling on GNU/Linux:
|
||||
-----------------------
|
||||
|
||||
Install dependencies. Here's an example for Debian/Ubuntu:
|
||||
$ sudo apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libjsoncpp-dev
|
||||
$ sudo apt-get install build-essential libirrlicht-dev cmake libbz2-dev libpng12-dev libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev libogg-dev libvorbis-dev libopenal-dev libcurl4-gnutls-dev libfreetype6-dev zlib1g-dev libgmp-dev libjsoncpp-dev
|
||||
|
||||
You can install git for easily keeping your copy up to date.
|
||||
If you dont want git, read below on how to get the source without git.
|
||||
@ -166,6 +166,7 @@ ENABLE_LEVELDB - Build with LevelDB; Enables use of LevelDB map backend (fa
|
||||
ENABLE_REDIS - Build with libhiredis; Enables use of Redis map backend
|
||||
ENABLE_SOUND - Build with OpenAL, libogg & libvorbis; in-game Sounds
|
||||
ENABLE_LUAJIT - Build with LuaJIT (much faster than non-JIT Lua)
|
||||
ENABLE_SYSTEM_GMP - Use GMP from system (much faster than bundled mini-gmp)
|
||||
RUN_IN_PLACE - Create a portable install (worlds, settings etc. in current directory)
|
||||
USE_GPROF - Enable profiling using GProf
|
||||
VERSION_EXTRA - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar)
|
||||
|
@ -118,6 +118,13 @@ CURL_TIMESTAMP = $(CURL_DIR)/timestamp
|
||||
CURL_TIMESTAMP_INT = $(ROOT)/deps/curl_timestamp
|
||||
CURL_URL_HTTP = http://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2
|
||||
|
||||
GMP_VERSION = 6.0.0
|
||||
GMP_DIR = $(ROOT)/deps/gmp-$(GMP_VERSION)
|
||||
GMP_LIB = $(GMP_DIR)/usr/lib/libgmp.la
|
||||
GMP_TIMESTAMP = $(GMP_DIR)/timestamp
|
||||
GMP_TIMESTAMP_INT = $(ROOT)/deps/gmp_timestamp
|
||||
GMP_URL_HTTP = https://gmplib.org/download/gmp/gmp-$(GMP_VERSION).tar.bz2
|
||||
|
||||
FREETYPE_DIR = $(ROOT)/deps/freetype2-android/
|
||||
FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a
|
||||
FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp
|
||||
@ -148,14 +155,14 @@ endif
|
||||
$(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \
|
||||
$(OPENSSL_TIMESTAMP) curl_binary \
|
||||
$(ROOT)/jni/src/android_version.h
|
||||
|
||||
|
||||
debug : $(PATHCFGFILE)
|
||||
export NDEBUG=; \
|
||||
export BUILD_TYPE=debug; \
|
||||
$(MAKE) apk
|
||||
|
||||
|
||||
all : debug release
|
||||
|
||||
|
||||
release : $(PATHCFGFILE)
|
||||
@export NDEBUG=1; \
|
||||
export BUILD_TYPE=release; \
|
||||
@ -194,7 +201,7 @@ $(OPENAL_TIMESTAMP) : openal_download
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OPENAL_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
|
||||
openal_download :
|
||||
@if [ ! -d ${OPENAL_DIR} ] ; then \
|
||||
echo "openal sources missing, downloading..."; \
|
||||
@ -202,7 +209,7 @@ openal_download :
|
||||
cd ${ROOT}/deps ; \
|
||||
git clone ${OPENAL_URL_GIT} || exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
openal : $(OPENAL_LIB)
|
||||
|
||||
$(OPENAL_LIB): $(OPENAL_TIMESTAMP)
|
||||
@ -227,16 +234,16 @@ $(OPENAL_LIB): $(OPENAL_TIMESTAMP)
|
||||
else \
|
||||
echo "nothing to be done for openal"; \
|
||||
fi
|
||||
|
||||
|
||||
clean_openal :
|
||||
$(RM) -rf ${OPENAL_DIR}
|
||||
|
||||
|
||||
$(OGG_TIMESTAMP) : ogg_download
|
||||
@LAST_MODIF=$$(find ${OGG_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OGG_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
|
||||
ogg_download :
|
||||
@if [ ! -d ${OGG_DIR} ] ; then \
|
||||
echo "ogg sources missing, downloading..."; \
|
||||
@ -246,7 +253,7 @@ ogg_download :
|
||||
cd libvorbis-libogg-android ; \
|
||||
patch -p1 < ../../libvorbis-libogg-fpu.patch || exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
ogg : $(OGG_LIB)
|
||||
|
||||
$(OGG_LIB): $(OGG_TIMESTAMP)
|
||||
@ -275,13 +282,13 @@ $(OGG_LIB): $(OGG_TIMESTAMP)
|
||||
|
||||
clean_ogg :
|
||||
$(RM) -rf ${OGG_DIR}
|
||||
|
||||
|
||||
$(OPENSSL_TIMESTAMP) : openssl_download
|
||||
@LAST_MODIF=$$(find ${OPENSSL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${OPENSSL_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
|
||||
openssl_download :
|
||||
@if [ ! -d ${OPENSSL_DIR} ] ; then \
|
||||
echo "openssl sources missing, downloading..."; \
|
||||
@ -292,7 +299,7 @@ openssl_download :
|
||||
cd ${OPENSSL_BASEDIR}; \
|
||||
patch -p1 < ../../openssl_arch.patch; \
|
||||
fi
|
||||
|
||||
|
||||
openssl : $(OPENSSL_LIB)
|
||||
|
||||
$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP)
|
||||
@ -340,7 +347,7 @@ leveldb_download :
|
||||
cd ${ROOT}/deps ; \
|
||||
git clone ${LEVELDB_URL_GIT} || exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
leveldb : $(LEVELDB_LIB)
|
||||
|
||||
$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
@ -374,10 +381,10 @@ $(LEVELDB_LIB): $(LEVELDB_TIMESTAMP)
|
||||
else \
|
||||
echo "nothing to be done for leveldb"; \
|
||||
fi
|
||||
|
||||
|
||||
clean_leveldb :
|
||||
$(RM) -rf deps/leveldb
|
||||
|
||||
|
||||
$(FREETYPE_TIMESTAMP) : freetype_download
|
||||
@LAST_MODIF=$$(find ${FREETYPE_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
@ -391,13 +398,13 @@ freetype_download :
|
||||
cd deps; \
|
||||
git clone ${FREETYPE_URL_GIT} || exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
$(IRRLICHT_TIMESTAMP) : irrlicht_download
|
||||
@LAST_MODIF=$$(find ${IRRLICHT_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${IRRLICHT_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
|
||||
freetype : $(FREETYPE_LIB)
|
||||
|
||||
$(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
|
||||
@ -426,7 +433,7 @@ $(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP)
|
||||
else \
|
||||
echo "nothing to be done for freetype"; \
|
||||
fi
|
||||
|
||||
|
||||
clean_freetype :
|
||||
$(RM) -rf ${FREETYPE_DIR}
|
||||
|
||||
@ -475,10 +482,10 @@ $(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB)
|
||||
else \
|
||||
echo "nothing to be done for irrlicht"; \
|
||||
fi
|
||||
|
||||
|
||||
clean_irrlicht :
|
||||
$(RM) -rf deps/irrlicht
|
||||
|
||||
|
||||
$(CURL_TIMESTAMP) : curl_download
|
||||
@LAST_MODIF=$$(find ${CURL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
@ -535,13 +542,13 @@ $(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB)
|
||||
else \
|
||||
echo "nothing to be done for curl"; \
|
||||
fi
|
||||
|
||||
|
||||
clean_curl :
|
||||
$(RM) -rf deps/curl-${CURL_VERSION} \
|
||||
$(RM) -f deps/curl
|
||||
|
||||
|
||||
curl_binary:
|
||||
|
||||
|
||||
curl_binary:
|
||||
@if [ ! -d "deps/curl-${CURL_VERSION_BINARY}" ] ; then \
|
||||
echo "curl sources missing, downloading..."; \
|
||||
mkdir -p ${ROOT}/deps; \
|
||||
@ -552,6 +559,62 @@ curl_binary:
|
||||
rm curl-7.34.0-rtmp-ssh2-ssl-zlib-static-bin-android.tar.gz; \
|
||||
fi
|
||||
|
||||
$(GMP_TIMESTAMP) : gmp_download
|
||||
@LAST_MODIF=$$(find ${GMP_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \
|
||||
if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
fi
|
||||
|
||||
gmp_download :
|
||||
@if [ ! -d "${GMP_DIR}" ] ; then \
|
||||
echo "gmp sources missing, downloading..."; \
|
||||
mkdir -p ${ROOT}/deps; \
|
||||
cd deps; \
|
||||
wget ${GMP_URL_HTTP} || exit 1; \
|
||||
tar -xjf gmp-${GMP_VERSION}.tar.bz2 || exit 1; \
|
||||
rm gmp-${GMP_VERSION}.tar.bz2; \
|
||||
ln -s gmp-${GMP_VERSION} gmp; \
|
||||
fi
|
||||
|
||||
gmp : $(GMP_LIB)
|
||||
|
||||
$(GMP_LIB): $(GMP_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ! -e ${GMP_LIB} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ ${GMP_TIMESTAMP} -nt ${GMP_TIMESTAMP_INT} ] ; then \
|
||||
REFRESH=1; \
|
||||
fi; \
|
||||
if [ $$REFRESH -ne 0 ] ; then \
|
||||
mkdir -p ${GMP_DIR}; \
|
||||
export PATH="$${PATH}:${SDKFOLDER}/platform-tools:${ANDROID_NDK}"; \
|
||||
echo "changed timestamp for gmp detected building..."; \
|
||||
cd deps/gmp-${GMP_VERSION}; \
|
||||
export CROSS_PREFIX=${CROSS_PREFIX}; \
|
||||
export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-gmp; \
|
||||
${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \
|
||||
--toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \
|
||||
--install-dir=$${TOOLCHAIN}; \
|
||||
export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \
|
||||
export CC=${CROSS_PREFIX}gcc; \
|
||||
export CXX=${CROSS_PREFIX}g++; \
|
||||
./configure --disable-static --host=${TARGET_HOST} --prefix=/usr; \
|
||||
$(MAKE) install DESTDIR=/${GMP_DIR} || exit 1; \
|
||||
touch ${GMP_TIMESTAMP}; \
|
||||
touch ${GMP_TIMESTAMP_INT}; \
|
||||
$(RM) -rf $${TOOLCHAIN}; \
|
||||
else \
|
||||
echo "nothing to be done for gmp"; \
|
||||
fi
|
||||
|
||||
clean_gmp:
|
||||
$(RM) -rf deps/gmp-${GMP_VERSION} \
|
||||
$(RM) -f deps/gmp
|
||||
|
||||
sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c
|
||||
|
||||
deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
@ -559,7 +622,7 @@ deps/${SQLITE3_FOLDER}/sqlite3.c :
|
||||
wget ${SQLITE3_URL}; \
|
||||
unzip ${SQLITE3_FOLDER}.zip; \
|
||||
ln -s ${SQLITE3_FOLDER} sqlite
|
||||
|
||||
|
||||
clean_sqlite3:
|
||||
cd deps && $(RM) -rf ${SQLITE3_FOLDER} && $(RM) -f ${SQLITE3_FOLDER}.zip && \
|
||||
$(RM) -f sqlite
|
||||
@ -622,7 +685,7 @@ $(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB)
|
||||
if [ ! -e $(ASSETS_TIMESTAMP) ] ; then \
|
||||
touch $(ASSETS_TIMESTAMP); \
|
||||
fi
|
||||
|
||||
|
||||
assets : $(ASSETS_TIMESTAMP)
|
||||
@REFRESH=0; \
|
||||
if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \
|
||||
@ -670,8 +733,8 @@ assets : $(ASSETS_TIMESTAMP)
|
||||
|
||||
clean_assets :
|
||||
@$(RM) -r assets
|
||||
|
||||
apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \
|
||||
|
||||
apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(GMP_LIB) $(LEVELDB_TARGET) \
|
||||
$(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ROOT)/jni/src/android_version.h \
|
||||
sqlite3_download
|
||||
@export NDEBUG=$$NDEBUG; $(MAKE) manifest; \
|
||||
@ -689,32 +752,32 @@ apk: $(PATHCFGFILE) assets $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \
|
||||
echo "++ Success!" && \
|
||||
echo "APK: bin/Minetest-$$BUILD_TYPE.apk" && \
|
||||
echo "You can install it with \`adb install -r bin/Minetest-$$BUILD_TYPE.apk\`"
|
||||
|
||||
|
||||
prep_srcdir :
|
||||
@rm ${ROOT}/jni/src; \
|
||||
ln -s ${ROOT}/../../src ${ROOT}/jni/src
|
||||
|
||||
|
||||
clean_apk : manifest
|
||||
@export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \
|
||||
export ANDROID_HOME=${SDKFOLDER}; \
|
||||
ant clean
|
||||
|
||||
install_debug :
|
||||
|
||||
install_debug :
|
||||
@export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \
|
||||
adb install -r ${ROOT}/bin/Minetest-debug.apk
|
||||
|
||||
|
||||
install :
|
||||
@export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}; \
|
||||
adb install -r ${ROOT}/bin/Minetest-release.apk
|
||||
|
||||
|
||||
envpaths :
|
||||
@echo "export PATH=$$PATH:${SDKFOLDER}platform-tools:${ANDROID_NDK}" > and_env;\
|
||||
echo "export ANDROID_HOME=${SDKFOLDER}" >> and_env;
|
||||
|
||||
clean_all :
|
||||
|
||||
clean_all :
|
||||
@$(MAKE) clean_apk; \
|
||||
$(MAKE) clean_assets clean_irrlicht clean_leveldb clean_curl clean_openssl \
|
||||
clean_openal clean_ogg clean_manifest; \
|
||||
clean_openal clean_ogg clean_gmp clean_manifest; \
|
||||
sleep 1; \
|
||||
$(RM) -r gen libs obj deps bin Debug and_env
|
||||
|
||||
@ -762,7 +825,7 @@ manifest :
|
||||
sed s/###BASE_VERSION###/$$BASE_VERSION/g | \
|
||||
sed -e "s@###DEBUG_BUILD###@$$DBG@g" | \
|
||||
sed -e "s@###DEBUG_FLAG###@$$DBG_FLAG@g" >${ROOT}/AndroidManifest.xml
|
||||
|
||||
|
||||
clean_manifest :
|
||||
rm -rf ${ROOT}/AndroidManifest.xml
|
||||
|
||||
|
@ -39,6 +39,11 @@ LOCAL_MODULE := vorbis
|
||||
LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := gmp
|
||||
LOCAL_SRC_FILES := deps/gmp/usr/lib/libgmp.so
|
||||
include $(PREBUILT_SHARED_LIBRARY)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := ssl
|
||||
LOCAL_SRC_FILES := deps/openssl/libssl.a
|
||||
@ -49,7 +54,6 @@ LOCAL_MODULE := crypto
|
||||
LOCAL_SRC_FILES := deps/openssl/libcrypto.a
|
||||
include $(PREBUILT_STATIC_LIBRARY)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := minetest
|
||||
|
||||
@ -97,6 +101,7 @@ LOCAL_C_INCLUDES := \
|
||||
deps/curl/include \
|
||||
deps/openal-soft/jni/OpenAL/include \
|
||||
deps/libvorbis-libogg-android/jni/include \
|
||||
deps/gmp/usr/include \
|
||||
deps/leveldb/include \
|
||||
deps/sqlite/
|
||||
|
||||
@ -283,7 +288,7 @@ LOCAL_SRC_FILES += \
|
||||
jni/src/script/lua_api/l_vmanip.cpp \
|
||||
jni/src/script/scripting_game.cpp \
|
||||
jni/src/script/scripting_mainmenu.cpp
|
||||
|
||||
|
||||
#freetype2 support
|
||||
LOCAL_SRC_FILES += \
|
||||
jni/src/cguittfont/xCGUITTFont.cpp
|
||||
@ -334,7 +339,7 @@ LOCAL_SRC_FILES += \
|
||||
# json
|
||||
LOCAL_SRC_FILES += jni/src/json/jsoncpp.cpp
|
||||
|
||||
LOCAL_SHARED_LIBRARIES := openal ogg vorbis
|
||||
LOCAL_SHARED_LIBRARIES := openal ogg vorbis gmp
|
||||
LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS)
|
||||
|
||||
ifeq ($(HAVE_LEVELDB), 1)
|
||||
|
28
cmake/Modules/FindGMP.cmake
Normal file
28
cmake/Modules/FindGMP.cmake
Normal file
@ -0,0 +1,28 @@
|
||||
|
||||
option(ENABLE_SYSTEM_GMP "Use GMP from system" TRUE)
|
||||
mark_as_advanced(GMP_LIBRARY GMP_INCLUDE_DIR)
|
||||
set(USE_SYSTEM_GMP FALSE)
|
||||
|
||||
if(ENABLE_SYSTEM_GMP)
|
||||
find_library(GMP_LIBRARY NAMES libgmp.so)
|
||||
find_path(GMP_INCLUDE_DIR NAMES gmp.h)
|
||||
|
||||
if(GMP_LIBRARY AND GMP_INCLUDE_DIR)
|
||||
message (STATUS "Using GMP provided by system.")
|
||||
set(USE_SYSTEM_GMP TRUE)
|
||||
else()
|
||||
message (STATUS "Detecting GMP from system failed.")
|
||||
endif()
|
||||
else()
|
||||
message (STATUS "Detecting GMP from system disabled! (ENABLE_SYSTEM_GMP=0)")
|
||||
endif()
|
||||
|
||||
if(NOT USE_SYSTEM_GMP)
|
||||
message(STATUS "Using bundled mini-gmp library.")
|
||||
set(GMP_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/gmp)
|
||||
set(GMP_LIBRARY gmp)
|
||||
add_subdirectory(gmp)
|
||||
endif()
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(GMP DEFAULT_MSG GMP_LIBRARY GMP_INCLUDE_DIR)
|
@ -143,6 +143,7 @@ endif(ENABLE_FREETYPE)
|
||||
|
||||
find_package(Lua REQUIRED)
|
||||
|
||||
find_package(GMP REQUIRED)
|
||||
|
||||
option(ENABLE_LEVELDB "Enable LevelDB backend" TRUE)
|
||||
set(USE_LEVELDB FALSE)
|
||||
@ -446,6 +447,7 @@ include_directories(
|
||||
${SOUND_INCLUDE_DIRS}
|
||||
${SQLITE3_INCLUDE_DIR}
|
||||
${LUA_INCLUDE_DIR}
|
||||
${GMP_INCLUDE_DIR}
|
||||
${JSON_INCLUDE_DIR}
|
||||
${PROJECT_SOURCE_DIR}/script
|
||||
)
|
||||
@ -479,6 +481,7 @@ if(BUILD_CLIENT)
|
||||
${SOUND_LIBRARIES}
|
||||
${SQLITE3_LIBRARY}
|
||||
${LUA_LIBRARY}
|
||||
${GMP_LIBRARY}
|
||||
${JSON_LIBRARY}
|
||||
${OPENGLES2_LIBRARIES}
|
||||
${PLATFORM_LIBS}
|
||||
@ -532,6 +535,7 @@ if(BUILD_SERVER)
|
||||
${JSON_LIBRARY}
|
||||
${GETTEXT_LIBRARY}
|
||||
${LUA_LIBRARY}
|
||||
${GMP_LIBRARY}
|
||||
${PLATFORM_LIBS}
|
||||
)
|
||||
set_target_properties(${PROJECT_NAME}server PROPERTIES
|
||||
|
@ -20,6 +20,7 @@
|
||||
#cmakedefine01 USE_FREETYPE
|
||||
#cmakedefine01 USE_LEVELDB
|
||||
#cmakedefine01 USE_LUAJIT
|
||||
#cmakedefine01 USE_SYSTEM_GMP
|
||||
#cmakedefine01 USE_REDIS
|
||||
#cmakedefine01 HAVE_ENDIAN_H
|
||||
|
||||
|
4
src/gmp/CMakeLists.txt
Normal file
4
src/gmp/CMakeLists.txt
Normal file
@ -0,0 +1,4 @@
|
||||
add_library(gmp mini-gmp.c)
|
||||
|
||||
target_link_libraries(gmp)
|
||||
|
4130
src/gmp/mini-gmp.c
Normal file
4130
src/gmp/mini-gmp.c
Normal file
File diff suppressed because it is too large
Load Diff
256
src/gmp/mini-gmp.h
Normal file
256
src/gmp/mini-gmp.h
Normal file
@ -0,0 +1,256 @@
|
||||
/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
|
||||
|
||||
Copyright 2011, 2012, 2013 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of the GNU MP Library.
|
||||
|
||||
The GNU MP Library is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation; either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The GNU MP Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
|
||||
|
||||
/* About mini-gmp: This is a minimal implementation of a subset of the
|
||||
GMP interface. It is intended for inclusion into applications which
|
||||
have modest bignums needs, as a fallback when the real GMP library
|
||||
is not installed.
|
||||
|
||||
This file defines the public interface. */
|
||||
|
||||
#ifndef __MINI_GMP_H__
|
||||
#define __MINI_GMP_H__
|
||||
|
||||
/* For size_t */
|
||||
#include <stddef.h>
|
||||
|
||||
#if defined (__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void mp_set_memory_functions (void *(*) (size_t),
|
||||
void *(*) (void *, size_t, size_t),
|
||||
void (*) (void *, size_t));
|
||||
|
||||
void mp_get_memory_functions (void *(**) (size_t),
|
||||
void *(**) (void *, size_t, size_t),
|
||||
void (**) (void *, size_t));
|
||||
|
||||
typedef unsigned long mp_limb_t;
|
||||
typedef long mp_size_t;
|
||||
typedef unsigned long mp_bitcnt_t;
|
||||
|
||||
typedef mp_limb_t *mp_ptr;
|
||||
typedef const mp_limb_t *mp_srcptr;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
int _mp_alloc; /* Number of *limbs* allocated and pointed
|
||||
to by the _mp_d field. */
|
||||
int _mp_size; /* abs(_mp_size) is the number of limbs the
|
||||
last field points to. If _mp_size is
|
||||
negative this is a negative number. */
|
||||
mp_limb_t *_mp_d; /* Pointer to the limbs. */
|
||||
} __mpz_struct;
|
||||
|
||||
typedef __mpz_struct mpz_t[1];
|
||||
|
||||
typedef __mpz_struct *mpz_ptr;
|
||||
typedef const __mpz_struct *mpz_srcptr;
|
||||
|
||||
void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
|
||||
void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
|
||||
|
||||
int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
|
||||
|
||||
mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
||||
mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
||||
mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
|
||||
|
||||
mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
||||
mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
||||
mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
|
||||
|
||||
mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
||||
mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
||||
mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
|
||||
|
||||
mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
|
||||
void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
|
||||
void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
|
||||
|
||||
mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
|
||||
mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
|
||||
|
||||
mp_limb_t mpn_invert_3by2 (mp_limb_t, mp_limb_t);
|
||||
#define mpn_invert_limb(x) mpn_invert_3by2 ((x), 0)
|
||||
|
||||
size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
|
||||
mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
|
||||
|
||||
void mpz_init (mpz_t);
|
||||
void mpz_init2 (mpz_t, mp_bitcnt_t);
|
||||
void mpz_clear (mpz_t);
|
||||
|
||||
#define mpz_odd_p(z) (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
|
||||
#define mpz_even_p(z) (! mpz_odd_p (z))
|
||||
|
||||
int mpz_sgn (const mpz_t);
|
||||
int mpz_cmp_si (const mpz_t, long);
|
||||
int mpz_cmp_ui (const mpz_t, unsigned long);
|
||||
int mpz_cmp (const mpz_t, const mpz_t);
|
||||
int mpz_cmpabs_ui (const mpz_t, unsigned long);
|
||||
int mpz_cmpabs (const mpz_t, const mpz_t);
|
||||
int mpz_cmp_d (const mpz_t, double);
|
||||
int mpz_cmpabs_d (const mpz_t, double);
|
||||
|
||||
void mpz_abs (mpz_t, const mpz_t);
|
||||
void mpz_neg (mpz_t, const mpz_t);
|
||||
void mpz_swap (mpz_t, mpz_t);
|
||||
|
||||
void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_add (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
|
||||
void mpz_sub (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_mul_si (mpz_t, const mpz_t, long int);
|
||||
void mpz_mul_ui (mpz_t, const mpz_t, unsigned long int);
|
||||
void mpz_mul (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_mul_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
|
||||
void mpz_cdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_fdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
|
||||
|
||||
void mpz_mod (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_divexact (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
int mpz_divisible_p (const mpz_t, const mpz_t);
|
||||
|
||||
unsigned long mpz_cdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
|
||||
unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
|
||||
unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
|
||||
unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
|
||||
|
||||
unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
int mpz_divisible_ui_p (const mpz_t, unsigned long);
|
||||
|
||||
unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
|
||||
int mpz_invert (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
void mpz_sqrtrem (mpz_t, mpz_t, const mpz_t);
|
||||
void mpz_sqrt (mpz_t, const mpz_t);
|
||||
|
||||
void mpz_pow_ui (mpz_t, const mpz_t, unsigned long);
|
||||
void mpz_ui_pow_ui (mpz_t, unsigned long, unsigned long);
|
||||
void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
|
||||
|
||||
void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
|
||||
int mpz_root (mpz_t, const mpz_t, unsigned long);
|
||||
|
||||
void mpz_fac_ui (mpz_t, unsigned long);
|
||||
void mpz_bin_uiui (mpz_t, unsigned long, unsigned long);
|
||||
|
||||
int mpz_tstbit (const mpz_t, mp_bitcnt_t);
|
||||
void mpz_setbit (mpz_t, mp_bitcnt_t);
|
||||
void mpz_clrbit (mpz_t, mp_bitcnt_t);
|
||||
void mpz_combit (mpz_t, mp_bitcnt_t);
|
||||
|
||||
void mpz_com (mpz_t, const mpz_t);
|
||||
void mpz_and (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_ior (mpz_t, const mpz_t, const mpz_t);
|
||||
void mpz_xor (mpz_t, const mpz_t, const mpz_t);
|
||||
|
||||
mp_bitcnt_t mpz_popcount (const mpz_t);
|
||||
mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
|
||||
mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
|
||||
mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
|
||||
|
||||
int mpz_fits_slong_p (const mpz_t);
|
||||
int mpz_fits_ulong_p (const mpz_t);
|
||||
long int mpz_get_si (const mpz_t);
|
||||
unsigned long int mpz_get_ui (const mpz_t);
|
||||
double mpz_get_d (const mpz_t);
|
||||
size_t mpz_size (const mpz_t);
|
||||
mp_limb_t mpz_getlimbn (const mpz_t, mp_size_t);
|
||||
|
||||
void mpz_set_si (mpz_t, signed long int);
|
||||
void mpz_set_ui (mpz_t, unsigned long int);
|
||||
void mpz_set (mpz_t, const mpz_t);
|
||||
void mpz_set_d (mpz_t, double);
|
||||
|
||||
void mpz_init_set_si (mpz_t, signed long int);
|
||||
void mpz_init_set_ui (mpz_t, unsigned long int);
|
||||
void mpz_init_set (mpz_t, const mpz_t);
|
||||
void mpz_init_set_d (mpz_t, double);
|
||||
|
||||
size_t mpz_sizeinbase (const mpz_t, int);
|
||||
char *mpz_get_str (char *, int, const mpz_t);
|
||||
int mpz_set_str (mpz_t, const char *, int);
|
||||
int mpz_init_set_str (mpz_t, const char *, int);
|
||||
|
||||
/* This long list taken from gmp.h. */
|
||||
/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
|
||||
<iostream> defines EOF but not FILE. */
|
||||
#if defined (FILE) \
|
||||
|| defined (H_STDIO) \
|
||||
|| defined (_H_STDIO) /* AIX */ \
|
||||
|| defined (_STDIO_H) /* glibc, Sun, SCO */ \
|
||||
|| defined (_STDIO_H_) /* BSD, OSF */ \
|
||||
|| defined (__STDIO_H) /* Borland */ \
|
||||
|| defined (__STDIO_H__) /* IRIX */ \
|
||||
|| defined (_STDIO_INCLUDED) /* HPUX */ \
|
||||
|| defined (__dj_include_stdio_h_) /* DJGPP */ \
|
||||
|| defined (_FILE_DEFINED) /* Microsoft */ \
|
||||
|| defined (__STDIO__) /* Apple MPW MrC */ \
|
||||
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|
||||
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
|
||||
|| defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
|
||||
|| defined (__STDIO_LOADED) /* VMS */
|
||||
size_t mpz_out_str (FILE *, int, const mpz_t);
|
||||
#endif
|
||||
|
||||
void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
|
||||
void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
|
||||
|
||||
#if defined (__cplusplus)
|
||||
}
|
||||
#endif
|
||||
#endif /* __MINI_GMP_H__ */
|
@ -12,7 +12,7 @@ sudo apt-get install p7zip-full
|
||||
if [[ $PLATFORM == "Linux" ]]; then
|
||||
sudo apt-get install libirrlicht-dev cmake libbz2-dev libpng12-dev \
|
||||
libjpeg-dev libxxf86vm-dev libgl1-mesa-dev libsqlite3-dev \
|
||||
libhiredis-dev libogg-dev libvorbis-dev libopenal-dev gettext
|
||||
libhiredis-dev libogg-dev libgmp-dev libvorbis-dev libopenal-dev gettext
|
||||
# Linking to LevelDB is broken, use a custom build
|
||||
wget http://sfan5.pf-control.de/libleveldb-1.18-ubuntu12.04.7z
|
||||
sudo 7z x -o/usr libleveldb-1.18-ubuntu12.04.7z
|
||||
|
Loading…
Reference in New Issue
Block a user