diff --git a/.github/actions/setup-dependencies/linux/action.yml b/.github/actions/setup-dependencies/linux/action.yml index 877b8aa6e..e47941ce3 100644 --- a/.github/actions/setup-dependencies/linux/action.yml +++ b/.github/actions/setup-dependencies/linux/action.yml @@ -11,9 +11,31 @@ runs: sudo apt-get -y install \ dpkg-dev \ ninja-build extra-cmake-modules pkg-config scdoc \ - cmark-dev libarchive-dev libqrencode-dev tomlplusplus-dev zlib-dev \ + cmark libarchive-dev libcmark-dev libqrencode-dev zlib1g-dev \ appstream libxcb-cursor-dev + # TODO(@getchoo): Install with the above when all targets use Ubuntu 24.04 + - name: Install tomlplusplus + if: ${{ runner.arch == 'ARM64' }} + shell: bash + run: | + sudo apt-get -y install libtomlplusplus-dev + + # FIXME(@getchoo): THIS IS HORRIBLE TO DO! + # Install tomlplusplus from Ubuntu 24.04, since it never got backported to 22.04 + # I've done too much to continue keeping this as a submodule.... + - name: Install tomlplusplus from 24.04 + if: ${{ runner.arch != 'ARM64' }} + shell: bash + run: | + deb_arch="$(dpkg-architecture -q DEB_HOST_ARCH)" + curl -Lo libtomlplusplus-dev.deb http://mirrors.kernel.org/ubuntu/pool/universe/t/tomlplusplus/libtomlplusplus-dev_3.4.0+ds-0.2build1_"$deb_arch".deb + curl -Lo libtomlplusplus3t64.deb http://mirrors.kernel.org/ubuntu/pool/universe/t/tomlplusplus/libtomlplusplus3t64_3.4.0+ds-0.2build1_"$deb_arch".deb + sudo dpkg -i libtomlplusplus3t64.deb + sudo dpkg -i libtomlplusplus-dev.deb + rm *.deb + sudo apt-get install -f + - name: Setup AppImage tooling shell: bash run: | diff --git a/.gitmodules b/.gitmodules index 246d9d791..f2d71ef29 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,18 +1,6 @@ -[submodule "libraries/tomlplusplus"] - path = libraries/tomlplusplus - url = https://github.com/marzer/tomlplusplus.git [submodule "libraries/libnbtplusplus"] path = libraries/libnbtplusplus url = https://github.com/PrismLauncher/libnbtplusplus.git -[submodule "libraries/zlib"] - path = libraries/zlib - url = https://github.com/madler/zlib.git -[submodule "libraries/extra-cmake-modules"] - path = libraries/extra-cmake-modules - url = https://github.com/KDE/extra-cmake-modules -[submodule "libraries/cmark"] - path = libraries/cmark - url = https://github.com/commonmark/cmark.git [submodule "flatpak/shared-modules"] path = flatpak/shared-modules url = https://github.com/flathub/shared-modules.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 3fbf33554..0cefd727a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -104,9 +104,6 @@ endif() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_WARN_DEPRECATED_UP_TO=0x060200") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DQT_DISABLE_DEPRECATED_UP_TO=0x060000") -# Fix aarch64 build for toml++ -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTOML_ENABLE_FLOAT16=0") - # set CXXFLAGS for build targets set(CMAKE_CXX_FLAGS_RELEASE "-O2 -D_FORTIFY_SOURCE=2 ${CMAKE_CXX_FLAGS_RELEASE}") @@ -174,20 +171,9 @@ endif() option(BUILD_TESTING "Build the testing tree." ON) -find_package(ECM QUIET NO_MODULE) -if(NOT ECM_FOUND) - if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/extra-cmake-modules/CMakeLists.txt") - message(STATUS "Using bundled ECM") - set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/libraries/extra-cmake-modules/modules;${CMAKE_MODULE_PATH}") - else() - message(FATAL_ERROR - " Could not find ECM\n \n" - " Either install ECM using the system package manager or clone submodules\n" - " Submodules can be cloned with 'git submodule update --init --recursive'") - endif() -else() - set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}") -endif() +find_package(ECM NO_MODULE REQUIRED) +set(CMAKE_MODULE_PATH "${ECM_MODULE_PATH};${CMAKE_MODULE_PATH}") + include(CTest) include(ECMAddTests) if(BUILD_TESTING) @@ -326,6 +312,8 @@ if(Launcher_QT_VERSION_MAJOR EQUAL 6) set(QT_LIBEXECS_DIR ${QT${QT_VERSION_MAJOR}_INSTALL_PREFIX}/${QT${QT_VERSION_MAJOR}_INSTALL_LIBEXECS}) endif() +find_package(cmark REQUIRED) + # Find libqrencode ## NOTE(@getchoo): Never use pkg-config with MSVC since the vcpkg port makes our install bundle fail to find the dll if(MSVC) @@ -339,27 +327,17 @@ else() endif() # Find libarchive through CMake packages, mainly for vcpkg -find_package(LibArchive QUIET) +find_package(LibArchive) # CMake packages aren't available in most distributions of libarchive, so fallback to pkg-config if(NOT LibArchive_FOUND) find_package(PkgConfig REQUIRED) pkg_check_modules(libarchive REQUIRED IMPORTED_TARGET libarchive) endif() -# Find toml++ -find_package(tomlplusplus 3.2.0 QUIET) -# Fallback to pkg-config (if available) if CMake files aren't found -if(NOT tomlplusplus_FOUND) - find_package(PkgConfig QUIET) - if(PkgConfig_FOUND) - pkg_check_modules(tomlplusplus IMPORTED_TARGET tomlplusplus>=3.2.0) - endif() -endif() +find_package(tomlplusplus 3.2.0 REQUIRED) +find_package(ZLIB REQUIRED) -# Find cmark -find_package(cmark QUIET) - include(ECMQtDeclareLoggingCategory) ####################################### Program Info ####################################### @@ -467,52 +445,8 @@ add_subdirectory(libraries/systeminfo) # system information library add_subdirectory(libraries/launcher) # java based launcher part for Minecraft add_subdirectory(libraries/javacheck) # java compatibility checker -find_package(ZLIB QUIET) -if(NOT ZLIB_FOUND) - message(STATUS "Using bundled zlib") - - set(CMAKE_POLICY_DEFAULT_CMP0069 NEW) # Suppress cmake warnings and allow INTERPROCEDURAL_OPTIMIZATION for zlib - set(SKIP_INSTALL_ALL ON) - add_subdirectory(libraries/zlib EXCLUDE_FROM_ALL) - - # On OS where unistd.h exists, zlib's generated header defines `Z_HAVE_UNISTD_H`, while the included header does not. - # We cannot safely undo the rename on those systems, and they generally have packages for zlib anyway. - check_include_file(unistd.h NEED_GENERATED_ZCONF) - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib/zconf.h.included" AND NOT NEED_GENERATED_ZCONF) - # zlib's cmake script renames a file, dirtying the submodule, see https://github.com/madler/zlib/issues/162 - message(STATUS "Undoing Rename") - message(STATUS " ${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib/zconf.h") - file(RENAME "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib/zconf.h.included" "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib/zconf.h") - endif() - - set(ZLIB_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/libraries/zlib" "${CMAKE_CURRENT_SOURCE_DIR}/libraries/zlib" CACHE STRING "" FORCE) - set_target_properties(zlibstatic PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ZLIB_INCLUDE_DIR}") - add_library(ZLIB::ZLIB ALIAS zlibstatic) - set(ZLIB_LIBRARY ZLIB::ZLIB CACHE STRING "zlib library name") - - find_package(ZLIB REQUIRED) -else() - message(STATUS "Using system zlib") -endif() add_subdirectory(libraries/rainbow) # Qt extension for colors add_subdirectory(libraries/LocalPeer) # fork of a library from Qt solutions -if(NOT tomlplusplus_FOUND) - message(STATUS "Using bundled tomlplusplus") - add_subdirectory(libraries/tomlplusplus) # toml parser -else() - message(STATUS "Using system tomlplusplus") -endif() -if(NOT cmark_FOUND) - message(STATUS "Using bundled cmark") - set(ORIGINAL_BUILD_TESTING ${BUILD_TESTING}) - set(BUILD_TESTING 0) - set(BUILD_SHARED_LIBS 0) - add_subdirectory(libraries/cmark EXCLUDE_FROM_ALL) # Markdown parser - add_library(cmark::cmark ALIAS cmark) - set(BUILD_TESTING ${ORIGINAL_BUILD_TESTING}) -else() - message(STATUS "Using system cmark") -endif() add_subdirectory(libraries/gamemode) add_subdirectory(libraries/murmur2) # Hash for usage with the CurseForge API add_subdirectory(libraries/qdcss) # css parser diff --git a/flatpak/cmark.yml b/flatpak/cmark.yml new file mode 100644 index 000000000..d5078baab --- /dev/null +++ b/flatpak/cmark.yml @@ -0,0 +1,14 @@ +name: cmark +buildsystem: cmake-ninja +builddir: true +config-opts: + - -DCMAKE_TESTS=OFF +sources: + - type: archive + url: https://github.com/commonmark/cmark/archive/0.31.1.tar.gz + sha256: 3da93db5469c30588cfeb283d9d62edfc6ded9eb0edc10a4f5bbfb7d722ea802 + x-checker-data: + type: anitya + project-id: 9159 + stable-only: true + url-template: https://github.com/commonmark/cmark/archive/$version.tar.gz diff --git a/flatpak/org.prismlauncher.PrismLauncher.yml b/flatpak/org.prismlauncher.PrismLauncher.yml index 136aef91a..80ed8158d 100644 --- a/flatpak/org.prismlauncher.PrismLauncher.yml +++ b/flatpak/org.prismlauncher.PrismLauncher.yml @@ -27,6 +27,9 @@ finish-args: - --filesystem=/sys/kernel/mm/transparent_hugepage:ro modules: + - cmark.yml + - tomlplusplus.yml + # Might be needed by some Controller mods (see https://github.com/isXander/Controlify/issues/31) - shared-modules/libusb/libusb.json diff --git a/flatpak/tomlplusplus.yml b/flatpak/tomlplusplus.yml new file mode 100644 index 000000000..0afaf6678 --- /dev/null +++ b/flatpak/tomlplusplus.yml @@ -0,0 +1,6 @@ +name: tomlplusplus +buildsystem: cmake-ninja +sources: + - type: archive + url: https://github.com/marzer/tomlplusplus/archive/v3.4.0.tar.gz + sha256: 8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155 diff --git a/libraries/README.md b/libraries/README.md index 2ebb80515..8cd49d24b 100644 --- a/libraries/README.md +++ b/libraries/README.md @@ -10,14 +10,6 @@ See [github repo](https://github.com/FeralInteractive/gamemode). BSD-3-Clause licensed -## cmark - -The C reference implementation of CommonMark, a standardized Markdown spec. - -See [github_repo](https://github.com/commonmark/cmark). - -BSD2 licensed. - ## javacheck Simple Java tool that prints the JVM details - version and platform bitness. @@ -99,22 +91,6 @@ Canonical implementation of the murmur2 hash, taken from [SMHasher](https://gith Public domain (the author disclaimed the copyright). -## QR-Code-generator - -A simple library for generating QR codes - -See [github repo](https://github.com/nayuki/QR-Code-generator). - -MIT - -## libarchive - -Multi-format archive and compression library. - -See [github repo](https://github.com/libarchive/libarchive). - -BSD 2-Clause license with some exception. - ## rainbow Color functions extracted from [KGuiAddons](https://inqlude.org/libraries/kguiaddons.html). Used for adaptive text coloring. @@ -127,14 +103,6 @@ A Prism Launcher-specific library for probing system information. Apache 2.0 -## tomlplusplus - -A TOML language parser. Used by Forge 1.14+ to store mod metadata. - -See [github repo](https://github.com/marzer/tomlplusplus). - -Licenced under the MIT licence. - ## qdcss A quick and dirty css parser, used by NilLoader to store mod metadata. diff --git a/libraries/cmark b/libraries/cmark deleted file mode 160000 index 3460cd809..000000000 --- a/libraries/cmark +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 3460cd809b6dd311b58e92733ece2fc956224fd2 diff --git a/libraries/extra-cmake-modules b/libraries/extra-cmake-modules deleted file mode 160000 index 1f820dc98..000000000 --- a/libraries/extra-cmake-modules +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 1f820dc98d0a520c175433bcbb0098327d82aac6 diff --git a/libraries/tomlplusplus b/libraries/tomlplusplus deleted file mode 160000 index c4369ae1d..000000000 --- a/libraries/tomlplusplus +++ /dev/null @@ -1 +0,0 @@ -Subproject commit c4369ae1d8955cae20c4ab40b9813ef4b60e48be diff --git a/libraries/zlib b/libraries/zlib deleted file mode 160000 index 51b7f2abd..000000000 --- a/libraries/zlib +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 51b7f2abdade71cd9bb0e7a373ef2610ec6f9daf