Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/wip5.10.0' into wip5.10.0webport
Browse files Browse the repository at this point in the history
  • Loading branch information
proller committed Jan 12, 2025
2 parents d038885 + a83f69d commit aa66be8
Show file tree
Hide file tree
Showing 121 changed files with 1,309 additions and 940 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
[submodule "src/external/jsoncpp"]
path = src/external/jsoncpp
url = https://github.com/open-source-parsers/jsoncpp.git
[submodule "games/pixture"]
path = games/Repixture
url = https://codeberg.org/Wuzzy/Repixture.git
[submodule "src/external/msgpack-c"]
path = src/external/msgpack-c
url = https://github.com/msgpack/msgpack-c.git
Expand Down
172 changes: 170 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ set(FETCH_TRACY_GIT_TAG "master" CACHE STRING
"Git tag for fetching Tracy client. Match with your server (gui) version")

set(DEFAULT_RUN_IN_PLACE FALSE)
set(DEFAULT_RUN_IN_PLACE TRUE)
if(NOT ANDROID)
set(DEFAULT_RUN_IN_PLACE TRUE)
endif()
if(WIN32)
set(DEFAULT_RUN_IN_PLACE TRUE)
endif()
Expand Down Expand Up @@ -139,7 +141,173 @@ if (USE_STATIC_LIBRARIES)
set(BUILD_SHARED_LIBS OFF)
endif()

#============
# === fm ===

INCLUDE(CheckCXXSourceRuns)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#set(CMAKE_CXX_STANDARD 20)

set(HAVE_SHARED_MUTEX 1)
set(HAVE_THREAD_LOCAL 1)

set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
set(HAVE_FUTURE 1)

set(CMAKE_REQUIRED_FLAGS "")

option(ENABLE_THREADS "Use more threads (might be slower on 1-2 core machines)" 1)

if(ENABLE_THREADS)
set(ENABLE_THREADS 1)
else()
set(ENABLE_THREADS 0)
endif()

option(MINETEST_PROTO "Use minetest protocol (Slow and buggy)" 1)
if(MINETEST_PROTO)
set(MINETEST_TRANSPORT 1 CACHE BOOL "")
message(STATUS "Using minetest compatible protocol (some features missing)")
endif()
if (MINETEST_TRANSPORT)
message(STATUS "Using minetest compatible transport (slow)")
endif()

#
# Set some optimizations and tweaks
#

include(CheckCXXCompilerFlag)

if(STATIC_BUILD)
set(STATIC_BUILD 1)
else()
set(STATIC_BUILD 0)
endif()

if(NOT MSVC)
# FM: TODO: REMOVE:
set(WARNING_FLAGS "${WARNING_FLAGS} -Wno-inconsistent-missing-override")

if("${CMAKE_GENERATOR}" STREQUAL "Ninja" )
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(OTHER_FLAGS "${OTHER_FLAGS} -fdiagnostics-color")
elseif ( CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.8 )
set(OTHER_FLAGS "${OTHER_FLAGS} -fdiagnostics-color=always")
endif ()
endif ()

if(SANITIZE_ADDRESS)
message(STATUS "Build with sanitize=address")
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=address -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(ENABLE_SYSTEM_JSONCPP 0)
endif()
if(SANITIZE_THREAD)
message(STATUS "Build with sanitize=thread")
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=thread -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set(OTHER_FLAGS "${OTHER_FLAGS} -pie")
endif()
set(ENABLE_SYSTEM_JSONCPP 0)
endif()
if(SANITIZE_MEMORY)
message(STATUS "Build with sanitize=memory")
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=memory -fPIE -fno-omit-frame-pointer -fno-optimize-sibling-calls")
SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
set(ENABLE_SYSTEM_JSONCPP 0)
endif()
if(SANITIZE_UNDEFINED)
message(STATUS "Build with sanitize=undefined ")
set(OTHER_FLAGS "${OTHER_FLAGS} -fsanitize=undefined -fno-omit-frame-pointer -fno-optimize-sibling-calls")
set(ENABLE_SYSTEM_JSONCPP 0)
endif()

if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug" OR SANITIZE_ADDRESS OR SANITIZE_THREAD OR SANITIZE_MEMORY OR SANITIZE_UNDEFINED))
option(ENABLE_TCMALLOC "Enable tcmalloc" 1)
endif()

if(ENABLE_GPERF OR ENABLE_TCMALLOC)
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)

if (USE_STATIC_LIBRARIES AND TCMALLOC_STATIC)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
find_library(TCMALLOC_LIBRARY NAMES tcmalloc_debug tcmalloc)
else()
find_library(TCMALLOC_LIBRARY NAMES tcmalloc tcmalloc_and_profiler)
endif()

