Improve Metadata

This commit is contained in:
TheBrokenRail 2022-06-09 21:31:40 -04:00
parent 3d508d7609
commit daccf65361
22 changed files with 173 additions and 173 deletions

View File

@ -1,10 +1,18 @@
cmake_minimum_required(VERSION 3.13.0)
cmake_minimum_required(VERSION 3.16.0)
# Specify Options
option(MCPI_IS_MIXED_BUILD "Whether The Architecture-Independent And ARM Code Are Different Architecture" FALSE)
option(MCPI_BUNDLE_ARMHF_SYSROOT "Whether To Include An ARMHF Sysroot" ${MCPI_IS_MIXED_BUILD})
set(MCPI_BUILD_MODE "both" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code; \"both\" = Build All Code As ARM")
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "both" "arm" "native")
option(MCPI_OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" FALSE)
option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE)
# Server/Headless Builds
option(MCPI_SERVER_MODE "Server Mode" FALSE)
option(MCPI_HEADLESS_MODE "Headless Mode" ${MCPI_SERVER_MODE})
# ARMHF Sysroot
option(MCPI_BUNDLE_ARMHF_SYSROOT "Whether To Include An ARMHF Sysroot" ${MCPI_IS_MIXED_BUILD})
set(MCPI_CUSTOM_BUNDLED_ARMHF_SYSROOT "" CACHE PATH "Custom Bundled ARMHF Sysroot")
# Media Layer
if(NOT MCPI_HEADLESS_MODE)
option(MCPI_USE_MEDIA_LAYER_PROXY "Whether To Enable The Media Layer Proxy" ${MCPI_IS_MIXED_BUILD})
option(MCPI_USE_GLES1_COMPATIBILITY_LAYER "Whether To Enable The GLESv1_CM Compatibility Layer" TRUE)
@ -12,10 +20,22 @@ else()
set(MCPI_USE_MEDIA_LAYER_PROXY FALSE)
set(MCPI_USE_GLES1_COMPATIBILITY_LAYER FALSE)
endif()
set(MCPI_BUILD_MODE "both" CACHE STRING "\"arm\" = Build Only Code That Must Be ARM; \"native\" = Build Architecture-Independent Code; \"both\" = Build All Code As ARM")
set_property(CACHE MCPI_BUILD_MODE PROPERTY STRINGS "both" "arm" "native")
option(MCPI_OPEN_SOURCE_ONLY "Only Install Open-Source Code (Will Result In Broken Install)" FALSE)
option(MCPI_IS_APPIMAGE_BUILD "AppImage Build" FALSE)
# App ID
set(DEFAULT_APP_ID "com.thebrokenrail.MCPIReborn")
if(MCPI_SERVER_MODE)
string(APPEND DEFAULT_APP_ID "Server")
else()
string(APPEND DEFAULT_APP_ID "Client")
endif()
set(MCPI_APP_ID "${DEFAULT_APP_ID}" CACHE STRING "App ID")
# App Title
set(DEFAULT_APP_TITLE "Minecraft: Pi Edition: Reborn")
if(MCPI_SERVER_MODE)
string(APPEND DEFAULT_APP_TITLE " (Server)")
else()
string(APPEND DEFAULT_APP_TITLE " (Client)")
endif()
set(MCPI_APP_TITLE "${DEFAULT_APP_TITLE}" CACHE STRING "App Title")
# Configure Build Mode
if(MCPI_BUILD_MODE STREQUAL "arm")
@ -40,9 +60,9 @@ include(cmake/util.cmake)
# Specify Variant Name
set(MCPI_VARIANT_NAME "minecraft-pi-reborn")
if(MCPI_SERVER_MODE)
set(MCPI_VARIANT_NAME "${MCPI_VARIANT_NAME}-server")
string(APPEND MCPI_VARIANT_NAME "-server")
else()
set(MCPI_VARIANT_NAME "${MCPI_VARIANT_NAME}-client")
string(APPEND MCPI_VARIANT_NAME "-client")
endif()
# Specify Installation Paths
@ -105,31 +125,14 @@ add_definitions(-D_GNU_SOURCE)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
# Specify Constants
if(MCPI_SERVER_MODE)
add_definitions(-DMCPI_SERVER_MODE)
endif()
if(MCPI_HEADLESS_MODE)
add_definitions(-DMCPI_HEADLESS_MODE)
endif()
if(MCPI_IS_APPIMAGE_BUILD)
add_definitions(-DMCPI_IS_APPIMAGE_BUILD)
endif()
if(MCPI_BUNDLE_ARMHF_SYSROOT)
add_definitions(-DMCPI_BUNDLE_ARMHF_SYSROOT)
endif()
if(MCPI_USE_GLES1_COMPATIBILITY_LAYER)
add_definitions(-DMCPI_USE_GLES1_COMPATIBILITY_LAYER)
endif()
# Version
set_property(
DIRECTORY
APPEND
PROPERTY CMAKE_CONFIGURE_DEPENDS VERSION
)
file(STRINGS VERSION VERSION)
add_definitions(-DVERSION="${VERSION}")
file(STRINGS "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MCPI_VERSION)
file(TIMESTAMP "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" MCPI_VERSION_DATE "%Y-%m-%d" UTC)
# Build libreborn
add_subdirectory(libreborn)

View File

@ -1,7 +1,6 @@
project(armhf-sysroot)
# Allow Custom Sysroot
set(MCPI_CUSTOM_BUNDLED_ARMHF_SYSROOT "" CACHE PATH "Custom Bundled ARMHF Sysroot")
# Check If Using Custom Sysroot
if(MCPI_CUSTOM_BUNDLED_ARMHF_SYSROOT)
# Custom Sysroot
set(SYSROOT_DIR "${MCPI_CUSTOM_BUNDLED_ARMHF_SYSROOT}")

View File

@ -14,7 +14,8 @@ FetchContent_Populate(minecraft-pi)
# Install
install(
DIRECTORY "${minecraft-pi_SOURCE_DIR}/"
DESTINATION "${MCPI_INSTALL_DIR}"
DESTINATION "${MCPI_INSTALL_DIR}/game"
USE_SOURCE_PERMISSIONS
REGEX "api" EXCLUDE
)
install_symlink("game/minecraft-pi" "${MCPI_INSTALL_DIR}/minecraft-pi")

View File

@ -8,3 +8,10 @@ if(NOT MCPI_SERVER_MODE)
RENAME "titleBG.png"
)
endif()
# Icon
install(
FILES "icon.png"
DESTINATION "share/icons/hicolor/scalable/apps"
RENAME "${MCPI_APP_ID}.png"
)

