From b99ae873367a8afb84e5b9d94763e49c86ce2a39 Mon Sep 17 00:00:00 2001 From: Dan Yeaw Date: Sun, 15 Sep 2024 20:12:19 -0400 Subject: [PATCH] Update librsvg to version 2.59.1 --- .../001-fix-failed-to-rename-query-rust.patch | 46 +++++++++++++++++++ gvsbuild/projects/librsvg.py | 43 ++++++++--------- 2 files changed, 66 insertions(+), 23 deletions(-) create mode 100644 gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch diff --git a/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch b/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch new file mode 100644 index 000000000..ab96c6a14 --- /dev/null +++ b/gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch @@ -0,0 +1,46 @@ +diff --git a/meson/query-rustc.py b/meson/query-rustc.py +index 2b169b1fc5ad7dff2dfec1d62214ee4cb1fce0de..f97cb692d1a080a730be8953c60e52ffc9a71b91 100755 +--- a/meson/query-rustc.py ++++ b/meson/query-rustc.py +@@ -64,7 +64,6 @@ def retrive_version_info(output, query): + + if __name__ == "__main__": + args = parser.parse_args() +- dummy_out = tempfile.NamedTemporaryFile() + query = args.query + query_arg = None + rustc_cmd = [Path(args.RUSTC).as_posix()] +@@ -85,17 +84,23 @@ if __name__ == "__main__": + if args.target: + rustc_cmd.extend(['--target', args.target]) + +- # We need these for '--print=native-static-libs' on Windows +- if query == 'native-static-libs': +- rustc_cmd.extend(['--crate-type', 'staticlib']) +- rustc_cmd.append(os.devnull) +- rustc_cmd.extend(['-o', dummy_out.name]) ++ fd, dummy_out = tempfile.mkstemp() ++ os.close(fd) ++ try: ++ # We need these for '--print=native-static-libs' on Windows ++ if query == 'native-static-libs': ++ rustc_cmd.extend(['--crate-type', 'staticlib']) ++ rustc_cmd.append(os.devnull) ++ rustc_cmd.extend(['-o', dummy_out]) ++ ++ query_results = subprocess.run( ++ rustc_cmd, ++ capture_output=True, ++ text=True, ++ ) ++ finally: ++ os.unlink(dummy_out) + +- query_results = subprocess.run( +- rustc_cmd, +- capture_output=True, +- text=True, +- ) + if query == 'native-static-libs': + retrieve_native_static_libs_from_output(query_results.stderr) + elif query == 'default-host-toolchain' or query == 'stable-actual-version': diff --git a/gvsbuild/projects/librsvg.py b/gvsbuild/projects/librsvg.py index 120ce3506..b8d6f2aac 100644 --- a/gvsbuild/projects/librsvg.py +++ b/gvsbuild/projects/librsvg.py @@ -12,22 +12,22 @@ # # You should have received a copy of the GNU General Public License # along with this program; if not, see . -import sys +from gvsbuild.utils.base_builders import Meson from gvsbuild.utils.base_expanders import Tarball from gvsbuild.utils.base_project import Project, project_add @project_add -class Librsvg(Tarball, Project): +class Librsvg(Tarball, Meson): def __init__(self): Project.__init__( self, "librsvg", - version="2.58.3", + version="2.59.1", repository="https://gitlab.gnome.org/GNOME/librsvg", archive_url="https://download.gnome.org/sources/librsvg/{major}.{minor}/librsvg-{version}.tar.xz", - hash="49f29a0a92f4c2d19a2cb41e96ab2fce7eb5bde41850c8a914fcf655e3110944", + hash="6116267c7ddabfd4daaf1c341326da0a773139a7223e885ae40ee09bd6986ef6", dependencies=[ "cargo", "cairo", @@ -36,29 +36,26 @@ def __init__(self): "libxml2", "freetype", ], - patches=[], + patches=[ + # https://gitlab.gnome.org/GNOME/librsvg/-/merge_requests/1040 + "001-fix-failed-to-rename-query-rust.patch", + ], ) - if Project.opts.enable_gi: - self.add_dependency("gobject-introspection") - - def build(self): - self.builder.mod_env("INCLUDE", "include\\cairo", add_gtk=True) - b_dir = f"{self.builder.working_dir}\\{self.name}\\win32" - - config = self.builder.opts.configuration - gtk_dir = self.builder.gtk_dir - rust_ver = Project.get_project("cargo").version - python = sys.executable - cmd = f'nmake -f makefile.vc CFG={config} "PREFIX={gtk_dir}" CARGO=cargo RUSTUP=rustup "PYTHON={python}" TOOLCHAIN_VERSION={rust_ver} install' - - if Project.opts.enable_gi: - cmd += " INTROSPECTION=1" + if self.opts.enable_gi: + self.add_dependency("gobject-introspection") + enable_gi = "enabled" + else: + enable_gi = "disabled" - self.push_location(b_dir) - self.exec_vs(cmd) - self.pop_location() + self.add_param(f"-Dintrospection={enable_gi}") + self.add_param("-Ddocs=disabled") + self.add_param("-Dtests=false") + self.add_param("-Dvala=disabled") + def build(self): + self.builder.exec_cargo("install cargo-c --locked") + Meson.build(self) self.install(r".\COPYING.LIB share\doc\librsvg") def post_install(self):