librsvg: attemp to fix problem with missing symbol '__clzsi2'

Using patch from 449fdccaff
This commit is contained in:
Leonid Pliushch 2019-07-19 23:29:37 +03:00
parent 0c2dd5fb97
commit d62890af1a
2 changed files with 93 additions and 3 deletions

View File

@ -2,10 +2,10 @@ TERMUX_PKG_HOMEPAGE=https://wiki.gnome.org/action/show/Projects/LibRsvg
TERMUX_PKG_DESCRIPTION="Library to render SVG files using cairo" TERMUX_PKG_DESCRIPTION="Library to render SVG files using cairo"
TERMUX_PKG_LICENSE="LGPL-2.0" TERMUX_PKG_LICENSE="LGPL-2.0"
TERMUX_PKG_VERSION=2.45.7 TERMUX_PKG_VERSION=2.45.7
TERMUX_PKG_REVISION=1 TERMUX_PKG_REVISION=2
TERMUX_PKG_SHA256=d4399eb76eb4e955fd36a5e536e4cb965ccfafbbc72e3b43495e08ac2a61f993
TERMUX_PKG_SRCURL=http://ftp.gnome.org/pub/GNOME/sources/librsvg/${TERMUX_PKG_VERSION:0:4}/librsvg-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SRCURL=http://ftp.gnome.org/pub/GNOME/sources/librsvg/${TERMUX_PKG_VERSION:0:4}/librsvg-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_DEPENDS="libcroco,pango,gdk-pixbuf,libcairo-gobject,zlib" TERMUX_PKG_SHA256=d4399eb76eb4e955fd36a5e536e4cb965ccfafbbc72e3b43495e08ac2a61f993
TERMUX_PKG_DEPENDS="libcroco, pango, gdk-pixbuf, libcairo-gobject, zlib"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-introspection --disable-pixbuf-loader" TERMUX_PKG_EXTRA_CONFIGURE_ARGS="--disable-introspection --disable-pixbuf-loader"
termux_step_pre_configure() { termux_step_pre_configure() {

View File

@ -0,0 +1,90 @@
From 449fdccaffd316eddb394589008310c327eb31bb Mon Sep 17 00:00:00 2001
From: Kleis Auke Wolthuizen <github@kleisauke.nl>
Date: Tue, 16 Jul 2019 09:00:00 +0200
Subject: [PATCH] Ensure that the __clzsi2 symbol is present
e310e36 solved static linking and the MinGW-w64 builds but included a
workaround for Rust 1.34 and 1.35 that didn't work for Rust 1.36.
The main problem with Rust 1.34 and 1.35 is that it included its own version
of the `__clzsi2` intrinsic instead of the C version. This caused duplicate
symbols during linking and required a workaround by removing the duplicated
symbol, see:
https://github.com/rust-lang/rust/issues/58277
Fortunately, this is solved within rustc 1.36, see:
https://github.com/rust-lang-nursery/compiler-builtins/commit/752e35a11f2e7eb29df84668bef0945e75cf3eb5
The workaround, however, did not ensure that `__clzsi2` intrinsic is only
removed when it is duplicated (it could also remove the optimized C version).
This commit ensures that the `__clzsi2` intrinsic is present only once. Note
that the entire workaround can be removed when the minimum Rust version is
bumped to 1.36.
Closes: https://gitlab.gnome.org/GNOME/librsvg/issues/485
---
Makefile.am | 12 +++++++-----
configure.ac | 1 +
rsvg_internals/build.rs | 2 +-
3 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/Makefile.am b/Makefile.am
index f9205080..9289a384 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -136,11 +136,11 @@ cargo_verbose_ = $(cargo_verbose_$(AM_DEFAULT_VERBOSITY))
cargo_verbose_0 =
cargo_verbose_1 = --verbose
-RUST_LIB=@abs_top_builddir@/.libs/librsvg_internals.a
-CARGO_TARGET_DIR=@abs_top_builddir@/target
-
LIBRSVG_BUILD_DIR=@abs_top_builddir@
-LIBRSVG_TARGET_DIR=@abs_top_builddir@/target/@RUST_TARGET_SUBDIR@
+CARGO_TARGET_DIR=$(LIBRSVG_BUILD_DIR)/target
+LIBRSVG_TARGET_DIR=$(CARGO_TARGET_DIR)/$(RUST_TARGET_SUBDIR)
+
+RUST_LIB=$(LIBRSVG_BUILD_DIR)/.libs/librsvg_internals.a
check-local:
cd $(srcdir) && \
@@ -177,7 +177,9 @@ librsvg_internals.la: $(librsvg_internals_la_SOURCES)
LIBRSVG_BUILD_DIR=$(LIBRSVG_BUILD_DIR) \
LIBRSVG_TARGET_DIR=$(LIBRSVG_TARGET_DIR) \
$(CARGO) --locked build $(CARGO_VERBOSE) $(CARGO_TARGET_ARGS) $(CARGO_RELEASE_ARGS) --features "c-library" \
- && $(AR) d $(RUST_LIB) clzsi2.o # HACK: https://github.com/rust-lang/rust/issues/58277
+ && if [[ $$($(NM) -g $(RUST_LIB) | grep "T __clzsi2" -c) -gt 1 ]] ; then \
+ $(AR) d $(RUST_LIB) clzsi2.o; \
+ fi
librsvg_@RSVG_API_MAJOR_VERSION@_la_CPPFLAGS = \
-I$(top_srcdir) \
diff --git a/configure.ac b/configure.ac
index e416231a..fea5fa67 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,6 +109,7 @@ AS_IF(test x$RUSTC = xno,
AC_MSG_ERROR([rustc is required. Please install the Rust toolchain from https://www.rust-lang.org/])
)
AC_CHECK_PROGS(AR, ar)
+AC_CHECK_PROGS(NM, nm)
dnl Minimum version of rustc that we support
dnl If you change this, please update COMPILING.md
diff --git a/rsvg_internals/build.rs b/rsvg_internals/build.rs
index eaa17b05..eafaa2b4 100644
--- a/rsvg_internals/build.rs
+++ b/rsvg_internals/build.rs
@@ -7,7 +7,7 @@ use std::path::Path;
use std::os::unix::fs::symlink;
#[cfg(all(windows, not(target_env = "msvc")))]
-use std::os::windows::fs::symlink_file;
+use std::os::windows::fs::symlink_file as symlink;
#[cfg(not(target_env = "msvc"))]
use std::fs;
--
2.22.0