From 7278ba936ac2cdf1686fa32255f93112ec88d658 Mon Sep 17 00:00:00 2001 From: Eric Long Date: Sat, 14 Oct 2023 12:56:46 +0800 Subject: [PATCH] updpatch: neovide 0.11.2-3 De-vendor Skia dependencies by making `SKIA_USE_SYSTEM_LIBRARIES` actually working; to be upstreamed to Arch. Related upstream PRs (for now): - https://github.com/rust-skia/rust-skia/pull/851 - https://github.com/rust-skia/rust-skia/pull/852 - https://github.com/rust-skia/rust-skia/pull/854 - https://github.com/google/skia/pull/146 --- neovide/riscv64.patch | 56 +++++++++++++++++----------- neovide/skia_native_build.patch | 66 --------------------------------- 2 files changed, 34 insertions(+), 88 deletions(-) delete mode 100644 neovide/skia_native_build.patch diff --git a/neovide/riscv64.patch b/neovide/riscv64.patch index ee7c4175e..d01c4452e 100644 --- a/neovide/riscv64.patch +++ b/neovide/riscv64.patch @@ -1,40 +1,52 @@ --- PKGBUILD +++ PKGBUILD -@@ -17,16 +17,33 @@ makedepends=(cargo - cmake - gtk3 - python -- sdl2) -+ sdl2 +@@ -15,23 +15,31 @@ depends=(fontconfig + libfreetype.so + libglvnd + neovim +- sndio) ++ sndio ++ libz.so ++ libexpat.so ++ libpng16.so ++ libjpeg.so) + makedepends=(cargo +- cmake) ++ cmake ++ python + git + gn + ninja + clang) optdepends=('vulkan-intel: vulkan support for intel') + optdepends=('libxkbcommon-x11: run on X11 (not needed for wayland)') _archive=("$pkgname-$pkgver") --source=("$url/archive/$pkgver/$_archive.tar.gz") --sha256sums=('4926c7fe1033a6f529bac649921c66bf98a03d70d4f0f7a7f7cdd1c74bb33533') -+source=("$url/archive/$pkgver/$_archive.tar.gz" -+ "git+https://github.com/rust-skia/rust-skia.git#tag=0.62.0" -+ "skia_native_build.patch") -+sha256sums=('4926c7fe1033a6f529bac649921c66bf98a03d70d4f0f7a7f7cdd1c74bb33533' -+ 'SKIP' -+ '7ec3b586aa492bc4e7417e55f46519e4d3dd40da51d758905b00f8c0913be387') + source=("$url/archive/$pkgver/$_archive.tar.gz") + sha256sums=('62e973a5407a6bfc731ce78e0495d2ed10930d33b22fe94cfe23acccbf789ae9') +options=(!lto) prepare() { -+ cd rust-skia -+ git submodule update --init --recursive -+ git apply ../skia_native_build.patch -+ cp /usr/bin/ninja skia-bindings/depot_tools/ -+ cd .. -+ cd "$_archive" - sed -i -e '/^incremental/a opt-level = 3' Cargo.toml +- sed -r -i \ +- -e '/^incremental/a opt-level = 3' \ +- -e '/wayland/s/\]/, "embed-icudtl"]/g' \ +- -e '/wayland/a no-default-features = true' \ +- Cargo.toml - cargo fetch --locked --target "$CARCH-unknown-linux-gnu" -+ echo -e "\n[patch.crates-io]\nskia-bindings = { path = '../rust-skia/skia-bindings' }\nring = { git = 'https://github.com/felixonmars/ring', branch = '0.16.20' }" >> Cargo.toml ++ sed -i -e '/^incremental/a opt-level = 3' Cargo.toml ++ echo -e "\n[patch.crates-io]\nskia-bindings = { git = 'https://github.com/hack3ric/rust-skia', branch = 'archrv-0.62.0' }\nring = { git = 'https://github.com/felixonmars/ring', branch = '0.16.20' }" >> Cargo.toml + cargo update -p skia-bindings -p ring + cargo fetch --locked } build() { +@@ -42,6 +50,9 @@ build() { + export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}" + CFLAGS+=' -ffat-lto-objects' + export SKIA_USE_SYSTEM_LIBRARIES=true ++ export FORCE_SKIA_BUILD=true ++ export SKIA_GN_COMMAND=gn ++ export SKIA_NINJA_COMMAND=ninja + cargo build --frozen --release --features embed-fonts + } + diff --git a/neovide/skia_native_build.patch b/neovide/skia_native_build.patch deleted file mode 100644 index ab6440403..000000000 --- a/neovide/skia_native_build.patch +++ /dev/null @@ -1,66 +0,0 @@ -diff --git a/skia-bindings/build_support/binary_cache/download.rs b/skia-bindings/build_support/binary_cache/download.rs -index 87def5a4..a8dff27e 100644 ---- a/skia-bindings/build_support/binary_cache/download.rs -+++ b/skia-bindings/build_support/binary_cache/download.rs -@@ -13,6 +13,7 @@ use std::{ - /// submodules, or when `build.rs` was invoked outside of the git repository by downloading and - /// unpacking them from GitHub. - pub fn resolve_dependencies() { -+ return; // manually do this in PKGBUILD - if cargo::is_crate() { - // In a crate. - download_dependencies(); -diff --git a/skia-bindings/build_support/skia/config.rs b/skia-bindings/build_support/skia/config.rs -index 504905e4..f5600a7d 100644 ---- a/skia-bindings/build_support/skia/config.rs -+++ b/skia-bindings/build_support/skia/config.rs -@@ -53,7 +53,7 @@ impl BuildConfiguration { - // It's possible that the provided command line for the compiler already includes --target. - // We assume that it's most specific/appropriate, extract and use is. It might for example include - // a vendor infix, while cargo targets usually don't. -- let target = cc -+ let mut target = cc - .find("--target=") - .map(|target_option_offset| { - let target_tail = &cc[(target_option_offset + "--target=".len())..]; -@@ -64,6 +64,10 @@ impl BuildConfiguration { - }) - .unwrap_or_else(cargo::target); - -+ if target.to_string() == "riscv64gc-unknown-linux-gnu" { -+ target = cargo::parse_target("riscv64-unknown-linux-gnu"); -+ } -+ - BuildConfiguration { - on_windows: cargo::host().is_windows(), - // `OPT_LEVEL` is set by Cargo itself. -Submodule skia-bindings/skia contains modified content -diff --git a/skia-bindings/skia/bin/fetch-gn b/skia-bindings/skia/bin/fetch-gn -index 0c251d8128..e7d5387d8d 100755 ---- a/skia-bindings/skia/bin/fetch-gn -+++ b/skia-bindings/skia/bin/fetch-gn -@@ -20,22 +20,11 @@ else: - - os.chdir(os.path.join(os.path.dirname(__file__), os.pardir)) - --gnzip = os.path.join(tempfile.mkdtemp(), 'gn.zip') --with open(gnzip, 'wb') as f: -- OS = {'darwin': 'mac', 'linux': 'linux', 'linux2': 'linux', 'win32': 'windows', 'msys': 'windows'}[sys.platform] -- cpu = {'aarch64': 'arm64', 'amd64': 'amd64', 'arm64': 'arm64', 'x86_64': 'amd64'}[platform.machine().lower()] -- -- rev = 'fe330c0ae1ec29db30b6f830e50771a335e071fb' -- url = 'https://chrome-infra-packages.appspot.com/dl/gn/gn/{}-{}/+/git_revision:{}'.format( -- OS,cpu,rev) -- f.write(urlopen(url).read()) -- - gn = 'gn.exe' if 'win32' in sys.platform or 'msys' in sys.platform else 'gn' --with zipfile.ZipFile(gnzip, 'r') as f: -- f.extract(gn, 'bin') -- - gn = os.path.join('bin', gn) - -+shutil.copy('/usr/bin/gn', gn) # use system gn -+ - os.chmod(gn, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | - stat.S_IRGRP | stat.S_IXGRP | - stat.S_IROTH | stat.S_IXOTH )