[FFmpeg-devel] Enhanced configure and Makefile to copy .pdb files to bindir for MSVC builds for make install

Submitted by Aaron Levinson on April 15, 2017, 1:27 a.m.

Details

Message ID ea9d425d-a495-c9e2-e062-50bd1cc08c01@aracnet.com
State New
Headers show

Commit Message

Aaron Levinson April 15, 2017, 1:27 a.m.
From 1059473c449c3079f03461bb42c2d3cc21d1b2c1 Mon Sep 17 00:00:00 2001
From: Aaron Levinson <alevinsn@aracnet.com>
Date: Fri, 14 Apr 2017 18:14:21 -0700
Subject: [PATCH] Enhanced configure and Makefile to copy .pdb files to
 bindir for MSVC builds for make install

Purpose: Enhanced configure and Makefile to copy .pdb files to bindir
for MSVC builds for make install.  Files are also uninstalled
appropriately when make uninstall is exercised.  Placing the PDB files
in the same directory as other binaries can make it easier to debug,
especially if the files are copied to another system.

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

Comments:

-- configure:
a) Leveraged 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) Added PROG_INSTALL_EXTRA_BIN variable for MSVC builds and also
   added 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.

-- Makefile: Enhanced 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.
---
 Makefile  | 2 ++
 configure | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

Comments

Aaron Levinson May 5, 2017, 7:01 a.m.
On 4/14/2017 6:27 PM, Aaron Levinson wrote:
> From 1059473c449c3079f03461bb42c2d3cc21d1b2c1 Mon Sep 17 00:00:00 2001
> From: Aaron Levinson <alevinsn@aracnet.com>
> Date: Fri, 14 Apr 2017 18:14:21 -0700
> Subject: [PATCH] Enhanced configure and Makefile to copy .pdb files to
>  bindir for MSVC builds for make install
>
> Purpose: Enhanced configure and Makefile to copy .pdb files to bindir
> for MSVC builds for make install.  Files are also uninstalled
> appropriately when make uninstall is exercised.  Placing the PDB files
> in the same directory as other binaries can make it easier to debug,
> especially if the files are copied to another system.
>
> Note: General idea for how to properly handle the copying of PDB files
> associated with programs suggested by Hendrik Leppkes.
>
> Comments:
>
> -- configure:
> a) Leveraged 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) Added PROG_INSTALL_EXTRA_BIN variable for MSVC builds and also
>    added 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.
>
> -- Makefile: Enhanced 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.
> ---
>  Makefile  | 2 ++
>  configure | 4 +++-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/Makefile b/Makefile
> index d5b51de..45c42c6 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -165,6 +165,7 @@ install-progs-$(CONFIG_SHARED): install-libs
>  install-progs: install-progs-yes $(AVPROGS)
>  	$(Q)mkdir -p "$(BINDIR)"
>  	$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
> +	$(if $(PROG_INSTALL_EXTRA_BIN), $(INSTALL) -m 644 $(PROG_INSTALL_EXTRA_BIN) "$(BINDIR)")
>
>  install-data: $(DATA_FILES) $(EXAMPLES_FILES)
>  	$(Q)mkdir -p "$(DATADIR)/examples"
> @@ -175,6 +176,7 @@ uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
>
>  uninstall-progs:
>  	$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
> +	$(if $(PROG_INSTALL_EXTRA_BIN), $(RM) $(addprefix "$(BINDIR)/", $(PROG_INSTALL_EXTRA_BIN)))
>
>  uninstall-data:
>  	$(RM) -r "$(DATADIR)"
> diff --git a/configure b/configure
> index 18d79ab..88206e3 100755
> --- a/configure
> +++ b/configure
> @@ -4947,9 +4947,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)'
>          objformat="win32"
>          ranlib=:
>          enable dos_paths
> @@ -6796,6 +6797,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
>

Ping.

Thanks,
Aaron Levinson

Patch hide | download patch | download mbox

diff --git a/Makefile b/Makefile
index d5b51de..45c42c6 100644
--- a/Makefile
+++ b/Makefile
@@ -165,6 +165,7 @@  install-progs-$(CONFIG_SHARED): install-libs
 install-progs: install-progs-yes $(AVPROGS)
 	$(Q)mkdir -p "$(BINDIR)"
 	$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
+	$(if $(PROG_INSTALL_EXTRA_BIN), $(INSTALL) -m 644 $(PROG_INSTALL_EXTRA_BIN) "$(BINDIR)")
 
 install-data: $(DATA_FILES) $(EXAMPLES_FILES)
 	$(Q)mkdir -p "$(DATADIR)/examples"
@@ -175,6 +176,7 @@  uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
 
 uninstall-progs:
 	$(RM) $(addprefix "$(BINDIR)/", $(ALLAVPROGS))
+	$(if $(PROG_INSTALL_EXTRA_BIN), $(RM) $(addprefix "$(BINDIR)/", $(PROG_INSTALL_EXTRA_BIN)))
 
 uninstall-data:
 	$(RM) -r "$(DATADIR)"
diff --git a/configure b/configure
index 18d79ab..88206e3 100755
--- a/configure
+++ b/configure
@@ -4947,9 +4947,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)'
         objformat="win32"
         ranlib=:
         enable dos_paths
@@ -6796,6 +6797,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