From 07baea7b5a105b7b6f7cf97316f664e229c69c9e Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Fri, 11 Mar 2022 00:00:13 -0500 Subject: [PATCH] Vendor Zenity For AppImages --- .gitmodules | 4 ++++ CMakeLists.txt | 20 +++++++++++--------- cmake/base-toolchain.cmake | 2 ++ dependencies/CMakeLists.txt | 4 ++++ dependencies/zenity/CMakeLists.txt | 15 +++++++++++++++ dependencies/zenity/src | 1 + scripts/generate-appimage-builder-yaml.js | 4 +++- scripts/install-dependencies.sh | 10 ++++++++++ 8 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 dependencies/zenity/CMakeLists.txt create mode 160000 dependencies/zenity/src diff --git a/.gitmodules b/.gitmodules index 14e4370a1..03211c809 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,7 @@ path = dependencies/glfw/src url = https://github.com/glfw/glfw.git shallow = true +[submodule "dependencies/zenity/src"] + path = dependencies/zenity/src + url = https://gitea.thebrokenrail.com/TheBrokenRail/zenity.git + shallow = true diff --git a/CMakeLists.txt b/CMakeLists.txt index 64f7a4f59..e463696f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -42,15 +42,10 @@ set(MCPI_INSTALL_DIR "lib/${MCPI_VARIANT_NAME}") set(MCPI_LIB_DIR "${MCPI_INSTALL_DIR}/lib") set(MCPI_FALLBACK_LIB_DIR "${MCPI_INSTALL_DIR}/fallback-lib") -# Optimizations +# Build Mode if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -if(CMAKE_BUILD_TYPE STREQUAL "Release") - add_compile_options(-O3) -else() - add_compile_options(-g) -endif() # Start Project project(minecraft-pi-reborn) @@ -65,6 +60,13 @@ if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "" FORCE) endif() +# Optimizations +if(CMAKE_BUILD_TYPE STREQUAL "Release") + add_compile_options(-O3) +else() + add_compile_options(-g) +endif() + # Use LLD When Using Clang if(CMAKE_C_COMPILER_ID STREQUAL "Clang") add_link_options("-fuse-ld=lld") @@ -73,6 +75,9 @@ endif() # PIC set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) +# Fast Math +add_compile_options(-ffast-math) + # Buld Dependencies add_subdirectory(dependencies) @@ -83,9 +88,6 @@ add_definitions(-D_GNU_SOURCE) set(CMAKE_C_STANDARD 99) set(CMAKE_CXX_STANDARD 11) -# Fast Math -add_compile_options(-ffast-math) - # Specify Constants if(MCPI_SERVER_MODE) add_definitions(-DMCPI_SERVER_MODE) diff --git a/cmake/base-toolchain.cmake b/cmake/base-toolchain.cmake index 4528ca458..131d92287 100644 --- a/cmake/base-toolchain.cmake +++ b/cmake/base-toolchain.cmake @@ -6,4 +6,6 @@ macro(setup_toolchain target) set(CMAKE_FIND_ROOT_PATH "/usr/${target}" "/usr/lib/${target}") # Extra set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) + # pkg-config + set(ENV{PKG_CONFIG_LIBDIR} "/usr/lib/${target}/pkgconfig:/usr/${target}/lib/pkgconfig:/usr/lib/pkgconfig:/usr/share/pkgconfig") endmacro() diff --git a/dependencies/CMakeLists.txt b/dependencies/CMakeLists.txt index 55b1488b3..9096eac3f 100644 --- a/dependencies/CMakeLists.txt +++ b/dependencies/CMakeLists.txt @@ -16,3 +16,7 @@ endif() if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE) add_subdirectory(glfw) endif() +# Zenity (Minimal AppImage Build) +if(BUILD_NATIVE_COMPONENTS AND NOT MCPI_HEADLESS_MODE AND MCPI_IS_APPIMAGE_BUILD) + add_subdirectory(zenity) +endif() diff --git a/dependencies/zenity/CMakeLists.txt b/dependencies/zenity/CMakeLists.txt new file mode 100644 index 000000000..4c14aa82b --- /dev/null +++ b/dependencies/zenity/CMakeLists.txt @@ -0,0 +1,15 @@ +project(zenity) + +# Silence Warnings +add_compile_options(-w) + +## Zenity + +# Download +add_subdirectory(src EXCLUDE_FROM_ALL) + +# Ensure Build +add_custom_target(zenity-build ALL DEPENDS zenity) + +# Install +install(TARGETS zenity DESTINATION "bin") diff --git a/dependencies/zenity/src b/dependencies/zenity/src new file mode 160000 index 000000000..6f08afb79 --- /dev/null +++ b/dependencies/zenity/src @@ -0,0 +1 @@ +Subproject commit 6f08afb7989c420282654eee9dea9d5df01e914a diff --git a/scripts/generate-appimage-builder-yaml.js b/scripts/generate-appimage-builder-yaml.js index 9e90714d0..0462d838b 100755 --- a/scripts/generate-appimage-builder-yaml.js +++ b/scripts/generate-appimage-builder-yaml.js @@ -29,7 +29,9 @@ const packages = [ if (mode === 'client') { // GLFW's Dependencies Aren't Included As They Should Be Provided By The Host System packages.push( - 'zenity', + 'libgtk-3-0', + 'libglib2.0-0', + 'libgdk-pixbuf2.0-0', 'libcanberra-gtk3-module', 'libfreeimage3', 'libopenal1' diff --git a/scripts/install-dependencies.sh b/scripts/install-dependencies.sh index 43cc986f5..203e92cd9 100755 --- a/scripts/install-dependencies.sh +++ b/scripts/install-dependencies.sh @@ -51,6 +51,11 @@ queue_pkg \ libxrandr-dev \ libxext-dev +# Zenity Dependencies +queue_pkg \ + libgtk-3-dev \ + libglib2.0-dev + # ARM Packages if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then # Build Tools @@ -72,6 +77,11 @@ if [ ! -z "${ARM_PACKAGES_SUPPORTED}" ]; then libxinerama-dev:armhf libxinerama-dev:arm64 \ libxrandr-dev:armhf libxrandr-dev:arm64 \ libxext-dev:armhf libxext-dev:arm64 + + # Zenity Dependencies + queue_pkg \ + libgtk-3-dev:armhf libgtk-3-dev:arm64 \ + libglib2.0-dev:armhf libglib2.0-dev:arm64 fi # Install appimagetool & appimage-builder Dependencies