View File

Before

Width:  |  Height:  |  Size: 100 KiB

After

Width:  |  Height:  |  Size: 100 KiB

View File

@ -1,7 +1,6 @@
project(launcher)
# Launcher
if(BUILD_NATIVE_COMPONENTS)
add_executable(launcher src/bootstrap.c src/patchelf.c src/crash-report.c)
if(MCPI_SERVER_MODE)
target_sources(launcher PRIVATE src/server/launcher.c)
@ -9,24 +8,100 @@ if(BUILD_NATIVE_COMPONENTS)
target_sources(launcher PRIVATE src/client/launcher.cpp)
endif()
target_link_libraries(launcher reborn-util)
# Install
install(TARGETS launcher DESTINATION "${MCPI_INSTALL_DIR}")
install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_VARIANT_NAME}")
set(ICON_PATH "data/com.thebrokenrail.MCPIReborn.png")
set(ICON_TARGET_PATH "share/icons/hicolor/scalable/apps")
# Install Available Feature Flags List
if(NOT MCPI_SERVER_MODE)
install(DIRECTORY "data/client/" DESTINATION ".")
install(
FILES "${ICON_PATH}"
DESTINATION "${ICON_TARGET_PATH}"
RENAME "com.thebrokenrail.MCPIRebornClient.png"
install(FILES "src/client/available-feature-flags" DESTINATION "${MCPI_INSTALL_DIR}")
endif()
# Install Desktop Entry
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
"[Desktop Entry]\n"
"Name=${MCPI_APP_TITLE}\n"
"Comment=Fun with Blocks\n"
"Icon=${MCPI_APP_ID}\n"
"Exec=${MCPI_VARIANT_NAME}\n"
"Type=Application\n"
"Categories=Game;\n"
)
if(MCPI_SERVER_MODE)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
"Terminal=true\n"
"NoDisplay=true\n"
)
else()
install(DIRECTORY "data/server/" DESTINATION ".")
install(
FILES "${ICON_PATH}"
DESTINATION "${ICON_TARGET_PATH}"
RENAME "com.thebrokenrail.MCPIRebornServer.png"
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
"Terminal=false\n"
"StartupNotify=false\n"
"StartupWMClass=${MCPI_APP_TITLE}\n"
)
endif()
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop"
DESTINATION "share/applications"
RENAME "${MCPI_APP_ID}.desktop"
)
# Install AppStream Metadata
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml"
"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
"<component type=\"desktop\">\n"
" <id>${MCPI_APP_ID}</id>\n"
" <name>${MCPI_APP_TITLE}</name>\n"
" <metadata_license>CC0-1.0</metadata_license>\n"
" <summary>Fun with Blocks</summary>\n"
" <description><p>Minecraft: Pi Edition Modding Project.</p><p>NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.</p></description>\n"
" <url type=\"homepage\">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn</url>\n"
" <launchable type=\"desktop-id\">${MCPI_APP_ID}.desktop</launchable>\n"
" <provides>\n"
" <id>com.thebrokenrail.MCPIRebornClient.desktop</id>\n"
" </provides>\n"
" <project_license>LicenseRef-proprietary</project_license>\n"
" <developer_name>TheBrokenRail &amp; Mojang AB</developer_name>\n"
" <content_rating type=\"oars-1.0\">\n"
" <content_attribute id=\"violence-cartoon\">moderate</content_attribute>\n"
" <content_attribute id=\"violence-fantasy\">none</content_attribute>\n"
" <content_attribute id=\"violence-realistic\">none</content_attribute>\n"
" <content_attribute id=\"violence-bloodshed\">none</content_attribute>\n"
" <content_attribute id=\"violence-sexual\">none</content_attribute>\n"
" <content_attribute id=\"drugs-alcohol\">none</content_attribute>\n"
" <content_attribute id=\"drugs-narcotics\">none</content_attribute>\n"
" <content_attribute id=\"drugs-tobacco\">none</content_attribute>\n"
" <content_attribute id=\"sex-nudity\">none</content_attribute>\n"
" <content_attribute id=\"sex-themes\">none</content_attribute>\n"
" <content_attribute id=\"language-profanity\">none</content_attribute>\n"
" <content_attribute id=\"language-humor\">none</content_attribute>\n"
" <content_attribute id=\"language-discrimination\">none</content_attribute>\n"
" <content_attribute id=\"social-chat\">intense</content_attribute>\n"
" <content_attribute id=\"social-info\">none</content_attribute>\n"
" <content_attribute id=\"social-audio\">none</content_attribute>\n"
" <content_attribute id=\"social-location\">none</content_attribute>\n"
" <content_attribute id=\"social-contacts\">none</content_attribute>\n"
" <content_attribute id=\"money-purchasing\">none</content_attribute>\n"
" <content_attribute id=\"money-gambling\">none</content_attribute>\n"
" </content_rating>\n"
" <releases>\n"
" <release version=\"${MCPI_VERSION}\" date=\"${MCPI_VERSION_DATE}\">\n"
" </release>\n"
)
if(NOT MCPI_SERVER_MODE)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml"
" <screenshots>\n"
" <screenshot type=\"default\">\n"
" <image>https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/raw/branch/master/images/start.png</image>\n"
" </screenshot>\n"
" </screenshots>\n"
)
endif()
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml"
"</component>\n"
)
install(
FILES "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml"
DESTINATION "share/metainfo"
RENAME "${MCPI_APP_ID}.appdata.xml"
)

