Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c78e56bf46 | ||
|
|
2126e2d623 |
No files matched your search
@@ -18,7 +18,7 @@ on:
|
|||||||
- "staticlink-avalonia-v*"
|
- "staticlink-avalonia-v*"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SKIASHARP_VERSION: "2.88.9"
|
SKIASHARP_VERSION: "3.119.2"
|
||||||
ANGLE_BRANCH: "7151"
|
ANGLE_BRANCH: "7151"
|
||||||
DOTNET_ALPINE_IMAGE: mcr.microsoft.com/dotnet/sdk:10.0-alpine
|
DOTNET_ALPINE_IMAGE: mcr.microsoft.com/dotnet/sdk:10.0-alpine
|
||||||
|
|
||||||
@@ -49,9 +49,6 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
sudo apt-get update
|
sudo apt-get update
|
||||||
sudo apt-get install -y clang lld llvm g++ ninja-build pkg-config libfontconfig1-dev libglib2.0-dev libgl1-mesa-dev libpci-dev libx11-dev libxcb1-dev libxext-dev
|
sudo apt-get install -y clang lld llvm g++ ninja-build pkg-config libfontconfig1-dev libglib2.0-dev libgl1-mesa-dev libpci-dev libx11-dev libxcb1-dev libxext-dev
|
||||||
if [ "${{ matrix.target_cpu }}" = "arm64" ]; then
|
|
||||||
sudo apt-get install -y generate-ninja
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Build Linux static graphics libraries
|
- name: Build Linux static graphics libraries
|
||||||
if: ${{ !startsWith(matrix.rid, 'linux-musl-') }}
|
if: ${{ !startsWith(matrix.rid, 'linux-musl-') }}
|
||||||
@@ -78,7 +75,7 @@ jobs:
|
|||||||
"$DOTNET_ALPINE_IMAGE" \
|
"$DOTNET_ALPINE_IMAGE" \
|
||||||
sh -lc '
|
sh -lc '
|
||||||
set -e
|
set -e
|
||||||
apk add --no-cache bash ca-certificates git python3 py3-httplib2 py3-pysocks py3-six clang compiler-rt lld llvm g++ gn ninja pkgconf fontconfig-dev glib-dev mesa-dev libx11-dev libxcb-dev libxext-dev pciutils-dev linux-headers perl curl tar xz patch gcompat libc6-compat
|
apk add --no-cache bash ca-certificates git python3 py3-httplib2 py3-pysocks py3-six clang compiler-rt lld llvm g++ ninja pkgconf fontconfig-dev glib-dev mesa-dev libx11-dev libxcb-dev libxext-dev pciutils-dev linux-headers perl curl tar xz patch gcompat libc6-compat
|
||||||
python3 - <<'"'"'PY'"'"'
|
python3 - <<'"'"'PY'"'"'
|
||||||
import pathlib
|
import pathlib
|
||||||
import httplib2
|
import httplib2
|
||||||
@@ -218,6 +215,12 @@ jobs:
|
|||||||
- rid: osx-arm64
|
- rid: osx-arm64
|
||||||
runner: macos-15
|
runner: macos-15
|
||||||
avalonia_version: 11.3.14
|
avalonia_version: 11.3.14
|
||||||
|
- rid: osx-x64
|
||||||
|
runner: macos-14
|
||||||
|
avalonia_version: 12.0.3
|
||||||
|
- rid: osx-arm64
|
||||||
|
runner: macos-15
|
||||||
|
avalonia_version: 12.0.3
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
env:
|
env:
|
||||||
RID: ${{ matrix.rid }}
|
RID: ${{ matrix.rid }}
|
||||||
@@ -314,7 +317,7 @@ jobs:
|
|||||||
- name: Pack NuGet package
|
- name: Pack NuGet package
|
||||||
run: |
|
run: |
|
||||||
dotnet pack NuGet/StaticGraphics/StaticLink.Avalonia.csproj -c Release -o artifacts/nuget
|
dotnet pack NuGet/StaticGraphics/StaticLink.Avalonia.csproj -c Release -o artifacts/nuget
|
||||||
for version in 11.3.14; do
|
for version in 11.3.14 12.0.3; do
|
||||||
mkdir -p External/NativeStatic/osx-x64/native External/NativeStatic/osx-arm64/native
|
mkdir -p External/NativeStatic/osx-x64/native External/NativeStatic/osx-arm64/native
|
||||||
cp External/AvaloniaNative/native-avalonia-$version-osx-x64/* External/NativeStatic/osx-x64/native/
|
cp External/AvaloniaNative/native-avalonia-$version-osx-x64/* External/NativeStatic/osx-x64/native/
|
||||||
cp External/AvaloniaNative/native-avalonia-$version-osx-arm64/* External/NativeStatic/osx-arm64/native/
|
cp External/AvaloniaNative/native-avalonia-$version-osx-arm64/* External/NativeStatic/osx-arm64/native/
|
||||||
@@ -382,6 +385,14 @@ jobs:
|
|||||||
runner: macos-15
|
runner: macos-15
|
||||||
avalonia_version: 11.3.14
|
avalonia_version: 11.3.14
|
||||||
native_version: 11.3.14.1
|
native_version: 11.3.14.1
|
||||||
|
- rid: osx-x64
|
||||||
|
runner: macos-14
|
||||||
|
avalonia_version: 12.0.3
|
||||||
|
native_version: 12.0.3.1
|
||||||
|
- rid: osx-arm64
|
||||||
|
runner: macos-15
|
||||||
|
avalonia_version: 12.0.3
|
||||||
|
native_version: 12.0.3.1
|
||||||
runs-on: ${{ matrix.runner }}
|
runs-on: ${{ matrix.runner }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dotnet add package StaticLink.Avalonia
|
|||||||
Or add it manually:
|
Or add it manually:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<PackageReference Include="StaticLink.Avalonia" Version="2.88.9-7151.10" />
|
<PackageReference Include="StaticLink.Avalonia" Version="3.119.2-7151.10" />
|
||||||
```
|
```
|
||||||
|
|
||||||
For macOS, also reference `StaticLink.Avalonia.Native`. This package is macOS-only and must match your Avalonia version because it contains `libAvaloniaNative.a`.
|
For macOS, also reference `StaticLink.Avalonia.Native`. This package is macOS-only and must match your Avalonia version because it contains `libAvaloniaNative.a`.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
<IncludeBuildOutput>false</IncludeBuildOutput>
|
<IncludeBuildOutput>false</IncludeBuildOutput>
|
||||||
<SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking>
|
<SuppressDependenciesWhenPacking>false</SuppressDependenciesWhenPacking>
|
||||||
<PackageId>StaticLink.Avalonia</PackageId>
|
<PackageId>StaticLink.Avalonia</PackageId>
|
||||||
<Version>2.88.9-7151.10</Version>
|
<Version>3.119.2-7151.10</Version>
|
||||||
<Authors>greepar</Authors>
|
<Authors>greepar</Authors>
|
||||||
<Company>greepar</Company>
|
<Company>greepar</Company>
|
||||||
<Description>Static SkiaSharp, HarfBuzzSharp, and ANGLE libraries for Avalonia NativeAOT single-file publishing.</Description>
|
<Description>Static SkiaSharp, HarfBuzzSharp, and ANGLE libraries for Avalonia NativeAOT single-file publishing.</Description>
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="SkiaSharp" Version="2.88.9" />
|
<PackageReference Include="SkiaSharp" Version="3.119.2" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -31,7 +31,8 @@
|
|||||||
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
||||||
<LinkerArg Include="synchronization.lib" />
|
<LinkerArg Include="synchronization.lib" />
|
||||||
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
||||||
<LinkerArg Include="d3d12.lib;d3dcompiler.lib" />
|
<LinkerArg Include="d3dcompiler.lib" />
|
||||||
|
<LinkerArg Include="/SUBSYSTEM:WINDOWS,6.01" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Target Name="StaticLinkAvaloniaAddWindowsDirectPInvokes"
|
<Target Name="StaticLinkAvaloniaAddWindowsDirectPInvokes"
|
||||||
@@ -74,7 +75,8 @@
|
|||||||
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
<LinkerArg Include="Gdi32.lib;User32.lib" />
|
||||||
<LinkerArg Include="synchronization.lib" />
|
<LinkerArg Include="synchronization.lib" />
|
||||||
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
<LinkerArg Include="fontsub.lib;Ole32.lib;USP10.lib" />
|
||||||
<LinkerArg Include="d3d12.lib;d3dcompiler.lib" />
|
<LinkerArg Include="d3dcompiler.lib" />
|
||||||
|
<LinkerArg Include="/SUBSYSTEM:WINDOWS,6.01" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
|
|||||||
@@ -10,10 +10,18 @@ dotnet add package StaticLink.Avalonia
|
|||||||
|
|
||||||
Or add it manually:
|
Or add it manually:
|
||||||
|
|
||||||
|
```xml
|
||||||
|
<PackageReference Include="StaticLink.Avalonia" Version="3.119.2-7151.10" />
|
||||||
|
```
|
||||||
|
|
||||||
|
`3.119.2-7151.10` supports Avalonia 11. If you need the SkiaSharp 2 line for an Avalonia 11 project, use this optional package variant:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<PackageReference Include="StaticLink.Avalonia" Version="2.88.9-7151.10" />
|
<PackageReference Include="StaticLink.Avalonia" Version="2.88.9-7151.10" />
|
||||||
```
|
```
|
||||||
|
|
||||||
|
`2.88.9-7151.10` is only for Avalonia 11 projects that specifically want SkiaSharp 2.
|
||||||
|
|
||||||
For macOS, also reference `StaticLink.Avalonia.Native`. This package is macOS-only and must match your Avalonia version because it contains `libAvaloniaNative.a`.
|
For macOS, also reference `StaticLink.Avalonia.Native`. This package is macOS-only and must match your Avalonia version because it contains `libAvaloniaNative.a`.
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ WORK_DIR="${WORK_DIR:-$ROOT_DIR/External/NativeStatic/.work}"
|
|||||||
TARGET_CPU="${TARGET_CPU:-x64}"
|
TARGET_CPU="${TARGET_CPU:-x64}"
|
||||||
RID="${RID:-linux-$TARGET_CPU}"
|
RID="${RID:-linux-$TARGET_CPU}"
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/External/NativeStatic/$RID}"
|
OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/External/NativeStatic/$RID}"
|
||||||
SKIASHARP_VERSION="${SKIASHARP_VERSION:-2.88.9}"
|
SKIASHARP_VERSION="${SKIASHARP_VERSION:-3.119.2}"
|
||||||
ANGLE_BRANCH="${ANGLE_BRANCH:-7151}"
|
ANGLE_BRANCH="${ANGLE_BRANCH:-7151}"
|
||||||
BUILD_JOBS="${BUILD_JOBS:-$(nproc)}"
|
BUILD_JOBS="${BUILD_JOBS:-$(nproc)}"
|
||||||
ANGLE_PATCH_DIR="${ANGLE_PATCH_DIR:-$ROOT_DIR/External/NativeStatic/patches}"
|
ANGLE_PATCH_DIR="${ANGLE_PATCH_DIR:-$ROOT_DIR/External/NativeStatic/patches}"
|
||||||
@@ -20,7 +20,7 @@ Usage: scripts/build-linux-static-graphics.sh [skia|angle|all]
|
|||||||
Environment:
|
Environment:
|
||||||
WORK_DIR Source/build cache directory. Default: External/NativeStatic/.work
|
WORK_DIR Source/build cache directory. Default: External/NativeStatic/.work
|
||||||
OUTPUT_DIR Final static library directory. Default: External/NativeStatic/linux-$TARGET_CPU
|
OUTPUT_DIR Final static library directory. Default: External/NativeStatic/linux-$TARGET_CPU
|
||||||
SKIASHARP_VERSION SkiaSharp release branch version. Default: 2.88.9
|
SKIASHARP_VERSION SkiaSharp release branch version. Default: 3.119.2
|
||||||
ANGLE_BRANCH ANGLE chromium branch. Default: 7151
|
ANGLE_BRANCH ANGLE chromium branch. Default: 7151
|
||||||
TARGET_CPU GN target_cpu. Default: x64. Supported: x64, arm64
|
TARGET_CPU GN target_cpu. Default: x64. Supported: x64, arm64
|
||||||
RID Output RID. Default: linux-$TARGET_CPU
|
RID Output RID. Default: linux-$TARGET_CPU
|
||||||
@@ -61,10 +61,8 @@ ensure_depot_tools() {
|
|||||||
else
|
else
|
||||||
git -C "$depot_dir" pull --ff-only
|
git -C "$depot_dir" pull --ff-only
|
||||||
fi
|
fi
|
||||||
if is_musl_rid || [[ "$TARGET_CPU" == "arm64" ]]; then
|
|
||||||
initialize_depot_tools_system_python "$depot_dir"
|
|
||||||
fi
|
|
||||||
if is_musl_rid; then
|
if is_musl_rid; then
|
||||||
|
initialize_depot_tools_system_python "$depot_dir"
|
||||||
patch_depot_tools_python_deps "$depot_dir"
|
patch_depot_tools_python_deps "$depot_dir"
|
||||||
fi
|
fi
|
||||||
export PATH="$python_bin_dir:$depot_dir:$PATH"
|
export PATH="$python_bin_dir:$depot_dir:$PATH"
|
||||||
@@ -182,45 +180,6 @@ sync_skia_deps() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_skia_gn() {
|
|
||||||
local skia_dir="$1"
|
|
||||||
if [[ -x "$skia_dir/bin/gn" ]] && "$skia_dir/bin/gn" --version >/dev/null 2>&1; then
|
|
||||||
echo "$skia_dir/bin/gn"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if [[ -x /usr/bin/gn ]] && /usr/bin/gn --version >/dev/null 2>&1; then
|
|
||||||
echo /usr/bin/gn
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if command -v gn >/dev/null 2>&1; then
|
|
||||||
command -v gn
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
echo "Missing runnable gn. Install generate-ninja/gn or provide a runnable $skia_dir/bin/gn." >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
patch_skia_2889_compat() {
|
|
||||||
local skia_dir="$1"
|
|
||||||
local parse_color="$skia_dir/src/utils/SkParseColor.cpp"
|
|
||||||
if [[ -f "$parse_color" ]] && ! grep -q '#include <iterator>' "$parse_color"; then
|
|
||||||
python3 - "$parse_color" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
if '#include <iterator>' not in text:
|
|
||||||
marker = '#include <algorithm>\n'
|
|
||||||
if marker in text:
|
|
||||||
text = text.replace(marker, marker + '#include <iterator>\n', 1)
|
|
||||||
else:
|
|
||||||
text = '#include <iterator>\n' + text
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
build_skia() {
|
build_skia() {
|
||||||
ensure_tools
|
ensure_tools
|
||||||
ensure_depot_tools
|
ensure_depot_tools
|
||||||
@@ -229,7 +188,6 @@ build_skia() {
|
|||||||
sync_skia_deps "$src"
|
sync_skia_deps "$src"
|
||||||
|
|
||||||
local skia_dir="$src/externals/skia"
|
local skia_dir="$src/externals/skia"
|
||||||
patch_skia_2889_compat "$skia_dir"
|
|
||||||
local out_dir="$skia_dir/out/linux-static-$TARGET_CPU"
|
local out_dir="$skia_dir/out/linux-static-$TARGET_CPU"
|
||||||
mkdir -p "$out_dir" "$OUTPUT_DIR"
|
mkdir -p "$out_dir" "$OUTPUT_DIR"
|
||||||
|
|
||||||
@@ -269,9 +227,7 @@ extra_cflags_cc = [ "-frtti" ]
|
|||||||
extra_ldflags = [ "-static-libstdc++", "-static-libgcc" ]
|
extra_ldflags = [ "-static-libstdc++", "-static-libgcc" ]
|
||||||
EOF_ARGS
|
EOF_ARGS
|
||||||
|
|
||||||
local gn_cmd
|
(cd "$skia_dir" && "$skia_dir/bin/gn" gen "$out_dir")
|
||||||
gn_cmd="$(resolve_skia_gn "$skia_dir")"
|
|
||||||
(cd "$skia_dir" && "$gn_cmd" gen "$out_dir")
|
|
||||||
ninja -C "$out_dir" -j "$BUILD_JOBS" skia SkiaSharp HarfBuzzSharp
|
ninja -C "$out_dir" -j "$BUILD_JOBS" skia SkiaSharp HarfBuzzSharp
|
||||||
|
|
||||||
copy_first_existing "$OUTPUT_DIR/libskia.a" \
|
copy_first_existing "$OUTPUT_DIR/libskia.a" \
|
||||||
@@ -312,18 +268,9 @@ build_angle() {
|
|||||||
prepend_python_module_path six
|
prepend_python_module_path six
|
||||||
prepare_angle_gcs_artifacts "$src"
|
prepare_angle_gcs_artifacts "$src"
|
||||||
fi
|
fi
|
||||||
if use_angle_nohooks_sync; then
|
|
||||||
prepare_angle_gcs_artifacts "$src"
|
|
||||||
fi
|
|
||||||
prepare_musl_clang_runtime
|
prepare_musl_clang_runtime
|
||||||
prepare_musl_libstdcxx_headers
|
prepare_musl_libstdcxx_headers
|
||||||
if use_angle_nohooks_sync; then
|
gclient sync -f -D -R
|
||||||
gclient sync -f -D -R --nohooks
|
|
||||||
patch_angle_system_gn_compat "$src"
|
|
||||||
python3 build/util/lastchange.py -o build/util/LASTCHANGE
|
|
||||||
else
|
|
||||||
gclient sync -f -D -R
|
|
||||||
fi
|
|
||||||
|
|
||||||
local out_dir="$src/out/linux-static-$TARGET_CPU"
|
local out_dir="$src/out/linux-static-$TARGET_CPU"
|
||||||
local angle_is_clang="false"
|
local angle_is_clang="false"
|
||||||
@@ -369,24 +316,6 @@ apply_angle_patches() {
|
|||||||
local build_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH.patch"
|
local build_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH.patch"
|
||||||
local deps_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH-deps.patch"
|
local deps_patch="$ANGLE_PATCH_DIR/angle-chromium-$ANGLE_BRANCH-deps.patch"
|
||||||
|
|
||||||
if ! grep -q 'not_needed(\["exec_script_allowlist"\])' "$src/.gn"; then
|
|
||||||
python3 - "$src/.gn" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
needle = 'exec_script_allowlist = angle_dotfile_settings.exec_script_allowlist +\n'
|
|
||||||
if needle in text and 'not_needed(["exec_script_allowlist"])' not in text:
|
|
||||||
end = text.find('\n\n', text.find(needle))
|
|
||||||
if end != -1:
|
|
||||||
text = text[:end] + '\nnot_needed(["exec_script_allowlist"])' + text[end:]
|
|
||||||
else:
|
|
||||||
text += '\nnot_needed(["exec_script_allowlist"])\n'
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
|
|
||||||
if ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then
|
if ! git -C "$src" grep -q 'angle_static_library("libANGLE_static")' -- BUILD.gn; then
|
||||||
python3 - "$src/BUILD.gn" <<'PY'
|
python3 - "$src/BUILD.gn" <<'PY'
|
||||||
import pathlib
|
import pathlib
|
||||||
@@ -451,27 +380,6 @@ download_angle_gcs_artifact() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
use_angle_nohooks_sync() {
|
|
||||||
! is_musl_rid && [[ "$TARGET_CPU" == "arm64" ]]
|
|
||||||
}
|
|
||||||
|
|
||||||
patch_angle_system_gn_compat() {
|
|
||||||
local src="$1"
|
|
||||||
local siso_gni="$src/build/toolchain/siso.gni"
|
|
||||||
if [[ -f "$siso_gni" ]] && grep -q 'path_exists(' "$siso_gni"; then
|
|
||||||
python3 - "$siso_gni" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import re
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
text = re.sub(r'(?<!false && )path_exists\(', 'false && path_exists(', text)
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
append_angle_musl_gn_args() {
|
append_angle_musl_gn_args() {
|
||||||
local args_file="$1"
|
local args_file="$1"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ WORK_DIR="${WORK_DIR:-$ROOT_DIR/External/NativeStatic/.work}"
|
|||||||
TARGET_CPU="${TARGET_CPU:-arm64}"
|
TARGET_CPU="${TARGET_CPU:-arm64}"
|
||||||
RID="${RID:-osx-$TARGET_CPU}"
|
RID="${RID:-osx-$TARGET_CPU}"
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/External/NativeStatic/$RID}"
|
OUTPUT_DIR="${OUTPUT_DIR:-$ROOT_DIR/External/NativeStatic/$RID}"
|
||||||
SKIASHARP_VERSION="${SKIASHARP_VERSION:-2.88.9}"
|
SKIASHARP_VERSION="${SKIASHARP_VERSION:-3.119.2}"
|
||||||
ANGLE_BRANCH="${ANGLE_BRANCH:-7151}"
|
ANGLE_BRANCH="${ANGLE_BRANCH:-7151}"
|
||||||
BUILD_JOBS="${BUILD_JOBS:-$(sysctl -n hw.ncpu)}"
|
BUILD_JOBS="${BUILD_JOBS:-$(sysctl -n hw.ncpu)}"
|
||||||
ANGLE_PATCH_DIR="${ANGLE_PATCH_DIR:-$ROOT_DIR/External/NativeStatic/patches}"
|
ANGLE_PATCH_DIR="${ANGLE_PATCH_DIR:-$ROOT_DIR/External/NativeStatic/patches}"
|
||||||
@@ -53,101 +53,6 @@ copy_first_existing() {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve_skia_gn() {
|
|
||||||
local skia_dir="$1"
|
|
||||||
if [[ -x "$skia_dir/bin/gn" ]] && "$skia_dir/bin/gn" --version >/dev/null 2>&1; then
|
|
||||||
echo "$skia_dir/bin/gn"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
if command -v gn >/dev/null 2>&1; then
|
|
||||||
command -v gn
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
echo "Missing runnable gn. Install Homebrew gn or provide a runnable $skia_dir/bin/gn." >&2
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
patch_skia_2889_compat() {
|
|
||||||
local skia_dir="$1"
|
|
||||||
local parse_color="$skia_dir/src/utils/SkParseColor.cpp"
|
|
||||||
if [[ -f "$parse_color" ]] && ! grep -q '#include <iterator>' "$parse_color"; then
|
|
||||||
python3 - "$parse_color" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
if '#include <iterator>' not in text:
|
|
||||||
marker = '#include <algorithm>\n'
|
|
||||||
if marker in text:
|
|
||||||
text = text.replace(marker, marker + '#include <iterator>\n', 1)
|
|
||||||
else:
|
|
||||||
text = '#include <iterator>\n' + text
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
|
|
||||||
local zutil="$skia_dir/third_party/externals/zlib/zutil.h"
|
|
||||||
if [[ -f "$zutil" ]] && grep -q 'define fdopen(fd,mode) NULL' "$zutil"; then
|
|
||||||
python3 - "$zutil" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
text = text.replace('# define fdopen(fd,mode) NULL /* No fdopen() */\n', '')
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pngpriv="$skia_dir/third_party/externals/libpng/pngpriv.h"
|
|
||||||
if [[ -f "$pngpriv" ]] && grep -q '# include <fp.h>' "$pngpriv"; then
|
|
||||||
python3 - "$pngpriv" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
text = text.replace('# include <fp.h>\n', '')
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
if [[ -f "$pngpriv" ]] && ! grep -q '#include <math.h>' "$pngpriv"; then
|
|
||||||
python3 - "$pngpriv" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
marker = '#include "png.h"\n'
|
|
||||||
if '#include <math.h>' not in text:
|
|
||||||
if marker in text:
|
|
||||||
text = text.replace(marker, marker + '#include <math.h>\n', 1)
|
|
||||||
else:
|
|
||||||
text = '#include <math.h>\n' + text
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
|
|
||||||
local pngc="$skia_dir/third_party/externals/libpng/png.c"
|
|
||||||
if [[ -f "$pngc" ]] && ! grep -q '#include <math.h>' "$pngc"; then
|
|
||||||
python3 - "$pngc" <<'PY'
|
|
||||||
from pathlib import Path
|
|
||||||
import sys
|
|
||||||
|
|
||||||
path = Path(sys.argv[1])
|
|
||||||
text = path.read_text()
|
|
||||||
marker = '#include "pngpriv.h"\n'
|
|
||||||
if '#include <math.h>' not in text:
|
|
||||||
if marker in text:
|
|
||||||
text = text.replace(marker, marker + '#include <math.h>\n', 1)
|
|
||||||
else:
|
|
||||||
text = '#include <math.h>\n' + text
|
|
||||||
path.write_text(text)
|
|
||||||
PY
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
sync_skiasharp() {
|
sync_skiasharp() {
|
||||||
local src="$WORK_DIR/SkiaSharp-$SKIASHARP_VERSION"
|
local src="$WORK_DIR/SkiaSharp-$SKIASHARP_VERSION"
|
||||||
if [[ ! -d "$src/.git" ]]; then
|
if [[ ! -d "$src/.git" ]]; then
|
||||||
@@ -201,15 +106,8 @@ build_skia() {
|
|||||||
if [[ ! -x "$skia_dir/bin/gn" ]]; then
|
if [[ ! -x "$skia_dir/bin/gn" ]]; then
|
||||||
sync_skia_deps "$skia_dir"
|
sync_skia_deps "$skia_dir"
|
||||||
fi
|
fi
|
||||||
patch_skia_2889_compat "$skia_dir"
|
|
||||||
|
|
||||||
local out_dir="$skia_dir/out/mac-static-$TARGET_CPU"
|
local out_dir="$skia_dir/out/mac-static-$TARGET_CPU"
|
||||||
local mac_arch
|
|
||||||
case "$TARGET_CPU" in
|
|
||||||
x64) mac_arch="x86_64" ;;
|
|
||||||
arm64) mac_arch="arm64" ;;
|
|
||||||
*) echo "Unsupported macOS TARGET_CPU: $TARGET_CPU" >&2; exit 1 ;;
|
|
||||||
esac
|
|
||||||
mkdir -p "$out_dir" "$OUTPUT_DIR"
|
mkdir -p "$out_dir" "$OUTPUT_DIR"
|
||||||
cat >"$out_dir/args.gn" <<EOF_ARGS
|
cat >"$out_dir/args.gn" <<EOF_ARGS
|
||||||
target_os = "mac"
|
target_os = "mac"
|
||||||
@@ -237,14 +135,11 @@ skia_use_xps = false
|
|||||||
cc = "clang"
|
cc = "clang"
|
||||||
cxx = "clang++"
|
cxx = "clang++"
|
||||||
ar = "ar"
|
ar = "ar"
|
||||||
extra_cflags = [ "-DSKIA_C_DLL", "-arch", "$mac_arch" ]
|
extra_cflags = [ "-DSKIA_C_DLL" ]
|
||||||
extra_cflags_cc = [ "-frtti" ]
|
extra_cflags_cc = [ "-frtti" ]
|
||||||
extra_ldflags = [ "-arch", "$mac_arch" ]
|
|
||||||
EOF_ARGS
|
EOF_ARGS
|
||||||
|
|
||||||
local gn_cmd
|
(cd "$skia_dir" && "$skia_dir/bin/gn" gen "$out_dir")
|
||||||
gn_cmd="$(resolve_skia_gn "$skia_dir")"
|
|
||||||
(cd "$skia_dir" && "$gn_cmd" gen "$out_dir")
|
|
||||||
ninja -C "$out_dir" -j "$BUILD_JOBS" skia SkiaSharp HarfBuzzSharp
|
ninja -C "$out_dir" -j "$BUILD_JOBS" skia SkiaSharp HarfBuzzSharp
|
||||||
copy_first_existing "$OUTPUT_DIR/libskia.a" "$out_dir/libskia.a" "$out_dir/obj/libskia.a"
|
copy_first_existing "$OUTPUT_DIR/libskia.a" "$out_dir/libskia.a" "$out_dir/obj/libskia.a"
|
||||||
copy_first_existing "$OUTPUT_DIR/libSkiaSharp.a" "$out_dir/libSkiaSharp.a" "$out_dir/obj/libSkiaSharp.a"
|
copy_first_existing "$OUTPUT_DIR/libSkiaSharp.a" "$out_dir/libSkiaSharp.a" "$out_dir/obj/libSkiaSharp.a"
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ $ErrorActionPreference = "Stop"
|
|||||||
|
|
||||||
$RootDir = Split-Path -Parent $PSScriptRoot
|
$RootDir = Split-Path -Parent $PSScriptRoot
|
||||||
$WorkDir = if ($env:WORK_DIR) { $env:WORK_DIR } else { Join-Path $RootDir "External\NativeStatic\.work" }
|
$WorkDir = if ($env:WORK_DIR) { $env:WORK_DIR } else { Join-Path $RootDir "External\NativeStatic\.work" }
|
||||||
$SkiaSharpVersion = if ($env:SKIASHARP_VERSION) { $env:SKIASHARP_VERSION } else { "2.88.9" }
|
$SkiaSharpVersion = if ($env:SKIASHARP_VERSION) { $env:SKIASHARP_VERSION } else { "3.119.2" }
|
||||||
$AngleBranch = if ($env:ANGLE_BRANCH) { $env:ANGLE_BRANCH } else { "7151" }
|
$AngleBranch = if ($env:ANGLE_BRANCH) { $env:ANGLE_BRANCH } else { "7151" }
|
||||||
$TargetCpu = if ($env:TARGET_CPU) { $env:TARGET_CPU } else { "x64" }
|
$TargetCpu = if ($env:TARGET_CPU) { $env:TARGET_CPU } else { "x64" }
|
||||||
$Rid = if ($env:RID) { $env:RID } else { "win-$TargetCpu" }
|
$Rid = if ($env:RID) { $env:RID } else { "win-$TargetCpu" }
|
||||||
@@ -72,15 +72,6 @@ function Copy-FirstExisting($Destination, [string[]]$Candidates) {
|
|||||||
throw "None of the expected files exist for ${Destination}: $($Candidates -join ', ')"
|
throw "None of the expected files exist for ${Destination}: $($Candidates -join ', ')"
|
||||||
}
|
}
|
||||||
|
|
||||||
function Resolve-FirstExistingPath([string[]]$Candidates) {
|
|
||||||
foreach ($candidate in $Candidates) {
|
|
||||||
if (Test-Path $candidate) {
|
|
||||||
return $candidate
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw "None of the expected paths exist: $($Candidates -join ', ')"
|
|
||||||
}
|
|
||||||
|
|
||||||
function Split-ParameterList($Parameters) {
|
function Split-ParameterList($Parameters) {
|
||||||
if ([string]::IsNullOrWhiteSpace($Parameters)) {
|
if ([string]::IsNullOrWhiteSpace($Parameters)) {
|
||||||
return @()
|
return @()
|
||||||
@@ -425,7 +416,12 @@ skia_use_system_libwebp = false
|
|||||||
skia_use_system_zlib = false
|
skia_use_system_zlib = false
|
||||||
skia_use_vulkan = false
|
skia_use_vulkan = false
|
||||||
skia_use_xps = true
|
skia_use_xps = true
|
||||||
extra_cflags = [ "-DSKIA_C_DLL" ]
|
extra_cflags = [
|
||||||
|
"-DSKIA_C_DLL",
|
||||||
|
"-DWINVER=0x0601",
|
||||||
|
"-D_WIN32_WINNT=0x0601",
|
||||||
|
"-DNTDDI_VERSION=0x06010000",
|
||||||
|
]
|
||||||
extra_cflags_cc = [ "/GR" ]
|
extra_cflags_cc = [ "/GR" ]
|
||||||
"@ | Set-Content -Path (Join-Path $outDir "args.gn") -Encoding ASCII
|
"@ | Set-Content -Path (Join-Path $outDir "args.gn") -Encoding ASCII
|
||||||
|
|
||||||
@@ -452,10 +448,7 @@ extra_cflags_cc = [ "/GR" ]
|
|||||||
)
|
)
|
||||||
New-WinX86SkiaStdcallThunks `
|
New-WinX86SkiaStdcallThunks `
|
||||||
-InputLibraries @($skiaLib, $skiaSharpLib, $harfbuzzLib) `
|
-InputLibraries @($skiaLib, $skiaSharpLib, $harfbuzzLib) `
|
||||||
-BindingFiles @(
|
-BindingFiles @((Join-Path $src "binding\SkiaSharp\SkiaApi.generated.cs"), (Join-Path $src "binding\HarfBuzzSharp\HarfBuzzApi.generated.cs")) `
|
||||||
(Resolve-FirstExistingPath @((Join-Path $src "binding\SkiaSharp\SkiaApi.generated.cs"), (Join-Path $src "binding\Binding\SkiaApi.generated.cs"))),
|
|
||||||
(Resolve-FirstExistingPath @((Join-Path $src "binding\HarfBuzzSharp\HarfBuzzApi.generated.cs"), (Join-Path $src "binding\HarfBuzzSharp.Shared\HarfBuzzApi.generated.cs")))
|
|
||||||
) `
|
|
||||||
-Destination (Join-Path $OutputDir "skia_x86_stdcall_thunks.lib")
|
-Destination (Join-Path $OutputDir "skia_x86_stdcall_thunks.lib")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -551,6 +544,11 @@ build_angle_deqp_tests = false
|
|||||||
angle_enable_swiftshader = false
|
angle_enable_swiftshader = false
|
||||||
angle_enable_vulkan = false
|
angle_enable_vulkan = false
|
||||||
angle_enable_wgpu = false
|
angle_enable_wgpu = false
|
||||||
|
extra_cflags = [
|
||||||
|
"-DWINVER=0x0601",
|
||||||
|
"-D_WIN32_WINNT=0x0601",
|
||||||
|
"-DNTDDI_VERSION=0x06010000",
|
||||||
|
]
|
||||||
"@ | Set-Content -Path (Join-Path $outDir "args.gn") -Encoding ASCII
|
"@ | Set-Content -Path (Join-Path $outDir "args.gn") -Encoding ASCII
|
||||||
gn gen $outDir
|
gn gen $outDir
|
||||||
ninja -C $outDir -j $BuildJobs libANGLE_static libGLESv2_static
|
ninja -C $outDir -j $BuildJobs libANGLE_static libGLESv2_static
|
||||||
|
|||||||
Reference in new issue
Block a user