From 05bdeb084402d59510dc44c4dcb96d928f82d6eb Mon Sep 17 00:00:00 2001 From: Atterpac <89053530+atterpac@users.noreply.github.com> Date: Wed, 8 May 2024 18:26:27 -0600 Subject: [PATCH] allow builds for webkit2gtk-4.1 (#3465) --- .github/workflows/pr.yml | 2 +- v2/internal/frontend/desktop/linux/clipboard.go | 4 +++- v2/internal/frontend/desktop/linux/frontend.go | 4 +++- v2/internal/frontend/desktop/linux/gtk.go | 4 +++- v2/internal/frontend/desktop/linux/keys.go | 5 ++++- v2/internal/frontend/desktop/linux/menu.go | 4 +++- v2/internal/frontend/desktop/linux/screen.go | 5 ++++- v2/internal/frontend/desktop/linux/webkit2.go | 3 ++- v2/internal/frontend/desktop/linux/window.go | 4 +++- v2/pkg/assetserver/webview/request_linux.go | 4 +++- v2/pkg/assetserver/webview/responsewriter_linux.go | 4 +++- v2/pkg/assetserver/webview/webkit2_36+.go | 6 ++++-- v2/pkg/assetserver/webview/webkit2_40+.go | 6 ++++-- v2/pkg/assetserver/webview/webkit2_41.go | 5 +++++ v2/pkg/assetserver/webview/webkit2_legacy.go | 2 +- website/src/pages/changelog.mdx | 3 +++ 16 files changed, 49 insertions(+), 16 deletions(-) create mode 100644 v2/pkg/assetserver/webview/webkit2_41.go diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 8435861eefd..0973cb65e01 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -56,7 +56,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, windows-latest, macos-latest] - go-version: ['1.20'] + go-version: ['1.22'] steps: - name: Checkout code diff --git a/v2/internal/frontend/desktop/linux/clipboard.go b/v2/internal/frontend/desktop/linux/clipboard.go index 88b8c713f3b..a2a46dacc34 100644 --- a/v2/internal/frontend/desktop/linux/clipboard.go +++ b/v2/internal/frontend/desktop/linux/clipboard.go @@ -4,7 +4,9 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/internal/frontend/desktop/linux/frontend.go b/v2/internal/frontend/desktop/linux/frontend.go index 2410457b780..f742a54206b 100644 --- a/v2/internal/frontend/desktop/linux/frontend.go +++ b/v2/internal/frontend/desktop/linux/frontend.go @@ -4,7 +4,9 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/internal/frontend/desktop/linux/gtk.go b/v2/internal/frontend/desktop/linux/gtk.go index f4bc531b3de..67a38c7a045 100644 --- a/v2/internal/frontend/desktop/linux/gtk.go +++ b/v2/internal/frontend/desktop/linux/gtk.go @@ -4,7 +4,9 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" diff --git a/v2/internal/frontend/desktop/linux/keys.go b/v2/internal/frontend/desktop/linux/keys.go index 1c095fea9df..e5a127dbdfc 100644 --- a/v2/internal/frontend/desktop/linux/keys.go +++ b/v2/internal/frontend/desktop/linux/keys.go @@ -4,7 +4,10 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 + #include "gtk/gtk.h" diff --git a/v2/internal/frontend/desktop/linux/menu.go b/v2/internal/frontend/desktop/linux/menu.go index bc3d2740b18..557a24b376d 100644 --- a/v2/internal/frontend/desktop/linux/menu.go +++ b/v2/internal/frontend/desktop/linux/menu.go @@ -4,7 +4,9 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" diff --git a/v2/internal/frontend/desktop/linux/screen.go b/v2/internal/frontend/desktop/linux/screen.go index fdda9b05575..0a05074256c 100644 --- a/v2/internal/frontend/desktop/linux/screen.go +++ b/v2/internal/frontend/desktop/linux/screen.go @@ -4,7 +4,10 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 + #cgo CFLAGS: -w #include #include "webkit2/webkit2.h" diff --git a/v2/internal/frontend/desktop/linux/webkit2.go b/v2/internal/frontend/desktop/linux/webkit2.go index 843b72604d8..06e0c782484 100644 --- a/v2/internal/frontend/desktop/linux/webkit2.go +++ b/v2/internal/frontend/desktop/linux/webkit2.go @@ -3,7 +3,8 @@ package linux /* -#cgo linux pkg-config: webkit2gtk-4.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "webkit2/webkit2.h" */ import "C" diff --git a/v2/internal/frontend/desktop/linux/window.go b/v2/internal/frontend/desktop/linux/window.go index fbe8d7b5c76..39867d69e3b 100644 --- a/v2/internal/frontend/desktop/linux/window.go +++ b/v2/internal/frontend/desktop/linux/window.go @@ -4,7 +4,9 @@ package linux /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include #include diff --git a/v2/pkg/assetserver/webview/request_linux.go b/v2/pkg/assetserver/webview/request_linux.go index 101ee12fbc6..c6785fb1cb4 100644 --- a/v2/pkg/assetserver/webview/request_linux.go +++ b/v2/pkg/assetserver/webview/request_linux.go @@ -4,7 +4,9 @@ package webview /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 gio-unix-2.0 +#cgo linux pkg-config: gtk+-3.0 gio-unix-2.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/pkg/assetserver/webview/responsewriter_linux.go b/v2/pkg/assetserver/webview/responsewriter_linux.go index 52e28aa5da4..59646ce29b3 100644 --- a/v2/pkg/assetserver/webview/responsewriter_linux.go +++ b/v2/pkg/assetserver/webview/responsewriter_linux.go @@ -4,7 +4,9 @@ package webview /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 gio-unix-2.0 +#cgo linux pkg-config: gtk+-3.0 gio-unix-2.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/pkg/assetserver/webview/webkit2_36+.go b/v2/pkg/assetserver/webview/webkit2_36+.go index 2c1a79c4331..1f0db3c8950 100644 --- a/v2/pkg/assetserver/webview/webkit2_36+.go +++ b/v2/pkg/assetserver/webview/webkit2_36+.go @@ -1,9 +1,11 @@ -//go:build linux && (webkit2_36 || webkit2_40) +//go:build linux && (webkit2_36 || webkit2_40 || webkit2_41 ) package webview /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 libsoup-2.4 +#cgo linux pkg-config: gtk+-3.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 libsoup-2.4 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 libsoup-3.0 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/pkg/assetserver/webview/webkit2_40+.go b/v2/pkg/assetserver/webview/webkit2_40+.go index dceb0803d5d..eb3e439f224 100644 --- a/v2/pkg/assetserver/webview/webkit2_40+.go +++ b/v2/pkg/assetserver/webview/webkit2_40+.go @@ -1,9 +1,11 @@ -//go:build linux && webkit2_40 +//go:build linux && (webkit2_40 || webkit2_41) package webview /* -#cgo linux pkg-config: gtk+-3.0 webkit2gtk-4.0 gio-unix-2.0 +#cgo linux pkg-config: gtk+-3.0 gio-unix-2.0 +#cgo !webkit2_41 pkg-config: webkit2gtk-4.0 +#cgo webkit2_41 pkg-config: webkit2gtk-4.1 #include "gtk/gtk.h" #include "webkit2/webkit2.h" diff --git a/v2/pkg/assetserver/webview/webkit2_41.go b/v2/pkg/assetserver/webview/webkit2_41.go new file mode 100644 index 00000000000..82f948d06c0 --- /dev/null +++ b/v2/pkg/assetserver/webview/webkit2_41.go @@ -0,0 +1,5 @@ +//go:build linux && webkit2_41 + +package webview + +const Webkit2MinMinorVersion = 41 diff --git a/v2/pkg/assetserver/webview/webkit2_legacy.go b/v2/pkg/assetserver/webview/webkit2_legacy.go index 1a87fe96aeb..1d1cf7c2b69 100644 --- a/v2/pkg/assetserver/webview/webkit2_legacy.go +++ b/v2/pkg/assetserver/webview/webkit2_legacy.go @@ -1,4 +1,4 @@ -//go:build linux && !(webkit2_36 || webkit2_40) +//go:build linux && !(webkit2_36 || webkit2_40 || webkit2_41) package webview diff --git a/website/src/pages/changelog.mdx b/website/src/pages/changelog.mdx index 576f32b4e77..7118ef897ba 100644 --- a/website/src/pages/changelog.mdx +++ b/website/src/pages/changelog.mdx @@ -14,6 +14,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Added +- Support for compiling with `libwebkit2gtk-4.1` instead of `4.0` to support latest Ubuntu release by [atterpac](https://github.com/atterpac) in [#3465](https://github.com/wailsapp/wails/pull/3465) + ## v2.8.2 - 2024-05-08 ### Breaking Change