commit 27f149433dc0e4a6d6635400cb29e3f56bc9aaaf Author: Mathiaszero <55817193+Mathiaszero@users.noreply.github.com> Date: Fri Mar 12 20:57:50 2021 -0500 a diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..455dc60 --- /dev/null +++ b/.clang-format @@ -0,0 +1,30 @@ +BasedOnStyle: LLVM +IndentWidth: 8 +UseTab: Always +BreakBeforeBraces: Custom +Standard: Cpp11 +BraceWrapping: + AfterClass: true + AfterControlStatement: false + AfterEnum: true + AfterFunction: true + AfterNamespace: true + AfterStruct: true + AfterUnion: true + BeforeCatch: false + BeforeElse: false +AllowShortIfStatementsOnASingleLine: false +IndentCaseLabels: false +AccessModifierOffset: -8 +ColumnLimit: 90 +AllowShortFunctionsOnASingleLine: InlineOnly +SortIncludes: false +IncludeCategories: + - Regex: '^".*' + Priority: 2 + - Regex: '^<.*' + Priority: 1 +AlignAfterOpenBracket: DontAlign +ContinuationIndentWidth: 16 +ConstructorInitializerIndentWidth: 16 +BreakConstructorInitializers: AfterColon diff --git a/.clang-tidy b/.clang-tidy new file mode 100644 index 0000000..80c1949 --- /dev/null +++ b/.clang-tidy @@ -0,0 +1,4 @@ +Checks: '-*,modernize-use-emplace,modernize-use-default-member-init,modernize-use-equals-delete,modernize-use-equals-default,modernize-return-braced-init-list,modernize-loop-convert,modernize-avoid-bind,misc-throw-by-value-catch-by-reference,misc-string-compare,misc-inefficient-algorithm,misc-inaccurate-erase,misc-incorrect-roundings,misc-unconventional-assign-operator,bugprone-suspicious-memset-usage,performance-*' +CheckOptions: + - key: modernize-use-default-member-init.UseAssignment + value: True diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2e62a4e --- /dev/null +++ b/.gitattributes @@ -0,0 +1,2 @@ +*.cpp diff=cpp +*.h diff=cpp diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..f6fc9ab --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,31 @@ +##### Issue type + + - Bug report + - Feature request + - Documentation issue + - Build issue + +##### Minetest version + +``` + +``` + +##### OS / Hardware + +Operating system: +CPU: + + +GPU model: +OpenGL version: + +##### Summary + + +##### Steps to reproduce + diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6591b84 --- /dev/null +++ b/.gitignore @@ -0,0 +1,113 @@ +## Editors and Development environments +*~ +*.swp +*.bak* +*.orig +# Vim +*.vim +# Kate +.*.kate-swp +.swp.* +# KDevelop4 +.kdev4/ +*.kdev4 +# Eclipse (CDT and LDT) +.project +.cproject +.settings/ +.buildpath +.metadata +# GNU Global +tags +!tags/ +gtags.files +.idea/* +# Codelite +*.project + +## Files related to minetest development cycle +/*.patch +*.diff +# GNU Patch reject file +*.rej + +## Non-static Minetest directories or symlinks to these +/bin/ +/games/* +!/games/minimal/ +/cache +/textures/* +!/textures/base/ +/screenshots +/sounds +/mods/* +!/mods/minetest/ +/mods/minetest/* +!/mods/minetest/mods_here.txt +/worlds +/world/ +/clientmods/* +!/clientmods/preview/ +/client/mod_storage/ + +## Configuration/log files +minetest.conf +debug.txt + +## Other files generated by minetest +screenshot_*.png +testbm.txt + +## Doxygen files +doc/Doxyfile +doc/html/ +doc/doxygen_* + +## Build files +CMakeFiles +Makefile +!build/android/Makefile +build/android/path.cfg +build/android/*.apk +build/android/.externalNativeBuild +cmake_install.cmake +CMakeCache.txt +CPackConfig.cmake +CPackSourceConfig.cmake +src/test_config.h +src/android_version.h +src/android_version_githash.h +src/cmake_config.h +src/cmake_config_githash.h +src/unittest/test_world/world.mt +src/lua/build/ +locale/ +.directory +*.cbp +*.layout +*.o +*.a +*.ninja +.ninja* +*.gch +*.iml +test_config.h +cmake-build-debug/ +cmake-build-release/ +cmake_config.h +cmake_config_githash.h +CMakeDoxy* +compile_commands.json + +## Android build files +build/android/src/main/assets +build/android/build +build/android/deps +build/android/libs +build/android/jni/lib +build/android/jni/src +build/android/src/main/jniLibs +build/android/obj +build/android/local.properties +build/android/.gradle +timestamp diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000..b957fdb --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,324 @@ +--- +# Github repository is cloned every day on Gitlab.com +# https://gitlab.com/minetest/minetest +# Pipelines URL: https://gitlab.com/minetest/minetest/pipelines + +stages: + - build + - package + - deploy + +variables: + MINETEST_GAME_REPO: "https://github.com/minetest/minetest_game.git" + CONTAINER_IMAGE: registry.gitlab.com/$CI_PROJECT_PATH + +.build_template: &build_definition + stage: build + script: + - mkdir cmakebuild + - mkdir -p artifact/minetest/usr/ + - cd cmakebuild + - cmake -DCMAKE_INSTALL_PREFIX=../artifact/minetest/usr/ -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE -DENABLE_GETTEXT=TRUE -DBUILD_SERVER=TRUE .. + - make -j2 + - make install + artifacts: + when: on_success + expire_in: 2h + paths: + - artifact/* + +.debpkg_template: &debpkg_template + stage: package + before_script: + - apt-get update -y + - apt-get install -y git + - mkdir -p build/deb/minetest/DEBIAN/ + - cp misc/debpkg-control build/deb/minetest/DEBIAN/control + - cp -Rp artifact/minetest/usr build/deb/minetest/ + script: + - git clone $MINETEST_GAME_REPO build/deb/minetest/usr/share/minetest/games/minetest + - rm -Rf build/deb/minetest/usr/share/minetest/games/minetest/.git + - sed -i 's/DATEPLACEHOLDER/'$(date +%y.%m.%d)'/g' build/deb/minetest/DEBIAN/control + - sed -i 's/LEVELDB_PLACEHOLDER/'$LEVELDB_PKG'/g' build/deb/minetest/DEBIAN/control + - cd build/deb/ && dpkg-deb -b minetest/ && mv minetest.deb ../../ + artifacts: + when: on_success + expire_in: 90 day + paths: + - ./*.deb + +.debpkg_install: &debpkg_install + stage: deploy + before_script: + - apt-get update -y + - apt-get install -y libc6 libcurl3-gnutls libfreetype6 libirrlicht1.8 $LEVELDB_PKG liblua5.1-0 libluajit-5.1-2 libopenal1 libstdc++6 libvorbisfile3 libx11-6 zlib1g + script: + - dpkg -i ./*.deb + +## +## Debian +## + +# Jessie + +build:debian-8: + <<: *build_definition + image: debian:8 + before_script: + - echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list + - apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F + - apt-get update -y + - apt-get -y install build-essential gcc-6 g++-6 libirrlicht-dev cmake libbz2-dev libpng-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 + variables: + CC: gcc-6 + CXX: g++-6 + +package:debian-8: + image: debian:8 + dependencies: + - build:debian-8 + variables: + LEVELDB_PKG: libleveldb1 + <<: *debpkg_template + +deploy:debian-8: + image: debian:8 + dependencies: + - package:debian-8 + variables: + LEVELDB_PKG: libleveldb1 + <<: *debpkg_install + +# Stretch + +build:debian-9: + <<: *build_definition + image: debian:9 + before_script: + - apt-get update -y + - apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-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 + +package:debian-9: + image: debian:9 + dependencies: + - build:debian-9 + variables: + LEVELDB_PKG: libleveldb1v5 + <<: *debpkg_template + +deploy:debian-9: + image: debian:9 + dependencies: + - package:debian-9 + variables: + LEVELDB_PKG: libleveldb1v5 + <<: *debpkg_install + +## +## Ubuntu +## + +# Trusty + +build:ubuntu-14.04: + <<: *build_definition + image: ubuntu:trusty + before_script: + - echo "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu trusty main" > /etc/apt/sources.list.d/uptodate-toolchain.list + - apt-key adv --keyserver keyserver.ubuntu.com --recv BA9EF27F + - apt-get update -y + - apt-get -y install build-essential gcc-6 g++-6 libirrlicht-dev cmake libbz2-dev libpng-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 + variables: + CC: gcc-6 + CXX: g++-6 + +package:ubuntu-14.04: + image: ubuntu:trusty + dependencies: + - build:ubuntu-14.04 + variables: + LEVELDB_PKG: libleveldb1 + <<: *debpkg_template + +deploy:ubuntu-14.04: + image: ubuntu:trusty + dependencies: + - package:ubuntu-14.04 + variables: + LEVELDB_PKG: libleveldb1 + <<: *debpkg_install + +# Xenial + +build:ubuntu-16.04: + <<: *build_definition + image: ubuntu:xenial + before_script: + - apt-get update -y + - apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-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 + +package:ubuntu-16.04: + image: ubuntu:xenial + dependencies: + - build:ubuntu-16.04 + variables: + LEVELDB_PKG: libleveldb1v5 + <<: *debpkg_template + +deploy:ubuntu-16.04: + image: ubuntu:xenial + dependencies: + - package:ubuntu-16.04 + variables: + LEVELDB_PKG: libleveldb1v5 + <<: *debpkg_install + +# Yakkety + +#build:ubuntu-16.10: +# <<: *build_definition +# image: ubuntu:yakkety +# before_script: +# - apt-get update -y +# - apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-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 + +#package:ubuntu-16.10: +# image: ubuntu:yakkety +# dependencies: +# - build:ubuntu-16.10 +# variables: +# LEVELDB_PKG: libleveldb1v5 +# <<: *debpkg_template + +#deploy:ubuntu-16.10: +# image: ubuntu:yakkety +# dependencies: +# - package:ubuntu-16.10 +# variables: +# LEVELDB_PKG: libleveldb1v5 +# <<: *debpkg_install + +# Zesty + +#build:ubuntu-17.04: +# <<: *build_definition +# image: ubuntu:zesty +# before_script: +# - apt-get update -y +# - apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-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 + +#package:ubuntu-17.04: +# image: ubuntu:zesty +# dependencies: +# - build:ubuntu-17.04 +# variables: +# LEVELDB_PKG: libleveldb1v5 +# <<: *debpkg_template + +#deploy:ubuntu-17.04: +# image: ubuntu:zesty +# dependencies: +# - package:ubuntu-17.04 +# variables: +# LEVELDB_PKG: libleveldb1v5 +# <<: *debpkg_install + +## +## Fedora +## + +build:fedora-24: + <<: *build_definition + image: fedora:24 + before_script: + - dnf -y install make automake gcc gcc-c++ kernel-devel cmake libcurl* openal* libvorbis* libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel + + +## +## Mingw for Windows +## + +.generic_win_template: &generic_win_template + image: ubuntu:xenial + before_script: + - apt-get update -y + - apt-get install -y p7zip-full wget unzip git cmake gettext + - wget http://minetest.kitsunemimi.pw/mingw-w64-${WIN_ARCH}_7.1.1_ubuntu14.04.7z -O mingw.7z > /dev/null + - sed -e "s|%PREFIX%|${WIN_ARCH}-w64-mingw32|" -e "s|%ROOTPATH%|/usr/${WIN_ARCH}-w64-mingw32|" < util/travis/toolchain_mingw.cmake.in > ${TOOLCHAIN_OUTPUT} + - 7z x -y -o/usr mingw.7z > /dev/null + +.build_win_template: &build_win_template + <<: *generic_win_template + stage: build + artifacts: + when: on_success + expire_in: 2h + paths: + - build/* + +.package_win_template: &package_win_template + <<: *generic_win_template + stage: package + script: + - cd build/minetest/_build + - make package + - cd ../../../ + - mkdir minetest-win-${WIN_ARCH} + - unzip build/minetest/_build/minetest-*-win*.zip -d minetest-win-${WIN_ARCH} + - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libgcc*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin + - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libstdc++*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin + - cp /usr/${WIN_ARCH}-w64-mingw32/bin/libwinpthread*.dll minetest-win-${WIN_ARCH}/minetest-*-win*/bin + artifacts: + when: on_success + expire_in: 90 day + paths: + - minetest-win-*/* + +build:win32: + <<: *build_win_template + script: + - ./util/buildbot/buildwin32.sh build + variables: + NO_PACKAGE: "1" + WIN_ARCH: "i686" + TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake" + +package:win32: + <<: *package_win_template + dependencies: + - build:win32 + variables: + NO_PACKAGE: "1" + WIN_ARCH: "i686" + TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw.cmake" + +build:win64: + <<: *build_win_template + script: + - ./util/buildbot/buildwin64.sh build + variables: + NO_PACKAGE: "1" + WIN_ARCH: "x86_64" + TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake" + +package:win64: + <<: *package_win_template + dependencies: + - build:win64 + variables: + NO_PACKAGE: "1" + WIN_ARCH: "x86_64" + TOOLCHAIN_OUTPUT: "util/buildbot/toolchain_mingw64.cmake" + +package:docker: + stage: package + image: docker:stable + services: + - docker:dind + before_script: + - docker login -u gitlab-ci-token -p $CI_JOB_TOKEN registry.gitlab.com + script: + - docker build . -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA -t ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME -t ${CONTAINER_IMAGE}/server:latest + - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_SHA + - docker push ${CONTAINER_IMAGE}/server:$CI_COMMIT_REF_NAME + - docker push ${CONTAINER_IMAGE}/server:latest diff --git a/.mailmap b/.mailmap new file mode 100644 index 0000000..c487460 --- /dev/null +++ b/.mailmap @@ -0,0 +1,33 @@ +0gb.us <0gb.us@0gb.us> +Calinou +Perttu Ahola celeron55 +Perttu Ahola celeron55 +Craig Robbins +Diego Martínez +Ilya Zhuravlev +kwolekr +PilzAdam PilzAdam +PilzAdam Pilz Adam +PilzAdam PilzAdam +proller +proller +RealBadAngel +RealBadAngel +Selat +ShadowNinja ShadowNinja +Shen Zheyu arsdragonfly +Pavel Elagin elagin +Esteban I. Ruiz Moreno Esteban I. RM +manuel duarte manuel joaquim +manuel duarte sweetbomber +Diego Martínez kaeza +Diego Martínez Diego Martinez +Lord James Lord89James +BlockMen Block Men +sfan5 Sfan5 +DannyDark dannydark +Ilya Pavlov Ilya +Ilya Zhuravlev xyzz +sapier sapier +sapier sapier + diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..2409a51 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,109 @@ +language: cpp +before_install: ./util/travis/before_install.sh +script: ./util/travis/script.sh +sudo: required +dist: trusty +group: edge +notifications: + email: false +matrix: + fast_finish: true + include: + + - env: LINT=1 + compiler: clang + os: linux + addons: + apt: + packages: ['clang-format-5.0'] + sources: &sources + - llvm-toolchain-trusty-5.0 + + - env: CLANG_TIDY=1 + compiler: clang + os: linux + script: ./util/travis/clangtidy.sh + addons: + apt: + packages: ['clang-tidy-5.0'] + sources: &sources + - llvm-toolchain-trusty-5.0 + + - env: PLATFORM=Win32 + compiler: gcc + os: linux + addons: + apt: + packages: ['gcc-mingw-w64-i686', 'g++-mingw-w64-i686', 'binutils-mingw-w64-i686'] + sources: &sources + - ubuntu-toolchain-r-test + - sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe' + + - env: PLATFORM=Win64 + compiler: gcc + os: linux + addons: + apt: + packages: ['gcc-mingw-w64-x86-64', 'g++-mingw-w64-x86-64', 'binutils-mingw-w64-x86-64'] + sources: &sources + - ubuntu-toolchain-r-test + - sourceline: 'deb http://mirrors.kernel.org/ubuntu xenial main universe' + + - env: PLATFORM=Unix + compiler: clang + os: osx + osx_image: xcode8 + + - env: PLATFORM=Unix COMPILER=gcc-6 + compiler: gcc + os: linux + addons: + apt: + packages: ['gcc-6', 'g++-6'] + sources: &sources + - ubuntu-toolchain-r-test + + - env: PLATFORM=Unix COMPILER=gcc-7 + compiler: gcc + os: linux + addons: + apt: + packages: ['gcc-7', 'g++-7'] + sources: &sources + - ubuntu-toolchain-r-test + + - env: PLATFORM=Unix COMPILER=clang-3.6 + compiler: clang + os: linux + addons: + apt: + packages: ['clang-3.6', 'clang++-3.6'] + sources: &sources + - llvm-toolchain-trusty-3.6 + + - env: PLATFORM=Unix COMPILER=clang-5.0 + compiler: clang + os: linux + addons: + apt: + packages: ['clang-5.0', 'clang++-5.0'] + sources: &sources + - llvm-toolchain-trusty-5.0 + + - env: PLATFORM=Unix COMPILER=clang-5.0 FREETYPE=0 + compiler: clang + os: linux + addons: + apt: + packages: ['clang-5.0', 'clang++-5.0'] + sources: &sources + - llvm-toolchain-trusty-5.0 + + - env: PLATFORM=Unix COMPILER=clang-5.0 VALGRIND=1 + compiler: clang + os: linux + addons: + apt: + packages: ['valgrind', 'clang-5.0', 'clang++-5.0'] + sources: &sources + - llvm-toolchain-trusty-5.0 diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..1210866 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,328 @@ +cmake_minimum_required(VERSION 2.6) + +if(${CMAKE_VERSION} STREQUAL "2.8.2") + # Bug http://vtk.org/Bug/view.php?id=11020 + message(WARNING "CMake/CPack version 2.8.2 will not create working .deb packages!") +endif() + +# This can be read from ${PROJECT_NAME} after project() is called +project(minetest) +set(PROJECT_NAME_CAPITALIZED "Minetest") + +# Works only for cmake 3.1 and greater +set(CMAKE_CXX_STANDARD 11) +set(GCC_MINIMUM_VERSION "4.8") +set(CLANG_MINIMUM_VERSION "3.4") + +# Also remember to set PROTOCOL_VERSION in network/networkprotocol.h when releasing +set(VERSION_MAJOR 5) +set(VERSION_MINOR 0) +set(VERSION_PATCH 0) +set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string") + +# Change to false for releases +set(DEVELOPMENT_BUILD FALSE) + +set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}") +if(VERSION_EXTRA) + set(VERSION_STRING ${VERSION_STRING}-${VERSION_EXTRA}) +elseif(DEVELOPMENT_BUILD) + set(VERSION_STRING "${VERSION_STRING}-dev") +endif() + +if (CMAKE_BUILD_TYPE STREQUAL Debug) + # Append "-debug" to version string + set(VERSION_STRING "${VERSION_STRING}-debug") +endif() + +message(STATUS "*** Will build version ${VERSION_STRING} ***") + + +# Configuration options +set(DEFAULT_RUN_IN_PLACE FALSE) +if(WIN32) + set(DEFAULT_RUN_IN_PLACE TRUE) +endif() +set(RUN_IN_PLACE ${DEFAULT_RUN_IN_PLACE} CACHE BOOL + "Run directly in source directory structure") + + +set(BUILD_CLIENT TRUE CACHE BOOL "Build client") +set(BUILD_SERVER FALSE CACHE BOOL "Build server") + + +set(WARN_ALL TRUE CACHE BOOL "Enable -Wall for Release build") + +if(NOT CMAKE_BUILD_TYPE) + # Default to release + set(CMAKE_BUILD_TYPE Release CACHE STRING "Build type: Debug or Release" FORCE) +endif() + +# Included stuff +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/") + + +# This is done here so that relative search paths are more reasonable +find_package(Irrlicht) + + +# Installation + +if(WIN32) + set(SHAREDIR ".") + set(BINDIR "bin") + set(DOCDIR "doc") + set(EXAMPLE_CONF_DIR ".") + set(LOCALEDIR "locale") +elseif(APPLE) + set(BUNDLE_NAME ${PROJECT_NAME}.app) + set(BUNDLE_PATH "${BUNDLE_NAME}") + set(BINDIR ${BUNDLE_NAME}/Contents/MacOS) + set(SHAREDIR ${BUNDLE_NAME}/Contents/Resources) + set(DOCDIR "${SHAREDIR}/${PROJECT_NAME}") + set(EXAMPLE_CONF_DIR ${DOCDIR}) + set(LOCALEDIR "${SHAREDIR}/locale") +elseif(UNIX) # Linux, BSD etc + if(RUN_IN_PLACE) + set(SHAREDIR ".") + set(BINDIR "bin") + set(DOCDIR "doc") + set(EXAMPLE_CONF_DIR ".") + set(MANDIR "unix/man") + set(XDG_APPS_DIR "unix/applications") + set(APPDATADIR "unix/metainfo") + set(ICONDIR "unix/icons") + set(LOCALEDIR "locale") + else() + set(SHAREDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}") + set(BINDIR "${CMAKE_INSTALL_PREFIX}/bin") + set(DOCDIR "${CMAKE_INSTALL_PREFIX}/share/doc/${PROJECT_NAME}") + set(MANDIR "${CMAKE_INSTALL_PREFIX}/share/man") + set(EXAMPLE_CONF_DIR ${DOCDIR}) + set(XDG_APPS_DIR "${CMAKE_INSTALL_PREFIX}/share/applications") + set(APPDATADIR "${CMAKE_INSTALL_PREFIX}/share/metainfo") + set(ICONDIR "${CMAKE_INSTALL_PREFIX}/share/icons") + set(LOCALEDIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}/locale") + endif() +endif() + +set(CUSTOM_SHAREDIR "" CACHE STRING "Directory to install data files into") +if(NOT CUSTOM_SHAREDIR STREQUAL "") + set(SHAREDIR "${CUSTOM_SHAREDIR}") + message(STATUS "Using SHAREDIR=${SHAREDIR}") +endif() + +set(CUSTOM_BINDIR "" CACHE STRING "Directory to install binaries into") +if(NOT CUSTOM_BINDIR STREQUAL "") + set(BINDIR "${CUSTOM_BINDIR}") + message(STATUS "Using BINDIR=${BINDIR}") +endif() + +set(CUSTOM_DOCDIR "" CACHE STRING "Directory to install documentation into") +if(NOT CUSTOM_DOCDIR STREQUAL "") + set(DOCDIR "${CUSTOM_DOCDIR}") + if(NOT RUN_IN_PLACE) + set(EXAMPLE_CONF_DIR ${DOCDIR}) + endif() + message(STATUS "Using DOCDIR=${DOCDIR}") +endif() + +set(CUSTOM_MANDIR "" CACHE STRING "Directory to install manpages into") +if(NOT CUSTOM_MANDIR STREQUAL "") + set(MANDIR "${CUSTOM_MANDIR}") + message(STATUS "Using MANDIR=${MANDIR}") +endif() + +set(CUSTOM_EXAMPLE_CONF_DIR "" CACHE STRING "Directory to install example config file into") +if(NOT CUSTOM_EXAMPLE_CONF_DIR STREQUAL "") + set(EXAMPLE_CONF_DIR "${CUSTOM_EXAMPLE_CONF_DIR}") + message(STATUS "Using EXAMPLE_CONF_DIR=${EXAMPLE_CONF_DIR}") +endif() + +set(CUSTOM_XDG_APPS_DIR "" CACHE STRING "Directory to install .desktop files into") +if(NOT CUSTOM_XDG_APPS_DIR STREQUAL "") + set(XDG_APPS_DIR "${CUSTOM_XDG_APPS_DIR}") + message(STATUS "Using XDG_APPS_DIR=${XDG_APPS_DIR}") +endif() + +set(CUSTOM_ICONDIR "" CACHE STRING "Directory to install icons into") +if(NOT CUSTOM_ICONDIR STREQUAL "") + set(ICONDIR "${CUSTOM_ICONDIR}") + message(STATUS "Using ICONDIR=${ICONDIR}") +endif() + +set(CUSTOM_LOCALEDIR "" CACHE STRING "Directory to install l10n files into") +if(NOT CUSTOM_LOCALEDIR STREQUAL "") + set(LOCALEDIR "${CUSTOM_LOCALEDIR}") + message(STATUS "Using LOCALEDIR=${LOCALEDIR}") +endif() + + +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/builtin" DESTINATION "${SHAREDIR}") +if(RUN_IN_PLACE) + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/mods/mods_here.txt" DESTINATION "${SHAREDIR}/mods") + install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures") +endif() + +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/" + COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE ) +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minimal" DESTINATION "${SHAREDIR}/games/" + COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE ) + +if(BUILD_CLIENT) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/shaders" DESTINATION "${SHAREDIR}/client") + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/textures/base/pack" DESTINATION "${SHAREDIR}/textures/base") + if(RUN_IN_PLACE) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/clientmods" DESTINATION "${SHAREDIR}") + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/client/serverlist" DESTINATION "${SHAREDIR}/client") + endif() +endif() + +install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/fonts" DESTINATION "${SHAREDIR}") + +install(FILES "README.md" DESTINATION "${DOCDIR}" COMPONENT "Docs") +install(FILES "doc/lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") +install(FILES "doc/menu_lua_api.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") +install(FILES "doc/texture_packs.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") +install(FILES "doc/world_format.txt" DESTINATION "${DOCDIR}" COMPONENT "Docs") +install(FILES "minetest.conf.example" DESTINATION "${EXAMPLE_CONF_DIR}") + +if(UNIX AND NOT APPLE) + install(FILES "doc/minetest.6" "doc/minetestserver.6" DESTINATION "${MANDIR}/man6") + install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}") + install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}") + install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps") + install(FILES "misc/minetest-xorg-icon-128.png" + DESTINATION "${ICONDIR}/hicolor/128x128/apps" + RENAME "minetest.png") +endif() + +if(APPLE) + install(FILES "misc/minetest-icon.icns" DESTINATION "${SHAREDIR}") + install(FILES "misc/Info.plist" DESTINATION "${BUNDLE_PATH}/Contents") +endif() + +# Library pack +find_package(GMP REQUIRED) +find_package(Json REQUIRED) +find_package(Lua REQUIRED) + +# JsonCPP doesn't compile well on GCC 4.8 +if(NOT ENABLE_SYSTEM_JSONCPP) + set(GCC_MINIMUM_VERSION "4.9") +endif() + +if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") + if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${GCC_MINIMUM_VERSION}") + message(FATAL_ERROR "Insufficient gcc version, found ${CMAKE_CXX_COMPILER_VERSION}. " + "Version ${GCC_MINIMUM_VERSION} or higher is required.") + endif() +elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "${CLANG_MINIMUM_VERSION}") + message(FATAL_ERROR "Insufficient clang version, found ${CMAKE_CXX_COMPILER_VERSION}. " + "Version ${CLANG_MINIMUM_VERSION} or higher is required.") + endif() +endif() + +# Subdirectories +# Be sure to add all relevant definitions above this + +add_subdirectory(src) + + +# CPack + +set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "An InfiniMiner/Minecraft inspired game") +set(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) +set(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) +set(CPACK_PACKAGE_VERSION_PATCH ${VERSION_PATCH}) +set(CPACK_PACKAGE_VENDOR "celeron55") +set(CPACK_PACKAGE_CONTACT "Perttu Ahola ") + +include(CPackComponent) + +cpack_add_component(Docs + DISPLAY_NAME "Documentation" + DESCRIPTION "Documentation about Minetest and Minetest modding" +) + +cpack_add_component(SUBGAME_MINETEST_GAME + DISPLAY_NAME "Minetest Game" + DESCRIPTION "The official subgame for the Minetest engine, that can easily extended by mods." + GROUP "Subgames" +) + +cpack_add_component(SUBGAME_MINIMAL + DISPLAY_NAME "Minimal development test" + DESCRIPTION "A minimal subgame helping to develop the engine." + DISABLED #DISABLED does not mean it is disabled, and is just not selected by default. + GROUP "Subgames" +) + +cpack_add_component_group(Subgames + DESCRIPTION "Games for the Minetest engine." +) + +if(WIN32) + # Include all dynamically linked runtime libaries such as MSVCRxxx.dll + include(InstallRequiredSystemLibraries) + + if(RUN_IN_PLACE) + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win64") + else() + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-win32") + endif() + + set(CPACK_GENERATOR ZIP) + + else() + set(CPACK_GENERATOR WIX ZIP) + set(CPACK_PACKAGE_NAME "${PROJECT_NAME_CAPITALIZED}") + set(CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME_CAPITALIZED}") + set(CPACK_PACKAGE_EXECUTABLES ${PROJECT_NAME} "${PROJECT_NAME_CAPITALIZED}") + set(CPACK_CREATE_DESKTOP_LINKS ${PROJECT_NAME}) + + set(CPACK_WIX_PRODUCT_ICON "${CMAKE_CURRENT_SOURCE_DIR}/misc/minetest-icon.ico") + # Supported languages can be found at + # http://wixtoolset.org/documentation/manual/v3/wixui/wixui_localization.html + #set(CPACK_WIX_CULTURES "ar-SA,bg-BG,ca-ES,hr-HR,cs-CZ,da-DK,nl-NL,en-US,et-EE,fi-FI,fr-FR,de-DE") + set(CPACK_WIX_UI_BANNER "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_BANNER.BMP") + set(CPACK_WIX_UI_DIALOG "${CMAKE_CURRENT_SOURCE_DIR}/misc/CPACK_WIX_UI_DIALOG.BMP") + + set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/doc/lgpl-2.1.txt") + + # The correct way would be to include both x32 and x64 into one installer + # and install the appropriate one. + # CMake does not support that, so there are two separate GUID's + if(CMAKE_SIZEOF_VOID_P EQUAL 8) + set(CPACK_WIX_UPGRADE_GUID "745A0FB3-5552-44CA-A587-A91C397CCC56") + else() + set(CPACK_WIX_UPGRADE_GUID "814A2E2D-2779-4BBD-9ACD-FC3BD51FBBA2") + endif() + endif() +elseif(APPLE) + set(CPACK_INCLUDE_TOPLEVEL_DIRECTORY 0) + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-osx") + set(CPACK_GENERATOR ZIP) +else() + set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${VERSION_STRING}-linux") + set(CPACK_GENERATOR TGZ) + set(CPACK_SOURCE_GENERATOR TGZ) +endif() + +include(CPack) + + +# Add a target to generate API documentation with Doxygen +find_package(Doxygen) +if(DOXYGEN_FOUND) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile.in + ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile @ONLY) + add_custom_target(doc + ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/doc/Doxyfile + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc + COMMENT "Generating API documentation with Doxygen" VERBATIM + ) +endif() + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..b234fb2 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,111 @@ +# Contributing + +Contributions are welcome! Here's how you can help: + +- [Contributing code](#code) +- [Reporting issues](#issues) +- [Requesting features](#feature-requests) +- [Translating](#translations) +- [Donating](#donations) + +## Code + +1. [Fork](https://help.github.com/articles/fork-a-repo/) the repository and [clone](https://help.github.com/articles/cloning-a-repository/) your fork. + +2. Before you start coding, consider opening an [issue at Github](https://github.com/minetest/minetest/issues) to discuss the suitability and implementation of your intended contribution with the core developers. If you are planning to start some very significant coding, you would benefit from first discussing on our IRC development channel [#minetest-dev](http://www.minetest.net/irc/). Note that a proper IRC client is required to speak on this channel. + +3. Start coding! + - Refer to the [Lua API](https://github.com/minetest/minetest/blob/master/doc/lua_api.txt), [Developer Wiki](http://dev.minetest.net/Main_Page) and other [documentation](https://github.com/minetest/minetest/tree/master/doc). + - Follow the [C/C++](http://dev.minetest.net/Code_style_guidelines) and [Lua](http://dev.minetest.net/Lua_code_style_guidelines) code style guidelines. + - Check your code works as expected and document any changes to the Lua API. + +4. Commit & [push](https://help.github.com/articles/pushing-to-a-remote/) your changes to a new branch (not `master`, one change per branch) + - Commit messages should: + - Use the present tense. + - Be descriptive. See the commit messages by core developers for examples. + - The first line should: + - Start with a capital letter. + - Be a compact summary of the commit. + - Preferably have less than 70 characters. + - Have no full stop at the end. + - The second line should be empty. + - The following lines should describe the commit, starting a new line for each point. + +5. Once you are happy with your changes, submit a pull request. + - Open the [pull-request form](https://github.com/minetest/minetest/pull/new/master). + - Add a description explaining what you've done (or if it's a work-in-progress - what you need to do). + +### A pull-request is considered merge-able when: + +1. It follows the roadmap in some way and fits the whole picture of the project: [roadmap introduction](http://c55.me/blog/?p=1491), [roadmap continued](https://forum.minetest.net/viewtopic.php?t=9177) +2. It works. +3. It follows the code style for [C/C++](http://dev.minetest.net/Code_style_guidelines) or [Lua](http://dev.minetest.net/Lua_code_style_guidelines). +4. The code's interfaces are well designed, regardless of other aspects that might need more work in the future. +5. It uses protocols and formats which include the required compatibility. + +## Issues + +If you experience an issue, we would like to know the details - especially when a stable release is on the way. + +1. Do a quick search on GitHub to check if the issue has already been reported. +2. Is it an issue with the Minetest *engine*? If not, report it [elsewhere](http://www.minetest.net/development/#reporting-issues). +3. [Open an issue](https://github.com/minetest/minetest/issues/new) and describe the issue you are having - you could include: + - Error logs (check the bottom of the `debug.txt` file). + - Screenshots. + - Ways you have tried to solve the issue, and whether they worked or not. + - Your Minetest version and the content (games, mods or texture packs) you have installed. + - Your platform (e.g. Windows 10 or Ubuntu 15.04 x64). + +After reporting you should aim to answer questions or clarifications as this helps pinpoint the cause of the issue (if you don't do this your issue may be closed after 1 month). + +## Feature requests + +Feature requests are welcome but take a moment to see if your idea follows the roadmap in some way and fits the whole picture of the project: [roadmap introduction](http://c55.me/blog/?p=1491), [roadmap continued](https://forum.minetest.net/viewtopic.php?t=9177). You should provide a clear explanation with as much detail as possible. + +## Translations + +Translations of Minetest are performed using Weblate. You can access the project page with a list of current languages [here](https://hosted.weblate.org/projects/minetest/minetest/). + +## Donations + +If you'd like to monetarily support Minetest development, you can find donation methods on [our website](http://www.minetest.net/development/#donate). + +# Maintaining + +*This is a concise version of the [Rules & Guidelines](http://dev.minetest.net/Category:Rules_and_Guidelines) on the developer wiki.* + +These notes are for those who have push access Minetest (core developers / maintainers). + +- See the [project organisation](http://dev.minetest.net/Organisation) for the people involved. + +## Reviewing pull requests + +Pull requests should be reviewed and, if appropriate, checked if they achieve their intended purpose. You can show that you are in the process of, or will review the pull request by commenting *"Looks good"* or something similar. + +**If the pull-request is not [merge-able](#a-pull-request-is-considered-merge-able-when):** + +Submit a comment explaining to the author what they need to change to make the pull-request merge-able. + +- If the author comments or makes changes to the pull-request, it can be reviewed again. +- If no response is made from the author within 1 month (when improvements are suggested or a question is asked), it can be closed. + +**If the pull-request is [merge-able](#a-pull-request-is-considered-merge-able-when):** + +Submit a :+1: (+1) or "Looks good" comment to show you believe the pull-request should be merged. "Looks good" comments often signify that the patch might require (more) testing. + +- Two core developers must agree to the merge before it is carried out and both should +1 the pull request. +- Who intends to merge the pull-request should follow the commit rules: + - The title should follow the commit guidelines (title starts with a capital letter, present tense, descriptive). + - Don't modify history older than 10 minutes. + - Use rebase, not merge to get linear history: + - `curl https://github.com/minetest/minetest/pull/1.patch | git am` + +## Reviewing issues and feature requests + +- If an issue does not get a response from its author within 1 month (when requiring more details), it can be closed. +- When an issue is a duplicate, refer to the first ones and close the later ones. +- Tag issues with the appropriate [labels](https://github.com/minetest/minetest/labels) for devices, platforms etc. + +## Releasing a new version + +*Refer to [dev.minetest.net/Releasing_Minetest](http://dev.minetest.net/Releasing_Minetest)* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2773411 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,40 @@ +FROM debian:stretch + +USER root +RUN apt-get update -y && \ + apt-get -y install build-essential libirrlicht-dev cmake libbz2-dev libpng-dev libjpeg-dev \ + libsqlite3-dev libcurl4-gnutls-dev zlib1g-dev libgmp-dev libjsoncpp-dev git && \ + apt-get clean && rm -rf /var/cache/apt/archives/* && \ + rm -rf /var/lib/apt/lists/* + +COPY . /usr/src/minetest + +RUN mkdir -p /usr/src/minetest/cmakebuild && cd /usr/src/minetest/cmakebuild && \ + cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DRUN_IN_PLACE=FALSE \ + -DBUILD_SERVER=TRUE \ + -DBUILD_CLIENT=FALSE \ + -DENABLE_SYSTEM_JSONCPP=1 \ + .. && \ + make -j2 && \ + rm -Rf ../games/minetest_game && git clone https://github.com/minetest/minetest_game ../games/minetest_game && \ + make install + +FROM debian:stretch + +USER root +RUN groupadd minetest && useradd -m -g minetest -d /var/lib/minetest minetest && \ + apt-get update -y && \ + apt-get -y install libcurl3-gnutls libjsoncpp1 liblua5.1-0 libluajit-5.1-2 libpq5 libsqlite3-0 \ + libstdc++6 zlib1g libc6 + +WORKDIR /var/lib/minetest + +COPY --from=0 /usr/local/share/minetest /usr/local/share/minetest +COPY --from=0 /usr/local/bin/minetestserver /usr/local/bin/minetestserver +COPY --from=0 /usr/local/share/doc/minetest/minetest.conf.example /etc/minetest/minetest.conf + +USER minetest + +EXPOSE 30000/udp + +CMD ["/usr/local/bin/minetestserver", "--config", "/etc/minetest/minetest.conf"] diff --git a/LICENSE.txt b/LICENSE.txt new file mode 100644 index 0000000..994e024 --- /dev/null +++ b/LICENSE.txt @@ -0,0 +1,171 @@ + +License of Minetest textures and sounds +--------------------------------------- + +This applies to textures and sounds contained in the main Minetest +distribution. + +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +textures/base/pack/refresh.png is under the Apache 2 license +https://www.apache.org/licenses/LICENSE-2.0.html + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + +ShadowNinja: + textures/base/pack/smoke_puff.png + +paramat: + textures/base/pack/menu_header.png + +erlehmann: + misc/minetest-icon-24x24.png + misc/minetest-icon.ico + misc/minetest.svg + textures/base/pack/logo.png + +JRottm + textures/base/pack/player_marker.png + +srifqi + textures/base/pack/chat_hide_btn.png + textures/base/pack/chat_show_btn.png + textures/base/pack/joystick_bg.png + textures/base/pack/joystick_center.png + textures/base/pack/joystick_off.png + textures/base/pack/minimap_btn.png + +License of Minetest source code +------------------------------- + +Minetest +Copyright (C) 2010-2018 celeron55, Perttu Ahola + +This program 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 2.1 of the License, or +(at your option) any later version. + +This program 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 this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Irrlicht +--------------- + +This program uses the Irrlicht Engine. http://irrlicht.sourceforge.net/ + + The Irrlicht Engine License + +Copyright © 2002-2005 Nikolaus Gebhardt + +This software is provided 'as-is', without any express or implied +warranty. In no event will the authors be held liable for any damages +arising from the use of this software. + +Permission is granted to anyone to use this software for any purpose, +including commercial applications, and to alter it and redistribute +it freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you + must not claim that you wrote the original software. If you use + this software in a product, an acknowledgment in the product + documentation would be appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must + not be misrepresented as being the original software. + 3. This notice may not be removed or altered from any source + distribution. + + +JThread +--------------- + +This program uses the JThread library. License for JThread follows: + +Copyright (c) 2000-2006 Jori Liesenborgs (jori.liesenborgs@gmail.com) + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the "Software"), +to deal in the Software without restriction, including without limitation +the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS +IN THE SOFTWARE. + +Lua +--------------- + +Lua is licensed under the terms of the MIT license reproduced below. +This means that Lua is free software and can be used for both academic +and commercial purposes at absolutely no cost. + +For details and rationale, see https://www.lua.org/license.html . + +Copyright (C) 1994-2008 Lua.org, PUC-Rio. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +Fonts +--------------- + +Bitstream Vera Fonts Copyright: + + Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream Vera is + a trademark of Bitstream, Inc. + +Arimo - Apache License, version 2.0 + Digitized data copyright (c) 2010-2012 Google Corporation. + +Cousine - Apache License, version 2.0 + Digitized data copyright (c) 2010-2012 Google Corporation. + +DroidSansFallBackFull: + + Copyright (C) 2008 The Android Open Source Project + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/README.md b/README.md new file mode 100644 index 0000000..8be6ecc --- /dev/null +++ b/README.md @@ -0,0 +1,500 @@ +Minetest +======== + +[![Build Status](https://travis-ci.org/minetest/minetest.svg?branch=master)](https://travis-ci.org/minetest/minetest) +[![Translation status](https://hosted.weblate.org/widgets/minetest/-/svg-badge.svg)](https://hosted.weblate.org/engage/minetest/?utm_source=widget) +[![License](https://img.shields.io/badge/license-LGPLv2.1%2B-blue.svg)](https://www.gnu.org/licenses/old-licenses/lgpl-2.1.en.html) + +Minetest is a free open-source voxel game engine with easy modding and game creation. + +Copyright (C) 2010-2018 Perttu Ahola +and contributors (see source file comments and the version control log) + +In case you downloaded the source code: +--------------------------------------- +If you downloaded the Minetest Engine source code in which this file is +contained, you probably want to download the [Minetest Game](https://github.com/minetest/minetest_game/) +project too. See its README.txt for more information. + +Table of Contents +------------------ + +1. [Further Documentation](#further-documentation) +2. [Default Controls](#default-controls) +3. [Paths](#paths) +4. [Configuration File](#configuration-file) +5. [Command-line Options](#command-line-options) +6. [Compiling](#compiling) +7. [Docker](#docker) +8. [Version Scheme](#version-scheme) + + +Further documentation +---------------------- +- Website: http://minetest.net/ +- Wiki: http://wiki.minetest.net/ +- Developer wiki: http://dev.minetest.net/ +- Forum: http://forum.minetest.net/ +- GitHub: https://github.com/minetest/minetest/ +- [doc/](doc/) directory of source distribution + +Default controls +---------------- +All controls are re-bindable using settings. +Some can be changed in the key config dialog in the settings tab. + +| Button | Action | +|-------------------------------|----------------------------------------------------------------| +| Move mouse | Look around | +| W, A, S, D | Move | +| Space | Jump/move up | +| Shift | Sneak/move down | +| Q | Drop itemstack | +| Shift + Q | Drop single item | +| Left mouse button | Dig/punch/take item | +| Right mouse button | Place/use | +| Shift + right mouse button | Build (without using) | +| I | Inventory menu | +| Mouse wheel | Select item | +| 0-9 | Select item | +| Z | Zoom (needs zoom privilege) | +| T | Chat | +| / | Command | +| Esc | Pause menu/abort/exit (pauses only singleplayer game) | +| R | Enable/disable full range view | +| + | Increase view range | +| - | Decrease view range | +| K | Enable/disable fly mode (needs fly privilege) | +| L | Enable/disable pitch move mode | +| J | Enable/disable fast mode (needs fast privilege) | +| H | Enable/disable noclip mode (needs noclip privilege) | +| E | Move fast in fast mode | +| F1 | Hide/show HUD | +| F2 | Hide/show chat | +| F3 | Disable/enable fog | +| F4 | Disable/enable camera update (Mapblocks are not updated anymore when disabled, disabled in release builds) | +| F5 | Cycle through debug information screens | +| F6 | Cycle through profiler info screens | +| F7 | Cycle through camera modes | +| F9 | Cycle through minimap modes | +| Shift + F9 | Change minimap orientation | +| F10 | Show/hide console | +| F12 | Take screenshot | + +Paths +----- +Locations: + +* `bin` - Compiled binaries +* `share` - Distributed read-only data +* `user` - User-created modifiable data + +Where each location is on each platform: + +* Windows .zip / RUN_IN_PLACE source: + * bin = `bin` + * share = `.` + * user = `.` +* Windows installed: + * $bin = `C:\Program Files\Minetest\bin (Depends on the install location)` + * $share = `C:\Program Files\Minetest (Depends on the install location)` + * $user = `%Appdata%\Minetest` +* Linux installed: + * `bin` = `/usr/bin` + * `share` = `/usr/share/minetest` + * `user` = `~/.minetest` +* macOS: + * `bin` = `Contents/MacOS` + * `share` = `Contents/Resources` + * `user` = `Contents/User OR ~/Library/Application Support/minetest` + +Worlds can be found as separate folders in: `user/worlds/` + +Configuration file: +------------------- +- Default location: + `user/minetest.conf` +- It is created by Minetest when it is ran the first time. +- A specific file can be specified on the command line: + `--config ` +- A run-in-place build will look for the configuration file in + `location_of_exe/../minetest.conf` and also `location_of_exe/../../minetest.conf` + +Command-line options: +--------------------- +- Use `--help` + +Compiling +--------- +### Compiling on GNU/Linux + +#### Dependencies + +| Dependency | Version | Commentary | +|------------|---------|------------| +| GCC | 4.9+ | Can be replaced with Clang 3.4+ | +| CMake | 2.6+ | | +| Irrlicht | 1.7.3+ | | +| SQLite3 | 3.0+ | | +| LuaJIT | 2.0+ | Bundled Lua 5.1 is used if not present | +| GMP | 5.0.0+ | Bundled mini-GMP is used if not present | +| JsonCPP | 1.0.0+ | Bundled JsonCPP is used if not present | + +For Debian/Ubuntu: + + sudo apt install build-essential libirrlicht-dev cmake libbz2-dev libpng-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 + +For Fedora users: + + sudo dnf install make automake gcc gcc-c++ kernel-devel cmake libcurl-devel openal-soft-devel libvorbis-devel libXxf86vm-devel libogg-devel freetype-devel mesa-libGL-devel zlib-devel jsoncpp-devel irrlicht-devel bzip2-libs gmp-devel sqlite-devel luajit-devel leveldb-devel ncurses-devel doxygen spatialindex-devel bzip2-devel + +#### Download + +You can install Git for easily keeping your copy up to date. +If you don’t want Git, read below on how to get the source without Git. +This is an example for installing Git on Debian/Ubuntu: + + sudo apt install git + +For Fedora users: + + sudo dnf install git + +Download source (this is the URL to the latest of source repository, which might not work at all times) using Git: + + git clone --depth 1 https://github.com/minetest/minetest.git + cd minetest + +Download minetest_game (otherwise only the "Minimal development test" game is available) using Git: + + git clone --depth 1 https://github.com/minetest/minetest_game.git games/minetest_game + +Download source, without using Git: + + wget https://github.com/minetest/minetest/archive/master.tar.gz + tar xf master.tar.gz + cd minetest-master + +Download minetest_game, without using Git: + + cd games/ + wget https://github.com/minetest/minetest_game/archive/master.tar.gz + tar xf master.tar.gz + mv minetest_game-master minetest_game + cd .. + +#### Build + +Build a version that runs directly from the source directory: + + cmake . -DRUN_IN_PLACE=TRUE + make -j + +Run it: + + ./bin/minetest + +- Use `cmake . -LH` to see all CMake options and their current state +- If you want to install it system-wide (or are making a distribution package), + you will want to use `-DRUN_IN_PLACE=FALSE` +- You can build a bare server by specifying `-DBUILD_SERVER=TRUE` +- You can disable the client build by specifying `-DBUILD_CLIENT=FALSE` +- You can select between Release and Debug build by `-DCMAKE_BUILD_TYPE=` + - Debug build is slower, but gives much more useful output in a debugger +- If you build a bare server, you don't need to have Irrlicht installed. + - In that case use `-DIRRLICHT_SOURCE_DIR=/the/irrlicht/source` + +### CMake options + +General options and their default values: + + BUILD_CLIENT=TRUE - Build Minetest client + BUILD_SERVER=FALSE - Build Minetest server + CMAKE_BUILD_TYPE=Release - Type of build (Release vs. Debug) + Release - Release build + Debug - Debug build + SemiDebug - Partially optimized debug build + RelWithDebInfo - Release build with debug information + MinSizeRel - Release build with -Os passed to compiler to make executable as small as possible + ENABLE_CURL=ON - Build with cURL; Enables use of online mod repo, public serverlist and remote media fetching via http + ENABLE_CURSES=ON - Build with (n)curses; Enables a server side terminal (command line option: --terminal) + ENABLE_FREETYPE=ON - Build with FreeType2; Allows using TTF fonts + ENABLE_GETTEXT=ON - Build with Gettext; Allows using translations + ENABLE_GLES=OFF - Search for Open GLES headers & libraries and use them + ENABLE_LEVELDB=ON - Build with LevelDB; Enables use of LevelDB map backend + ENABLE_POSTGRESQL=ON - Build with libpq; Enables use of PostgreSQL map backend (PostgreSQL 9.5 or greater recommended) + ENABLE_REDIS=ON - Build with libhiredis; Enables use of Redis map backend + ENABLE_SPATIAL=ON - Build with LibSpatial; Speeds up AreaStores + ENABLE_SOUND=ON - Build with OpenAL, libogg & libvorbis; in-game sounds + ENABLE_LUAJIT=ON - Build with LuaJIT (much faster than non-JIT Lua) + ENABLE_SYSTEM_GMP=ON - Use GMP from system (much faster than bundled mini-gmp) + ENABLE_SYSTEM_JSONCPP=OFF - Use JsonCPP from system + OPENGL_GL_PREFERENCE=LEGACY - Linux client build only; See CMake Policy CMP0072 for reference + RUN_IN_PLACE=FALSE - Create a portable install (worlds, settings etc. in current directory) + USE_GPROF=FALSE - Enable profiling using GProf + VERSION_EXTRA= - Text to append to version (e.g. VERSION_EXTRA=foobar -> Minetest 0.4.9-foobar) + +Library specific options: + + BZIP2_INCLUDE_DIR - Linux only; directory where bzlib.h is located + BZIP2_LIBRARY - Linux only; path to libbz2.a/libbz2.so + CURL_DLL - Only if building with cURL on Windows; path to libcurl.dll + CURL_INCLUDE_DIR - Only if building with cURL; directory where curl.h is located + CURL_LIBRARY - Only if building with cURL; path to libcurl.a/libcurl.so/libcurl.lib + EGL_INCLUDE_DIR - Only if building with GLES; directory that contains egl.h + EGL_LIBRARY - Only if building with GLES; path to libEGL.a/libEGL.so + FREETYPE_INCLUDE_DIR_freetype2 - Only if building with FreeType 2; directory that contains an freetype directory with files such as ftimage.h in it + FREETYPE_INCLUDE_DIR_ft2build - Only if building with FreeType 2; directory that contains ft2build.h + FREETYPE_LIBRARY - Only if building with FreeType 2; path to libfreetype.a/libfreetype.so/freetype.lib + FREETYPE_DLL - Only if building with FreeType 2 on Windows; path to libfreetype.dll + GETTEXT_DLL - Only when building with gettext on Windows; path to libintl3.dll + GETTEXT_ICONV_DLL - Only when building with gettext on Windows; path to libiconv2.dll + GETTEXT_INCLUDE_DIR - Only when building with gettext; directory that contains iconv.h + GETTEXT_LIBRARY - Only when building with gettext on Windows; path to libintl.dll.a + GETTEXT_MSGFMT - Only when building with gettext; path to msgfmt/msgfmt.exe + IRRLICHT_DLL - Only on Windows; path to Irrlicht.dll + IRRLICHT_INCLUDE_DIR - Directory that contains IrrCompileConfig.h + IRRLICHT_LIBRARY - Path to libIrrlicht.a/libIrrlicht.so/libIrrlicht.dll.a/Irrlicht.lib + LEVELDB_INCLUDE_DIR - Only when building with LevelDB; directory that contains db.h + LEVELDB_LIBRARY - Only when building with LevelDB; path to libleveldb.a/libleveldb.so/libleveldb.dll.a + LEVELDB_DLL - Only when building with LevelDB on Windows; path to libleveldb.dll + PostgreSQL_INCLUDE_DIR - Only when building with PostgreSQL; directory that contains libpq-fe.h + POSTGRESQL_LIBRARY - Only when building with PostgreSQL; path to libpq.a/libpq.so + REDIS_INCLUDE_DIR - Only when building with Redis; directory that contains hiredis.h + REDIS_LIBRARY - Only when building with Redis; path to libhiredis.a/libhiredis.so + SPATIAL_INCLUDE_DIR - Only when building with LibSpatial; directory that contains spatialindex/SpatialIndex.h + SPATIAL_LIBRARY - Only when building with LibSpatial; path to libspatialindex_c.so/spatialindex-32.lib + LUA_INCLUDE_DIR - Only if you want to use LuaJIT; directory where luajit.h is located + LUA_LIBRARY - Only if you want to use LuaJIT; path to libluajit.a/libluajit.so + MINGWM10_DLL - Only if compiling with MinGW; path to mingwm10.dll + OGG_DLL - Only if building with sound on Windows; path to libogg.dll + OGG_INCLUDE_DIR - Only if building with sound; directory that contains an ogg directory which contains ogg.h + OGG_LIBRARY - Only if building with sound; path to libogg.a/libogg.so/libogg.dll.a + OPENAL_DLL - Only if building with sound on Windows; path to OpenAL32.dll + OPENAL_INCLUDE_DIR - Only if building with sound; directory where al.h is located + OPENAL_LIBRARY - Only if building with sound; path to libopenal.a/libopenal.so/OpenAL32.lib + OPENGLES2_INCLUDE_DIR - Only if building with GLES; directory that contains gl2.h + OPENGLES2_LIBRARY - Only if building with GLES; path to libGLESv2.a/libGLESv2.so + SQLITE3_INCLUDE_DIR - Directory that contains sqlite3.h + SQLITE3_LIBRARY - Path to libsqlite3.a/libsqlite3.so/sqlite3.lib + VORBISFILE_DLL - Only if building with sound on Windows; path to libvorbisfile-3.dll + VORBISFILE_LIBRARY - Only if building with sound; path to libvorbisfile.a/libvorbisfile.so/libvorbisfile.dll.a + VORBIS_DLL - Only if building with sound on Windows; path to libvorbis-0.dll + VORBIS_INCLUDE_DIR - Only if building with sound; directory that contains a directory vorbis with vorbisenc.h inside + VORBIS_LIBRARY - Only if building with sound; path to libvorbis.a/libvorbis.so/libvorbis.dll.a + XXF86VM_LIBRARY - Only on Linux; path to libXXf86vm.a/libXXf86vm.so + ZLIB_DLL - Only on Windows; path to zlib1.dll + ZLIBWAPI_DLL - Only on Windows; path to zlibwapi.dll + ZLIB_INCLUDE_DIR - Directory that contains zlib.h + ZLIB_LIBRARY - Path to libz.a/libz.so/zlibwapi.lib + +### Compiling on Windows + +* This section is outdated. In addition to what is described here: + * In addition to minetest, you need to download [minetest_game](https://github.com/minetest/minetest_game). + * If you wish to have sound support, you need libogg, libvorbis and libopenal + +* You need: + * CMake: + http://www.cmake.org/cmake/resources/software.html + * A compiler + * MinGW: http://www.mingw.org/ + * or Visual Studio: http://msdn.microsoft.com/en-us/vstudio/default + * Irrlicht SDK 1.7: + http://irrlicht.sourceforge.net/downloads.html + * Zlib headers (zlib125.zip) + http://www.winimage.com/zLibDll/index.html + * Zlib library (zlibwapi.lib and zlibwapi.dll from zlib125dll.zip): + http://www.winimage.com/zLibDll/index.html + * SQLite3 headers and library + https://www.sqlite.org/download.html + * Optional: gettext library and tools: + http://gnuwin32.sourceforge.net/downlinks/gettext.php + * This is used for other UI languages. Feel free to leave it out. + * And, of course, Minetest: + http://minetest.net/download +* Steps: + * Select a directory called DIR hereafter in which you will operate. + * Make sure you have CMake and a compiler installed. + * Download all the other stuff to DIR and extract them into there. + ("extract here", not "extract to packagename/") + * NOTE: zlib125dll.zip needs to be extracted into zlib125dll + * NOTE: You need to extract sqlite3.h & sqlite3ext.h from the SQLite 3 + source and sqlite3.dll & sqlite3.def from the SQLite 3 precompiled + binaries into "sqlite3" directory, and generate sqlite3.lib using + command "LIB /DEF:sqlite3.def /OUT:sqlite3.lib" + * All those packages contain a nice base directory in them, which + should end up being the direct subdirectories of DIR. + * You will end up with a directory structure like this (+=dir, -=file): + ----------------- + + DIR + * zlib-1.2.5.tar.gz + * zlib125dll.zip + * irrlicht-1.8.3.zip + * sqlite-amalgamation-3130000.zip (SQLite3 headers) + * sqlite-dll-win32-x86-3130000.zip (SQLite3 library for 32bit system) + * 110214175330.zip (or whatever, this is the minetest source) + + zlib-1.2.5 + * zlib.h + + win32 + ... + + zlib125dll + * readme.txt + + dll32 + ... + + irrlicht-1.8.3 + + lib + + include + ... + + sqlite3 + sqlite3.h + sqlite3ext.h + sqlite3.lib + sqlite3.dll + + gettext (optional) + +bin + +include + +lib + + minetest + + src + + doc + * CMakeLists.txt + ... + ----------------- + * Start up the CMake GUI + * Select "Browse Source..." and select DIR/minetest + * Now, if using MSVC: + * Select "Browse Build..." and select DIR/minetest-build + * Else if using MinGW: + * Select "Browse Build..." and select DIR/minetest + * Select "Configure" + * Select your compiler + * It will warn about missing stuff, ignore that at this point. (later don't) + * Make sure the configuration is as follows + (note that the versions may differ for you): + + BUILD_CLIENT [X] + BUILD_SERVER [ ] + CMAKE_BUILD_TYPE Release + CMAKE_INSTALL_PREFIX DIR/minetest-install + IRRLICHT_SOURCE_DIR DIR/irrlicht-1.8.3 + RUN_IN_PLACE [X] + WARN_ALL [ ] + ZLIB_DLL DIR/zlib125dll/dll32/zlibwapi.dll + ZLIB_INCLUDE_DIR DIR/zlib-1.2.5 + ZLIB_LIBRARIES DIR/zlib125dll/dll32/zlibwapi.lib + GETTEXT_BIN_DIR DIR/gettext/bin + GETTEXT_INCLUDE_DIR DIR/gettext/include + GETTEXT_LIBRARIES DIR/gettext/lib/intl.lib + GETTEXT_MSGFMT DIR/gettext/bin/msgfmt + + * If CMake complains it couldn't find SQLITE3, choose "Advanced" box on the + right top corner, then specify the location of SQLITE3_INCLUDE_DIR and + SQLITE3_LIBRARY manually. + * If you want to build 64-bit minetest, you will need to build 64-bit version + of irrlicht engine manually, as only 32-bit pre-built library is provided. + * Hit "Configure" + * Hit "Configure" once again 8) + * If something is still coloured red, you have a problem. + * Hit "Generate" + If using MSVC: + * Open the generated minetest.sln + * The project defaults to the "Debug" configuration. Make very sure to + select "Release", unless you want to debug some stuff (it's slower + and might not even work at all) + * Build the ALL_BUILD project + * Build the INSTALL project + * You should now have a working game with the executable in + DIR/minetest-install/bin/minetest.exe + * Additionally you may create a zip package by building the PACKAGE + project. + If using MinGW: + * Using the command line, browse to the build directory and run 'make' + (or mingw32-make or whatever it happens to be) + * You may need to copy some of the downloaded DLLs into bin/, see what + running the produced executable tells you it doesn't have. + * You should now have a working game with the executable in + DIR/minetest/bin/minetest.exe + +### Bat script to build Windows releases of Minetest + +This is how we build Windows releases. + + set sourcedir=%CD% + set installpath="C:\tmp\minetest_install" + set irrlichtpath="C:\tmp\irrlicht-1.7.2" + + set builddir=%sourcedir%\bvc10 + mkdir %builddir% + pushd %builddir% + cmake %sourcedir% -G "Visual Studio 10" -DIRRLICHT_SOURCE_DIR=%irrlichtpath% -DRUN_IN_PLACE=TRUE -DCMAKE_INSTALL_PREFIX=%installpath% + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" ALL_BUILD.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" INSTALL.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + "C:\WINDOWS\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe" PACKAGE.vcxproj /p:Configuration=Release + if %errorlevel% neq 0 goto fail + popd + echo Finished. + exit /b 0 + + :fail + popd + echo Failed. + exit /b 1 + +### Windows Installer using WIX Toolset + +Requirements: +* Visual Studio 2017 +* Wix Toolset + +In Visual Studio 2017 Installer select "Optional Features" -> "Wix Toolset" + +Build the binaries like described above, but make sure you unselect "RUN_IN_PLACE". + +Open the generated Project file with VS. Right click "PACKAGE" and choose "Generate". +It may take some minutes to generate the installer. + + +Docker +------ +We provide Minetest server docker images using the Gitlab mirror registry. + +Images are built on each commit and available using the following tag scheme: + +* `registry.gitlab.com/minetest/minetest/server:latest` (latest build) +* `registry.gitlab.com/minetest/minetest/server:` (current branch or current tag) +* `registry.gitlab.com/minetest/minetest/server:` (current commit id) + +If you want to test it on a docker server, you can easily run: + + sudo docker run registry.gitlab.com/minetest/minetest/server: + +If you want to use it in a production environment you should use volumes bound to the docker host +to persist data and modify the configuration: + + sudo docker create -v /home/minetest/data/:/var/lib/minetest/ -v /home/minetest/conf/:/etc/minetest/ registry.gitlab.com/minetest/minetest/server:master + +Data will be written to `/home/minetest/data` on the host, and configuration will be read from `/home/minetest/conf/minetest.conf`. + +Note: If you don't understand the previous commands, please read the official Docker documentation before use. + +You can also host your minetest server inside a Kubernetes cluster. See our example implementation in `misc/kubernetes.yml`. + + +Version scheme +-------------- +We use `major.minor.patch` since 5.0.0-dev. Prior to that we used `0.major.minor`. + +- Major is incremented when the release contains breaking changes, all other +numbers are set to 0. +- Minor is incremented when the release contains new non-breaking features, +patch is set to 0. +- Patch is incremented when the release only contains bugfixes and very +minor/trivial features considered necessary. + +Since 5.0.0-dev and 0.4.17-dev, the dev notation refers to the next release, +i.e.: 5.0.0-dev is the development version leading to 5.0.0. +Prior to that we used `previous_version-dev`. diff --git a/build/android/Makefile b/build/android/Makefile new file mode 100644 index 0000000..c5a21c2 --- /dev/null +++ b/build/android/Makefile @@ -0,0 +1,766 @@ +# build options + +OS := $(shell uname) + +# compile with GPROF +# GPROF = 1 + +# build for build platform +API = 14 +APP_PLATFORM = android-$(API) + +ANDR_ROOT = $(shell pwd) +PROJ_ROOT = $(shell realpath $(ANDR_ROOT)/../..) +APP_ROOT = $(ANDR_ROOT)/src/main + +VERSION_MAJOR := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \ + grep ^set\(VERSION_MAJOR\ | sed 's/)/ /' | cut -f2 -d' ') +VERSION_MINOR := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \ + grep ^set\(VERSION_MINOR\ | sed 's/)/ /' | cut -f2 -d' ') +VERSION_PATCH := $(shell cat $(PROJ_ROOT)/CMakeLists.txt | \ + grep ^set\(VERSION_PATCH\ | sed 's/)/ /' | cut -f2 -d' ') + +################################################################################ +# toolchain config for arm new processors +################################################################################ +TARGET_HOST = arm-linux +TARGET_ABI = armeabi-v7a +TARGET_LIBDIR = armeabi-v7a +TARGET_TOOLCHAIN = arm-linux-androideabi- +TARGET_CFLAGS_ADDON = -mfloat-abi=softfp -mfpu=vfpv3 -O3 +TARGET_CXXFLAGS_ADDON = $(TARGET_CFLAGS_ADDON) +TARGET_ARCH = armv7 +CROSS_CC = clang +CROSS_CXX = clang++ +COMPILER_VERSION = clang +HAVE_LEVELDB = 0 + +################################################################################ +# toolchain config for little endian mips +################################################################################ +#TARGET_HOST = mipsel-linux +#TARGET_ABI = mips +#TARGET_LIBDIR = mips +#TARGET_TOOLCHAIN = mipsel-linux-android- +#TARGET_ARCH = mips32 +#CROSS_CC = mipsel-linux-android-gcc +#CROSS_CXX = mipsel-linux-android-g++ +#COMPILER_VERSION = 4.9 +#HAVE_LEVELDB = 0 + +################################################################################ +# toolchain config for x86 +################################################################################ +#TARGET_HOST = x86-linux +#TARGET_ABI = x86 +#TARGET_LIBDIR = x86 +#TARGET_TOOLCHAIN = x86- +#TARGET_ARCH = x86 +#CROSS_CC = clang +#CROSS_CXX = clang++ +#COMPILER_VERSION = clang +#HAVE_LEVELDB = 0 + +################################################################################ +ASSETS_TIMESTAMP = deps/assets_timestamp + +LEVELDB_DIR = $(ANDR_ROOT)/deps/leveldb/ +LEVELDB_LIB = $(LEVELDB_DIR)libleveldb.a +LEVELDB_TIMESTAMP = $(LEVELDB_DIR)/timestamp +LEVELDB_TIMESTAMP_INT = $(ANDR_ROOT)/deps/leveldb_timestamp +LEVELDB_URL_GIT = https://github.com/google/leveldb +LEVELDB_COMMIT = 2d0320a458d0e6a20fff46d5f80b18bfdcce7018 + +OPENAL_DIR = $(ANDR_ROOT)/deps/openal-soft/ +OPENAL_LIB = $(OPENAL_DIR)libs/$(TARGET_ABI)/libopenal.so +OPENAL_TIMESTAMP = $(OPENAL_DIR)/timestamp +OPENAL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/openal_timestamp +OPENAL_URL_GIT = https://github.com/apportable/openal-soft + +OGG_DIR = $(ANDR_ROOT)/deps/libvorbis-libogg-android/ +OGG_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so +VORBIS_LIB = $(OGG_DIR)libs/$(TARGET_ABI)/libogg.so +OGG_TIMESTAMP = $(OGG_DIR)timestamp +OGG_TIMESTAMP_INT = $(ANDR_ROOT)/deps/ogg_timestamp +OGG_URL_GIT = https://gitlab.com/minetest/libvorbis-libogg-android + +IRRLICHT_REVISION = 5150 +IRRLICHT_DIR = $(ANDR_ROOT)/deps/irrlicht/ +IRRLICHT_LIB = $(IRRLICHT_DIR)lib/Android/libIrrlicht.a +IRRLICHT_TIMESTAMP = $(IRRLICHT_DIR)timestamp +IRRLICHT_TIMESTAMP_INT = $(ANDR_ROOT)/deps/irrlicht_timestamp +IRRLICHT_URL_SVN = https://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@$(IRRLICHT_REVISION) + +OPENSSL_VERSION = 1.0.2n +OPENSSL_BASEDIR = openssl-$(OPENSSL_VERSION) +OPENSSL_DIR = $(ANDR_ROOT)/deps/$(OPENSSL_BASEDIR)/ +OPENSSL_LIB = $(OPENSSL_DIR)/libssl.a +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.60.0 +CURL_DIR = $(ANDR_ROOT)/deps/curl-$(CURL_VERSION) +CURL_LIB = $(CURL_DIR)/lib/.libs/libcurl.a +CURL_TIMESTAMP = $(CURL_DIR)/timestamp +CURL_TIMESTAMP_INT = $(ANDR_ROOT)/deps/curl_timestamp +CURL_URL_HTTP = https://curl.haxx.se/download/curl-${CURL_VERSION}.tar.bz2 + +FREETYPE_DIR = $(ANDR_ROOT)/deps/freetype2-android/ +FREETYPE_LIB = $(FREETYPE_DIR)/Android/obj/local/$(TARGET_ABI)/libfreetype2-static.a +FREETYPE_TIMESTAMP = $(FREETYPE_DIR)timestamp +FREETYPE_TIMESTAMP_INT = $(ANDR_ROOT)/deps/freetype_timestamp +FREETYPE_URL_GIT = https://github.com/cdave1/freetype2-android + +ICONV_VERSION = 1.14 +ICONV_DIR = $(ANDR_ROOT)/deps/libiconv/ +ICONV_LIB = $(ICONV_DIR)/lib/.libs/libiconv.so +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_FOLDER = sqlite-amalgamation-3240000 +SQLITE3_URL = https://www.sqlite.org/2018/$(SQLITE3_FOLDER).zip + +ANDROID_SDK = $(shell grep '^sdk\.dir' local.properties | sed 's/^.*=[[:space:]]*//') +ANDROID_NDK = $(shell grep '^ndk\.dir' local.properties | sed 's/^.*=[[:space:]]*//') + +#use interim target variable to switch leveldb on or off +ifeq ($(HAVE_LEVELDB),1) + LEVELDB_TARGET = $(LEVELDB_LIB) +endif + +.PHONY : debug release reconfig delconfig \ + leveldb_download clean_leveldb leveldb\ + irrlicht_download clean_irrlicht irrlicht \ + clean_assets assets sqlite3_download \ + freetype_download clean_freetype freetype \ + apk clean_apk \ + clean_all clean prep_srcdir \ + install_debug install_release envpaths all \ + $(ASSETS_TIMESTAMP) $(LEVELDB_TIMESTAMP) \ + $(OPENAL_TIMESTAMP) $(OGG_TIMESTAMP) \ + $(IRRLICHT_TIMESTAMP) $(CURL_TIMESTAMP) \ + $(OPENSSL_TIMESTAMP) \ + $(ANDR_ROOT)/jni/src/android_version.h \ + $(ANDR_ROOT)/jni/src/android_version_githash.h + +debug : local.properties + export NDEBUG=; \ + export BUILD_TYPE=debug; \ + $(MAKE) apk + +all : debug release + +release : local.properties + @export NDEBUG=1; \ + export BUILD_TYPE=release; \ + $(MAKE) apk + +reconfig: delconfig + @$(MAKE) local.properties + +delconfig: + $(RM) local.properties + +local.properties: + @echo "Please specify path of ANDROID NDK"; \ + echo "e.g. $$HOME/Android/Sdk/ndk-bundle/"; \ + read ANDROID_NDK ; \ + if [ ! -d $$ANDROID_NDK ] ; then \ + echo "$$ANDROID_NDK is not a valid folder"; \ + exit 1; \ + fi; \ + echo "ndk.dir = $$ANDROID_NDK" > local.properties; \ + echo "Please specify path of ANDROID SDK"; \ + echo "e.g. $$HOME/Android/Sdk/"; \ + read SDKFLDR ; \ + if [ ! -d $$SDKFLDR ] ; then \ + echo "$$SDKFLDR is not a valid folder"; \ + exit 1; \ + fi; \ + echo "sdk.dir = $$SDKFLDR" >> local.properties; + + +$(OPENAL_TIMESTAMP) : openal_download + @LAST_MODIF=$$(find ${OPENAL_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ + touch ${OPENAL_TIMESTAMP}; \ + fi + +openal_download : + @if [ ! -d ${OPENAL_DIR} ] ; then \ + echo "openal sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd ${ANDR_ROOT}/deps ; \ + git clone ${OPENAL_URL_GIT} || exit 1; \ + fi + +openal : $(OPENAL_LIB) + +$(OPENAL_LIB): $(OPENAL_TIMESTAMP) + + @REFRESH=0; \ + if [ ! -e ${OPENAL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${OPENAL_TIMESTAMP} -nt ${OPENAL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + echo "changed timestamp for openal detected building..."; \ + cd ${OPENAL_DIR}; \ + export APP_PLATFORM=${APP_PLATFORM}; \ + export TARGET_ABI=${TARGET_ABI}; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ + NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ + touch ${OPENAL_TIMESTAMP}; \ + touch ${OPENAL_TIMESTAMP_INT}; \ + 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..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd ${ANDR_ROOT}/deps ; \ + git clone ${OGG_URL_GIT}|| exit 1; \ + cd libvorbis-libogg-android ; \ + patch -p1 < ${ANDR_ROOT}/patches/libvorbis-libogg-fpu.patch || exit 1; \ + fi + +ogg : $(OGG_LIB) + +$(OGG_LIB): $(OGG_TIMESTAMP) + + @REFRESH=0; \ + if [ ! -e ${OGG_TIMESTAMP_INT} ] ; then \ + echo "${OGG_TIMESTAMP_INT} doesn't exist"; \ + REFRESH=1; \ + fi; \ + if [ ${OGG_TIMESTAMP} -nt ${OGG_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + echo "changed timestamp for ogg detected building..."; \ + cd ${OGG_DIR}; \ + export APP_PLATFORM=${APP_PLATFORM}; \ + export TARGET_ABI=${TARGET_ABI}; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --platform=${APP_PLATFORM} \ + --install-dir=$${TOOLCHAIN}; \ + touch ${OGG_TIMESTAMP}; \ + touch ${OGG_TIMESTAMP_INT}; \ + else \ + echo "nothing to be done for libogg/libvorbis"; \ + fi + +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..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd ${ANDR_ROOT}/deps ; \ + wget ${OPENSSL_URL} || exit 1; \ + tar -xzf ${OPENSSL_BASEDIR}.tar.gz; \ + cd ${OPENSSL_BASEDIR}; \ + patch -p1 < ${ANDR_ROOT}/patches/openssl_arch.patch; \ + sed -i 's/-mandroid //g' Configure; \ + fi + +openssl : $(OPENSSL_LIB) + +$(OPENSSL_LIB): $(OPENSSL_TIMESTAMP) + @REFRESH=0; \ + if [ ! -e ${OPENSSL_TIMESTAMP_INT} ] ; then \ + echo "${OPENSSL_TIMESTAMP_INT} doesn't exist"; \ + REFRESH=1; \ + fi; \ + if [ ${OPENSSL_TIMESTAMP} -nt ${OPENSSL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + echo "changed timestamp for openssl detected building..."; \ + cd ${OPENSSL_DIR}; \ + ln -s ${OPENSSL_DIR} ../openssl; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-openssl; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --platform=${APP_PLATFORM} \ + --stl=libc++ \ + --install-dir=$${TOOLCHAIN}; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \ + CC=${CROSS_CC} ./Configure -DL_ENDIAN no-asm android-${TARGET_ARCH} \ + -D__ANDROID_API__=$(API); \ + CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make depend; \ + CC=${CROSS_CC} ANDROID_DEV=/tmp/ndk-${TARGET_HOST} make build_libs; \ + touch ${OPENSSL_TIMESTAMP}; \ + touch ${OPENSSL_TIMESTAMP_INT}; \ + $(RM) -rf $${TOOLCHAIN}; \ + else \ + echo "nothing to be done for openssl"; \ + fi + +clean_openssl : + $(RM) -rf ${OPENSSL_DIR}; \ + $(RM) -rf $(ANDR_ROOT)/deps/${OPENSSL_BASEDIR}.tar.gz; \ + $(RM) -rf $(ANDR_ROOT)/deps/openssl + +$(LEVELDB_TIMESTAMP) : leveldb_download + @LAST_MODIF=$$(find ${LEVELDB_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ + touch ${LEVELDB_TIMESTAMP}; \ + fi + +leveldb_download : + @if [ ! -d ${LEVELDB_DIR} ] ; then \ + echo "leveldb sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd ${ANDR_ROOT}/deps ; \ + git clone ${LEVELDB_URL_GIT} || exit 1; \ + cd ${LEVELDB_DIR} || exit 1; \ + git checkout ${LEVELDB_COMMIT} || exit 1; \ + fi + +leveldb : $(LEVELDB_LIB) +ifeq ($(HAVE_LEVELDB),1) +$(LEVELDB_LIB): $(LEVELDB_TIMESTAMP) + @REFRESH=0; \ + if [ ! -e ${LEVELDB_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${LEVELDB_TIMESTAMP} -nt ${LEVELDB_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + echo "changed timestamp for leveldb detected building..."; \ + cd deps/leveldb; \ + export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-leveldb; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --platform=${APP_PLATFORM} \ + --stl=libc++ \ + --install-dir=$${TOOLCHAIN}; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ + export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ + export CPPFLAGS="$${CPPFLAGS} ${TARGET_CXXFLAGS_ADDON}"; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON}"; \ + export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ + $(MAKE) || exit 1; \ + touch ${LEVELDB_TIMESTAMP}; \ + touch ${LEVELDB_TIMESTAMP_INT}; \ + $(RM) -rf $${TOOLCHAIN}; \ + else \ + echo "nothing to be done for leveldb"; \ + fi +endif + +clean_leveldb : + ./gradlew cleanLevelDB + +$(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 \ + touch ${FREETYPE_TIMESTAMP}; \ + fi + +freetype_download : + @if [ ! -d ${FREETYPE_DIR} ] ; then \ + echo "freetype sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd deps; \ + git clone ${FREETYPE_URL_GIT} || exit 1; \ + fi + +freetype : $(FREETYPE_LIB) + +$(FREETYPE_LIB) : $(FREETYPE_TIMESTAMP) + + @REFRESH=0; \ + if [ ! -e ${FREETYPE_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -e ${FREETYPE_LIB} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${FREETYPE_TIMESTAMP} -nt ${FREETYPE_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + mkdir -p ${FREETYPE_DIR}; \ + echo "changed timestamp for freetype detected building..."; \ + cd ${FREETYPE_DIR}/Android/jni; \ + export APP_PLATFORM=${APP_PLATFORM}; \ + export TARGET_ABI=${TARGET_ABI}; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ + NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ + touch ${FREETYPE_TIMESTAMP}; \ + touch ${FREETYPE_TIMESTAMP_INT}; \ + else \ + echo "nothing to be done for freetype"; \ + fi + +clean_freetype : + ./gradlew cleanFreetype + +$(ICONV_TIMESTAMP) : iconv_download + @LAST_MODIF=$$(find ${ICONV_DIR} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ + touch ${ICONV_TIMESTAMP}; \ + fi + +iconv_download : + @if [ ! -d ${ICONV_DIR} ] ; then \ + echo "iconv sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd ${ANDR_ROOT}/deps; \ + wget ${ICONV_URL_HTTP} || exit 1; \ + tar -xzf libiconv-${ICONV_VERSION}.tar.gz || exit 1; \ + rm libiconv-${ICONV_VERSION}.tar.gz; \ + ln -s libiconv-${ICONV_VERSION} libiconv; \ + cd ${ICONV_DIR}; \ + patch -p1 < ${ANDR_ROOT}/patches/libiconv_android.patch; \ + patch -p1 < ${ANDR_ROOT}/patches/libiconv_stdio.patch; \ + fi + +iconv : $(ICONV_LIB) + +$(ICONV_LIB) : $(ICONV_TIMESTAMP) + @REFRESH=0; \ + if [ ! -e ${ICONV_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -e ${ICONV_LIB} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${ICONV_TIMESTAMP} -nt ${ICONV_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + 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} \ + --platform=${APP_PLATFORM} \ + --stl=libc++ \ + --install-dir=$${TOOLCHAIN}; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ + export LDFLAGS="$${LDFLAGS} ${TARGET_LDFLAGS_ADDON} -lstdc++"; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ + export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ + ./configure --host=${TARGET_HOST} || exit 1; \ + sed -i 's/LIBICONV_VERSION_INFO) /LIBICONV_VERSION_INFO) -avoid-version /g' lib/Makefile; \ + grep "iconv_LDFLAGS" src/Makefile; \ + $(MAKE) -s || exit 1; \ + touch ${ICONV_TIMESTAMP}; \ + touch ${ICONV_TIMESTAMP_INT}; \ + rm -rf ${TOOLCHAIN}; \ + else \ + echo "nothing to be done for iconv"; \ + fi + +clean_iconv : + ./gradlew cleanIconv + +#Note: Texturehack patch is required for gpu's not supporting color format +# correctly. Known bad GPU: +# -geforce on emulator +# -Vivante Corporation GC1000 core (e.g. Galaxy Tab 3) + +irrlicht_download : + @if [ ! -d "deps/irrlicht" ] ; then \ + echo "irrlicht sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd deps; \ + svn co ${IRRLICHT_URL_SVN} irrlicht || exit 1; \ + cd irrlicht; \ + patch -p1 < ${ANDR_ROOT}/patches/irrlicht-touchcount.patch || exit 1; \ + patch -p1 < ${ANDR_ROOT}/patches/irrlicht-back_button.patch || exit 1; \ + patch -p1 < ${ANDR_ROOT}/patches/irrlicht-texturehack.patch || exit 1; \ + patch -p1 < ${ANDR_ROOT}/patches/irrlicht-native_activity.patch || 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 + +irrlicht : $(IRRLICHT_LIB) + +$(IRRLICHT_LIB): $(IRRLICHT_TIMESTAMP) $(FREETYPE_LIB) + + @REFRESH=0; \ + if [ ! -e ${IRRLICHT_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -e ${IRRLICHT_LIB} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${IRRLICHT_TIMESTAMP} -nt ${IRRLICHT_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + mkdir -p ${IRRLICHT_DIR}; \ + echo "changed timestamp for irrlicht detected building..."; \ + cd deps/irrlicht/source/Irrlicht/Android; \ + export APP_PLATFORM=${APP_PLATFORM}; \ + export TARGET_ABI=${TARGET_ABI}; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + ${ANDROID_NDK}/ndk-build \ + NDK_APPLICATION_MK=${ANDR_ROOT}/jni/Deps.mk || exit 1; \ + touch ${IRRLICHT_TIMESTAMP}; \ + touch ${IRRLICHT_TIMESTAMP_INT}; \ + else \ + echo "nothing to be done for irrlicht"; \ + fi + +clean_irrlicht : + ./gradlew cleanIrrlicht + +$(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 \ + touch ${CURL_TIMESTAMP}; \ + fi + +curl_download : + @if [ ! -d "deps/curl-${CURL_VERSION}" ] ; then \ + echo "curl sources missing, downloading..."; \ + mkdir -p ${ANDR_ROOT}/deps; \ + cd deps; \ + wget ${CURL_URL_HTTP} || exit 1; \ + tar -xjf curl-${CURL_VERSION}.tar.bz2 || exit 1; \ + rm curl-${CURL_VERSION}.tar.bz2; \ + ln -s curl-${CURL_VERSION} curl; \ + fi + +curl : $(CURL_LIB) + +$(CURL_LIB): $(CURL_TIMESTAMP) $(OPENSSL_LIB) + @REFRESH=0; \ + if [ ! -e ${CURL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -e ${CURL_LIB} ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${CURL_TIMESTAMP} -nt ${CURL_TIMESTAMP_INT} ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + mkdir -p ${CURL_DIR}; \ + echo "changed timestamp for curl detected building..."; \ + cd deps/curl-${CURL_VERSION}; \ + export CROSS_PREFIX=${TARGET_TOOLCHAIN}; \ + export TOOLCHAIN=/tmp/ndk-${TARGET_HOST}-curl; \ + ${ANDROID_NDK}/build/tools/make-standalone-toolchain.sh \ + --toolchain=${TARGET_TOOLCHAIN}${COMPILER_VERSION} \ + --platform=${APP_PLATFORM} \ + --stl=libc++ \ + --install-dir=$${TOOLCHAIN}; \ + export PATH="$${TOOLCHAIN}/bin:$${PATH}"; \ + export CC=${CROSS_CC}; \ + export CXX=${CROSS_CXX}; \ + export TARGET_OS=OS_ANDROID_CROSSCOMPILE; \ + export CPPFLAGS="$${CPPFLAGS} -I${OPENSSL_DIR}/include ${TARGET_CFLAGS_ADDON}"; \ + export CFLAGS="$${CFLAGS} ${TARGET_CFLAGS_ADDON}"; \ + export LDFLAGS="$${LDFLAGS} -L${OPENSSL_DIR} ${TARGET_LDFLAGS_ADDON}"; \ + ./configure --host=${TARGET_HOST} --disable-shared --enable-static --with-ssl; \ + $(MAKE) -s || exit 1; \ + touch ${CURL_TIMESTAMP}; \ + touch ${CURL_TIMESTAMP_INT}; \ + $(RM) -rf $${TOOLCHAIN}; \ + else \ + echo "nothing to be done for curl"; \ + fi + +clean_curl : + ./gradlew cleanCURL + +sqlite3_download: deps/${SQLITE3_FOLDER}/sqlite3.c + +deps/${SQLITE3_FOLDER}/sqlite3.c : + cd deps; \ + wget ${SQLITE3_URL}; \ + unzip ${SQLITE3_FOLDER}.zip; \ + ln -s ${SQLITE3_FOLDER} sqlite; \ + cd ${SQLITE3_FOLDER}; + +clean_sqlite3: + ./gradlew cleanSQLite3 + +$(ASSETS_TIMESTAMP) : $(IRRLICHT_LIB) + @mkdir -p ${ANDR_ROOT}/deps; \ + for DIRNAME in {builtin,client,doc,fonts,games,mods,po,textures}; do \ + LAST_MODIF=$$(find ${PROJ_ROOT}/${DIRNAME} -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ]; then \ + touch ${PROJ_ROOT}/${DIRNAME}/timestamp; \ + touch ${ASSETS_TIMESTAMP}; \ + echo ${DIRNAME} changed $$LAST_MODIF; \ + fi; \ + done; \ + LAST_MODIF=$$(find ${IRRLICHT_DIR}/media -type f -printf '%T@ %p\n' | sort -n | tail -1 | cut -f2- -d" "); \ + if [ $$(basename $$LAST_MODIF) != "timestamp" ] ; then \ + touch ${IRRLICHT_DIR}/media/timestamp; \ + touch ${ASSETS_TIMESTAMP}; \ + fi; \ + if [ ${PROJ_ROOT}/minetest.conf.example -nt ${ASSETS_TIMESTAMP} ] ; then \ + echo "conf changed"; \ + touch ${ASSETS_TIMESTAMP}; \ + fi; \ + if [ ${PROJ_ROOT}/README.txt -nt ${ASSETS_TIMESTAMP} ] ; then \ + touch ${ASSETS_TIMESTAMP}; \ + fi; \ + if [ ! -e $(ASSETS_TIMESTAMP) ] ; then \ + touch $(ASSETS_TIMESTAMP); \ + fi + +assets : $(ASSETS_TIMESTAMP) + @REFRESH=0; \ + if [ ! -e ${ASSETS_TIMESTAMP}.old ] ; then \ + REFRESH=1; \ + fi; \ + if [ ${ASSETS_TIMESTAMP} -nt ${ASSETS_TIMESTAMP}.old ] ; then \ + REFRESH=1; \ + fi; \ + if [ ! -d ${APP_ROOT}/assets ] ; then \ + REFRESH=1; \ + fi; \ + if [ $$REFRESH -ne 0 ] ; then \ + echo "assets changed, refreshing..."; \ + $(MAKE) clean_assets; \ + ./gradlew copyAssets; \ + cp -r ${IRRLICHT_DIR}/media/Shaders ${APP_ROOT}/assets/Minetest/media; \ + cd ${APP_ROOT}/assets || exit 1; \ + find . -name "timestamp" -exec rm {} \; ; \ + find . -name "*.blend" -exec rm {} \; ; \ + find . -name "*~" -exec rm {} \; ; \ + find . -type d -path "*.git" -exec rm -rf {} \; ; \ + find . -type d -path "*.svn" -exec rm -rf {} \; ; \ + find . -type f -path "*.gitignore" -exec rm -rf {} \; ; \ + ls -R | grep ":$$" | sed -e 's/:$$//' -e 's/\.//' -e 's/^\///' > "index.txt"; \ + find -L Minetest > filelist.txt; \ + cp ${ANDR_ROOT}/${ASSETS_TIMESTAMP} ${ANDR_ROOT}/${ASSETS_TIMESTAMP}.old; \ + else \ + echo "nothing to be done for assets"; \ + fi + +clean_assets : + ./gradlew cleanAssets + +apk: local.properties assets $(ICONV_LIB) $(IRRLICHT_LIB) $(CURL_LIB) $(LEVELDB_TARGET) \ + $(OPENAL_LIB) $(OGG_LIB) prep_srcdir $(ANDR_ROOT)/jni/src/android_version.h \ + $(ANDR_ROOT)/jni/src/android_version_githash.h sqlite3_download + + @export TARGET_LIBDIR=${TARGET_LIBDIR}; \ + export HAVE_LEVELDB=${HAVE_LEVELDB}; \ + export APP_PLATFORM=${APP_PLATFORM}; \ + export TARGET_ABI=${TARGET_ABI}; \ + export TARGET_CFLAGS_ADDON="${TARGET_CFLAGS_ADDON}"; \ + export TARGET_CXXFLAGS_ADDON="${TARGET_CXXFLAGS_ADDON}"; \ + export COMPILER_VERSION=${COMPILER_VERSION}; \ + export GPROF=${GPROF}; \ + ${ANDROID_NDK}/ndk-build || exit 1; \ + if [ ! -e ${APP_ROOT}/jniLibs ]; then \ + ln -s ${ANDR_ROOT}/libs ${APP_ROOT}/jniLibs || exit 1; \ + fi; \ + export VERSION_STR="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" && \ + export BUILD_TYPE_C=$$(echo "$${BUILD_TYPE}" | sed 's/./\U&/') && \ + ./gradlew assemble$$BUILD_TYPE_C && \ + echo "APK stored at: build/outputs/apk/$$BUILD_TYPE/Minetest-$$BUILD_TYPE.apk" && \ + echo "You can install it with \`make install_$$BUILD_TYPE\`" + +# These Intentionally doesn't depend on their respective build steps, +# because it takes a while to verify that everything's up-to-date. +install_debug: + ${ANDROID_SDK}/platform-tools/adb install -r build/outputs/apk/debug/Minetest-debug.apk + +install_release: + ${ANDROID_SDK}/platform-tools/adb install -r build/outputs/apk/release/Minetest-release.apk + +prep_srcdir : + @if [ ! -e ${ANDR_ROOT}/jni/src ]; then \ + ln -s ${PROJ_ROOT}/src ${ANDR_ROOT}/jni/src; \ + fi; \ + if [ ! -e ${ANDR_ROOT}/jni/lib ]; then \ + ln -s ${PROJ_ROOT}/lib ${ANDR_ROOT}/jni/lib; \ + fi + +clean_apk : + ./gradlew clean + +clean_all : + ./gradlew cleanAll + +$(ANDR_ROOT)/jni/src/android_version_githash.h : prep_srcdir + @export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version_githash.h; \ + export VERSION_FILE_NEW=$${VERSION_FILE}.new; \ + { \ + echo "#ifndef ANDROID_MT_VERSION_GITHASH_H"; \ + echo "#define ANDROID_MT_VERSION_GITHASH_H"; \ + export GITHASH=$$(git rev-parse --short=8 HEAD); \ + export VERSION_STR="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}"; \ + echo "#define VERSION_GITHASH \"$$VERSION_STR-$$GITHASH-Android\""; \ + echo "#endif"; \ + } > "$${VERSION_FILE_NEW}"; \ + if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \ + echo "android_version_githash.h changed, updating..."; \ + mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \ + else \ + rm "$${VERSION_FILE_NEW}"; \ + fi + + +$(ANDR_ROOT)/jni/src/android_version.h : prep_srcdir + @export VERSION_FILE=${ANDR_ROOT}/jni/src/android_version.h; \ + export VERSION_FILE_NEW=$${VERSION_FILE}.new; \ + { \ + echo "#ifndef ANDROID_MT_VERSION_H"; \ + echo "#define ANDROID_MT_VERSION_H"; \ + echo "#define VERSION_MAJOR ${VERSION_MAJOR}"; \ + echo "#define VERSION_MINOR ${VERSION_MINOR}"; \ + echo "#define VERSION_PATCH ${VERSION_PATCH}"; \ + echo "#define VERSION_STRING STR(VERSION_MAJOR) \".\" STR(VERSION_MINOR) \ + \".\" STR(VERSION_PATCH)"; \ + echo "#endif"; \ + } > $${VERSION_FILE_NEW}; \ + if ! cmp -s $${VERSION_FILE} $${VERSION_FILE_NEW}; then \ + echo "android_version.h changed, updating..."; \ + mv "$${VERSION_FILE_NEW}" "$${VERSION_FILE}"; \ + else \ + rm "$${VERSION_FILE_NEW}"; \ + fi + +clean : clean_apk clean_assets diff --git a/build/android/build.gradle b/build/android/build.gradle new file mode 100644 index 0000000..7b9ebb9 --- /dev/null +++ b/build/android/build.gradle @@ -0,0 +1,170 @@ +buildscript { + repositories { + maven { url 'https://maven.google.com' } + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:3.1.3' + } +} + +allprojects { + repositories { + maven { url 'https://maven.google.com' } + jcenter() + } +} + +def curl_version = "7.60.0" +def irrlicht_revision = "5150" +def openal_version = "1.18.2" +def openssl_version = "1.0.2n" +def sqlite3_version = "3240000" + +apply plugin: "com.android.application" + +android { + compileSdkVersion 28 + buildToolsVersion "28.0.3" + + defaultConfig { + versionCode 23 + versionName "${System.env.VERSION_STR}.${versionCode}" + minSdkVersion 14 + targetSdkVersion 28 + applicationId "net.minetest.minetest" + manifestPlaceholders = [package: "net.minetest.minetest", project: project.name] + ndk { + // Specifies the ABI configurations of your native + // libraries Gradle should build and package with your APK. + // abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64' + abiFilters 'armeabi-v7a', 'x86' + } + } + + lintOptions { + disable "OldTargetApi", "GoogleAppIndexingWarning" + } + + Properties props = new Properties() + props.load(new FileInputStream(file("local.properties"))) + + if (props.getProperty("keystore") != null) { + signingConfigs { + release { + storeFile file(props["keystore"]) + storePassword props["keystore.password"] + keyAlias props["key"] + keyPassword props["key.password"] + } + } + + buildTypes { + release { + signingConfig signingConfigs.release + } + } + } +} + +task cleanAssets(type: Delete) { + delete 'src/main/assets' +} + +task copyAssets { + dependsOn 'cleanAssets' + mkdir "src/main/assets" + + def mtAssetsFolder = "src/main/assets/Minetest" + def projRoot = "../.." + def gameToCopy = "minetest_game" + + doLast { + mkdir "${mtAssetsFolder}" + mkdir "${mtAssetsFolder}/client" + mkdir "${mtAssetsFolder}/fonts" + mkdir "${mtAssetsFolder}/games" + mkdir "${mtAssetsFolder}/media" + + copy { + from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into mtAssetsFolder + } + copy { + from "${projRoot}/doc/lgpl-2.1.txt" into "${mtAssetsFolder}/LICENSE.txt" + } + copy { + from "${projRoot}/builtin" into "${mtAssetsFolder}/builtin" + } + copy { + from "${projRoot}/client/shaders" into "${mtAssetsFolder}/client/shaders" + } + copy { + from "${projRoot}/fonts" include "*.ttf" into "${mtAssetsFolder}/fonts" + } + copy { + from "${projRoot}/games/${gameToCopy}" into "${mtAssetsFolder}/games/${gameToCopy}" + } + copy { + from "${projRoot}/po" into "${mtAssetsFolder}/po" + } + copy { + from "${projRoot}/textures" into "${mtAssetsFolder}/textures" + } + } +} + +task cleanIconv(type: Delete) { + delete 'deps/libiconv' +} + +task cleanIrrlicht(type: Delete) { + delete 'deps/irrlicht' +} + +task cleanLevelDB(type: Delete) { + delete 'deps/leveldb' +} + +task cleanCURL(type: Delete) { + delete 'deps/curl' + delete 'deps/curl-' + curl_version +} + +task cleanOpenSSL(type: Delete) { + delete 'deps/openssl' + delete 'deps/openssl-' + openssl_version + delete 'deps/openssl-' + openssl_version + '.tar.gz' +} + +task cleanOpenAL(type: Delete) { + delete 'deps/openal-soft' +} + +task cleanFreetype(type: Delete) { + delete 'deps/freetype2-android' +} + +task cleanOgg(type: Delete) { + delete 'deps/libvorbis-libogg-android' +} + +task cleanSQLite3(type: Delete) { + delete 'deps/sqlite-amalgamation-' + sqlite3_version + delete 'deps/sqlite-amalgamation-' + sqlite3_version + '.zip' +} + +task cleanAll(type: Delete, dependsOn: [clean, cleanAssets, cleanIconv, + cleanFreetype, cleanIrrlicht, cleanLevelDB, cleanSQLite3, cleanCURL, + cleanOpenSSL, cleanOpenAL, cleanOgg]) { + delete 'deps' + delete 'gen' + delete 'libs' + delete 'obj' + delete 'bin' + delete 'Debug' + delete 'and_env' +} + +dependencies { + implementation 'com.android.support:support-v4:28.0.0' +} diff --git a/build/android/gradle/wrapper/gradle-wrapper.jar b/build/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..6b6ea3a Binary files /dev/null and b/build/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/build/android/gradle/wrapper/gradle-wrapper.properties b/build/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..d7d50b6 --- /dev/null +++ b/build/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Mon Oct 15 00:47:03 CEST 2018 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip diff --git a/build/android/gradlew b/build/android/gradlew new file mode 100644 index 0000000..cccdd3d --- /dev/null +++ b/build/android/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@" diff --git a/build/android/gradlew.bat b/build/android/gradlew.bat new file mode 100644 index 0000000..f955316 --- /dev/null +++ b/build/android/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/build/android/icons/aux_btn.svg b/build/android/icons/aux_btn.svg new file mode 100644 index 0000000..6bbefff --- /dev/null +++ b/build/android/icons/aux_btn.svg @@ -0,0 +1,411 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + AUX + + diff --git a/build/android/icons/camera_btn.svg b/build/android/icons/camera_btn.svg new file mode 100644 index 0000000..a91a7fc --- /dev/null +++ b/build/android/icons/camera_btn.svg @@ -0,0 +1,108 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/chat_btn.svg b/build/android/icons/chat_btn.svg new file mode 100644 index 0000000..41dc6f8 --- /dev/null +++ b/build/android/icons/chat_btn.svg @@ -0,0 +1,96 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/chat_hide_btn.svg b/build/android/icons/chat_hide_btn.svg new file mode 100644 index 0000000..6647b30 --- /dev/null +++ b/build/android/icons/chat_hide_btn.svg @@ -0,0 +1,139 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/chat_show_btn.svg b/build/android/icons/chat_show_btn.svg new file mode 100644 index 0000000..fce9de9 --- /dev/null +++ b/build/android/icons/chat_show_btn.svg @@ -0,0 +1,133 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/checkbox_tick.svg b/build/android/icons/checkbox_tick.svg new file mode 100644 index 0000000..6b727bb --- /dev/null +++ b/build/android/icons/checkbox_tick.svg @@ -0,0 +1,93 @@ + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/debug_btn.svg b/build/android/icons/debug_btn.svg new file mode 100644 index 0000000..2c37f14 --- /dev/null +++ b/build/android/icons/debug_btn.svg @@ -0,0 +1,344 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/down.svg b/build/android/icons/down.svg new file mode 100644 index 0000000..190e7e8 --- /dev/null +++ b/build/android/icons/down.svg @@ -0,0 +1,542 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/drop_btn.svg b/build/android/icons/drop_btn.svg new file mode 100644 index 0000000..7cb0e85 --- /dev/null +++ b/build/android/icons/drop_btn.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/fast_btn.svg b/build/android/icons/fast_btn.svg new file mode 100644 index 0000000..1436596 --- /dev/null +++ b/build/android/icons/fast_btn.svg @@ -0,0 +1,190 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/fly_btn.svg b/build/android/icons/fly_btn.svg new file mode 100644 index 0000000..d203842 --- /dev/null +++ b/build/android/icons/fly_btn.svg @@ -0,0 +1,168 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/gear_icon.svg b/build/android/icons/gear_icon.svg new file mode 100644 index 0000000..b44685a --- /dev/null +++ b/build/android/icons/gear_icon.svg @@ -0,0 +1,194 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/inventory_btn.svg b/build/android/icons/inventory_btn.svg new file mode 100644 index 0000000..ee3dc3c --- /dev/null +++ b/build/android/icons/inventory_btn.svg @@ -0,0 +1,509 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/joystick_bg.svg b/build/android/icons/joystick_bg.svg new file mode 100644 index 0000000..d8836b3 --- /dev/null +++ b/build/android/icons/joystick_bg.svg @@ -0,0 +1,876 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/joystick_center.svg b/build/android/icons/joystick_center.svg new file mode 100644 index 0000000..1720229 --- /dev/null +++ b/build/android/icons/joystick_center.svg @@ -0,0 +1,877 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/joystick_off.svg b/build/android/icons/joystick_off.svg new file mode 100644 index 0000000..58e1acf --- /dev/null +++ b/build/android/icons/joystick_off.svg @@ -0,0 +1,882 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/jump_btn.svg b/build/android/icons/jump_btn.svg new file mode 100644 index 0000000..882c49e --- /dev/null +++ b/build/android/icons/jump_btn.svg @@ -0,0 +1,547 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/minimap_btn.svg b/build/android/icons/minimap_btn.svg new file mode 100644 index 0000000..deda327 --- /dev/null +++ b/build/android/icons/minimap_btn.svg @@ -0,0 +1,159 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/noclip_btn.svg b/build/android/icons/noclip_btn.svg new file mode 100644 index 0000000..a816edf --- /dev/null +++ b/build/android/icons/noclip_btn.svg @@ -0,0 +1,173 @@ + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/rangeview_btn.svg b/build/android/icons/rangeview_btn.svg new file mode 100644 index 0000000..f9319e0 --- /dev/null +++ b/build/android/icons/rangeview_btn.svg @@ -0,0 +1,456 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/rare_controls.svg b/build/android/icons/rare_controls.svg new file mode 100644 index 0000000..c9991ec --- /dev/null +++ b/build/android/icons/rare_controls.svg @@ -0,0 +1,521 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/icons/zoom.svg b/build/android/icons/zoom.svg new file mode 100644 index 0000000..ea8dec3 --- /dev/null +++ b/build/android/icons/zoom.svg @@ -0,0 +1,599 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/jni/Android.mk b/build/android/jni/Android.mk new file mode 100644 index 0000000..a8e0175 --- /dev/null +++ b/build/android/jni/Android.mk @@ -0,0 +1,434 @@ +LOCAL_PATH := $(call my-dir)/.. + +#LOCAL_ADDRESS_SANITIZER:=true + +include $(CLEAR_VARS) +LOCAL_MODULE := Irrlicht +LOCAL_SRC_FILES := deps/irrlicht/lib/Android/libIrrlicht.a +include $(PREBUILT_STATIC_LIBRARY) + +ifeq ($(HAVE_LEVELDB), 1) + include $(CLEAR_VARS) + LOCAL_MODULE := LevelDB + LOCAL_SRC_FILES := deps/leveldb/libleveldb.a + include $(PREBUILT_STATIC_LIBRARY) +endif + +include $(CLEAR_VARS) +LOCAL_MODULE := curl +LOCAL_SRC_FILES := deps/curl/lib/.libs/libcurl.a +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := freetype +LOCAL_SRC_FILES := deps/freetype2-android/Android/obj/local/$(TARGET_ARCH_ABI)/libfreetype2-static.a +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := iconv +LOCAL_SRC_FILES := deps/libiconv/lib/.libs/libiconv.so +include $(PREBUILT_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := openal +LOCAL_SRC_FILES := deps/openal-soft/libs/$(TARGET_LIBDIR)/libopenal.so +include $(PREBUILT_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := ogg +LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libogg.so +include $(PREBUILT_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := vorbis +LOCAL_SRC_FILES := deps/libvorbis-libogg-android/libs/$(TARGET_LIBDIR)/libvorbis.so +include $(PREBUILT_SHARED_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := ssl +LOCAL_SRC_FILES := deps/openssl/libssl.a +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := crypto +LOCAL_SRC_FILES := deps/openssl/libcrypto.a +include $(PREBUILT_STATIC_LIBRARY) + +include $(CLEAR_VARS) +LOCAL_MODULE := minetest + +LOCAL_CPP_FEATURES += exceptions + +ifdef GPROF +GPROF_DEF=-DGPROF +endif + +LOCAL_CFLAGS := -D_IRR_ANDROID_PLATFORM_ \ + -DHAVE_TOUCHSCREENGUI \ + -DUSE_CURL=1 \ + -DUSE_SOUND=1 \ + -DUSE_FREETYPE=1 \ + -DUSE_LEVELDB=$(HAVE_LEVELDB) \ + $(GPROF_DEF) \ + -pipe -fstrict-aliasing + +ifndef NDEBUG +LOCAL_CFLAGS += -g -D_DEBUG -O0 -fno-omit-frame-pointer +else +LOCAL_CFLAGS += $(TARGET_CFLAGS_ADDON) +endif + +ifdef GPROF +PROFILER_LIBS := android-ndk-profiler +LOCAL_CFLAGS += -pg +endif + +# LOCAL_CFLAGS += -fsanitize=address +# LOCAL_LDFLAGS += -fsanitize=address + +ifeq ($(TARGET_ABI),x86) +LOCAL_CFLAGS += -fno-stack-protector +endif + +LOCAL_C_INCLUDES := \ + jni/src \ + jni/src/script \ + jni/lib/gmp \ + jni/lib/lua/src \ + jni/lib/jsoncpp \ + jni/src/cguittfont \ + deps/irrlicht/include \ + deps/libiconv/include \ + deps/freetype2-android/include \ + deps/curl/include \ + deps/openal-soft/jni/OpenAL/include \ + deps/libvorbis-libogg-android/jni/include \ + deps/leveldb/include \ + deps/sqlite/ + +LOCAL_SRC_FILES := \ + jni/src/ban.cpp \ + jni/src/chat.cpp \ + jni/src/client/activeobjectmgr.cpp \ + jni/src/client/camera.cpp \ + jni/src/client/client.cpp \ + jni/src/client/clientenvironment.cpp \ + jni/src/client/clientlauncher.cpp \ + jni/src/client/clientmap.cpp \ + jni/src/client/clientmedia.cpp \ + jni/src/client/clientobject.cpp \ + jni/src/client/clouds.cpp \ + jni/src/client/content_cao.cpp \ + jni/src/client/content_cso.cpp \ + jni/src/client/content_mapblock.cpp \ + jni/src/client/filecache.cpp \ + jni/src/client/fontengine.cpp \ + jni/src/client/game.cpp \ + jni/src/client/gameui.cpp \ + jni/src/client/guiscalingfilter.cpp \ + jni/src/client/hud.cpp \ + jni/src/clientiface.cpp \ + jni/src/client/imagefilters.cpp \ + jni/src/client/inputhandler.cpp \ + jni/src/client/joystick_controller.cpp \ + jni/src/client/keycode.cpp \ + jni/src/client/localplayer.cpp \ + jni/src/client/mapblock_mesh.cpp \ + jni/src/client/mesh.cpp \ + jni/src/client/meshgen/collector.cpp \ + jni/src/client/mesh_generator_thread.cpp \ + jni/src/client/minimap.cpp \ + jni/src/client/particles.cpp \ + jni/src/client/render/anaglyph.cpp \ + jni/src/client/render/core.cpp \ + jni/src/client/render/factory.cpp \ + jni/src/client/renderingengine.cpp \ + jni/src/client/render/interlaced.cpp \ + jni/src/client/render/pageflip.cpp \ + jni/src/client/render/plain.cpp \ + jni/src/client/render/sidebyside.cpp \ + jni/src/client/render/stereo.cpp \ + jni/src/client/shader.cpp \ + jni/src/client/sky.cpp \ + jni/src/client/sound.cpp \ + jni/src/client/sound_openal.cpp \ + jni/src/client/tile.cpp \ + jni/src/client/wieldmesh.cpp \ + jni/src/collision.cpp \ + jni/src/content/content.cpp \ + jni/src/content_mapnode.cpp \ + jni/src/content/mods.cpp \ + jni/src/content_nodemeta.cpp \ + jni/src/content/packages.cpp \ + jni/src/content_sao.cpp \ + jni/src/content/subgames.cpp \ + jni/src/convert_json.cpp \ + jni/src/craftdef.cpp \ + jni/src/database/database.cpp \ + jni/src/database/database-dummy.cpp \ + jni/src/database/database-files.cpp \ + jni/src/database/database-leveldb.cpp \ + jni/src/database/database-sqlite3.cpp \ + jni/src/debug.cpp \ + jni/src/defaultsettings.cpp \ + jni/src/emerge.cpp \ + jni/src/environment.cpp \ + jni/src/face_position_cache.cpp \ + jni/src/filesys.cpp \ + jni/src/genericobject.cpp \ + jni/src/gettext.cpp \ + jni/src/gui/guiChatConsole.cpp \ + jni/src/gui/guiConfirmRegistration.cpp \ + jni/src/gui/guiEditBoxWithScrollbar.cpp \ + jni/src/gui/guiEngine.cpp \ + jni/src/gui/guiFormSpecMenu.cpp \ + jni/src/gui/guiKeyChangeMenu.cpp \ + jni/src/gui/guiPasswordChange.cpp \ + jni/src/gui/guiPathSelectMenu.cpp \ + jni/src/gui/guiTable.cpp \ + jni/src/gui/guiVolumeChange.cpp \ + jni/src/gui/intlGUIEditBox.cpp \ + jni/src/gui/modalMenu.cpp \ + jni/src/gui/profilergraph.cpp \ + jni/src/gui/touchscreengui.cpp \ + jni/src/httpfetch.cpp \ + jni/src/hud.cpp \ + jni/src/inventory.cpp \ + jni/src/inventorymanager.cpp \ + jni/src/irrlicht_changes/CGUITTFont.cpp \ + jni/src/irrlicht_changes/static_text.cpp \ + jni/src/itemdef.cpp \ + jni/src/itemstackmetadata.cpp \ + jni/src/light.cpp \ + jni/src/log.cpp \ + jni/src/main.cpp \ + jni/src/mapblock.cpp \ + jni/src/map.cpp \ + jni/src/mapgen/cavegen.cpp \ + jni/src/mapgen/dungeongen.cpp \ + jni/src/mapgen/mapgen_carpathian.cpp \ + jni/src/mapgen/mapgen.cpp \ + jni/src/mapgen/mapgen_flat.cpp \ + jni/src/mapgen/mapgen_fractal.cpp \ + jni/src/mapgen/mapgen_singlenode.cpp \ + jni/src/mapgen/mapgen_v5.cpp \ + jni/src/mapgen/mapgen_v6.cpp \ + jni/src/mapgen/mapgen_v7.cpp \ + jni/src/mapgen/mapgen_valleys.cpp \ + jni/src/mapgen/mg_biome.cpp \ + jni/src/mapgen/mg_decoration.cpp \ + jni/src/mapgen/mg_ore.cpp \ + jni/src/mapgen/mg_schematic.cpp \ + jni/src/mapgen/treegen.cpp \ + jni/src/mapnode.cpp \ + jni/src/mapsector.cpp \ + jni/src/map_settings_manager.cpp \ + jni/src/metadata.cpp \ + jni/src/modchannels.cpp \ + jni/src/nameidmapping.cpp \ + jni/src/nodedef.cpp \ + jni/src/nodemetadata.cpp \ + jni/src/nodetimer.cpp \ + jni/src/noise.cpp \ + jni/src/objdef.cpp \ + jni/src/object_properties.cpp \ + jni/src/pathfinder.cpp \ + jni/src/player.cpp \ + jni/src/porting_android.cpp \ + jni/src/porting.cpp \ + jni/src/profiler.cpp \ + jni/src/quicktune.cpp \ + jni/src/raycast.cpp \ + jni/src/reflowscan.cpp \ + jni/src/remoteplayer.cpp \ + jni/src/rollback.cpp \ + jni/src/rollback_interface.cpp \ + jni/src/serialization.cpp \ + jni/src/server/activeobjectmgr.cpp \ + jni/src/server.cpp \ + jni/src/serverenvironment.cpp \ + jni/src/serverlist.cpp \ + jni/src/server/mods.cpp \ + jni/src/serverobject.cpp \ + jni/src/settings.cpp \ + jni/src/staticobject.cpp \ + jni/src/tileanimation.cpp \ + jni/src/tool.cpp \ + jni/src/translation.cpp \ + jni/src/unittest/test_authdatabase.cpp \ + jni/src/unittest/test_collision.cpp \ + jni/src/unittest/test_compression.cpp \ + jni/src/unittest/test_connection.cpp \ + jni/src/unittest/test.cpp \ + jni/src/unittest/test_filepath.cpp \ + jni/src/unittest/test_gameui.cpp \ + jni/src/unittest/test_inventory.cpp \ + jni/src/unittest/test_mapnode.cpp \ + jni/src/unittest/test_map_settings_manager.cpp \ + jni/src/unittest/test_nodedef.cpp \ + jni/src/unittest/test_noderesolver.cpp \ + jni/src/unittest/test_noise.cpp \ + jni/src/unittest/test_objdef.cpp \ + jni/src/unittest/test_profiler.cpp \ + jni/src/unittest/test_random.cpp \ + jni/src/unittest/test_schematic.cpp \ + jni/src/unittest/test_serialization.cpp \ + jni/src/unittest/test_settings.cpp \ + jni/src/unittest/test_socket.cpp \ + jni/src/unittest/test_utilities.cpp \ + jni/src/unittest/test_voxelalgorithms.cpp \ + jni/src/unittest/test_voxelmanipulator.cpp \ + jni/src/util/areastore.cpp \ + jni/src/util/auth.cpp \ + jni/src/util/base64.cpp \ + jni/src/util/directiontables.cpp \ + jni/src/util/enriched_string.cpp \ + jni/src/util/ieee_float.cpp \ + jni/src/util/numeric.cpp \ + jni/src/util/pointedthing.cpp \ + jni/src/util/serialize.cpp \ + jni/src/util/sha1.cpp \ + jni/src/util/srp.cpp \ + jni/src/util/string.cpp \ + jni/src/util/timetaker.cpp \ + jni/src/version.cpp \ + jni/src/voxelalgorithms.cpp \ + jni/src/voxel.cpp + + +# intentionally kept out (we already build openssl itself): jni/src/util/sha256.c + +# Network +LOCAL_SRC_FILES += \ + jni/src/network/address.cpp \ + jni/src/network/connection.cpp \ + jni/src/network/networkpacket.cpp \ + jni/src/network/clientopcodes.cpp \ + jni/src/network/clientpackethandler.cpp \ + jni/src/network/connectionthreads.cpp \ + jni/src/network/serveropcodes.cpp \ + jni/src/network/serverpackethandler.cpp \ + jni/src/network/socket.cpp \ + +# lua api +LOCAL_SRC_FILES += \ + jni/src/script/common/c_content.cpp \ + jni/src/script/common/c_converter.cpp \ + jni/src/script/common/c_internal.cpp \ + jni/src/script/common/c_types.cpp \ + jni/src/script/common/helper.cpp \ + jni/src/script/cpp_api/s_async.cpp \ + jni/src/script/cpp_api/s_base.cpp \ + jni/src/script/cpp_api/s_client.cpp \ + jni/src/script/cpp_api/s_entity.cpp \ + jni/src/script/cpp_api/s_env.cpp \ + jni/src/script/cpp_api/s_inventory.cpp \ + jni/src/script/cpp_api/s_item.cpp \ + jni/src/script/cpp_api/s_mainmenu.cpp \ + jni/src/script/cpp_api/s_modchannels.cpp \ + jni/src/script/cpp_api/s_node.cpp \ + jni/src/script/cpp_api/s_nodemeta.cpp \ + jni/src/script/cpp_api/s_player.cpp \ + jni/src/script/cpp_api/s_security.cpp \ + jni/src/script/cpp_api/s_server.cpp \ + jni/src/script/lua_api/l_areastore.cpp \ + jni/src/script/lua_api/l_auth.cpp \ + jni/src/script/lua_api/l_base.cpp \ + jni/src/script/lua_api/l_camera.cpp \ + jni/src/script/lua_api/l_client.cpp \ + jni/src/script/lua_api/l_craft.cpp \ + jni/src/script/lua_api/l_env.cpp \ + jni/src/script/lua_api/l_inventory.cpp \ + jni/src/script/lua_api/l_item.cpp \ + jni/src/script/lua_api/l_itemstackmeta.cpp\ + jni/src/script/lua_api/l_localplayer.cpp \ + jni/src/script/lua_api/l_mainmenu.cpp \ + jni/src/script/lua_api/l_mapgen.cpp \ + jni/src/script/lua_api/l_metadata.cpp \ + jni/src/script/lua_api/l_minimap.cpp \ + jni/src/script/lua_api/l_modchannels.cpp \ + jni/src/script/lua_api/l_nodemeta.cpp \ + jni/src/script/lua_api/l_nodetimer.cpp \ + jni/src/script/lua_api/l_noise.cpp \ + jni/src/script/lua_api/l_object.cpp \ + jni/src/script/lua_api/l_playermeta.cpp \ + jni/src/script/lua_api/l_particles.cpp \ + jni/src/script/lua_api/l_particles_local.cpp\ + jni/src/script/lua_api/l_rollback.cpp \ + jni/src/script/lua_api/l_server.cpp \ + jni/src/script/lua_api/l_settings.cpp \ + jni/src/script/lua_api/l_sound.cpp \ + jni/src/script/lua_api/l_http.cpp \ + jni/src/script/lua_api/l_storage.cpp \ + jni/src/script/lua_api/l_util.cpp \ + jni/src/script/lua_api/l_vmanip.cpp \ + jni/src/script/scripting_client.cpp \ + jni/src/script/scripting_server.cpp \ + jni/src/script/scripting_mainmenu.cpp + +#freetype2 support +#LOCAL_SRC_FILES += jni/src/cguittfont/xCGUITTFont.cpp + +# GMP +LOCAL_SRC_FILES += jni/lib/gmp/mini-gmp.c + +# Lua +LOCAL_SRC_FILES += \ + jni/lib/lua/src/lapi.c \ + jni/lib/lua/src/lauxlib.c \ + jni/lib/lua/src/lbaselib.c \ + jni/lib/lua/src/lcode.c \ + jni/lib/lua/src/ldblib.c \ + jni/lib/lua/src/ldebug.c \ + jni/lib/lua/src/ldo.c \ + jni/lib/lua/src/ldump.c \ + jni/lib/lua/src/lfunc.c \ + jni/lib/lua/src/lgc.c \ + jni/lib/lua/src/linit.c \ + jni/lib/lua/src/liolib.c \ + jni/lib/lua/src/llex.c \ + jni/lib/lua/src/lmathlib.c \ + jni/lib/lua/src/lmem.c \ + jni/lib/lua/src/loadlib.c \ + jni/lib/lua/src/lobject.c \ + jni/lib/lua/src/lopcodes.c \ + jni/lib/lua/src/loslib.c \ + jni/lib/lua/src/lparser.c \ + jni/lib/lua/src/lstate.c \ + jni/lib/lua/src/lstring.c \ + jni/lib/lua/src/lstrlib.c \ + jni/lib/lua/src/ltable.c \ + jni/lib/lua/src/ltablib.c \ + jni/lib/lua/src/ltm.c \ + jni/lib/lua/src/lundump.c \ + jni/lib/lua/src/lvm.c \ + jni/lib/lua/src/lzio.c \ + jni/lib/lua/src/print.c + +# SQLite3 +LOCAL_SRC_FILES += deps/sqlite/sqlite3.c + +# Threading +LOCAL_SRC_FILES += \ + jni/src/threading/event.cpp \ + jni/src/threading/semaphore.cpp \ + jni/src/threading/thread.cpp + +# JSONCPP +LOCAL_SRC_FILES += jni/lib/jsoncpp/jsoncpp.cpp + +LOCAL_SHARED_LIBRARIES := iconv openal ogg vorbis +LOCAL_STATIC_LIBRARIES := Irrlicht freetype curl ssl crypto android_native_app_glue $(PROFILER_LIBS) + +ifeq ($(HAVE_LEVELDB), 1) + LOCAL_STATIC_LIBRARIES += LevelDB +endif +LOCAL_LDLIBS := -lEGL -llog -lGLESv1_CM -lGLESv2 -lz -landroid + +include $(BUILD_SHARED_LIBRARY) + +# at the end of Android.mk +ifdef GPROF +$(call import-module,android-ndk-profiler) +endif +$(call import-module,android/native_app_glue) diff --git a/build/android/jni/Application.mk b/build/android/jni/Application.mk new file mode 100644 index 0000000..f5eb96e --- /dev/null +++ b/build/android/jni/Application.mk @@ -0,0 +1,9 @@ +APP_PLATFORM := ${APP_PLATFORM} +APP_ABI := ${TARGET_ABI} +APP_STL := c++_shared +APP_MODULES := minetest +ifndef NDEBUG +APP_OPTIM := debug +endif + +APP_CPPFLAGS += -fexceptions -std=c++11 -frtti diff --git a/build/android/jni/Deps.mk b/build/android/jni/Deps.mk new file mode 100644 index 0000000..73db235 --- /dev/null +++ b/build/android/jni/Deps.mk @@ -0,0 +1,7 @@ +APP_PLATFORM := ${APP_PLATFORM} +APP_ABI := ${TARGET_ABI} +APP_STL := c++_shared +APP_DEPRECATED_HEADERS := true + +APP_CFLAGS += ${TARGET_CFLAGS_ADDON} +APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions -std=c++11 diff --git a/build/android/jni/Irrlicht.mk b/build/android/jni/Irrlicht.mk new file mode 100644 index 0000000..cedfe31 --- /dev/null +++ b/build/android/jni/Irrlicht.mk @@ -0,0 +1,8 @@ +APP_PLATFORM := ${APP_PLATFORM} +APP_ABI := ${TARGET_ABI} +APP_STL := c++_shared +APP_DEPRECATED_HEADERS := true +APP_MODULES := Irrlicht + +APP_CLAFGS += ${TARGET_CFLAGS_ADDON} +APP_CPPFLAGS += ${TARGET_CXXFLAGS_ADDON} -fexceptions diff --git a/build/android/patches/irrlicht-back_button.patch b/build/android/patches/irrlicht-back_button.patch new file mode 100644 index 0000000..fa5d446 --- /dev/null +++ b/build/android/patches/irrlicht-back_button.patch @@ -0,0 +1,20 @@ +--- irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp.orig 2015-08-29 15:43:09.000000000 +0300 ++++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2016-05-13 21:36:22.880388505 +0300 +@@ -486,7 +486,7 @@ + event.KeyInput.Char = 0; + } + +- device->postEventFromUser(event); ++ status = device->postEventFromUser(event); + } + break; + default: +@@ -543,7 +543,7 @@ + KeyMap[1] = KEY_LBUTTON; // AKEYCODE_SOFT_LEFT + KeyMap[2] = KEY_RBUTTON; // AKEYCODE_SOFT_RIGHT + KeyMap[3] = KEY_HOME; // AKEYCODE_HOME +- KeyMap[4] = KEY_BACK; // AKEYCODE_BACK ++ KeyMap[4] = KEY_CANCEL; // AKEYCODE_BACK + KeyMap[5] = KEY_UNKNOWN; // AKEYCODE_CALL + KeyMap[6] = KEY_UNKNOWN; // AKEYCODE_ENDCALL + KeyMap[7] = KEY_KEY_0; // AKEYCODE_0 diff --git a/build/android/patches/irrlicht-native_activity.patch b/build/android/patches/irrlicht-native_activity.patch new file mode 100644 index 0000000..95a7189 --- /dev/null +++ b/build/android/patches/irrlicht-native_activity.patch @@ -0,0 +1,13 @@ +--- irrlicht/source/Irrlicht/CEGLManager.cpp.orig 2018-09-11 18:19:51.453403631 +0300 ++++ irrlicht/source/Irrlicht/CEGLManager.cpp 2018-09-11 18:36:24.603471869 +0300 +@@ -9,6 +9,10 @@ + #include "irrString.h" + #include "os.h" + ++#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_) ++#include ++#endif ++ + namespace irr + { + namespace video diff --git a/build/android/patches/irrlicht-texturehack.patch b/build/android/patches/irrlicht-texturehack.patch new file mode 100644 index 0000000..3024419 --- /dev/null +++ b/build/android/patches/irrlicht-texturehack.patch @@ -0,0 +1,240 @@ +--- irrlicht/source/Irrlicht/COGLESTexture.cpp.orig 2014-06-22 17:01:13.266568869 +0200 ++++ irrlicht/source/Irrlicht/COGLESTexture.cpp 2014-06-22 17:03:59.298572810 +0200 +@@ -366,112 +366,140 @@ + void(*convert)(const void*, s32, void*) = 0; + getFormatParameters(ColorFormat, InternalFormat, filtering, PixelFormat, PixelType, convert); + +- // make sure we don't change the internal format of existing images +- if (!newTexture) +- InternalFormat = oldInternalFormat; +- +- Driver->setActiveTexture(0, this); +- +- if (Driver->testGLError()) +- os::Printer::log("Could not bind Texture", ELL_ERROR); +- +- // mipmap handling for main texture +- if (!level && newTexture) +- { +- // auto generate if possible and no mipmap data is given +- if (!IsCompressed && HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE)) +- { +- if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED)) +- glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); +- else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY)) +- glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST); +- else +- glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); ++ bool retry = false; ++ ++ do { ++ if (retry) { ++ InternalFormat = GL_RGBA; ++ PixelFormat = GL_RGBA; ++ convert = CColorConverter::convert_A8R8G8B8toA8B8G8R8; ++ } ++ // make sure we don't change the internal format of existing images ++ if (!newTexture) ++ InternalFormat = oldInternalFormat; + +- glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); +- AutomaticMipmapUpdate=true; +- } ++ Driver->setActiveTexture(0, this); + +- // enable bilinear filter without mipmaps +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); +- glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); +- } ++ if (Driver->testGLError()) ++ os::Printer::log("Could not bind Texture", ELL_ERROR); + +- // now get image data and upload to GPU ++ // mipmap handling for main texture ++ if (!level && newTexture) ++ { ++ // auto generate if possible and no mipmap data is given ++ if (!IsCompressed && HasMipMaps && !mipmapData && Driver->queryFeature(EVDF_MIP_MAP_AUTO_UPDATE)) ++ { ++ if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_SPEED)) ++ glHint(GL_GENERATE_MIPMAP_HINT, GL_FASTEST); ++ else if (Driver->getTextureCreationFlag(ETCF_OPTIMIZED_FOR_QUALITY)) ++ glHint(GL_GENERATE_MIPMAP_HINT, GL_NICEST); ++ else ++ glHint(GL_GENERATE_MIPMAP_HINT, GL_DONT_CARE); ++ ++ glTexParameteri(GL_TEXTURE_2D, GL_GENERATE_MIPMAP, GL_TRUE); ++ AutomaticMipmapUpdate=true; ++ } ++ ++ // enable bilinear filter without mipmaps ++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filtering); ++ glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); ++ } + +- u32 compressedImageSize = IImage::getCompressedImageSize(ColorFormat, image->getDimension().Width, image->getDimension().Height); ++ // now get image data and upload to GPU + +- void* source = image->lock(); ++ u32 compressedImageSize = IImage::getCompressedImageSize(ColorFormat, image->getDimension().Width, image->getDimension().Height); + +- IImage* tmpImage = 0; ++ void* source = image->lock(); + +- if (convert) +- { +- tmpImage = new CImage(image->getColorFormat(), image->getDimension()); +- void* dest = tmpImage->lock(); +- convert(source, image->getDimension().getArea(), dest); +- image->unlock(); +- source = dest; +- } ++ IImage* tmpImage = 0; + +- if (newTexture) +- { +- if (IsCompressed) ++ if (convert) + { +- glCompressedTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, image->getDimension().Width, +- image->getDimension().Height, 0, compressedImageSize, source); ++ tmpImage = new CImage(image->getColorFormat(), image->getDimension()); ++ void* dest = tmpImage->lock(); ++ convert(source, image->getDimension().getArea(), dest); ++ image->unlock(); ++ source = dest; + } +- else +- glTexImage2D(GL_TEXTURE_2D, level, InternalFormat, image->getDimension().Width, +- image->getDimension().Height, 0, PixelFormat, PixelType, source); +- } +- else +- { +- if (IsCompressed) ++ ++ if (newTexture) + { +- glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width, +- image->getDimension().Height, PixelFormat, compressedImageSize, source); ++ if (IsCompressed) ++ { ++ glCompressedTexImage2D(GL_TEXTURE_2D, 0, InternalFormat, image->getDimension().Width, ++ image->getDimension().Height, 0, compressedImageSize, source); ++ } ++ else ++ glTexImage2D(GL_TEXTURE_2D, level, InternalFormat, image->getDimension().Width, ++ image->getDimension().Height, 0, PixelFormat, PixelType, source); + } + else +- glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width, +- image->getDimension().Height, PixelFormat, PixelType, source); +- } +- +- if (convert) +- { +- tmpImage->unlock(); +- tmpImage->drop(); +- } +- else +- image->unlock(); +- +- if (!level && newTexture) +- { +- if (IsCompressed && !mipmapData) + { +- if (image->hasMipMaps()) +- mipmapData = static_cast(image->lock())+compressedImageSize; ++ if (IsCompressed) ++ { ++ glCompressedTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width, ++ image->getDimension().Height, PixelFormat, compressedImageSize, source); ++ } + else +- HasMipMaps = false; ++ glTexSubImage2D(GL_TEXTURE_2D, level, 0, 0, image->getDimension().Width, ++ image->getDimension().Height, PixelFormat, PixelType, source); + } + +- regenerateMipMapLevels(mipmapData); +- +- if (HasMipMaps) // might have changed in regenerateMipMapLevels ++ if (convert) + { +- // enable bilinear mipmap filter +- GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST; +- +- if (filtering != GL_LINEAR) +- filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST; ++ tmpImage->unlock(); ++ tmpImage->drop(); ++ } ++ else ++ image->unlock(); ++ ++ if (glGetError() != GL_NO_ERROR) { ++ static bool warned = false; ++ if ((!retry) && (ColorFormat == ECF_A8R8G8B8)) { ++ ++ if (!warned) { ++ os::Printer::log("Your driver claims to support GL_BGRA but fails on trying to upload a texture, converting to GL_RGBA and trying again", ELL_ERROR); ++ warned = true; ++ } ++ } ++ else if (retry) { ++ os::Printer::log("Neither uploading texture as GL_BGRA nor, converted one using GL_RGBA succeeded", ELL_ERROR); ++ } ++ retry = !retry; ++ continue; ++ } else { ++ retry = false; ++ } + +- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filteringMipMaps); +- glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); ++ if (!level && newTexture) ++ { ++ if (IsCompressed && !mipmapData) ++ { ++ if (image->hasMipMaps()) ++ mipmapData = static_cast(image->lock())+compressedImageSize; ++ else ++ HasMipMaps = false; ++ } ++ ++ regenerateMipMapLevels(mipmapData); ++ ++ if (HasMipMaps) // might have changed in regenerateMipMapLevels ++ { ++ // enable bilinear mipmap filter ++ GLint filteringMipMaps = GL_LINEAR_MIPMAP_NEAREST; ++ ++ if (filtering != GL_LINEAR) ++ filteringMipMaps = GL_NEAREST_MIPMAP_NEAREST; ++ ++ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, filteringMipMaps); ++ glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, filtering); ++ } + } +- } + +- if (Driver->testGLError()) +- os::Printer::log("Could not glTexImage2D", ELL_ERROR); ++ if (Driver->testGLError()) ++ os::Printer::log("Could not glTexImage2D", ELL_ERROR); ++ } ++ while(retry); + } + + +--- irrlicht/source/Irrlicht/COGLESTexture.cpp.orig 2014-06-25 00:28:50.820501856 +0200 ++++ irrlicht/source/Irrlicht/COGLESTexture.cpp 2014-06-25 00:08:37.712544692 +0200 +@@ -422,6 +422,9 @@ + source = dest; + } + ++ //clear old error ++ glGetError(); ++ + if (newTexture) + { + if (IsCompressed) diff --git a/build/android/patches/irrlicht-touchcount.patch b/build/android/patches/irrlicht-touchcount.patch new file mode 100644 index 0000000..f0c3db6 --- /dev/null +++ b/build/android/patches/irrlicht-touchcount.patch @@ -0,0 +1,30 @@ +--- irrlicht.orig/include/IEventReceiver.h 2014-06-03 19:43:50.433713133 +0200 ++++ irrlicht/include/IEventReceiver.h 2014-06-03 19:44:36.993711489 +0200 +@@ -375,6 +375,9 @@ + // Y position of simple touch. + s32 Y; + ++ // number of current touches ++ s32 touchedCount; ++ + //! Type of touch event. + ETOUCH_INPUT_EVENT Event; + }; +--- irrlicht.orig/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2014-06-03 19:43:50.505713130 +0200 ++++ irrlicht/source/Irrlicht/Android/CIrrDeviceAndroid.cpp 2014-06-03 19:45:37.265709359 +0200 +@@ -315,6 +315,7 @@ + event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, i); + event.TouchInput.X = AMotionEvent_getX(androidEvent, i); + event.TouchInput.Y = AMotionEvent_getY(androidEvent, i); ++ event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent); + + device->postEventFromUser(event); + } +@@ -326,6 +327,7 @@ + event.TouchInput.ID = AMotionEvent_getPointerId(androidEvent, pointerIndex); + event.TouchInput.X = AMotionEvent_getX(androidEvent, pointerIndex); + event.TouchInput.Y = AMotionEvent_getY(androidEvent, pointerIndex); ++ event.TouchInput.touchedCount = AMotionEvent_getPointerCount(androidEvent); + + device->postEventFromUser(event); + } diff --git a/build/android/patches/libiconv_android.patch b/build/android/patches/libiconv_android.patch new file mode 100644 index 0000000..4eca0a4 --- /dev/null +++ b/build/android/patches/libiconv_android.patch @@ -0,0 +1,39 @@ +--- a/libcharset/lib/localcharset.c 2015-06-10 11:55:25.933870724 +0200 ++++ b/libcharset/lib/localcharset.c 2015-06-10 11:55:39.578063493 +0200 +@@ -47,7 +47,7 @@ + + #if !defined WIN32_NATIVE + # include +-# if HAVE_LANGINFO_CODESET ++# if HAVE_LANGINFO_CODESET && !(defined __ANDROID__) + # include + # else + # if 0 /* see comment below */ +@@ -124,7 +124,7 @@ get_charset_aliases (void) + cp = charset_aliases; + if (cp == NULL) + { +-#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__) ++#if !(defined DARWIN7 || defined VMS || defined WIN32_NATIVE || defined __CYGWIN__ || defined __ANDROID__) + const char *dir; + const char *base = "charset.alias"; + char *file_name; +@@ -338,6 +338,9 @@ get_charset_aliases (void) + "CP54936" "\0" "GB18030" "\0" + "CP65001" "\0" "UTF-8" "\0"; + # endif ++# if defined __ANDROID__ ++ cp = "*" "\0" "UTF-8" "\0"; ++# endif + #endif + + charset_aliases = cp; +@@ -361,7 +364,7 @@ locale_charset (void) + const char *codeset; + const char *aliases; + +-#if !(defined WIN32_NATIVE || defined OS2) ++#if !(defined WIN32_NATIVE || defined OS2 || defined __ANDROID__) + + # if HAVE_LANGINFO_CODESET + diff --git a/build/android/patches/libiconv_stdio.patch b/build/android/patches/libiconv_stdio.patch new file mode 100644 index 0000000..9fa50f7 --- /dev/null +++ b/build/android/patches/libiconv_stdio.patch @@ -0,0 +1,13 @@ +--- a/srclib/stdio.in.h 2011-08-07 15:42:06.000000000 +0200 ++++ b/srclib/stdio.in.h 2015-06-10 09:27:58.129056262 +0200 +@@ -695,8 +696,9 @@ _GL_CXXALIASWARN (gets); + /* It is very rare that the developer ever has full control of stdin, + so any use of gets warrants an unconditional warning. Assume it is + always declared, since it is required by C89. */ +-_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead"); ++/*_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");*/ ++#define gets(a) fgets( a, sizeof(*(a)), stdin) + #endif + + +#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@ diff --git a/build/android/patches/libvorbis-libogg-fpu.patch b/build/android/patches/libvorbis-libogg-fpu.patch new file mode 100644 index 0000000..52ab397 --- /dev/null +++ b/build/android/patches/libvorbis-libogg-fpu.patch @@ -0,0 +1,37 @@ +--- libvorbis-libogg-android/jni/libvorbis-jni/Android.mk.orig 2014-06-17 19:22:50.621559073 +0200 ++++ libvorbis-libogg-android/jni/libvorbis-jni/Android.mk 2014-06-17 19:38:20.641581140 +0200 +@@ -4,9 +4,6 @@ + + LOCAL_MODULE := vorbis-jni + LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -fsigned-char +-ifeq ($(TARGET_ARCH),arm) +- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp +-endif + + LOCAL_SHARED_LIBRARIES := libogg libvorbis + +--- libvorbis-libogg-android/jni/libvorbis/Android.mk.orig 2014-06-17 19:22:39.077558797 +0200 ++++ libvorbis-libogg-android/jni/libvorbis/Android.mk 2014-06-17 19:38:52.121581887 +0200 +@@ -4,9 +4,6 @@ + + LOCAL_MODULE := libvorbis + LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char +-ifeq ($(TARGET_ARCH),arm) +- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp +-endif + LOCAL_SHARED_LIBRARIES := libogg + + LOCAL_SRC_FILES := \ +--- libvorbis-libogg-android/jni/libogg/Android.mk.orig 2014-06-17 19:22:33.965558675 +0200 ++++ libvorbis-libogg-android/jni/libogg/Android.mk 2014-06-17 19:38:25.337581252 +0200 +@@ -4,10 +4,6 @@ + + LOCAL_MODULE := libogg + LOCAL_CFLAGS += -I$(LOCAL_PATH)/../include -ffast-math -fsigned-char +-ifeq ($(TARGET_ARCH),arm) +- LOCAL_CFLAGS += -march=armv6 -marm -mfloat-abi=softfp -mfpu=vfp +-endif +- + + LOCAL_SRC_FILES := \ + bitwise.c \ diff --git a/build/android/patches/openssl_arch.patch b/build/android/patches/openssl_arch.patch new file mode 100644 index 0000000..d15e2b1 --- /dev/null +++ b/build/android/patches/openssl_arch.patch @@ -0,0 +1,13 @@ +--- openssl-1.0.2e.orig/Configure 2015-12-03 15:04:23.000000000 +0100 ++++ openssl-1.0.2e/Configure 2015-12-14 21:01:40.351265968 +0100 +@@ -464,8 +464,10 @@ + # Android: linux-* but without pointers to headers and libs. + "android","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${no_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "android-x86","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG ${x86_gcc_des} ${x86_gcc_opts}:".eval{my $asm=${x86_elf_asm};$asm=~s/:elf/:android/;$asm}.":dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"android-arm","gcc:-march=armv4 -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "android-armv7","gcc:-march=armv7-a -mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -fomit-frame-pointer -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${armv4_asm}:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + "android-mips","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", ++"android-mips32","gcc:-mandroid -I\$(ANDROID_DEV)/include -B\$(ANDROID_DEV)/lib -O3 -Wall::-D_REENTRANT::-ldl:BN_LLONG RC4_CHAR RC4_CHUNK DES_INT DES_UNROLL BF_PTR:${mips32_asm}:o32:dlfcn:linux-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", + + #### *BSD [do see comment about ${BSDthreads} above!] + "BSD-generic32","gcc:-O3 -fomit-frame-pointer -Wall::${BSDthreads}:::BN_LLONG RC2_CHAR RC4_INDEX DES_INT DES_UNROLL:${no_asm}:dlfcn:bsd-gcc-shared:-fPIC::.so.\$(SHLIB_MAJOR).\$(SHLIB_MINOR)", diff --git a/build/android/settings.gradle b/build/android/settings.gradle new file mode 100644 index 0000000..b0cee5d --- /dev/null +++ b/build/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = "Minetest" diff --git a/build/android/src/debug/AndroidManifest.xml b/build/android/src/debug/AndroidManifest.xml new file mode 100644 index 0000000..ee04d1d --- /dev/null +++ b/build/android/src/debug/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/build/android/src/main/AndroidManifest.xml b/build/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000..7f61cda --- /dev/null +++ b/build/android/src/main/AndroidManifest.xml @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/android/src/main/java/net.minetest.minetest/MainActivity.java b/build/android/src/main/java/net.minetest.minetest/MainActivity.java new file mode 100644 index 0000000..1baa716 --- /dev/null +++ b/build/android/src/main/java/net.minetest.minetest/MainActivity.java @@ -0,0 +1,79 @@ +package net.minetest.minetest; + +import android.Manifest; +import android.app.Activity; +import android.content.Intent; +import android.content.pm.PackageManager; +import android.os.Build; +import android.os.Bundle; +import android.support.annotation.NonNull; +import android.support.v4.app.ActivityCompat; +import android.support.v4.content.ContextCompat;; +import android.widget.Toast; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +public class MainActivity extends Activity { + + private final static int PERMISSIONS = 1; + private static final String[] REQUIRED_SDK_PERMISSIONS = new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { + checkPermission(); + } else { + next(); + } + } + + protected void checkPermission() { + final List missingPermissions = new ArrayList(); + // check required permission + for (final String permission : REQUIRED_SDK_PERMISSIONS) { + final int result = ContextCompat.checkSelfPermission(this, permission); + if (result != PackageManager.PERMISSION_GRANTED) { + missingPermissions.add(permission); + } + } + if (!missingPermissions.isEmpty()) { + // request permission + final String[] permissions = missingPermissions + .toArray(new String[missingPermissions.size()]); + ActivityCompat.requestPermissions(this, permissions, PERMISSIONS); + } else { + final int[] grantResults = new int[REQUIRED_SDK_PERMISSIONS.length]; + Arrays.fill(grantResults, PackageManager.PERMISSION_GRANTED); + onRequestPermissionsResult(PERMISSIONS, REQUIRED_SDK_PERMISSIONS, + grantResults); + } + } + + @Override + public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[], + @NonNull int[] grantResults) { + switch (requestCode) { + case PERMISSIONS: + for (int index = 0; index < permissions.length; index++) { + if (grantResults[index] != PackageManager.PERMISSION_GRANTED) { + // permission not granted - toast and exit + Toast.makeText(this, R.string.not_granted, Toast.LENGTH_LONG).show(); + finish(); + return; + } + } + // permission were granted - run + next(); + break; + } + } + + public void next() { + Intent intent = new Intent(this, MtNativeActivity.class); + intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_CLEAR_TASK); + startActivity(intent); + } +} diff --git a/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java b/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java new file mode 100644 index 0000000..b570fe6 --- /dev/null +++ b/build/android/src/main/java/net.minetest.minetest/MinetestAssetCopy.java @@ -0,0 +1,373 @@ +package net.minetest.minetest; + +import android.app.Activity; +import android.content.res.AssetFileDescriptor; +import android.os.AsyncTask; +import android.os.Build; +import android.os.Bundle; +import android.os.Environment; +import android.util.Log; +import android.view.Display; +import android.view.View; +import android.widget.ProgressBar; +import android.widget.TextView; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.OutputStream; +import java.util.Iterator; +import java.util.Vector; + +public class MinetestAssetCopy extends Activity { + ProgressBar m_ProgressBar; + TextView m_Filename; + copyAssetTask m_AssetCopy; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.assetcopy); + m_ProgressBar = findViewById(R.id.progressBar1); + m_Filename = findViewById(R.id.textView1); + Display display = getWindowManager().getDefaultDisplay(); + m_ProgressBar.getLayoutParams().width = (int) (display.getWidth() * 0.8); + m_ProgressBar.invalidate(); + + /* check if there's already a copy in progress and reuse in case it is*/ + MinetestAssetCopy prevActivity = + (MinetestAssetCopy) getLastNonConfigurationInstance(); + if (prevActivity != null) { + m_AssetCopy = prevActivity.m_AssetCopy; + } else { + m_AssetCopy = new copyAssetTask(); + m_AssetCopy.execute(); + } + } + + @Override + protected void onResume() { + super.onResume(); + makeFullScreen(); + } + + public void makeFullScreen() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + this.getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ); + } + } + + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + if (hasFocus) { + makeFullScreen(); + } + } + + /* preserve asset copy background task to prevent restart of copying */ + /* this way of doing it is not recommended for latest android version */ + /* but the recommended way isn't available on android 2.x */ + public Object onRetainNonConfigurationInstance() { + return this; + } + + private class copyAssetTask extends AsyncTask { + boolean m_copy_started = false; + String m_Foldername = "media"; + Vector m_foldernames; + Vector m_filenames; + Vector m_tocopy; + Vector m_asset_size_unknown; + + private long getFullSize(String filename) { + long size = 0; + try { + InputStream src = getAssets().open(filename); + byte[] buf = new byte[4096]; + + int len = 0; + while ((len = src.read(buf)) > 0) { + size += len; + } + } catch (IOException e) { + e.printStackTrace(); + } + return size; + } + + @Override + protected String doInBackground(String... files) { + m_foldernames = new Vector(); + m_filenames = new Vector(); + m_tocopy = new Vector(); + m_asset_size_unknown = new Vector(); + String baseDir = + Environment.getExternalStorageDirectory().getAbsolutePath() + + "/"; + + + // prepare temp folder + File TempFolder = new File(baseDir + "Minetest/tmp/"); + + if (!TempFolder.exists()) { + TempFolder.mkdir(); + } else { + File[] todel = TempFolder.listFiles(); + + for (int i = 0; i < todel.length; i++) { + Log.v("MinetestAssetCopy", "deleting: " + todel[i].getAbsolutePath()); + todel[i].delete(); + } + } + + // add a .nomedia file + try { + OutputStream dst = new FileOutputStream(baseDir + "Minetest/.nomedia"); + dst.close(); + } catch (IOException e) { + Log.e("MinetestAssetCopy", "Failed to create .nomedia file"); + e.printStackTrace(); + } + + + // build lists from prepared data + BuildFolderList(); + BuildFileList(); + + // scan filelist + ProcessFileList(); + + // doing work + m_copy_started = true; + m_ProgressBar.setMax(m_tocopy.size()); + + for (int i = 0; i < m_tocopy.size(); i++) { + try { + String filename = m_tocopy.get(i); + publishProgress(i); + + boolean asset_size_unknown = false; + long filesize = -1; + + if (m_asset_size_unknown.contains(filename)) { + File testme = new File(baseDir + "/" + filename); + + if (testme.exists()) { + filesize = testme.length(); + } + asset_size_unknown = true; + } + + InputStream src; + try { + src = getAssets().open(filename); + } catch (IOException e) { + Log.e("MinetestAssetCopy", "Copying file: " + filename + " FAILED (not in assets)"); + e.printStackTrace(); + continue; + } + + // Transfer bytes from in to out + byte[] buf = new byte[1024]; + int len = src.read(buf, 0, 1024); + + /* following handling is crazy but we need to deal with */ + /* compressed assets.Flash chips limited livetime due to */ + /* write operations, we can't allow large files to destroy */ + /* users flash. */ + if (asset_size_unknown) { + if ((len > 0) && (len < buf.length) && (len == filesize)) { + src.close(); + continue; + } + + if (len == buf.length) { + src.close(); + long size = getFullSize(filename); + if (size == filesize) { + continue; + } + src = getAssets().open(filename); + len = src.read(buf, 0, 1024); + } + } + if (len > 0) { + int total_filesize = 0; + OutputStream dst; + try { + dst = new FileOutputStream(baseDir + "/" + filename); + } catch (IOException e) { + Log.e("MinetestAssetCopy", "Copying file: " + baseDir + + "/" + filename + " FAILED (couldn't open output file)"); + e.printStackTrace(); + src.close(); + continue; + } + dst.write(buf, 0, len); + total_filesize += len; + + while ((len = src.read(buf)) > 0) { + dst.write(buf, 0, len); + total_filesize += len; + } + + dst.close(); + Log.v("MinetestAssetCopy", "Copied file: " + + m_tocopy.get(i) + " (" + total_filesize + + " bytes)"); + } else if (len < 0) { + Log.e("MinetestAssetCopy", "Copying file: " + + m_tocopy.get(i) + " failed, size < 0"); + } + src.close(); + } catch (IOException e) { + Log.e("MinetestAssetCopy", "Copying file: " + + m_tocopy.get(i) + " failed"); + e.printStackTrace(); + } + } + return ""; + } + + /** + * update progress bar + */ + protected void onProgressUpdate(Integer... progress) { + + if (m_copy_started) { + boolean shortened = false; + String todisplay = m_tocopy.get(progress[0]); + m_ProgressBar.setProgress(progress[0]); + m_Filename.setText(todisplay); + } else { + boolean shortened = false; + String todisplay = m_Foldername; + String full_text = "scanning " + todisplay + " ..."; + m_Filename.setText(full_text); + } + } + + /** + * check all files and folders in filelist + */ + protected void ProcessFileList() { + String FlashBaseDir = + Environment.getExternalStorageDirectory().getAbsolutePath(); + + Iterator itr = m_filenames.iterator(); + + while (itr.hasNext()) { + String current_path = (String) itr.next(); + String FlashPath = FlashBaseDir + "/" + current_path; + + if (isAssetFolder(current_path)) { + /* store information and update gui */ + m_Foldername = current_path; + publishProgress(0); + + /* open file in order to check if it's a folder */ + File current_folder = new File(FlashPath); + if (!current_folder.exists()) { + if (!current_folder.mkdirs()) { + Log.e("MinetestAssetCopy", "\t failed create folder: " + + FlashPath); + } else { + Log.v("MinetestAssetCopy", "\t created folder: " + + FlashPath); + } + } + + continue; + } + + /* if it's not a folder it's most likely a file */ + boolean refresh = true; + + File testme = new File(FlashPath); + + long asset_filesize = -1; + long stored_filesize = -1; + + if (testme.exists()) { + try { + AssetFileDescriptor fd = getAssets().openFd(current_path); + asset_filesize = fd.getLength(); + fd.close(); + } catch (IOException e) { + refresh = true; + m_asset_size_unknown.add(current_path); + Log.e("MinetestAssetCopy", "Failed to open asset file \"" + + FlashPath + "\" for size check"); + } + + stored_filesize = testme.length(); + + if (asset_filesize == stored_filesize) { + refresh = false; + } + + } + + if (refresh) { + m_tocopy.add(current_path); + } + } + } + + /** + * read list of folders prepared on package build + */ + protected void BuildFolderList() { + try { + InputStream is = getAssets().open("index.txt"); + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + String line = reader.readLine(); + while (line != null) { + m_foldernames.add(line); + line = reader.readLine(); + } + is.close(); + } catch (IOException e1) { + Log.e("MinetestAssetCopy", "Error on processing index.txt"); + e1.printStackTrace(); + } + } + + /** + * read list of asset files prepared on package build + */ + protected void BuildFileList() { + long entrycount = 0; + try { + InputStream is = getAssets().open("filelist.txt"); + BufferedReader reader = new BufferedReader(new InputStreamReader(is)); + + String line = reader.readLine(); + while (line != null) { + m_filenames.add(line); + line = reader.readLine(); + entrycount++; + } + is.close(); + } catch (IOException e1) { + Log.e("MinetestAssetCopy", "Error on processing filelist.txt"); + e1.printStackTrace(); + } + } + + protected void onPostExecute(String result) { + finish(); + } + + protected boolean isAssetFolder(String path) { + return m_foldernames.contains(path); + } + } +} diff --git a/build/android/src/main/java/net.minetest.minetest/MinetestTextEntry.java b/build/android/src/main/java/net.minetest.minetest/MinetestTextEntry.java new file mode 100644 index 0000000..4cd8990 --- /dev/null +++ b/build/android/src/main/java/net.minetest.minetest/MinetestTextEntry.java @@ -0,0 +1,87 @@ +package net.minetest.minetest; + +import android.app.Activity; +import android.app.AlertDialog; +import android.content.DialogInterface; +import android.content.Intent; +import android.os.Bundle; +import android.text.InputType; +import android.view.KeyEvent; +import android.view.View; +import android.view.View.OnKeyListener; +import android.widget.EditText; + +public class MinetestTextEntry extends Activity { + private final int MultiLineTextInput = 1; + private final int SingleLineTextInput = 2; + private final int SingleLinePasswordInput = 3; + public AlertDialog mTextInputDialog; + public EditText mTextInputWidget; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + Bundle b = getIntent().getExtras(); + String acceptButton = b.getString("EnterButton"); + String hint = b.getString("hint"); + String current = b.getString("current"); + int editType = b.getInt("editType"); + + AlertDialog.Builder builder = new AlertDialog.Builder(this); + mTextInputWidget = new EditText(this); + mTextInputWidget.setHint(hint); + mTextInputWidget.setText(current); + mTextInputWidget.setMinWidth(300); + if (editType == SingleLinePasswordInput) { + mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT | + InputType.TYPE_TEXT_VARIATION_PASSWORD); + } else { + mTextInputWidget.setInputType(InputType.TYPE_CLASS_TEXT); + } + + builder.setView(mTextInputWidget); + + if (editType == MultiLineTextInput) { + builder.setPositiveButton(acceptButton, new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, int whichButton) { + pushResult(mTextInputWidget.getText().toString()); + } + }); + } + + builder.setOnCancelListener(new DialogInterface.OnCancelListener() { + public void onCancel(DialogInterface dialog) { + cancelDialog(); + } + }); + + mTextInputWidget.setOnKeyListener(new OnKeyListener() { + @Override + public boolean onKey(View view, int KeyCode, KeyEvent event) { + if (KeyCode == KeyEvent.KEYCODE_ENTER) { + + pushResult(mTextInputWidget.getText().toString()); + return true; + } + return false; + } + }); + + mTextInputDialog = builder.create(); + mTextInputDialog.show(); + } + + public void pushResult(String text) { + Intent resultData = new Intent(); + resultData.putExtra("text", text); + setResult(Activity.RESULT_OK, resultData); + mTextInputDialog.dismiss(); + finish(); + } + + public void cancelDialog() { + setResult(Activity.RESULT_CANCELED); + mTextInputDialog.dismiss(); + finish(); + } +} diff --git a/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java b/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java new file mode 100644 index 0000000..b32e97b --- /dev/null +++ b/build/android/src/main/java/net.minetest.minetest/MtNativeActivity.java @@ -0,0 +1,111 @@ +package net.minetest.minetest; + +import android.app.NativeActivity; +import android.content.Intent; +import android.os.Build; +import android.os.Bundle; +import android.view.View; +import android.view.WindowManager; + +public class MtNativeActivity extends NativeActivity { + + static { + System.loadLibrary("c++_shared"); + System.loadLibrary("openal"); + System.loadLibrary("ogg"); + System.loadLibrary("vorbis"); + System.loadLibrary("iconv"); + System.loadLibrary("minetest"); + } + + private int m_MessagReturnCode; + private String m_MessageReturnValue; + + public static native void putMessageBoxResult(String text); + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); + m_MessagReturnCode = -1; + m_MessageReturnValue = ""; + } + + @Override + protected void onResume() { + super.onResume(); + makeFullScreen(); + } + + public void makeFullScreen() { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + this.getWindow().getDecorView().setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY + ); + } + } + + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + if (hasFocus) { + makeFullScreen(); + } + } + + public void copyAssets() { + Intent intent = new Intent(this, MinetestAssetCopy.class); + startActivity(intent); + } + + public void showDialog(String acceptButton, String hint, String current, + int editType) { + + Intent intent = new Intent(this, MinetestTextEntry.class); + Bundle params = new Bundle(); + params.putString("acceptButton", acceptButton); + params.putString("hint", hint); + params.putString("current", current); + params.putInt("editType", editType); + intent.putExtras(params); + startActivityForResult(intent, 101); + m_MessageReturnValue = ""; + m_MessagReturnCode = -1; + } + + /* ugly code to workaround putMessageBoxResult not beeing found */ + public int getDialogState() { + return m_MessagReturnCode; + } + + public String getDialogValue() { + m_MessagReturnCode = -1; + return m_MessageReturnValue; + } + + public float getDensity() { + return getResources().getDisplayMetrics().density; + } + + public int getDisplayWidth() { + return getResources().getDisplayMetrics().widthPixels; + } + + public int getDisplayHeight() { + return getResources().getDisplayMetrics().heightPixels; + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, + Intent data) { + if (requestCode == 101) { + if (resultCode == RESULT_OK) { + String text = data.getStringExtra("text"); + m_MessagReturnCode = 0; + m_MessageReturnValue = text; + } else { + m_MessagReturnCode = 1; + } + } + } +} diff --git a/build/android/src/main/res/drawable/background.png b/build/android/src/main/res/drawable/background.png new file mode 100644 index 0000000..43bd608 Binary files /dev/null and b/build/android/src/main/res/drawable/background.png differ diff --git a/build/android/src/main/res/drawable/bg.xml b/build/android/src/main/res/drawable/bg.xml new file mode 100644 index 0000000..c76ec37 --- /dev/null +++ b/build/android/src/main/res/drawable/bg.xml @@ -0,0 +1,4 @@ + + \ No newline at end of file diff --git a/build/android/src/main/res/layout/assetcopy.xml b/build/android/src/main/res/layout/assetcopy.xml new file mode 100644 index 0000000..b3da2f0 --- /dev/null +++ b/build/android/src/main/res/layout/assetcopy.xml @@ -0,0 +1,24 @@ + + + + + + + + diff --git a/build/android/src/main/res/mipmap/ic_launcher.png b/build/android/src/main/res/mipmap/ic_launcher.png new file mode 100644 index 0000000..88a8378 Binary files /dev/null and b/build/android/src/main/res/mipmap/ic_launcher.png differ diff --git a/build/android/src/main/res/values-v21/styles.xml b/build/android/src/main/res/values-v21/styles.xml new file mode 100644 index 0000000..825ab1d --- /dev/null +++ b/build/android/src/main/res/values-v21/styles.xml @@ -0,0 +1,12 @@ + + + + + + + +