From 95bf030d007c39220bcb20b201578feebe7add11 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:00:23 +0100 Subject: [PATCH 01/25] start updating --- script/build.bat | 59 +------- script/build.ts | 346 ++++++++++++++++++++++++++--------------------- webview | 2 +- 3 files changed, 195 insertions(+), 212 deletions(-) diff --git a/script/build.bat b/script/build.bat index 103aeed..e959c8f 100644 --- a/script/build.bat +++ b/script/build.bat @@ -1,23 +1,4 @@ @echo off - -echo Prepare directories... -set script_dir=%~dp0 -set src_dir=%script_dir%..\webview -set build_dir=%script_dir%..\build -mkdir "%build_dir%" - -echo Webview directory: %src_dir% -echo Build directory: %build_dir% - -:: If you update the nuget package, change its version here -set nuget_version=1.0.1150.38 -echo Using Nuget Package microsoft.web.webview2.%nuget_version% -if not exist "%script_dir%\microsoft.web.webview2.%nuget_version%" ( - curl -sSLO https://dist.nuget.org/win-x86-commandline/latest/nuget.exe - nuget.exe install Microsoft.Web.Webview2 -Version %nuget_version% -OutputDirectory %script_dir% - echo Nuget package installed -) - echo Looking for vswhere.exe... set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" set "vswhere=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" @@ -37,40 +18,8 @@ if not exist "%vc_dir%\Common7\Tools\vsdevcmd.bat" ( ) echo Found %vc_dir% -:: 4100: unreferenced formal parameter -set warning_params=/W4 /wd4100 - -:: build dlls if not found -if not exist "%src_dir%\dll\x64\webview.dll" ( - mkdir "%src_dir%\dll\x86" - mkdir "%src_dir%\dll\x64" - copy "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\x64\WebView2Loader.dll" "%src_dir%\dll\x64" - copy "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\x86\WebView2Loader.dll" "%src_dir%\dll\x86" - - call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x86 -host_arch=x64 - - echo "Building webview.dll (x86)" - cl %warning_params% ^ - /D "WEBVIEW_API=__declspec(dllexport)" ^ - /I "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\include" ^ - "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\x86\WebView2Loader.dll.lib" ^ - /std:c++17 /EHsc "/Fo%build_dir%"\ ^ - "%src_dir%\webview.cc" /link /DLL "/OUT:%src_dir%\dll\x86\webview.dll" || exit \b - - call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 - echo "Building webview.dll (x64)" - cl %warning_params% ^ - /D "WEBVIEW_API=__declspec(dllexport)" ^ - /I "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\include" ^ - "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\x64\WebView2Loader.dll.lib" ^ - /std:c++17 /EHsc "/Fo%build_dir%"\ ^ - "%src_dir%\webview.cc" /link /DLL "/OUT:%src_dir%\dll\x64\webview.dll" || exit \b -) -if not exist "%build_dir%\webview.dll" ( - copy "%src_dir%\dll\x64\webview.dll" %build_dir% -) -if not exist "%build_dir%\WebView2Loader.dll" ( - copy "%script_dir%\microsoft.web.webview2.%nuget_version%\build\native\x64\WebView2Loader.dll" "%build_dir%" -) - call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 +cd %~dp0..\webview + +cmake -G "Ninja Multi-Config" -B build -S . +cmake --build build --config Release diff --git a/script/build.ts b/script/build.ts index 85b8205..f54a304 100644 --- a/script/build.ts +++ b/script/build.ts @@ -1,162 +1,196 @@ -import { ensureDir } from "jsr:@std/fs@0.218/ensure_dir"; - -const decoder = new TextDecoder(); -const architectures = [["x86_64", "x86_64"], ["aarch64", "arm64"]] as const; - -const ExitType = { - Exit: "exit", - Fail: "fail", - Never: "never", -} as const; -type ExitType = typeof ExitType[keyof typeof ExitType]; - -const LogType = { - Success: "success", - Always: "always", - Fail: "fail", - Never: "never", -} as const; -type LogType = typeof LogType[keyof typeof LogType]; - -function indent(source: string, spaces = 2): string { - return source.split("\n").map((line) => `${" ".repeat(spaces)}${line}\n`) - .join(""); -} - -async function command( - cmd: string, - { opts, exit, log }: { opts?: T; exit?: ExitType; log?: LogType } = {}, -): Promise<{ - code: number; - stdout: string; - stderr: string; -}> { - if (opts !== undefined) { - opts.stdout = "piped"; - opts.stderr = "piped"; - } - - exit ??= ExitType.Never; - log ??= LogType.Always; - - const command = new Deno.Command(cmd, opts); - const { code, stdout, stderr } = await command.output(); - - const stdoutStr = decoder.decode(stdout); - const stderrStr = decoder.decode(stderr); - - if (code === 0) { - if (log !== "never") { - console.log(`Successfully ran "${cmd} ${(opts?.args ?? []).join(" ")}"`); - } - - if (log === "success" || log === "always") { - if (stdoutStr.length !== 0) { - console.log(`stdout:\n${indent(stdoutStr)}`); - } - if (stderrStr.length !== 0) { - console.log(`stderr:\n${indent(stderrStr)}`); - } - } - } else { - if (log !== "never") { - console.log(`Failed run "${cmd}"`); - } - - if (log === "fail" || log === "always") { - if (stdoutStr.length !== 0) { - console.log(`stdout:\n${indent(stdoutStr)}`); - } - if (stderrStr.length !== 0) { - console.log(`stderr:\n${indent(stderrStr)}`); - } - console.log(`code: ${code}`); - } - - if (exit === ExitType.Fail) { - Deno.exit(code); - } - } - - if (exit === ExitType.Exit) { - Deno.exit(code); - } - - return { - code, - stdout: stdoutStr, - stderr: stderrStr, - }; -} +import { $ } from "jsr:@david/dax@0.42.0"; +import process from "node:process"; -await ensureDir("build"); +const { arch, platform } = process; -switch (Deno.build.os) { - case "windows": { - await command("script/build.bat", { - exit: ExitType.Exit, - }); +switch (platform) { + case "win32": + await $` + scripts/build.bat + cp webview/build/core/Release/webview.dll build/libwebview.dll + `; break; - } - - case "darwin": { - for (const [denoArch, gccArch] of architectures) { - await command("c++", { - opts: { - exit: ExitType.Fail, - args: [ - "webview/webview.cc", - "-dynamiclib", - "-fpic", - "-DWEBVIEW_COCOA", - "-std=c++11", - "-Wall", - "-Wextra", - "-pedantic", - "-framework", - "WebKit", - "-arch", - gccArch, - "-o", - `build/libwebview.${denoArch}.dylib`, - ], - }, - }); - } - Deno.exit(0); + case "linux": + await $` + cd webview + export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH + cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake + cmake --build build + cp build/core/libwebview.so ../build/libwebview-${arch}.so + strip ../build/libwebview-${arch}.so + `; break; - } - - case "linux": { - const { stdout } = await command("pkg-config", { - opts: { - args: [ - "--cflags", - "--libs", - "gtk+-3.0", - "webkit2gtk-4.0", - ], - }, - }); - await command("c++", { - opts: { - exit: ExitType.Fail, - args: [ - "webview/webview.cc", - "-DWEBVIEW_GTK", - "-shared", - "-std=c++11", - "-Wall", - "-Wextra", - "-pedantic", - "-fpic", - ...stdout.trim().split(" "), - "-o", - "build/libwebview.so", - ], - }, - }); - Deno.exit(0); + + case "darwin": + await $` + cd webview + cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake + cmake --build build --config Release + cp build/core/Release/libwebview.dylib ../build/libwebview.dylib + strip -x -S ../build/libwebview.dylib + `; break; - } } + +// import { ensureDir } from "jsr:@std/fs@0.218/ensure_dir"; + +// const decoder = new TextDecoder(); +// const architectures = [["x86_64", "x86_64"], ["aarch64", "arm64"]] as const; + +// const ExitType = { +// Exit: "exit", +// Fail: "fail", +// Never: "never", +// } as const; +// type ExitType = typeof ExitType[keyof typeof ExitType]; + +// const LogType = { +// Success: "success", +// Always: "always", +// Fail: "fail", +// Never: "never", +// } as const; +// type LogType = typeof LogType[keyof typeof LogType]; + +// function indent(source: string, spaces = 2): string { +// return source.split("\n").map((line) => `${" ".repeat(spaces)}${line}\n`) +// .join(""); +// } + +// async function command( +// cmd: string, +// { opts, exit, log }: { opts?: T; exit?: ExitType; log?: LogType } = {}, +// ): Promise<{ +// code: number; +// stdout: string; +// stderr: string; +// }> { +// if (opts !== undefined) { +// opts.stdout = "piped"; +// opts.stderr = "piped"; +// } + +// exit ??= ExitType.Never; +// log ??= LogType.Always; + +// const command = new Deno.Command(cmd, opts); +// const { code, stdout, stderr } = await command.output(); + +// const stdoutStr = decoder.decode(stdout); +// const stderrStr = decoder.decode(stderr); + +// if (code === 0) { +// if (log !== "never") { +// console.log(`Successfully ran "${cmd} ${(opts?.args ?? []).join(" ")}"`); +// } + +// if (log === "success" || log === "always") { +// if (stdoutStr.length !== 0) { +// console.log(`stdout:\n${indent(stdoutStr)}`); +// } +// if (stderrStr.length !== 0) { +// console.log(`stderr:\n${indent(stderrStr)}`); +// } +// } +// } else { +// if (log !== "never") { +// console.log(`Failed run "${cmd}"`); +// } + +// if (log === "fail" || log === "always") { +// if (stdoutStr.length !== 0) { +// console.log(`stdout:\n${indent(stdoutStr)}`); +// } +// if (stderrStr.length !== 0) { +// console.log(`stderr:\n${indent(stderrStr)}`); +// } +// console.log(`code: ${code}`); +// } + +// if (exit === ExitType.Fail) { +// Deno.exit(code); +// } +// } + +// if (exit === ExitType.Exit) { +// Deno.exit(code); +// } + +// return { +// code, +// stdout: stdoutStr, +// stderr: stderrStr, +// }; +// } + +// await ensureDir("build"); + +// switch (Deno.build.os) { +// case "windows": { +// await command("script/build.bat", { +// exit: ExitType.Exit, +// }); +// break; +// } + +// case "darwin": { +// for (const [denoArch, gccArch] of architectures) { +// await command("c++", { +// opts: { +// exit: ExitType.Fail, +// args: [ +// "webview/webview.cc", +// "-dynamiclib", +// "-fpic", +// "-DWEBVIEW_COCOA", +// "-std=c++11", +// "-Wall", +// "-Wextra", +// "-pedantic", +// "-framework", +// "WebKit", +// "-arch", +// gccArch, +// "-o", +// `build/libwebview.${denoArch}.dylib`, +// ], +// }, +// }); +// } +// Deno.exit(0); +// break; +// } + +// case "linux": { +// const { stdout } = await command("pkg-config", { +// opts: { +// args: [ +// "--cflags", +// "--libs", +// "gtk+-3.0", +// "webkit2gtk-4.0", +// ], +// }, +// }); +// await command("c++", { +// opts: { +// exit: ExitType.Fail, +// args: [ +// "webview/webview.cc", +// "-DWEBVIEW_GTK", +// "-shared", +// "-std=c++11", +// "-Wall", +// "-Wextra", +// "-pedantic", +// "-fpic", +// ...stdout.trim().split(" "), +// "-o", +// "build/libwebview.so", +// ], +// }, +// }); +// Deno.exit(0); +// break; +// } +// } diff --git a/webview b/webview index 2ee04cc..c5b1940 160000 --- a/webview +++ b/webview @@ -1 +1 @@ -Subproject commit 2ee04ccd0530e3928a872f5d508c114403803e61 +Subproject commit c5b19403382ef089f9933ea5331c76aa35414589 From 94873353ba178ac9fc9d28a57d79984e17cae58e Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:15:44 +0100 Subject: [PATCH 02/25] seems to work --- script/build.ts | 200 ++++-------------------------------------------- 1 file changed, 16 insertions(+), 184 deletions(-) diff --git a/script/build.ts b/script/build.ts index f54a304..cd28c04 100644 --- a/script/build.ts +++ b/script/build.ts @@ -1,196 +1,28 @@ import { $ } from "jsr:@david/dax@0.42.0"; import process from "node:process"; -const { arch, platform } = process; +const { platform } = process; +$.setPrintCommand(true); +await $.path("./build").ensureDir(); switch (platform) { case "win32": - await $` - scripts/build.bat - cp webview/build/core/Release/webview.dll build/libwebview.dll - `; + await $`scripts/build.bat`; + await $`cp webview/build/core/Release/webview.dll build/libwebview.dll`; break; case "linux": - await $` - cd webview - export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH - cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake - cmake --build build - cp build/core/libwebview.so ../build/libwebview-${arch}.so - strip ../build/libwebview-${arch}.so - `; + $.cd("webview"); + await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; + await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake`; + await $`cmake --build build`; + await $`cp build/core/libwebview.so ../build/libwebview-${Deno.build.arch}.so`; + await $`strip ../build/libwebview-${Deno.build.arch}.so`; break; - case "darwin": - await $` - cd webview - cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake - cmake --build build --config Release - cp build/core/Release/libwebview.dylib ../build/libwebview.dylib - strip -x -S ../build/libwebview.dylib - `; + $.cd("webview"); + await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake`; + await $`cmake --build build --config Release`; + await $`cp build/core/Release/libwebview.dylib ../build/libwebview.dylib`; + await $`strip -x -S ../build/libwebview.dylib`; break; } - -// import { ensureDir } from "jsr:@std/fs@0.218/ensure_dir"; - -// const decoder = new TextDecoder(); -// const architectures = [["x86_64", "x86_64"], ["aarch64", "arm64"]] as const; - -// const ExitType = { -// Exit: "exit", -// Fail: "fail", -// Never: "never", -// } as const; -// type ExitType = typeof ExitType[keyof typeof ExitType]; - -// const LogType = { -// Success: "success", -// Always: "always", -// Fail: "fail", -// Never: "never", -// } as const; -// type LogType = typeof LogType[keyof typeof LogType]; - -// function indent(source: string, spaces = 2): string { -// return source.split("\n").map((line) => `${" ".repeat(spaces)}${line}\n`) -// .join(""); -// } - -// async function command( -// cmd: string, -// { opts, exit, log }: { opts?: T; exit?: ExitType; log?: LogType } = {}, -// ): Promise<{ -// code: number; -// stdout: string; -// stderr: string; -// }> { -// if (opts !== undefined) { -// opts.stdout = "piped"; -// opts.stderr = "piped"; -// } - -// exit ??= ExitType.Never; -// log ??= LogType.Always; - -// const command = new Deno.Command(cmd, opts); -// const { code, stdout, stderr } = await command.output(); - -// const stdoutStr = decoder.decode(stdout); -// const stderrStr = decoder.decode(stderr); - -// if (code === 0) { -// if (log !== "never") { -// console.log(`Successfully ran "${cmd} ${(opts?.args ?? []).join(" ")}"`); -// } - -// if (log === "success" || log === "always") { -// if (stdoutStr.length !== 0) { -// console.log(`stdout:\n${indent(stdoutStr)}`); -// } -// if (stderrStr.length !== 0) { -// console.log(`stderr:\n${indent(stderrStr)}`); -// } -// } -// } else { -// if (log !== "never") { -// console.log(`Failed run "${cmd}"`); -// } - -// if (log === "fail" || log === "always") { -// if (stdoutStr.length !== 0) { -// console.log(`stdout:\n${indent(stdoutStr)}`); -// } -// if (stderrStr.length !== 0) { -// console.log(`stderr:\n${indent(stderrStr)}`); -// } -// console.log(`code: ${code}`); -// } - -// if (exit === ExitType.Fail) { -// Deno.exit(code); -// } -// } - -// if (exit === ExitType.Exit) { -// Deno.exit(code); -// } - -// return { -// code, -// stdout: stdoutStr, -// stderr: stderrStr, -// }; -// } - -// await ensureDir("build"); - -// switch (Deno.build.os) { -// case "windows": { -// await command("script/build.bat", { -// exit: ExitType.Exit, -// }); -// break; -// } - -// case "darwin": { -// for (const [denoArch, gccArch] of architectures) { -// await command("c++", { -// opts: { -// exit: ExitType.Fail, -// args: [ -// "webview/webview.cc", -// "-dynamiclib", -// "-fpic", -// "-DWEBVIEW_COCOA", -// "-std=c++11", -// "-Wall", -// "-Wextra", -// "-pedantic", -// "-framework", -// "WebKit", -// "-arch", -// gccArch, -// "-o", -// `build/libwebview.${denoArch}.dylib`, -// ], -// }, -// }); -// } -// Deno.exit(0); -// break; -// } - -// case "linux": { -// const { stdout } = await command("pkg-config", { -// opts: { -// args: [ -// "--cflags", -// "--libs", -// "gtk+-3.0", -// "webkit2gtk-4.0", -// ], -// }, -// }); -// await command("c++", { -// opts: { -// exit: ExitType.Fail, -// args: [ -// "webview/webview.cc", -// "-DWEBVIEW_GTK", -// "-shared", -// "-std=c++11", -// "-Wall", -// "-Wextra", -// "-pedantic", -// "-fpic", -// ...stdout.trim().split(" "), -// "-o", -// "build/libwebview.so", -// ], -// }, -// }); -// Deno.exit(0); -// break; -// } -// } From f4608442ef798fde530cf99e40770582001fb776 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:17:58 +0100 Subject: [PATCH 03/25] fixes --- script/build.ts | 8 ++++---- src/ffi.ts | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/script/build.ts b/script/build.ts index cd28c04..397ae5a 100644 --- a/script/build.ts +++ b/script/build.ts @@ -15,14 +15,14 @@ switch (platform) { await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake`; await $`cmake --build build`; - await $`cp build/core/libwebview.so ../build/libwebview-${Deno.build.arch}.so`; - await $`strip ../build/libwebview-${Deno.build.arch}.so`; + await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; + await $`strip ../build/libwebview.${Deno.build.arch}.so`; break; case "darwin": $.cd("webview"); await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake`; await $`cmake --build build --config Release`; - await $`cp build/core/Release/libwebview.dylib ../build/libwebview.dylib`; - await $`strip -x -S ../build/libwebview.dylib`; + await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; + await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; break; } diff --git a/src/ffi.ts b/src/ffi.ts index fff7bae..58dbb11 100644 --- a/src/ffi.ts +++ b/src/ffi.ts @@ -105,6 +105,7 @@ export const lib = await dlopen( url, cache, suffixes: { + linux: `.${Deno.build.arch}`, darwin: `.${Deno.build.arch}`, }, }, From cb370711ef6cf8d8f5524607c4b4a3d37e1cad38 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:19:15 +0100 Subject: [PATCH 04/25] test build --- .github/workflows/build.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a204de1..c4a6c4b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,13 +4,14 @@ on: push: branches: - main - paths: - - ".github/workflows/**" - - "script/build.*" - - "src/ffi.ts" - - "webview/**" - - ".gitmodules" - - "deno.json" + - update_webview + # paths: + # - ".github/workflows/**" + # - "script/build.*" + # - "src/ffi.ts" + # - "webview/**" + # - ".gitmodules" + # - "deno.json" jobs: build: From 47159acc72212d52d41bc0282298fda316f875c2 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:21:36 +0100 Subject: [PATCH 05/25] disable mac for now --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c4a6c4b..6eefc14 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,8 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: [macos-latest, windows-latest, ubuntu-latest] + # os: [macos-latest, windows-latest, ubuntu-latest] + os: [windows-latest, ubuntu-latest] steps: - name: Clone repository From 9b6b79d689c9ce671bdc71d54816ba96d5685c6d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:26:20 +0100 Subject: [PATCH 06/25] fixes --- .github/workflows/build.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6eefc14..cefd1be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,9 +19,9 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: + fail-fast: false matrix: - # os: [macos-latest, windows-latest, ubuntu-latest] - os: [windows-latest, ubuntu-latest] + os: [macos-latest, windows-latest, ubuntu-latest] steps: - name: Clone repository @@ -38,7 +38,12 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y webkit2gtk-4.0 + sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev + + - name: Install ninja (macOS) + if: matrix.os == 'macos-latest' + run: | + brew install ninja - name: Build dynamic library run: deno task build From 71d47c1c0f326e071c9507384d6176e942462b56 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:30:10 +0100 Subject: [PATCH 07/25] fixes --- .github/workflows/build.yml | 3 ++- script/build.ts | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cefd1be..4938686 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,12 +38,13 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev + sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev doxygen graphviz - name: Install ninja (macOS) if: matrix.os == 'macos-latest' run: | brew install ninja + brew install clang-format - name: Build dynamic library run: deno task build diff --git a/script/build.ts b/script/build.ts index 397ae5a..decb5bb 100644 --- a/script/build.ts +++ b/script/build.ts @@ -7,7 +7,7 @@ $.setPrintCommand(true); await $.path("./build").ensureDir(); switch (platform) { case "win32": - await $`scripts/build.bat`; + await $`script/build.bat`; await $`cp webview/build/core/Release/webview.dll build/libwebview.dll`; break; case "linux": From cdbae395905a7366df2f455c2eca26a29fce30b6 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:33:58 +0100 Subject: [PATCH 08/25] fixes --- .github/workflows/build.yml | 7 +++++++ script/build.bat | 16 ++++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4938686..dffa5f3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -45,6 +45,13 @@ jobs: run: | brew install ninja brew install clang-format + brew install llvm + echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH + + - name: Install ninja (Windows) + if: matrix.os == 'windows-latest' + run: | + choco install ninja - name: Build dynamic library run: deno task build diff --git a/script/build.bat b/script/build.bat index e959c8f..afef04e 100644 --- a/script/build.bat +++ b/script/build.bat @@ -3,23 +3,27 @@ echo Looking for vswhere.exe... set "vswhere=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" set "vswhere=%ProgramFiles%\Microsoft Visual Studio\Installer\vswhere.exe" if not exist "%vswhere%" ( - echo ERROR: Failed to find vswhere.exe - exit /b 1 + echo ERROR: Failed to find vswhere.exe + exit /b 1 ) echo Found %vswhere% echo Looking for VC... for /f "usebackq tokens=*" %%i in (`"%vswhere%" -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do ( - set vc_dir=%%i + set vc_dir=%%i ) if not exist "%vc_dir%\Common7\Tools\vsdevcmd.bat" ( - echo ERROR: Failed to find VC tools x86/x64 - exit /b 1 + echo ERROR: Failed to find VC tools x86/x64 + exit /b 1 ) echo Found %vc_dir% call "%vc_dir%\Common7\Tools\vsdevcmd.bat" -arch=x64 -host_arch=x64 cd %~dp0..\webview -cmake -G "Ninja Multi-Config" -B build -S . +cmake -G "Ninja Multi-Config" -B build -S . ^ + -DWEBVIEW_BUILD_DOCS=OFF ^ + -DWEBVIEW_USE_CLANG_TIDY=OFF ^ + -DWEBVIEW_USE_CLANG_FORMAT=OFF + cmake --build build --config Release From 688c9ade41153d52f07ccd17c22e7cfd14694b7f Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:36:49 +0100 Subject: [PATCH 09/25] fixes --- .github/workflows/build.yml | 3 --- script/build.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index dffa5f3..ed705ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,9 +44,6 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja - brew install clang-format - brew install llvm - echo "/usr/local/opt/llvm/bin" >> $GITHUB_PATH - name: Install ninja (Windows) if: matrix.os == 'windows-latest' diff --git a/script/build.ts b/script/build.ts index decb5bb..6edd6a0 100644 --- a/script/build.ts +++ b/script/build.ts @@ -20,7 +20,7 @@ switch (platform) { break; case "darwin": $.cd("webview"); - await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake`; + await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From a008bbaf50d1184d22615500c0e681c861332a69 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:37:52 +0100 Subject: [PATCH 10/25] fixes --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed705ed..0c7c09f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,7 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja + brew install clang-format - name: Install ninja (Windows) if: matrix.os == 'windows-latest' From 2f1de5bb78fba5ca7855d3fadb11c6ec8e173a44 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:40:20 +0100 Subject: [PATCH 11/25] fixes --- .github/workflows/build.yml | 1 - script/build.ts | 7 +++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0c7c09f..ed705ed 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,7 +44,6 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja - brew install clang-format - name: Install ninja (Windows) if: matrix.os == 'windows-latest' diff --git a/script/build.ts b/script/build.ts index 6edd6a0..9726d71 100644 --- a/script/build.ts +++ b/script/build.ts @@ -4,6 +4,9 @@ import process from "node:process"; const { platform } = process; $.setPrintCommand(true); +const commonCmakeFlags = + "-DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF"; + await $.path("./build").ensureDir(); switch (platform) { case "win32": @@ -13,14 +16,14 @@ switch (platform) { case "linux": $.cd("webview"); await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; - await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake`; + await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake ${commonCmakeFlags}`; await $`cmake --build build`; await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; await $`strip ../build/libwebview.${Deno.build.arch}.so`; break; case "darwin": $.cd("webview"); - await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake ${commonCmakeFlags}`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From 60f5bfaaeb17243cd9ae41fb0f42c34c50e9cb43 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:40:55 +0100 Subject: [PATCH 12/25] fixes --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ed705ed..10b4d07 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -38,7 +38,7 @@ jobs: if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update - sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev doxygen graphviz + sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev - name: Install ninja (macOS) if: matrix.os == 'macos-latest' From 65d1137c1301019bc820be79927ea6ec1cd71114 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:42:49 +0100 Subject: [PATCH 13/25] fixes --- script/build.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/script/build.ts b/script/build.ts index 9726d71..0aef82f 100644 --- a/script/build.ts +++ b/script/build.ts @@ -4,9 +4,6 @@ import process from "node:process"; const { platform } = process; $.setPrintCommand(true); -const commonCmakeFlags = - "-DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF"; - await $.path("./build").ensureDir(); switch (platform) { case "win32": @@ -16,14 +13,14 @@ switch (platform) { case "linux": $.cd("webview"); await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; - await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake ${commonCmakeFlags}`; + await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build`; await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; await $`strip ../build/libwebview.${Deno.build.arch}.so`; break; case "darwin": $.cd("webview"); - await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake ${commonCmakeFlags}`; + await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From 9a9bb53e49cb6cdf844a7f1ccdd504711b79e29d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:47:16 +0100 Subject: [PATCH 14/25] fixes --- .github/workflows/build.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 10b4d07..11444d5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -44,6 +44,8 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja + brew install llvm + echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH - name: Install ninja (Windows) if: matrix.os == 'windows-latest' From 175d6be8a1a1054250bd10fa2012d6e93cc958d9 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:53:25 +0100 Subject: [PATCH 15/25] fixes --- .github/workflows/build.yml | 3 --- script/build.ts | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 11444d5..31abaf2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,6 @@ jobs: runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: - fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] @@ -44,8 +43,6 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja - brew install llvm - echo "$(brew --prefix llvm)/bin" >> $GITHUB_PATH - name: Install ninja (Windows) if: matrix.os == 'windows-latest' diff --git a/script/build.ts b/script/build.ts index 0aef82f..576227c 100644 --- a/script/build.ts +++ b/script/build.ts @@ -20,7 +20,7 @@ switch (platform) { break; case "darwin": $.cd("webview"); - await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TOOLS=OFF -DWEBVIEW_ENABLE_CHECKS=OFF -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From 0b9e255f1077beddffc6666be6fad2c482659e5e Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:55:11 +0100 Subject: [PATCH 16/25] fixes --- script/build.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/script/build.ts b/script/build.ts index 576227c..4c9cd77 100644 --- a/script/build.ts +++ b/script/build.ts @@ -20,7 +20,15 @@ switch (platform) { break; case "darwin": $.cd("webview"); - await $`cmake -G "Ninja Multi-Config" -B build -S . -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/universal-macos-llvm.cmake -DWEBVIEW_USE_CLANG_TOOLS=OFF -DWEBVIEW_ENABLE_CHECKS=OFF -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + await $`cmake -G "Ninja Multi-Config" -B build -S . \ + -DCMAKE_BUILD_TYPE=Release \ + -DWEBVIEW_BUILD_TESTS=OFF \ + -DWEBVIEW_BUILD_EXAMPLES=OFF \ + -DWEBVIEW_USE_CLANG_TOOLS=OFF \ + -DWEBVIEW_ENABLE_CHECKS=OFF \ + -DWEBVIEW_USE_CLANG_TIDY=OFF \ + -DWEBVIEW_BUILD_DOCS=OFF \ + -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From 30a532c0cd5ed5486c2117408f63c0973dd27934 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 09:58:30 +0100 Subject: [PATCH 17/25] fixes --- .github/workflows/build.yml | 2 ++ script/build.ts | 19 +++++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 31abaf2..f2647d3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,6 +43,8 @@ jobs: if: matrix.os == 'macos-latest' run: | brew install ninja + brew install llvm + echo "WEBVIEW_CLANG_FORMAT_EXE=$(brew --prefix llvm)/bin/clang-format" >> $GITHUB_ENV - name: Install ninja (Windows) if: matrix.os == 'windows-latest' diff --git a/script/build.ts b/script/build.ts index 4c9cd77..4ec878c 100644 --- a/script/build.ts +++ b/script/build.ts @@ -21,14 +21,17 @@ switch (platform) { case "darwin": $.cd("webview"); await $`cmake -G "Ninja Multi-Config" -B build -S . \ - -DCMAKE_BUILD_TYPE=Release \ - -DWEBVIEW_BUILD_TESTS=OFF \ - -DWEBVIEW_BUILD_EXAMPLES=OFF \ - -DWEBVIEW_USE_CLANG_TOOLS=OFF \ - -DWEBVIEW_ENABLE_CHECKS=OFF \ - -DWEBVIEW_USE_CLANG_TIDY=OFF \ - -DWEBVIEW_BUILD_DOCS=OFF \ - -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + -DCMAKE_BUILD_TYPE=Release \ + -DWEBVIEW_BUILD_TESTS=OFF \ + -DWEBVIEW_BUILD_EXAMPLES=OFF \ + -DWEBVIEW_USE_CLANG_TOOLS=OFF \ + -DWEBVIEW_ENABLE_CHECKS=OFF \ + -DWEBVIEW_USE_CLANG_TIDY=OFF \ + -DWEBVIEW_BUILD_DOCS=OFF \ + -DWEBVIEW_USE_CLANG_FORMAT=OFF \ + -DWEBVIEW_CLANG_FORMAT_EXE=${Deno.env.get( + "WEBVIEW_CLANG_FORMAT_EXE", + )!}`; await $`cmake --build build --config Release`; await $`cp build/core/Release/libwebview.dylib ../build/libwebview.${Deno.build.arch}.dylib`; await $`strip -x -S ../build/libwebview.${Deno.build.arch}.dylib`; From abc4fdced6b4d0de130773c785e82582382bb822 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 10:04:36 +0100 Subject: [PATCH 18/25] fixes --- .github/workflows/build.yml | 22 ++++++++++++++++++---- script/build.ts | 23 +++++++++++++++++++---- 2 files changed, 37 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2647d3..83c9f08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,12 +15,17 @@ on: jobs: build: - name: ${{ matrix.kind }} ${{ matrix.os }} + name: ${{ matrix.kind }} ${{ matrix.os }} ${{ matrix.arch }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: + fail-fast: false matrix: - os: [macos-latest, windows-latest, ubuntu-latest] + os: [macos-latest, macos-13, windows-latest, ubuntu-latest] + arch: [amd64] + include: + - os: ubuntu-latest + arch: arm64 steps: - name: Clone repository @@ -33,12 +38,19 @@ jobs: with: deno-version: v2.x - - name: install webkit2gtk (Linux) - if: matrix.os == 'ubuntu-latest' + - name: install webkit2gtk (Linux amd64) + if: matrix.os == 'ubuntu-latest' && matrix.arch == 'amd64' run: | sudo apt-get update sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev + - name: install webkit2gtk (Linux arm64) + if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64' + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev:arm64 cmake ninja-build clang pkg-config libgtk-4-dev:arm64 + - name: Install ninja (macOS) if: matrix.os == 'macos-latest' run: | @@ -52,6 +64,8 @@ jobs: choco install ninja - name: Build dynamic library + env: + ARCH: ${{ matrix.arch }} run: deno task build - name: Upload Artifacts diff --git a/script/build.ts b/script/build.ts index 4ec878c..50467a0 100644 --- a/script/build.ts +++ b/script/build.ts @@ -2,6 +2,7 @@ import { $ } from "jsr:@david/dax@0.42.0"; import process from "node:process"; const { platform } = process; +const arch = Deno.env.get("ARCH") || "amd64"; $.setPrintCommand(true); await $.path("./build").ensureDir(); @@ -12,11 +13,25 @@ switch (platform) { break; case "linux": $.cd("webview"); - await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; - await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + if (arch === "arm64") { + await $`cmake -G Ninja -B build -S . \ + -D CMAKE_BUILD_TYPE=Release \ + -D WEBVIEW_WEBKITGTK_API=6.0 \ + -DWEBVIEW_ENABLE_CHECKS=false \ + -DWEBVIEW_USE_CLANG_TIDY=OFF \ + -DWEBVIEW_BUILD_DOCS=OFF \ + -DWEBVIEW_USE_CLANG_FORMAT=OFF \ + -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ + -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ + -DCMAKE_SYSTEM_NAME=Linux \ + -DCMAKE_SYSTEM_PROCESSOR=aarch64`; + } else { + await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; + await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; + } await $`cmake --build build`; - await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; - await $`strip ../build/libwebview.${Deno.build.arch}.so`; + await $`cp build/core/libwebview.so ../build/libwebview.${arch}.so`; + await $`strip ../build/libwebview.${arch}.so`; break; case "darwin": $.cd("webview"); From 06807111d7c31466b59a33bc33f97a6fa837f07d Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:05:52 +0100 Subject: [PATCH 19/25] fixes --- .github/workflows/build.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 83c9f08..c6ca362 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,17 +15,12 @@ on: jobs: build: - name: ${{ matrix.kind }} ${{ matrix.os }} ${{ matrix.arch }} + name: ${{ matrix.kind }} ${{ matrix.os }} runs-on: ${{ matrix.os }} timeout-minutes: 60 strategy: - fail-fast: false matrix: - os: [macos-latest, macos-13, windows-latest, ubuntu-latest] - arch: [amd64] - include: - - os: ubuntu-latest - arch: arm64 + os: [macos-latest, macos-13, windows-latest, ubuntu-latest, ubuntu-24.04-arm] steps: - name: Clone repository @@ -38,19 +33,12 @@ jobs: with: deno-version: v2.x - - name: install webkit2gtk (Linux amd64) - if: matrix.os == 'ubuntu-latest' && matrix.arch == 'amd64' + - name: install webkit2gtk (Linux) + if: matrix.os == 'ubuntu-latest' run: | sudo apt-get update sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev - - name: install webkit2gtk (Linux arm64) - if: matrix.os == 'ubuntu-latest' && matrix.arch == 'arm64' - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu g++-aarch64-linux-gnu - sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev:arm64 cmake ninja-build clang pkg-config libgtk-4-dev:arm64 - - name: Install ninja (macOS) if: matrix.os == 'macos-latest' run: | @@ -64,8 +52,6 @@ jobs: choco install ninja - name: Build dynamic library - env: - ARCH: ${{ matrix.arch }} run: deno task build - name: Upload Artifacts From 608c3e165965296833c22ea90e8d28cbac4d6c16 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:07:06 +0100 Subject: [PATCH 20/25] fixes --- .github/workflows/build.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c6ca362..df5ecfa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,7 +20,13 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: [macos-latest, macos-13, windows-latest, ubuntu-latest, ubuntu-24.04-arm] + os: [ + macos-latest, + macos-13, + windows-latest, + ubuntu-latest, + ubuntu-24.04-arm, + ] steps: - name: Clone repository From 867d47dd88c32541dce5a94e0c534c6e6a0aa113 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:10:30 +0100 Subject: [PATCH 21/25] fixes --- .github/workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index df5ecfa..58206be 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -40,13 +40,13 @@ jobs: deno-version: v2.x - name: install webkit2gtk (Linux) - if: matrix.os == 'ubuntu-latest' + if: startsWith(matrix.os, 'ubuntu') run: | sudo apt-get update sudo apt-get install -y webkitgtk-6.0 libwebkitgtk-6.0-dev cmake ninja-build clang pkg-config libgtk-4-dev - name: Install ninja (macOS) - if: matrix.os == 'macos-latest' + if: startsWith(matrix.os, 'macos') run: | brew install ninja brew install llvm From e8e65e96bcc4abdb035b14fb7f7da278f3f034ac Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:19:06 +0100 Subject: [PATCH 22/25] fixes --- .github/workflows/build.yml | 25 +++++++++++++------------ script/build.ts | 23 ++++------------------- 2 files changed, 17 insertions(+), 31 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 58206be..5f8eae1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -69,15 +69,16 @@ jobs: build/*.dylib build/*.so -# - name: Release Plugin -# uses: softprops/action-gh-release@master -# env: -# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} -# with: -# tag_name: "webview_deno release" -# draft: true -# files: | -# build/libwebview.x86_64.dylib -# build/libwebview.so -# build/webview.dll -# build/Webview2Loader.dll + # - name: Release Plugin + # uses: softprops/action-gh-release@master + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: "webview_deno release" + # draft: true + # files: | + # build/libwebview.x86_64.dylib + # build/libwebview.x86_64.dylib + # build/libwebview.so + # build/webview.dll + # build/Webview2Loader.dll diff --git a/script/build.ts b/script/build.ts index 50467a0..4ec878c 100644 --- a/script/build.ts +++ b/script/build.ts @@ -2,7 +2,6 @@ import { $ } from "jsr:@david/dax@0.42.0"; import process from "node:process"; const { platform } = process; -const arch = Deno.env.get("ARCH") || "amd64"; $.setPrintCommand(true); await $.path("./build").ensureDir(); @@ -13,25 +12,11 @@ switch (platform) { break; case "linux": $.cd("webview"); - if (arch === "arm64") { - await $`cmake -G Ninja -B build -S . \ - -D CMAKE_BUILD_TYPE=Release \ - -D WEBVIEW_WEBKITGTK_API=6.0 \ - -DWEBVIEW_ENABLE_CHECKS=false \ - -DWEBVIEW_USE_CLANG_TIDY=OFF \ - -DWEBVIEW_BUILD_DOCS=OFF \ - -DWEBVIEW_USE_CLANG_FORMAT=OFF \ - -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ - -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ \ - -DCMAKE_SYSTEM_NAME=Linux \ - -DCMAKE_SYSTEM_PROCESSOR=aarch64`; - } else { - await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; - await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; - } + await $`export PATH=/usr/lib/llvm14/bin/:/usr/lib/llvm-14/bin/:/usr/lib64/llvm15/bin/:$PATH`; + await $`cmake -G Ninja -B build -S . -D CMAKE_BUILD_TYPE=Release -D WEBVIEW_WEBKITGTK_API=6.0 -DWEBVIEW_ENABLE_CHECKS=false -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/host-llvm.cmake -DWEBVIEW_USE_CLANG_TIDY=OFF -DWEBVIEW_BUILD_DOCS=OFF -DWEBVIEW_USE_CLANG_FORMAT=OFF`; await $`cmake --build build`; - await $`cp build/core/libwebview.so ../build/libwebview.${arch}.so`; - await $`strip ../build/libwebview.${arch}.so`; + await $`cp build/core/libwebview.so ../build/libwebview.${Deno.build.arch}.so`; + await $`strip ../build/libwebview.${Deno.build.arch}.so`; break; case "darwin": $.cd("webview"); From cd452383d1702d2cdfe404a3dedfedb11a3b1bf1 Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:23:06 +0100 Subject: [PATCH 23/25] fixes --- .github/workflows/build.yml | 42 +++++++++++++++++++------------------ script/build.ts | 7 +++---- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5f8eae1..08003c2 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,13 +20,14 @@ jobs: timeout-minutes: 60 strategy: matrix: - os: [ - macos-latest, - macos-13, - windows-latest, - ubuntu-latest, - ubuntu-24.04-arm, - ] + os: + [ + macos-latest, + macos-13, + windows-latest, + ubuntu-latest, + ubuntu-24.04-arm, + ] steps: - name: Clone repository @@ -69,16 +70,17 @@ jobs: build/*.dylib build/*.so - # - name: Release Plugin - # uses: softprops/action-gh-release@master - # env: - # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # with: - # tag_name: "webview_deno release" - # draft: true - # files: | - # build/libwebview.x86_64.dylib - # build/libwebview.x86_64.dylib - # build/libwebview.so - # build/webview.dll - # build/Webview2Loader.dll + - name: Release Plugin + uses: softprops/action-gh-release@master + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: "webview_deno release" + draft: true + files: | + build/libwebview.x86_64.dylib + build/libwebview.aarch64.dylib + build/libwebview.x86_64.so + build/libwebview.aarch64.so + build/webview.dll + build/Webview2Loader.dll diff --git a/script/build.ts b/script/build.ts index 4ec878c..11ab86b 100644 --- a/script/build.ts +++ b/script/build.ts @@ -1,12 +1,11 @@ import { $ } from "jsr:@david/dax@0.42.0"; -import process from "node:process"; -const { platform } = process; +const { os } = Deno.build; $.setPrintCommand(true); await $.path("./build").ensureDir(); -switch (platform) { - case "win32": +switch (os) { + case "windows": await $`script/build.bat`; await $`cp webview/build/core/Release/webview.dll build/libwebview.dll`; break; From 63762051eaed5cbcf4cc7d52f9b5fd99e611ddef Mon Sep 17 00:00:00 2001 From: Nbiba Bedis Date: Sun, 26 Jan 2025 17:26:18 +0100 Subject: [PATCH 24/25] done --- .github/workflows/build.yml | 43 ++++++++++++++++++------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 08003c2..6be63bd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,14 +4,13 @@ on: push: branches: - main - - update_webview - # paths: - # - ".github/workflows/**" - # - "script/build.*" - # - "src/ffi.ts" - # - "webview/**" - # - ".gitmodules" - # - "deno.json" + paths: + - ".github/workflows/**" + - "script/build.*" + - "src/ffi.ts" + - "webview/**" + - ".gitmodules" + - "deno.json" jobs: build: @@ -70,17 +69,17 @@ jobs: build/*.dylib build/*.so - - name: Release Plugin - uses: softprops/action-gh-release@master - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: "webview_deno release" - draft: true - files: | - build/libwebview.x86_64.dylib - build/libwebview.aarch64.dylib - build/libwebview.x86_64.so - build/libwebview.aarch64.so - build/webview.dll - build/Webview2Loader.dll + # - name: Release Plugin + # uses: softprops/action-gh-release@master + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: "webview_deno release" + # draft: true + # files: | + # build/libwebview.x86_64.dylib + # build/libwebview.aarch64.dylib + # build/libwebview.x86_64.so + # build/libwebview.aarch64.so + # build/webview.dll + # build/Webview2Loader.dll From 6529899aa62f4f0da9ac12dddc7d6f3959cf64fc Mon Sep 17 00:00:00 2001 From: Bedis Nbiba Date: Tue, 28 Jan 2025 20:00:24 +0100 Subject: [PATCH 25/25] fix windows artifact name --- script/build.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/script/build.ts b/script/build.ts index 11ab86b..e15b209 100644 --- a/script/build.ts +++ b/script/build.ts @@ -7,7 +7,7 @@ await $.path("./build").ensureDir(); switch (os) { case "windows": await $`script/build.bat`; - await $`cp webview/build/core/Release/webview.dll build/libwebview.dll`; + await $`cp webview/build/core/Release/webview.dll build/webview.dll`; break; case "linux": $.cd("webview");