Skip to content

Commit

Permalink
Update librsvg to version 2.59.1
Browse files Browse the repository at this point in the history
  • Loading branch information
danyeaw authored and pbor committed Oct 22, 2024
1 parent 5178660 commit b99ae87
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 23 deletions.
46 changes: 46 additions & 0 deletions gvsbuild/patches/librsvg/001-fix-failed-to-rename-query-rust.patch
Original file line number Diff line number Diff line change
@@ -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':
43 changes: 20 additions & 23 deletions gvsbuild/projects/librsvg.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,22 @@
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, see <http://www.gnu.org/licenses/>.
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",
Expand All @@ -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):
Expand Down

0 comments on commit b99ae87

Please sign in to comment.