Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a98ddc7f23 |
No files matched your search
@@ -18,7 +18,7 @@ on:
|
|||||||
- "staticlink-avalonia-v*"
|
- "staticlink-avalonia-v*"
|
||||||
|
|
||||||
env:
|
env:
|
||||||
SKIASHARP_VERSION: "3.119.2"
|
SKIASHARP_VERSION: "2.88.9"
|
||||||
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,6 +49,9 @@ 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-') }}
|
||||||
@@ -75,7 +78,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++ 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++ 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
|
||||||
python3 - <<'"'"'PY'"'"'
|
python3 - <<'"'"'PY'"'"'
|
||||||
import pathlib
|
import pathlib
|
||||||
import httplib2
|
import httplib2
|
||||||
@@ -215,12 +218,6 @@ 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 }}
|
||||||
@@ -317,7 +314,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 12.0.3; do
|
for version in 11.3.14; 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/
|
||||||
@@ -385,14 +382,6 @@ 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="3.119.2-7151.10" />
|
<PackageReference Include="StaticLink.Avalonia" Version="2.88.9-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>3.119.2-7151.10</Version>
|
<Version>2.88.9-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="3.119.2" />
|
<PackageReference Include="SkiaSharp" Version="2.88.9" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ dotnet add package StaticLink.Avalonia
|
|||||||
Or add it manually:
|
Or add it manually:
|
||||||
|
|
||||||
```xml
|
```xml
|
||||||
<PackageReference Include="StaticLink.Avalonia" Version="3.119.2-7151.10" />
|
<PackageReference Include="StaticLink.Avalonia" Version="2.88.9-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 @@ 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:-3.119.2}"
|
SKIASHARP_VERSION="${SKIASHARP_VERSION:-2.88.9}"
|
||||||
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: 3.119.2
|
SKIASHARP_VERSION SkiaSharp release branch version. Default: 2.88.9
|
||||||
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,8 +61,10 @@ 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; then
|
if is_musl_rid || [[ "$TARGET_CPU" == "arm64" ]]; then
|
||||||
initialize_depot_tools_system_python "$depot_dir"
|
initialize_depot_tools_system_python "$depot_dir"
|
||||||
|
fi
|
||||||
|
if is_musl_rid; then
|
||||||
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"
|
||||||
@@ -180,6 +182,45 @@ 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
|
||||||
@@ -188,6 +229,7 @@ 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"
|
||||||
|
|
||||||
@@ -227,7 +269,9 @@ extra_cflags_cc = [ "-frtti" ]
|
|||||||
extra_ldflags = [ "-static-libstdc++", "-static-libgcc" ]
|
extra_ldflags = [ "-static-libstdc++", "-static-libgcc" ]
|
||||||
EOF_ARGS
|
EOF_ARGS
|
||||||
|
|
||||||
(cd "$skia_dir" && "$skia_dir/bin/gn" gen "$out_dir")
|
local gn_cmd
|
||||||
|
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" \
|
||||||
@@ -268,9 +312,18 @@ 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
|
||||||
gclient sync -f -D -R
|
if use_angle_nohooks_sync; then
|
||||||
|
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"
|
||||||
@@ -316,6 +369,24 @@ 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
|
||||||
@@ -380,6 +451,27 @@ 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:-3.119.2}"
|
SKIASHARP_VERSION="${SKIASHARP_VERSION:-2.88.9}"
|
||||||
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,6 +53,101 @@ 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
|
||||||
@@ -106,8 +201,15 @@ 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"
|
||||||
@@ -135,11 +237,14 @@ skia_use_xps = false
|
|||||||
cc = "clang"
|
cc = "clang"
|
||||||
cxx = "clang++"
|
cxx = "clang++"
|
||||||
ar = "ar"
|
ar = "ar"
|
||||||
extra_cflags = [ "-DSKIA_C_DLL" ]
|
extra_cflags = [ "-DSKIA_C_DLL", "-arch", "$mac_arch" ]
|
||||||
extra_cflags_cc = [ "-frtti" ]
|
extra_cflags_cc = [ "-frtti" ]
|
||||||
|
extra_ldflags = [ "-arch", "$mac_arch" ]
|
||||||
EOF_ARGS
|
EOF_ARGS
|
||||||
|
|
||||||
(cd "$skia_dir" && "$skia_dir/bin/gn" gen "$out_dir")
|
local gn_cmd
|
||||||
|
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 { "3.119.2" }
|
$SkiaSharpVersion = if ($env:SKIASHARP_VERSION) { $env:SKIASHARP_VERSION } else { "2.88.9" }
|
||||||
$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,6 +72,15 @@ 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 @()
|
||||||
@@ -443,7 +452,10 @@ extra_cflags_cc = [ "/GR" ]
|
|||||||
)
|
)
|
||||||
New-WinX86SkiaStdcallThunks `
|
New-WinX86SkiaStdcallThunks `
|
||||||
-InputLibraries @($skiaLib, $skiaSharpLib, $harfbuzzLib) `
|
-InputLibraries @($skiaLib, $skiaSharpLib, $harfbuzzLib) `
|
||||||
-BindingFiles @((Join-Path $src "binding\SkiaSharp\SkiaApi.generated.cs"), (Join-Path $src "binding\HarfBuzzSharp\HarfBuzzApi.generated.cs")) `
|
-BindingFiles @(
|
||||||
|
(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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user