diff mbox

[FFmpeg-devel] configure, fftools/Makefile: Copy .pdb files to bindir for MSVC builds for make install

Message ID 9db79101-4675-a28d-1ded-fcd2ddaabc1a@levland.net
State New
Headers show

Commit Message

Aaron Levinson Oct. 31, 2017, 6:05 p.m. UTC
When ffmpeg is built using MSVC, symbols are stored separately from
executables and libraries in .pdb files.  However, unlike with
gcc-based builds, when make install is invoked, symbols, in the form
of .pdb files, which are important for debugging, are not copied to
bindir.  This change corrects this deficiency for MSVC builds.  Files
are also uninstalled appropriately when make uninstall is exercised.

Note: General idea for how to properly handle the copying of PDB files
associated with programs suggested by Hendrik Leppkes.

Comments:

-- configure:
a) Leverage already existing SLIB_INSTALL_EXTRA_SHLIB facility (which
   is already pretty specific to Windows) to add .pdb files, in
   addition to .lib files, for shared libraries to bindir during make
   install.
b) Add PROG_INSTALL_EXTRA_BIN variable for MSVC builds and also add it
   to the section that causes it to be added to config.mak.  This is
   used in Makefile to copy any additional files associated with
   programs.  For MSVC, it is used to copy the pdb files associated
   with any executables that are built.  Note that such executables
   are build with _g in the file name and are later copied to a
   filename without _g in the file name.  As such, the PDB files have
   _g in the file name.

-- fftools/Makefile: Enhance install-progs and uninstall-progs targets
   to handle PROG_INSTALL_EXTRA_BIN if defined.  It uses a similar
   procedure as already in place for SLIB_INSTALL_EXTRA_SHLIB in
   library.mak.

Signed-off-by: Aaron Levinson <alevinsn_dev@levland.net>
---
 configure        | 4 +++-
 fftools/Makefile | 2 ++
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Aaron Levinson Nov. 9, 2017, 6:51 p.m. UTC | #1
Ping

On 10/31/2017 11:05 AM, Aaron Levinson wrote:
> When ffmpeg is built using MSVC, symbols are stored separately from
> executables and libraries in .pdb files.  However, unlike with
> gcc-based builds, when make install is invoked, symbols, in the form
> of .pdb files, which are important for debugging, are not copied to
> bindir.  This change corrects this deficiency for MSVC builds.  Files
> are also uninstalled appropriately when make uninstall is exercised.
> 
> Note: General idea for how to properly handle the copying of PDB files
> associated with programs suggested by Hendrik Leppkes.
> 
> Comments:
> 
> -- configure:
> a) Leverage already existing SLIB_INSTALL_EXTRA_SHLIB facility (which
>     is already pretty specific to Windows) to add .pdb files, in
>     addition to .lib files, for shared libraries to bindir during make
>     install.
> b) Add PROG_INSTALL_EXTRA_BIN variable for MSVC builds and also add it
>     to the section that causes it to be added to config.mak.  This is
>     used in Makefile to copy any additional files associated with
>     programs.  For MSVC, it is used to copy the pdb files associated
>     with any executables that are built.  Note that such executables
>     are build with _g in the file name and are later copied to a
>     filename without _g in the file name.  As such, the PDB files have
>     _g in the file name.
> 
> -- fftools/Makefile: Enhance install-progs and uninstall-progs targets
>     to handle PROG_INSTALL_EXTRA_BIN if defined.  It uses a similar
>     procedure as already in place for SLIB_INSTALL_EXTRA_SHLIB in
>     library.mak.
> 
> Signed-off-by: Aaron Levinson <alevinsn_dev@levland.net>
> ---
>   configure        | 4 +++-
>   fftools/Makefile | 2 ++
>   2 files changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/configure b/configure
> index 2ac6fed98a..feb86b2069 100755
> --- a/configure
> +++ b/configure
> @@ -5101,9 +5101,10 @@ case $target_os in
>           SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
>           SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
>           SLIB_INSTALL_LINKS=
> -        SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
> +        SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.pdb)'
>           SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
>           SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
> +        PROG_INSTALL_EXTRA_BIN='$(AVPROGS-yes:%=%$(PROGSSUF)_g.pdb)'
>           enabled x86_64 && objformat="win64" || objformat="win32"
>           ranlib=:
>           enable dos_paths
> @@ -7034,6 +7035,7 @@ SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
>   SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
>   SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
>   SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
> +PROG_INSTALL_EXTRA_BIN=${PROG_INSTALL_EXTRA_BIN}
>   VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
>   SAMPLES:=${samples:-\$(FATE_SAMPLES)}
>   NOREDZONE_FLAGS=$noredzone_flags
> diff --git a/fftools/Makefile b/fftools/Makefile
> index c867814a71..8c121b9762 100644
> --- a/fftools/Makefile
> +++ b/fftools/Makefile
> @@ -47,11 +47,13 @@ install-progs-$(CONFIG_SHARED): install-libs
>   install-progs: install-progs-yes $(AVPROGS)
>   	$(Q)mkdir -p "$(BINDIR)"
>   	$(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
> +	$(if $(PROG_INSTALL_EXTRA_BIN), $(INSTALL) -m 644 $(PROG_INSTALL_EXTRA_BIN) "$(BINDIR)")
>   
>   uninstall: uninstall-progs
>   
>   uninstall-progs:
>   	$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
> +	$(if $(PROG_INSTALL_EXTRA_BIN), $(RM) $(addprefix "$(BINDIR)/", $(PROG_INSTALL_EXTRA_BIN)))
>   
>   clean::
>   	$(RM) $(ALLAVPROGS) $(ALLAVPROGS_G) $(CLEANSUFFIXES:%=fftools/%)
>
diff mbox

Patch

diff --git a/configure b/configure
index 2ac6fed98a..feb86b2069 100755
--- a/configure
+++ b/configure
@@ -5101,9 +5101,10 @@  case $target_os in
         SLIB_CREATE_DEF_CMD='$(SRC_PATH)/compat/windows/makedef $(SUBDIR)lib$(NAME).ver $(OBJS) > $$(@:$(SLIBSUF)=.def)'
         SLIB_INSTALL_NAME='$(SLIBNAME_WITH_MAJOR)'
         SLIB_INSTALL_LINKS=
-        SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib)'
+        SLIB_INSTALL_EXTRA_SHLIB='$(SLIBNAME:$(SLIBSUF)=.lib) $(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.pdb)'
         SLIB_INSTALL_EXTRA_LIB='$(SLIBNAME_WITH_MAJOR:$(SLIBSUF)=.def)'
         SHFLAGS='-dll -def:$$(@:$(SLIBSUF)=.def) -implib:$(SUBDIR)$(SLIBNAME:$(SLIBSUF)=.lib)'
