[vlc-devel] [PATCH 1/5] tools: add pdb support to libtool
Steve Lhomme
robux4 at ycbcr.xyz
Thu May 16 10:03:21 CEST 2019
It will add -Wl,-pdb,<libname>.pdb for DLL and EXE to linker outputs with
--generate-pdb.
If the -Wl,-pdb comes from the makefile, it will be copied next to the DLL/EXE
it belongs to (in the .libs folders).
---
extras/tools/libtool-2.4.6-pdb.patch | 104 +++++++++++++++++++++++++++
extras/tools/tools.mak | 1 +
2 files changed, 105 insertions(+)
create mode 100644 extras/tools/libtool-2.4.6-pdb.patch
diff --git a/extras/tools/libtool-2.4.6-pdb.patch b/extras/tools/libtool-2.4.6-pdb.patch
new file mode 100644
index 0000000000..8a7576f019
--- /dev/null
+++ b/extras/tools/libtool-2.4.6-pdb.patch
@@ -0,0 +1,104 @@
+--- libtool-2.4.6/build-aux/ltmain.sh.pdb 2019-03-08 10:49:36.502590300 +0100
++++ libtool-2.4.6/build-aux/ltmain.sh 2019-03-15 14:45:20.447123000 +0100
+@@ -2036,6 +2036,7 @@ usage_message="Options:
+ --version print version information
+ -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all]
+ -h, --help, --help-all print short, long, or detailed help message
++ --generate-pdb Generate PDB files alongside executables and libraries
+ "
+
+ # Additional text appended to 'usage_message' in response to '--help'.
+@@ -2266,6 +2267,7 @@ libtool_options_prep ()
+ opt_mode=
+ opt_preserve_dup_deps=false
+ opt_quiet=false
++ opt_generate_pdb=false
+
+ nonopt=
+ preserve_args=
+@@ -2330,6 +2332,9 @@ libtool_parse_options ()
+ --preserve-dup-deps)
+ opt_preserve_dup_deps=: ;;
+
++ --generate-pdb)
++ opt_generate_pdb=: ;;
++
+ --features) func_features ;;
+
+ --finish) set dummy --mode finish ${1+"$@"}; shift ;;
+@@ -4344,6 +4349,18 @@ func_mode_install ()
+ done
+ fi
+
++ pdbname=
++ if $opt_generate_pdb; then
++ case $dlname in
++ *.dll)
++ pdbname=${dlname%.dll}.pdb
++ ;;
++ *.exe)
++ pdbname=${dlname%.exe}.pdb
++ ;;
++ esac
++ fi
++
+ # Do each command in the postinstall commands.
+ lib=$destdir/$realname
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+@@ -7484,6 +7501,16 @@ func_mode_link ()
+ *) linkmode=prog ;; # Anything else should be a program.
+ esac
+
++ if $opt_generate_pdb; then
++ case $output in
++ *.$libext) ;;
++ *.lo | *.$objext) ;;
++ *.la)
++ func_append compiler_flags " ${wl}-pdb ${wl}${output_objdir}/${output%.la}.pdb"
++ ;;
++ esac
++ fi
++
+ specialdeplibs=
+
+ libs=
+--- libtool-2.4.6/m4/libtool.m4.pdb 2019-03-15 13:10:24.200619400 +0100
++++ libtool-2.4.6/m4/libtool.m4 2019-03-15 13:10:36.850516500 +0100
+@@ -2538,6 +2538,9 @@ cygwin* | mingw* | pw32* | cegcc*)
+ test -d \$dldir || mkdir -p \$dldir~
+ $install_prog $dir/$dlname \$dldir/$dlname~
+ chmod a+x \$dldir/$dlname~
++ if test -n '\''$pdbname'\''; then
++ $install_prog $dir/$pdbname \$dldir/$pdbname;
++ fi~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+--- libtool/build-aux/ltmain.sh.pdb 2019-05-14 16:20:07.594737800 +0200
++++ libtool/build-aux/ltmain.sh 2019-05-16 07:59:14.500898800 +0200
+@@ -7238,16 +7238,25 @@ func_mode_link ()
+ ;;
+
+ -Wl,*)
++ next_is_pdb=
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
+ arg=
+ save_ifs=$IFS; IFS=,
+ for flag in $args; do
++ if test -n "$next_is_pdb"; then
++ # a -pdb was found, put it in the same folder as the library
++ flag=$objdir/$flag
++ next_is_pdb=
++ fi
+ IFS=$save_ifs
+ func_quote_for_eval "$flag"
+ func_append arg " $wl$func_quote_for_eval_result"
+ func_append compiler_flags " $wl$func_quote_for_eval_result"
+ func_append linker_flags " $func_quote_for_eval_result"
++ if test "$flag" = "-pdb"; then
++ next_is_pdb=yes
++ fi
+ done
+ IFS=$save_ifs
+ func_stripname ' ' '' "$arg"
diff --git a/extras/tools/tools.mak b/extras/tools/tools.mak
index f20934284d..8fa11ba913 100644
--- a/extras/tools/tools.mak
+++ b/extras/tools/tools.mak
@@ -129,6 +129,7 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
$(APPLY) libtool-2.4.6-san.patch
$(APPLY) libtool-2.4.6-clang-libs.patch
$(APPLY) libtool-2.4.6-response-files.patch
+ $(APPLY) libtool-2.4.6-pdb.patch
$(MOVE)
.buildlibtool: libtool .automake .help2man
--
2.17.1
More information about the vlc-devel
mailing list