View File

@ -1,10 +0,0 @@
[Desktop Entry]
Name=Minecraft: Pi Edition: Reborn (Client)
Comment=Fun with Blocks
Icon=com.thebrokenrail.MCPIRebornClient
StartupNotify=false
StartupWMClass=Minecraft: Pi Edition: Reborn
Exec=minecraft-pi-reborn-client
Terminal=false
Type=Application
Categories=Game;

View File

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.thebrokenrail.MCPIRebornClient</id>
<name>Minecraft: Pi Edition: Reborn (Client)</name>
<metadata_license>CC0-1.0</metadata_license>
<summary>Fun with Blocks</summary>
<description><p>Minecraft: Pi Edition Modding Project.</p><p>NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.</p></description>
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn</url>
<screenshots>
<screenshot type="default">
<image>https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn/raw/branch/master/images/start.png</image>
</screenshot>
</screenshots>
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornClient.desktop</launchable>
<provides>
<id>com.thebrokenrail.MCPIRebornClient.desktop</id>
</provides>
<project_license>LicenseRef-proprietary</project_license>
<developer_name>TheBrokenRail &amp; Mojang AB</developer_name>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
<content_attribute id="violence-realistic">none</content_attribute>
<content_attribute id="violence-bloodshed">none</content_attribute>
<content_attribute id="violence-sexual">none</content_attribute>
<content_attribute id="drugs-alcohol">none</content_attribute>
<content_attribute id="drugs-narcotics">none</content_attribute>
<content_attribute id="drugs-tobacco">none</content_attribute>
<content_attribute id="sex-nudity">none</content_attribute>
<content_attribute id="sex-themes">none</content_attribute>
<content_attribute id="language-profanity">none</content_attribute>
<content_attribute id="language-humor">none</content_attribute>
<content_attribute id="language-discrimination">none</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">none</content_attribute>
<content_attribute id="social-audio">none</content_attribute>
<content_attribute id="social-location">none</content_attribute>
<content_attribute id="social-contacts">none</content_attribute>
<content_attribute id="money-purchasing">none</content_attribute>
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
</component>

