From 6ce78c0913723e7cdbbbd887cbe4746e8c7de53b Mon Sep 17 00:00:00 2001 From: halx99 Date: Sun, 15 Sep 2024 22:09:17 +0800 Subject: [PATCH] Add build on ubuntu 24.04 support (#2152) --- core/CMakeLists.txt | 11 +++++++++-- setup.ps1 | 14 ++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 6deed277ad..deca2de071 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -459,10 +459,17 @@ if(LINUX) target_include_directories(${_AX_CORE_LIB} PUBLIC "${X11_X11_INCLUDE_PATH}") # X11 gets linked by cmake/Modules/AXLinkHelpers.cmake - # including GTK3.0 and WebKit2Gtk4.0 + # including GTK3.0 and WebKit2Gtk4.x find_package(PkgConfig REQUIRED) pkg_check_modules(GKT3 REQUIRED gtk+-3.0) - pkg_check_modules(WEBKIT2GTK webkit2gtk-4.0) + + set(_webkit2gtk_vers "4.1;4.0") + foreach(_ver ${_webkit2gtk_vers}) + pkg_check_modules(WEBKIT2GTK webkit2gtk-${_ver}) + if (WEBKIT2GTK_LIBRARY_DIRS) + break() + endif() + endforeach() target_include_directories(${_AX_CORE_LIB} PUBLIC ${GTK3_INCLUDE_DIRS} ${WEBKIT2GTK_INCLUDE_DIRS}) target_link_directories(${_AX_CORE_LIB} PRIVATE ${GTK3_LIBRARY_DIRS} ${WEBKIT2GTK_LIBRARY_DIRS}) diff --git a/setup.ps1 b/setup.ps1 index f6c7efba62..ce4dbe932d 100755 --- a/setup.ps1 +++ b/setup.ps1 @@ -283,6 +283,16 @@ if ($IsLinux) { if ($answer -like 'y*') { if ($LinuxDistro -eq 'Debian') { println "It will take few minutes" + $os_name = $PSVersionTable.OS + $os_ver = [Regex]::Match($os_name, '(\d+\.)+(\*|\d+)(\-[a-z0-9]+)?').Value + if (($os_name -match 'Ubuntu' -and [VersionEx]$os_ver -ge [VersionEx]'24.04') -or + ($os_name -match 'Debian' -and [VersionEx]$os_ver -ge [VersionEx]'13')) { + $webkit2gtk_dev = 'libwebkit2gtk-4.1-dev' + } + else { + $webkit2gtk_dev = 'libwebkit2gtk-4.0-dev' + } + sudo apt update # for vm, libxxf86vm-dev also required @@ -298,7 +308,7 @@ if ($IsLinux) { $DEPENDS += 'libxi-dev' $DEPENDS += 'libfontconfig1-dev' $DEPENDS += 'libgtk-3-dev' - $DEPENDS += 'libwebkit2gtk-4.0-dev' + $DEPENDS += $webkit2gtk_dev $DEPENDS += 'binutils' $DEPENDS += 'g++' $DEPENDS += 'libasound2-dev' @@ -307,7 +317,7 @@ if ($IsLinux) { # if vlc encouter codec error, install # sudo apt install ubuntu-restricted-extras - + println "Install packages: $DEPENDS ..." sudo apt install --allow-unauthenticated --yes $DEPENDS > /dev/null } elseif ($LinuxDistro -eq 'Arch') {