From 327a070266d00ed368d854d19eb4d29ab3e3803a Mon Sep 17 00:00:00 2001
From: Alexandre Janniaux <ajanni@videolabs.io>
Date: Tue, 19 Apr 2022 09:38:09 +0200
Subject: [PATCH] extras/tools: bump libtool to 2.4.7

The -fsanitize support has been added upstream in the commit
a5c6466528c060cc4660ad0319c00740db0e42ba which is shipped into 2.4.7.
---
 Makefile.am                                   |  1 -
 extras/tools/SHA512SUMS                       |  1 +
 .../tools/libtool-2.4.6-embed-bitcode.patch   | 39 ++++++++-----------
 extras/tools/packages.mak                     |  2 +-
 extras/tools/tools.mak                        |  1 -
 5 files changed, 19 insertions(+), 25 deletions(-)

diff --git a/Makefile.am b/Makefile.am
index 421b1d3338bf..b2a7d392e6a1 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -69,7 +69,6 @@ EXTRA_DIST += \
 	extras/tools/libtool-2.4.6-bitcode.patch \
 	extras/tools/libtool-2.4.6-clang-libs.patch \
 	extras/tools/libtool-2.4.6-response-files.patch \
-	extras/tools/libtool-2.4.6-san.patch \
 	extras/tools/ragel-6.8-javacodegen.patch
 
 ###############################################################################
diff --git a/extras/tools/SHA512SUMS b/extras/tools/SHA512SUMS
index 30c47af2720c..77b0f27b400d 100644
--- a/extras/tools/SHA512SUMS
+++ b/extras/tools/SHA512SUMS
@@ -19,3 +19,4 @@ d24849b93de58b20f518c071687e7bfa653a96600382f36c4cf7fc1047656458f75f093b911b786b
 8d23dde18525dccaa648ca01df40151e7f00cec4846bd611c8970dbcfc1fb57a453facfe4d41462e7c3c8bb548d44b961a04e4fc3073ab6b65063e53f42bf6fd  nasm-2.14.tar.gz
 1650bf9e3eddeb0b0fbb415c2b8e0a7c094421e991fa8139fd77fae0f6ee7ee980b7cf5e98d883c3a884f99abcb06fa26e3980af3a3a5bb6dd655124755782c2  ninja-1.8.2.tar.gz
 3b6cc5cae31d756b251ecde3483d3710bceff50cfd03ef6cf6f939d9e599998e61fcb03a2ee09d6a6f9bfa2198f43e7f20447359de3bff1055febcf03e82e514  meson-0.56.2.tar.gz
+27acef46d9eb67203d708b57d80b853f76fa4b9c2720ff36ec161e6cdf702249e7982214ddf60bae75511aa79bc7d92aa27e3eab7ef9c0f5c040e8e42e76a385  libtool-2.4.7.tar.gz
diff --git a/extras/tools/libtool-2.4.6-embed-bitcode.patch b/extras/tools/libtool-2.4.6-embed-bitcode.patch
index 4ca8e75591c5..33173e4e057a 100644
--- a/extras/tools/libtool-2.4.6-embed-bitcode.patch
+++ b/extras/tools/libtool-2.4.6-embed-bitcode.patch
@@ -1,46 +1,41 @@
-From 23f7d7c98d923bd454c114ea7dfa6ded9ef49bbe Mon Sep 17 00:00:00 2001
+From 019e9ec253a972fd5b0e3675140256b0982ec6f4 Mon Sep 17 00:00:00 2001
 From: Alexandre Janniaux <ajanni@videolabs.io>
 Date: Mon, 31 May 2021 10:28:54 +0200
 Subject: [PATCH] ltmain: add support for -fembed-bitcode
 
 ---
- build-aux/ltmain.in | 8 ++++++++
+ build-aux/ltmain.in | 1 +
  m4/libtool.m4       | 4 ++--
- 2 files changed, 10 insertions(+), 2 deletions(-)
+ 2 files changed, 3 insertions(+), 2 deletions(-)
 
 diff --git a/build-aux/ltmain.in b/build-aux/ltmain.in
-index 96b37003..0d9f10a0 100644
+index 8ef537c1..d8131598 100644
 --- a/build-aux/ltmain.in
 +++ b/build-aux/ltmain.in
-@@ -5173,6 +5173,13 @@ func_mode_link ()
- 	prev=xcompiler
+@@ -5197,6 +5197,7 @@ func_mode_link ()
  	continue
  	;;
-+      -fembed-bitcode|-fembed-bitcode-marker)
-+	func_append compiler_flags " $arg"
-+	func_append compile_command " $arg"
-+	func_append finalize_command " $arg"
-+	func_append linker_flags " $arg"
-+        continue
-+        ;;
-
-       -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
+       -mt|-mthreads|-kthread|-Kthread|-pthreads|--thread-safe \
++      |-fembed-bitcode|-fembed-bitcode-marker \
        |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ 	func_append compiler_flags " $arg"
+ 	func_append compile_command " $arg"
 diff --git a/m4/libtool.m4 b/m4/libtool.m4
-index f2d1f398..e5891815 100644
+index 69cd577d..da0eec54 100644
 --- a/m4/libtool.m4
 +++ b/m4/libtool.m4
-@@ -1125,9 +1125,9 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
+@@ -1122,9 +1122,9 @@ m4_defun([_LT_DARWIN_LINKER_FEATURES],
    if test yes = "$_lt_dar_can_shared"; then
      output_verbose_link_cmd=func_echo_all
      _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil"
 -    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
 +    _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -dynamiclib \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil"
-     _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
--    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
-+    _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -dynamiclib \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
+     _LT_TAGVAR(archive_expsym_cmds, $1)="$SED 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil"
+-    _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
++    _LT_TAGVAR(module_expsym_cmds, $1)="$SED -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -dynamiclib \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil"
      m4_if([$1], [CXX],
  [   if test yes != "$lt_cv_apple_cc_single_mod"; then
        _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil"
---
-2.31.1
+-- 
+2.36.0
+
diff --git a/extras/tools/packages.mak b/extras/tools/packages.mak
index da0b0d412e55..780a594fca5d 100644
--- a/extras/tools/packages.mak
+++ b/extras/tools/packages.mak
@@ -9,7 +9,7 @@ NASM_URL=http://www.nasm.us/pub/nasm/releasebuilds/$(NASM_VERSION)/nasm-$(NASM_V
 CMAKE_VERSION=3.17.0
 CMAKE_URL=http://www.cmake.org/files/v3.17/cmake-$(CMAKE_VERSION).tar.gz
 
-LIBTOOL_VERSION=2.4.6
+LIBTOOL_VERSION=2.4.7
 LIBTOOL_URL=$(GNU)/libtool/libtool-$(LIBTOOL_VERSION).tar.gz
 
 AUTOCONF_VERSION=2.69
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index 975b3afc532f..d7144f827d2e 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -113,7 +113,6 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
 	$(UNPACK)
 	(cd $(UNPACK_DIR) && chmod u+w build-aux/ltmain.sh)
 	$(APPLY) $(TOOLS)/libtool-2.4.6-bitcode.patch
-	$(APPLY) $(TOOLS)/libtool-2.4.6-san.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.6-clang-libs.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.6-response-files.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.6-lpthread.patch
-- 
GitLab