if(ENABLE_GPERF)
find_library(PROFILER_LIBRARY NAMES profiler tcmalloc_and_profiler)
endif()

if (USE_STATIC_LIBRARIES AND TCMALLOC_STATIC)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

if (PROFILER_LIBRARY)
# set(PLATFORM_LIBS ${PLATFORM_LIBS} -Wl,--no-as-needed ${PROFILER_LIBRARY} -Wl,--as-needed)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${PROFILER_LIBRARY})
endif()

if (TCMALLOC_LIBRARY)
set(PLATFORM_LIBS ${PLATFORM_LIBS} ${TCMALLOC_LIBRARY})
set(OTHER_FLAGS "${OTHER_FLAGS} -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free")
endif()

message(STATUS "Build with tcmalloc ${TCMALLOC_LIBRARY} ${PROFILER_LIBRARY}")
endif()

# too noisy
option(ENABLE_UNWIND "Enable unwind" 0)
if(ENABLE_UNWIND)

if(USE_STATIC_LIBRARIES AND UNWIND_STATIC)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

find_library(UNWIND_LIBRARY NAMES unwind)

if(USE_STATIC_LIBRARIES AND UNWIND_STATIC)
list(REVERSE CMAKE_FIND_LIBRARY_SUFFIXES)
endif()

if(UNWIND_LIBRARY)
CHECK_CXX_SOURCE_RUNS("
#include <execinfo.h> // for backtrace
int main(int argc, char *argv[]) {
void *callstack[128];
const int nMaxFrames = sizeof(callstack) / sizeof(callstack[0]);
char buf[1024];
int nFrames = backtrace(callstack, nMaxFrames);
return 0;
}
"
USE_UNWIND)
if(NOT USE_UNWIND)
set(USE_UNWIND 0)
endif()
# set(USE_UNWIND 1)
SET(PLATFORM_LIBS ${PLATFORM_LIBS} ${UNWIND_LIBRARY})
message(STATUS "Build with unwind ${UNWIND_LIBRARY}")
endif()

endif()

if(CMAKE_SYSTEM_NAME MATCHES "(BSD|DragonFly)") # Darwin|
SET(PLATFORM_LIBS ${PLATFORM_LIBS} execinfo)
endif()