View File

@ -1,9 +0,0 @@
[Desktop Entry]
Name=Minecraft: Pi Edition: Reborn (Server)
Comment=Fun with Blocks
Icon=com.thebrokenrail.MCPIRebornServer
Exec=minecraft-pi-reborn-server
Terminal=true
Type=Application
Categories=Game;
NoDisplay=true

View File

@ -1,38 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<component type="desktop">
<id>com.thebrokenrail.MCPIRebornServer</id>
<name>Minecraft: Pi Edition: Reborn (Server)</name>
<metadata_license>CC0-1.0</metadata_license>
<summary>Fun with Blocks</summary>
<description><p>Minecraft: Pi Edition Modding Project.</p><p>NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.</p></description>
<url type="homepage">https://gitea.thebrokenrail.com/TheBrokenRail/minecraft-pi-reborn</url>
<launchable type="desktop-id">com.thebrokenrail.MCPIRebornServer.desktop</launchable>
<provides>
<id>com.thebrokenrail.MCPIRebornServer.desktop</id>
</provides>
<project_license>LicenseRef-proprietary</project_license>
<developer_name>TheBrokenRail &amp; Mojang AB</developer_name>
<content_rating type="oars-1.0">
<content_attribute id="violence-cartoon">moderate</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
<content_attribute id="violence-realistic">none</content_attribute>
<content_attribute id="violence-bloodshed">none</content_attribute>
<content_attribute id="violence-sexual">none</content_attribute>
<content_attribute id="drugs-alcohol">none</content_attribute>
<content_attribute id="drugs-narcotics">none</content_attribute>
<content_attribute id="drugs-tobacco">none</content_attribute>
<content_attribute id="sex-nudity">none</content_attribute>
<content_attribute id="sex-themes">none</content_attribute>
<content_attribute id="language-profanity">none</content_attribute>
<content_attribute id="language-humor">none</content_attribute>
<content_attribute id="language-discrimination">none</content_attribute>
<content_attribute id="social-chat">intense</content_attribute>
<content_attribute id="social-info">none</content_attribute>
<content_attribute id="social-audio">none</content_attribute>
<content_attribute id="social-location">none</content_attribute>
<content_attribute id="social-contacts">none</content_attribute>
<content_attribute id="money-purchasing">none</content_attribute>
<content_attribute id="money-gambling">none</content_attribute>
</content_rating>
</component>

View File