+        PROG_INSTALL_EXTRA_BIN='$(AVPROGS-yes:%=%$(PROGSSUF)_g.pdb)'
         enabled x86_64 && objformat="win64" || objformat="win32"
         ranlib=:
         enable dos_paths
@@ -7034,6 +7035,7 @@  SLIB_INSTALL_NAME=${SLIB_INSTALL_NAME}
 SLIB_INSTALL_LINKS=${SLIB_INSTALL_LINKS}
 SLIB_INSTALL_EXTRA_LIB=${SLIB_INSTALL_EXTRA_LIB}
 SLIB_INSTALL_EXTRA_SHLIB=${SLIB_INSTALL_EXTRA_SHLIB}
+PROG_INSTALL_EXTRA_BIN=${PROG_INSTALL_EXTRA_BIN}
 VERSION_SCRIPT_POSTPROCESS_CMD=${VERSION_SCRIPT_POSTPROCESS_CMD}
 SAMPLES:=${samples:-\$(FATE_SAMPLES)}
 NOREDZONE_FLAGS=$noredzone_flags
diff --git a/fftools/Makefile b/fftools/Makefile
index c867814a71..8c121b9762 100644
--- a/fftools/Makefile
+++ b/fftools/Makefile
@@ -47,11 +47,13 @@  install-progs-$(CONFIG_SHARED): install-libs
 install-progs: install-progs-yes $(AVPROGS)
 	$(Q)mkdir -p "$(BINDIR)"
 	$(INSTALL) -c -m 755 $(AVPROGS) "$(BINDIR)"
+	$(if $(PROG_INSTALL_EXTRA_BIN), $(INSTALL) -m 644 $(PROG_INSTALL_EXTRA_BIN) "$(BINDIR)")
 
 uninstall: uninstall-progs
 
 uninstall-progs:
 	$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
+	$(if $(PROG_INSTALL_EXTRA_BIN), $(RM) $(addprefix "$(BINDIR)/", $(PROG_INSTALL_EXTRA_BIN)))
 
 clean::
 	$(RM) $(ALLAVPROGS) $(ALLAVPROGS_G) $(CLEANSUFFIXES:%=fftools/%)