set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${OTHER_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${OTHER_FLAGS}")
endif()

# === fm === ^^^


message(STATUS "*** Will build version ${VERSION_STRING} ***")
message(STATUS "BUILD_CLIENT: " ${BUILD_CLIENT})
Expand Down
10 changes: 7 additions & 3 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apply plugin: 'com.android.application'
android {
ndkVersion "$ndk_version"
defaultConfig {
applicationId 'net.minetest.minetest'
applicationId 'org.freeminer.freeminer'
minSdkVersion 21
compileSdk 34
targetSdkVersion 34
Expand Down Expand Up @@ -52,12 +52,13 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
namespace 'net.minetest.minetest'
namespace 'org.freeminer.freeminer'
}

task prepareAssets() {
def assetsFolder = "build/assets"
def projRoot = rootDir.parent
def gameToCopy = "default"

// See issue #4638
def unsupportedLanguages = new File("${projRoot}/src/unsupported_language_list.txt").text.readLines()
Expand All @@ -67,7 +68,7 @@ task prepareAssets() {
}
doLast {
copy {
from "${projRoot}/minetest.conf.example", "${projRoot}/README.md" into assetsFolder
from "${projRoot}/freeminer.conf.example", "${projRoot}/README.md" into assetsFolder
}
copy {
from "${projRoot}/doc/lgpl-2.1.txt" into assetsFolder
Expand All @@ -84,6 +85,9 @@ task prepareAssets() {
copy {
from "${projRoot}/fonts" include "*.ttf" into "${assetsFolder}/fonts"
}
copy {
from "${projRoot}/games/${gameToCopy}" into "${assetsFolder}/games/${gameToCopy}"
}
copy {
from "${projRoot}/textures/base/pack" into "${assetsFolder}/textures/base/pack"
}
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<provider
android:name="androidx.core.content.FileProvider"
android:authorities="net.minetest.minetest.fileprovider"
android:authorities="org.freeminer.freeminer.fileprovider"
android:grantUriPermissions="true"
android:exported="false">
<meta-data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

package net.minetest.minetest;
package org.freeminer.freeminer;

import android.content.Context;
import android.view.KeyEvent;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

package net.minetest.minetest;
package org.freeminer.freeminer;

import org.libsdl.app.SDLActivity;

Expand Down Expand Up @@ -52,7 +52,7 @@
public class GameActivity extends SDLActivity {
@Override
protected String getMainSharedObject() {
return getContext().getApplicationInfo().nativeLibraryDir + "/libluanti.so";
return getContext().getApplicationInfo().nativeLibraryDir + "/libfreeminer.so";
}

@Override
Expand All @@ -63,7 +63,7 @@ protected String getMainFunction() {
@Override
protected String[] getLibraries() {
return new String[] {
"luanti"
"freeminer"
};
}

Expand Down Expand Up @@ -225,7 +225,7 @@ public void shareFile(String path) {
return;
}

Uri fileUri = FileProvider.getUriForFile(this, "net.minetest.minetest.fileprovider", file);
Uri fileUri = FileProvider.getUriForFile(this, "org.freeminer.freeminer.fileprovider", file);

Intent intent = new Intent(Intent.ACTION_SEND, fileUri);
intent.setDataAndType(fileUri, getContentResolver().getType(fileUri));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

package net.minetest.minetest;
package org.freeminer.freeminer;

import android.annotation.SuppressLint;
import android.app.NotificationChannel;
Expand All @@ -39,7 +39,7 @@
import androidx.annotation.StringRes;
import androidx.appcompat.app.AppCompatActivity;

import static net.minetest.minetest.UnzipService.*;
import static org.freeminer.freeminer.UnzipService.*;

public class MainActivity extends AppCompatActivity {
public static final String NOTIFICATION_CHANNEL_ID = "Minetest channel";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/

package net.minetest.minetest;
package org.freeminer.freeminer;

import android.app.IntentService;
import android.app.Notification;
Expand All @@ -44,10 +44,10 @@
import java.util.zip.ZipInputStream;

public class UnzipService extends IntentService {
public static final String ACTION_UPDATE = "net.minetest.minetest.UPDATE";
public static final String ACTION_PROGRESS = "net.minetest.minetest.PROGRESS";
public static final String ACTION_PROGRESS_MESSAGE = "net.minetest.minetest.PROGRESS_MESSAGE";
public static final String ACTION_FAILURE = "net.minetest.minetest.FAILURE";
public static final String ACTION_UPDATE = "org.freeminer.freeminer.UPDATE";
public static final String ACTION_PROGRESS = "org.freeminer.freeminer.PROGRESS";
public static final String ACTION_PROGRESS_MESSAGE = "org.freeminer.freeminer.PROGRESS_MESSAGE";
public static final String ACTION_FAILURE = "org.freeminer.freeminer.FAILURE";
public static final int SUCCESS = -1;
public static final int FAILURE = -2;
public static final int INDETERMINATE = -3;
Expand All @@ -67,7 +67,7 @@ private static synchronized void setIsRunning(boolean v) {
}

public UnzipService() {
super("net.minetest.minetest.UnzipService");
super("org.freeminer.freeminer.UnzipService");
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/java/net/minetest/minetest/Utils.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package net.minetest.minetest;
package org.freeminer.freeminer;

import android.content.Context;
import android.util.Log;
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-de/strings.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="label">Luanti</string>
<string name="label">Freeminer</string>
<string name="loading">Lädt…</string>
<string name="unzip_notification_title">Luanti lädt</string>
<string name="unzip_notification_description">Weniger als 1 Minute…</string>
Expand Down
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-es-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="no_web_browser">No se encontró ningún navegador web</string>
<string name="loading">Cargando…</string>
<string name="notification_channel_name">Notificación General</string>
<string name="label">Luanti</string>
<string name="label">Freeminer</string>
<string name="notification_channel_description">Notificaciones de Luanti</string>
<string name="unzip_notification_title">Cargando Luanti</string>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-es/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<string name="notification_channel_description">Notificaciones de Luanti</string>
<string name="unzip_notification_description">Menos de 1 minuto…</string>
<string name="ime_dialog_done">Hecho</string>
<string name="label">Luanti</string>
<string name="label">Freeminer</string>
<string name="unzip_notification_title">Cargando Luanti</string>
<string name="notification_channel_name">Notificación General</string>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-hu/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@
<string name="unzip_notification_title">Luanti betöltése…</string>
<string name="ime_dialog_done">Kész</string>
<string name="no_web_browser">Nem található webböngésző</string>
<string name="label">Luanti</string>
<string name="label">Freeminer</string>
<string name="unzip_notification_description">Kevesebb, mint 1 perc…</string>
</resources>
2 changes: 1 addition & 1 deletion android/app/src/main/res/values-in/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<resources>
<string name="no_web_browser">Tidak ditemukan peramban web</string>
<string name="ime_dialog_done">Selesai</string>
<string name="label">Luanti</string>
<string name="label">Freeminer</string>
<string name="loading">Memuat…</string>
<string name="notification_channel_name">Pemberitahuan umum</string>
<string name="unzip_notification_description">Kurang dari 1 menit…</string>
Expand Down
Loading

0 comments on commit aa66be8

Please sign in to comment.