@ -157,7 +157,7 @@ void pre_bootstrap(int argc, char *argv[]) {
for (int i = 1; i < argc; i++) {
if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-v") == 0) {
// Print
printf("Reborn v%s\n", VERSION);
printf("Reborn v%s\n", MCPI_VERSION);
fflush(stdout);
exit(EXIT_SUCCESS);
}

View File

@ -106,12 +106,15 @@ static void run_command_and_set_env(const char *env_name, const char *command[])
}
// Use Zenity To Set Environmental Variable
#define DIALOG_TITLE "Launcher"
static void run_zenity_and_set_env(const char *env_name, std::vector<std::string> command) {
// Create Full Command
std::vector<std::string> full_command;
full_command.push_back("zenity");
full_command.push_back("--title");
full_command.push_back(DIALOG_TITLE);
full_command.push_back("--name");
full_command.push_back(GUI_TITLE);
full_command.push_back(MCPI_APP_TITLE);
full_command.insert(full_command.end(), command.begin(), command.end());
// Convert To C Array
const char *full_command_array[full_command.size() + 1];

View File

@ -21,7 +21,7 @@ static void show_report(const char *log_filename) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", GUI_TITLE,
"--name", MCPI_APP_TITLE,
"--width", CRASH_REPORT_DIALOG_WIDTH,
"--height", CRASH_REPORT_DIALOG_HEIGHT,
"--text-info",

View File

@ -1,8 +1,14 @@
project(libreborn)
add_library(reborn-util STATIC src/util/elf.c src/util/exec.c src/util/string.c src/util/util.c)
target_include_directories(reborn-util PUBLIC include)
# Config
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/include/libreborn")
configure_file(include/libreborn/config.h.in "${CMAKE_CURRENT_BINARY_DIR}/include/libreborn/config.h" ESCAPE_QUOTES @ONLY)
# Util
add_library(reborn-util STATIC src/util/elf.c src/util/exec.c src/util/string.c src/util/util.c)
target_include_directories(reborn-util PUBLIC include PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/include")
# Patch
if(BUILD_ARM_COMPONENTS)
add_library(reborn-patch SHARED src/patch/patch.c)
target_link_libraries(reborn-patch dl pthread reborn-util)

View File

@ -1,3 +0,0 @@
#pragma once
#define GUI_TITLE "Minecraft: Pi Edition: Reborn"

View File

@ -0,0 +1,9 @@
#pragma once
#cmakedefine MCPI_SERVER_MODE
#cmakedefine MCPI_HEADLESS_MODE
#cmakedefine MCPI_IS_APPIMAGE_BUILD
#cmakedefine MCPI_BUNDLE_ARMHF_SYSROOT
#cmakedefine MCPI_USE_GLES1_COMPATIBILITY_LAYER
#cmakedefine MCPI_APP_TITLE "@MCPI_APP_TITLE@"
#cmakedefine MCPI_VERSION "@MCPI_VERSION@"

View File

@ -1,6 +1,6 @@
#pragma once
#include "config.h"
#include <libreborn/config.h>
#include "log.h"
#include "util.h"
#include "string.h"

View File

@ -34,7 +34,7 @@ static void *chat_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", GUI_TITLE,
"--name", MCPI_APP_TITLE,
"--entry",
"--text", "Enter Chat Message:",
NULL

View File

@ -20,7 +20,7 @@
// Custom Title
HOOK(SDL_WM_SetCaption, void, (__attribute__((unused)) const char *title, const char *icon)) {
ensure_SDL_WM_SetCaption();
(*real_SDL_WM_SetCaption)(GUI_TITLE, icon);
(*real_SDL_WM_SetCaption)(MCPI_APP_TITLE, icon);
}
// Mouse Cursor Is Always Invisible In Vanilla MCPI

View File

@ -89,7 +89,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", GUI_TITLE,
"--name", MCPI_APP_TITLE,
"--entry",
"--text", "Enter World Name:",
"--entry-text", DEFAULT_WORLD_NAME,
@ -116,7 +116,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", GUI_TITLE,
"--name", MCPI_APP_TITLE,
"--list",
"--radiolist",
"--width", GAME_MODE_DIALOG_SIZE,
@ -149,7 +149,7 @@ static void *create_world_thread(__attribute__((unused)) void *nop) {
const char *command[] = {
"zenity",
"--title", DIALOG_TITLE,
"--name", GUI_TITLE,
"--name", MCPI_APP_TITLE,
"--entry",
"--only-numerical",
"--text", "Enter Seed (Leave Blank For Random):",

View File

@ -9,7 +9,7 @@ char *version_get() {
static char *version = NULL;
// Load
if (version == NULL) {
safe_asprintf(&version, "%s / Reborn v" VERSION, *minecraft_pi_version);
safe_asprintf(&version, "%s / Reborn v" MCPI_VERSION, *minecraft_pi_version);
}
// Return
return version;