diff --git a/CMakeLists.txt b/CMakeLists.txt index c23d1175..4f662585 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -189,6 +189,7 @@ if(BUILD_NATIVE_COMPONENTS) # Configure CMAKE_CACHE_ARGS ${ARM_OPTIONS} CMAKE_GENERATOR "Ninja Multi-Config" + CONFIGURE_HANDLED_BY_BUILD TRUE # Build BUILD_COMMAND "${CMAKE_COMMAND}" "--build" "" "--config" "$" diff --git a/README.md b/README.md index c00d952f..9c82ecc5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@

- Start Screen + Start Screen

diff --git a/cmake/cpack/appimage.cmake b/cmake/cpack/appimage.cmake index b7726687..d3e59b0b 100644 --- a/cmake/cpack/appimage.cmake +++ b/cmake/cpack/appimage.cmake @@ -1,28 +1,9 @@ -# Utility Functions -include("${CMAKE_CURRENT_LIST_DIR}/../util/util.cmake") - -# Download AppImage Runtime -set(RUNTIME_ARCH "unknown") -if(CPACK_MCPI_ARCH STREQUAL "armhf") - set(RUNTIME_ARCH "armhf") -elseif(CPACK_MCPI_ARCH STREQUAL "arm64") - set(RUNTIME_ARCH "aarch64") -elseif(CPACK_MCPI_ARCH STREQUAL "amd64") - set(RUNTIME_ARCH "x86_64") -endif() -set(RUNTIME "${CPACK_TOPLEVEL_DIRECTORY}/runtime") -safe_download( - "AppImage Runtime" - "https://github.com/AppImage/type2-runtime/releases/download/continuous/runtime-${RUNTIME_ARCH}" - "${RUNTIME}" -) - # Package set(APPIMAGE_ARCH "unknown") if(CPACK_MCPI_ARCH STREQUAL "armhf") set(APPIMAGE_ARCH "arm") elseif(CPACK_MCPI_ARCH STREQUAL "arm64") - set(APPIMAGE_ARCH "arm_aarch64") + set(APPIMAGE_ARCH "aarch64") elseif(CPACK_MCPI_ARCH STREQUAL "amd64") set(APPIMAGE_ARCH "x86_64") endif() @@ -33,8 +14,6 @@ execute_process( "VERSION=${CPACK_MCPI_VERSION}" "appimagetool" "--updateinformation" "zsync|${CPACK_MCPI_REPO}/releases/download/latest/${CPACK_PACKAGE_FILE_NAME_ZSYNC}${CPACK_MCPI_APPIMAGE_ZSYNC_EXT}" - "--runtime-file" "${RUNTIME}" - "--comp" "zstd" "${CPACK_TEMPORARY_DIRECTORY}" "${CPACK_PACKAGE_FILE_NAME}${CPACK_MCPI_APPIMAGE_EXT}" WORKING_DIRECTORY "${CPACK_PACKAGE_DIRECTORY}" diff --git a/cmake/options/extra-options.cmake b/cmake/options/extra-options.cmake index 6cfd6770..55bcf637 100644 --- a/cmake/options/extra-options.cmake +++ b/cmake/options/extra-options.cmake @@ -29,9 +29,13 @@ else() set(BUILD_MEDIA_LAYER_CORE "${BUILD_ARM_COMPONENTS}") endif() +# Author +mcpi_option(AUTHOR "Author" STRING "TheBrokenRail") +mcpi_option(AUTHOR_ID "Author ID" STRING "com.thebrokenrail") + # App Information mcpi_option(APP_NAME "App Name" STRING "minecraft-pi-reborn") -mcpi_option(APP_ID "App ID" STRING "com.thebrokenrail.MCPIReborn") +mcpi_option(APP_ID "App ID" STRING "${MCPI_AUTHOR_ID}.MCPIReborn") mcpi_option(APP_TITLE "App Title" STRING "Minecraft: Pi Edition: Reborn") # Skin Server @@ -49,9 +53,6 @@ set_property( file(STRINGS "${CMAKE_CURRENT_LIST_DIR}/../../VERSION" MCPI_VERSION) file(TIMESTAMP "${CMAKE_CURRENT_LIST_DIR}/../../VERSION" MCPI_VERSION_DATE "%Y-%m-%d" UTC) -# Author -mcpi_option(AUTHOR "Author" STRING "TheBrokenRail") - # Homepage mcpi_option(REPO_HOST "Repository Host" STRING "https://gitea.thebrokenrail.com") mcpi_option(REPO_PATH "Repository Path" STRING "minecraft-pi-reborn/minecraft-pi-reborn") diff --git a/images/screenshots/launcher.png b/images/screenshots/launcher.png new file mode 100644 index 00000000..01d7fd7a Binary files /dev/null and b/images/screenshots/launcher.png differ diff --git a/images/screenshots/start.png b/images/screenshots/start.png new file mode 100644 index 00000000..06c494c3 Binary files /dev/null and b/images/screenshots/start.png differ diff --git a/images/start.png b/images/start.png deleted file mode 100644 index 68f80e8e..00000000 Binary files a/images/start.png and /dev/null differ diff --git a/launcher/data/appstream.xml b/launcher/data/appstream.xml index 292ce716..f67269ae 100644 --- a/launcher/data/appstream.xml +++ b/launcher/data/appstream.xml @@ -1,48 +1,65 @@ - + ${MCPI_APP_ID} + ${MCPI_APP_TITLE} - CC0-1.0

