From 723d5160c811b528cdd193c7105f9ccfb24476ef Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 27 Feb 2025 08:33:56 -0500 Subject: [PATCH] Some Fixes --- launcher/CMakeLists.txt | 89 +++++--------------------------- launcher/data/appstream.xml | 48 +++++++++++++++++ launcher/data/launcher.desktop | 10 ++++ scripts/install-dependencies.mjs | 9 +++- scripts/lib/util.mjs | 9 ++++ 5 files changed, 88 insertions(+), 77 deletions(-) create mode 100644 launcher/data/appstream.xml create mode 100644 launcher/data/launcher.desktop diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 4a87e022..921d4982 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -38,81 +38,20 @@ target_compile_definitions(launcher PRIVATE _FILE_OFFSET_BITS=64) install(TARGETS launcher DESTINATION "${MCPI_INSTALL_DIR}") install_symlink("../${MCPI_INSTALL_DIR}/launcher" "bin/${MCPI_APP_NAME}") -# 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_APP_NAME}\n" - "Type=Application\n" - "Categories=Game;\n" - "Terminal=false\n" - "StartupNotify=false\n" - "StartupWMClass=${MCPI_APP_ID}\n" -) -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/launcher.desktop" - DESTINATION "${MCPI_SHARE_DIR}/applications" - RENAME "${MCPI_APP_ID}.desktop" -) - -# Install AppStream Metadata -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml" - "\n" - "\n" - " ${MCPI_APP_ID}\n" - " ${MCPI_APP_TITLE}\n" - " CC0-1.0\n" - " Fun with Blocks\n" - " \n" - "

Minecraft: Pi Edition Modding Project.

\n" - "

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

\n" - "
\n" - " ${MCPI_REPO}\n" - " ${MCPI_APP_ID}.desktop\n" - " \n" - " ${MCPI_APP_ID}.desktop\n" - " \n" - " LicenseRef-proprietary\n" - " ${MCPI_AUTHOR} & Mojang AB\n" - " \n" - " moderate\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " intense\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " none\n" - " \n" - " \n" - " \n" - " \n" - " \n" - " \n" - " ${MCPI_REPO}/raw/branch/master/images/start.png\n" - " \n" - " \n" - "
\n" -) -install( - FILES "${CMAKE_CURRENT_BINARY_DIR}/appstream.xml" - DESTINATION "${MCPI_SHARE_DIR}/metainfo" - RENAME "${MCPI_APP_ID}.appdata.xml" -) +# Data +set(DATA_DIR "data") +set_and_mkdir(CONFIGURED_DATA_DIR "${CMAKE_CURRENT_BINARY_DIR}/${DATA_DIR}") +function(configure_and_install_data input_name output_path output_name) + set(configured_path "${CONFIGURED_DATA_DIR}/${input_name}") + configure_file("${DATA_DIR}/${input_name}" "${configured_path}" ESCAPE_QUOTES) + install( + FILES "${configured_path}" + DESTINATION "${MCPI_SHARE_DIR}/${output_path}" + RENAME "${output_name}" + ) +endfunction() +configure_and_install_data(launcher.desktop applications "${MCPI_APP_ID}.desktop") +configure_and_install_data(appstream.xml metainfo "${MCPI_APP_ID}.appdata.xml") # AppImage if(MCPI_IS_APPIMAGE_BUILD) diff --git a/launcher/data/appstream.xml b/launcher/data/appstream.xml new file mode 100644 index 00000000..292ce716 --- /dev/null +++ b/launcher/data/appstream.xml @@ -0,0 +1,48 @@ + + + ${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.

+
+ ${MCPI_REPO} + ${MCPI_APP_ID}.desktop + + ${MCPI_APP_ID}.desktop + + LicenseRef-proprietary + ${MCPI_AUTHOR} & Mojang AB + + 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/launcher/data/launcher.desktop b/launcher/data/launcher.desktop new file mode 100644 index 00000000..9e8c9855 --- /dev/null +++ b/launcher/data/launcher.desktop @@ -0,0 +1,10 @@ +[Desktop Entry] +Name=${MCPI_APP_TITLE} +Comment=Fun with Blocks +Icon=${MCPI_APP_ID} +Exec=${MCPI_APP_NAME} +Type=Application +Categories=Game; +Terminal=false +StartupNotify=false +StartupWMClass=${MCPI_APP_ID} \ No newline at end of file diff --git a/scripts/install-dependencies.mjs b/scripts/install-dependencies.mjs index 846f69ee..3262465b 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, makeExecutable, getDebianVersion, getScriptsDir, info } from './lib/util.mjs'; +import { err, run, makeExecutable, getDebianVersion, getScriptsDir, info, doesPackageExist } from './lib/util.mjs'; import { parseOptions, Enum, Architectures } from './lib/options.mjs'; // Check System @@ -125,11 +125,16 @@ handlers.set(Modes.Build, function () { // Testing Dependencies handlers.set(Modes.Test, function () { + let glib = 'libglib2.0-0'; + const newerGlib = glib + 't64'; + if (doesPackageExist(newerGlib)) { + glib = newerGlib; + } addPackageForHost( 'libc6', 'libstdc++6', 'libopenal1', - 'libglib2.0-0' + glib ); }); diff --git a/scripts/lib/util.mjs b/scripts/lib/util.mjs index 75c9d2e4..dd5fab97 100644 --- a/scripts/lib/util.mjs +++ b/scripts/lib/util.mjs @@ -25,6 +25,15 @@ export function run(command) { err(e); } } +export function doesPackageExist(name) { + try { + info('Checking If Package Exists: ' + name); + child_process.execFileSync('apt-cache', ['show', name], {stdio: 'ignore'}); + return true; + } catch (e) { + return false; + } +} // Create Directory export function createDir(dir, clean) {