Fun with Blocks

Minecraft: Pi Edition Modding Project.

NOTE: This is not verified by, affiliated with, or supported by Mojang or Microsoft.

+ + + Game + Simulation + + + sandbox + world + mining + crafting + blocks + multiplayer + + + CC0-1.0 + LicenseRef-proprietary + + + ${MCPI_AUTHOR} & Mojang AB + + ${MCPI_REPO} + ${MCPI_DISCORD_INVITE} + + + + ${MCPI_REPO}/raw/branch/master/images/screenshots/start.png + Start Screen + + + ${MCPI_REPO}/raw/branch/master/images/screenshots/launcher.png + Launcher + + + ${MCPI_APP_ID}.desktop - ${MCPI_APP_ID}.desktop + ${MCPI_APP_NAME} - LicenseRef-proprietary - ${MCPI_AUTHOR} & Mojang AB - + + + pointing + keyboard + 360 + + + moderate - none - none - none - none - none - none - none - none - none - none - none - none intense - none - none - none - none - none - none + - - - ${MCPI_REPO}/raw/branch/master/images/start.png - - \ No newline at end of file diff --git a/scripts/build.mjs b/scripts/build.mjs index 1097dfbe..248b9a4b 100755 --- a/scripts/build.mjs +++ b/scripts/build.mjs @@ -1,7 +1,8 @@ #!/usr/bin/env node import * as path from 'node:path'; import * as fs from 'node:fs'; -import { info, err, run, createDir, getScriptsDir, getBuildToolsBin, getParallelFlag } from './lib/util.mjs'; +import * as os from 'node:os'; +import { info, err, run, createDir, getScriptsDir, getBuildToolsBin } from './lib/util.mjs'; import { parseOptions, Enum, Architectures } from './lib/options.mjs'; // CMake Options @@ -100,9 +101,9 @@ if (!options.install) { // Use Build Tools const buildTools = getBuildToolsBin(); -const makeTool = 'make'; -const hasBuildTools = fs.existsSync(path.join(buildTools, makeTool)); -if (hasBuildTools) { +const jobserver = 'jobserver_pool.py'; +const supportsJobserver = fs.existsSync(path.join(buildTools, jobserver)); +if (supportsJobserver) { function prependEnv(env, value) { const old = process.env[env]; if (old) { @@ -123,12 +124,11 @@ run(configure); // Build const configArg = ['--config', options.debug ? 'Debug' : 'Release']; -if (hasBuildTools) { - fs.writeFileSync(path.join(build, 'Makefile'), `.PHONY: all\nall:\n\t+@cmake --build . ${configArg.join(' ')}\n`); - run([makeTool, '-C', build, getParallelFlag(), '--jobserver-style=fifo']); -} else { - run(['cmake', '--build', build, getParallelFlag(), ...configArg]); +const buildCommand = ['cmake', '--build', build, ...configArg]; +if (supportsJobserver) { + buildCommand.unshift(jobserver, '--fifo', path.join(os.tmpdir(), '.jobserver-' + process.pid)); } +run(buildCommand); // Package if (options.packageType !== PackageTypes.AppImage) { diff --git a/scripts/install-dependencies.mjs b/scripts/install-dependencies.mjs index 49342d7e..483da558 100755 --- a/scripts/install-dependencies.mjs +++ b/scripts/install-dependencies.mjs @@ -1,7 +1,7 @@ #!/usr/bin/env node import * as path from 'node:path'; import * as fs from 'node:fs'; -import { err, run, getDebianVersion, info, doesPackageExist, getBuildToolsDir, createDir, getBuildToolsBin, getParallelFlag } from './lib/util.mjs'; +import { err, run, getDebianVersion, info, doesPackageExist, getBuildToolsDir, createDir } from './lib/util.mjs'; import { parseOptions, Enum, Architectures } from './lib/options.mjs'; // Check System @@ -75,9 +75,17 @@ handlers.set(Modes.Build, function () { addPackageForBuild( 'git', 'cmake' + backportsSuffix, - // For Build Tools - 'make', - 're2c' + // For Building Ninja + 'ninja-build', + 're2c', + // For Building AppStream + 'libyaml-dev', + 'libxmlb-dev', + 'liblzma-dev', + 'libcurl4-openssl-dev', + 'libglib2.0-dev', + 'meson', + 'gperf' ); // Compiler @@ -112,10 +120,7 @@ handlers.set(Modes.Build, function () { addPackageForHost('libglib2.0-dev'); // AppImage Dependencies - addPackageForBuild( - 'appstream', - 'zsync' - ); + addPackageForBuild('zsync'); // Install Packages installPackages(); @@ -126,11 +131,10 @@ handlers.set(Modes.Build, function () { createDir(buildDir, false); run([ 'cmake', - '-DCMAKE_BUILD_TYPE=Release', - '-DCMAKE_INSTALL_PREFIX=' + getBuildToolsBin(), + '-GNinja', '-S', buildToolsDir, '-B', buildDir ]); - run(['cmake', '--build', buildDir, getParallelFlag()]); + run(['cmake', '--build', buildDir]); run(['cmake', '--install', buildDir]); }); diff --git a/scripts/lib/util.mjs b/scripts/lib/util.mjs index 1274ec42..7034d969 100644 --- a/scripts/lib/util.mjs +++ b/scripts/lib/util.mjs @@ -2,7 +2,6 @@ import * as child_process from 'node:child_process'; import * as fs from 'node:fs'; import * as path from 'node:path'; import * as url from 'node:url'; -import * as os from 'node:os'; // Logging const EXIT_FAILURE = 1; @@ -72,9 +71,4 @@ export function getBuildToolsBin() { const dir = path.join(getBuildToolsDir(), 'bin'); createDir(dir, false); return dir; -} - -// Get '-jX' Flag For Build Tools -export function getParallelFlag() { - return '-j' + os.cpus().length; } \ No newline at end of file diff --git a/scripts/screenshot.sh b/scripts/screenshot.sh index b14b885d..73343b10 100755 --- a/scripts/screenshot.sh +++ b/scripts/screenshot.sh @@ -5,9 +5,38 @@ set -e # Setup export XDG_SESSION_TYPE=x11 unset MCPI_GUI_SCALE -export PATH="$(pwd)/out/host/usr/bin:${PATH}" +unset MCPI_USERNAME +export PATH="$(pwd)/out/none/host/usr/bin:${PATH}" -# Setup Feature Flags +# Game Directory +export MCPI_PROFILE_DIRECTORY="$(pwd)/.testing-tmp" +rm -rf "${MCPI_PROFILE_DIRECTORY}" +mkdir "${MCPI_PROFILE_DIRECTORY}" + +# Take Screenshot +screenshot() { + # Arguments + IMAGE="images/screenshots/$1.png" + TIMER="$2" + shift 2 + + # Run + minecraft-pi-reborn "$@" & + PID="$!" + + # Screenshot + sleep "${TIMER}" + gnome-screenshot --window "--file=${IMAGE}" + + # Kill + kill "${PID}" + wait "${PID}" || : +} + +# Launcher +screenshot launcher 0.5 + +# Start Screen export MCPI_FEATURE_FLAGS="$( # Get All Feature Flags minecraft-pi-reborn --print-available-feature-flags | @@ -19,15 +48,4 @@ export MCPI_FEATURE_FLAGS="$( # Format tr '\n' '|' )" - -# Run -minecraft-pi-reborn --default --no-cache & -PID="$!" - -# Screenshot -sleep 3 -gnome-screenshot --window --file=images/start.png - -# Kill -kill "${PID}" -wait "${PID}" +screenshot start 3 --default \ No newline at end of file diff --git a/scripts/test.sh b/scripts/test.sh index 47c10d00..d822aceb 100755 --- a/scripts/test.sh +++ b/scripts/test.sh @@ -19,7 +19,7 @@ fi # Make Test Directory TEST_WORKING_DIR="$(pwd)/.testing-tmp" rm -rf "${TEST_WORKING_DIR}" -mkdir -p "${TEST_WORKING_DIR}" +mkdir "${TEST_WORKING_DIR}" ROOT="$(pwd)" cd "${TEST_WORKING_DIR}" @@ -34,7 +34,7 @@ if [ "${MODE}" = "server" ]; then ./tmp.AppImage --appimage-extract-and-run --server --only-generate else # Client Test - export HOME="${TEST_WORKING_DIR}" + export MCPI_PROFILE_DIRECTORY="${TEST_WORKING_DIR}" ./tmp.AppImage --appimage-extract-and-run --default --no-cache --benchmark --force-headless fi diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt index 8cb472d2..733b805c 100644 --- a/tools/CMakeLists.txt +++ b/tools/CMakeLists.txt @@ -1,40 +1,32 @@ cmake_minimum_required(VERSION 3.25.0) -project(tools) # Utility Functions include(../cmake/util/util.cmake) +# Force Build Type +force_set(CMAKE_BUILD_TYPE "Release" STRING) + +# Project +project(tools) + # Options force_set(BUILD_TESTING FALSE BOOL) force_set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/bin" FILEPATH) force_set(CMAKE_INSTALL_BINDIR "." FILEPATH) +# Versions +set(NINJA_VERSION "jobserver") +set(APPIMAGETOOL_VERSION "continuous") +set(APPSTREAM_VERSION "v1.0.4") + # Ninja include(FetchContent) FetchContent_Declare(ninja GIT_REPOSITORY "https://github.com/digit-google/ninja.git" - GIT_TAG jobserver + GIT_TAG "${NINJA_VERSION}" ) FetchContent_MakeAvailable(ninja) - -# Make -include(ExternalProject) -ExternalProject_Add(make - URL "https://ftp.gnu.org/gnu/make/make-4.4.1.tar.gz" - URL_HASH "SHA256=dd16fb1d67bfab79a72f5e8390735c49e3e8e70b4945a15ab1f81ddb78658fb3" - DOWNLOAD_EXTRACT_TIMESTAMP TRUE - CONFIGURE_COMMAND - "/configure" - "--prefix=" - "--without-guile" - "--enable-silent-rules" - "--quiet" - "CFLAGS=${CMAKE_C_FLAGS}" - BUILD_IN_SOURCE TRUE - INSTALL_COMMAND "" -) -ExternalProject_Get_Property(make SOURCE_DIR) -install(PROGRAMS "${SOURCE_DIR}/make" DESTINATION "${CMAKE_INSTALL_BINDIR}") +install(PROGRAMS "${ninja_SOURCE_DIR}/misc/jobserver_pool.py" TYPE BIN) # Download AppImageTool execute_process(COMMAND uname -m OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE) @@ -45,7 +37,7 @@ set(APPIMAGETOOL_NAME "appimagetool") set(APPIMAGETOOL_BIN "${CMAKE_CURRENT_BINARY_DIR}/${APPIMAGETOOL_NAME}.AppImage") safe_download( "AppImageTool" - "https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-${ARCH}.AppImage" + "https://github.com/AppImage/appimagetool/releases/download/${APPIMAGETOOL_VERSION}/appimagetool-${ARCH}.AppImage" "${APPIMAGETOOL_BIN}" ) # Fix @@ -58,4 +50,35 @@ file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/${APPIMAGETOOL_NAME}" "#!/bin/sh\n" "exec \"${APPIMAGETOOL_BIN}\" --appimage-extract-and-run \"\$@\"\n" ) -install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${APPIMAGETOOL_NAME}" DESTINATION "${CMAKE_INSTALL_BINDIR}") \ No newline at end of file +install(PROGRAMS "${CMAKE_CURRENT_BINARY_DIR}/${APPIMAGETOOL_NAME}" TYPE BIN) + +# AppStream +include(ExternalProject) +ExternalProject_Add(appstream + GIT_REPOSITORY "https://github.com/ximion/appstream.git" + GIT_TAG "${APPSTREAM_VERSION}" + # Patch + PATCH_COMMAND sed -i "/i18n\\|po\\/\\|data\\/\\|docs\\/\\|tests\\//d" meson.build + # Configure + CONFIGURE_COMMAND + "meson" "setup" + "--reconfigure" + "--prefix=" + "--buildtype=release" + "--default-library=static" + "-Dsystemd=false" + "-Dstemming=false" + "-Dgir=false" + "-Dzstd-support=false" + "" "" + CONFIGURE_HANDLED_BY_BUILD TRUE + USES_TERMINAL_CONFIGURE TRUE + # Build + BUILD_COMMAND "meson" "compile" + USES_TERMINAL_BUILD TRUE + # Install + INSTALL_COMMAND "meson" "install" "--quiet" + USES_TERMINAL_INSTALL TRUE +) +ExternalProject_Get_Property(appstream INSTALL_DIR) +install(PROGRAMS "${INSTALL_DIR}/bin/appstreamcli" TYPE BIN) \ No newline at end of file