[vlc-devel] [PATCH 3.0 07/10] package/win32: build.sh: add an option to set the PDB source file mapping

Steve Lhomme robux4 at ycbcr.xyz
Fri Aug 21 13:41:01 CEST 2020


This can be useful when cross-compiling. The UNIX pathes need to be mapped
to a Windows path that the debugger can use.

So if you build with "-D c:/vlc" the debugger will look for VLC sources in
c:\vlc, as if they were originally built from there.

(cherry picked from commit 990d460b71500b7c9906778b7b4300ff5600c7aa)

Signed-off-by: Steve Lhomme <robux4 at ycbcr.xyz>
---
 extras/package/win32/build.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 68568e3fdc..654ac99d59 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -28,6 +28,8 @@ OPTIONS:
    -s            Interactive shell (get correct environment variables for build)
    -b <url>      Enable breakpad support and send crash reports to this URL
    -d            Create PDB files during the build
+   -D <win_path> Create PDB files during the build, map the VLC sources to <win_path>
+                 e.g.: -D c:/sources/vlc
    -x            Add extra checks when compiling
    -u            Use the Universal C Runtime (instead of msvcrt)
    -w            Restrict to Windows Store APIs
@@ -37,7 +39,7 @@ EOF
 }
 
 ARCH="x86_64"
-while getopts "hra:pcli:sb:dxuwzo:" OPTION
+while getopts "hra:pcli:sb:dD:xuwzo:" OPTION
 do
      case $OPTION in
          h)
@@ -72,6 +74,10 @@ do
          d)
              WITH_PDB="yes"
          ;;
+         D)
+             WITH_PDB="yes"
+             PDB_MAP=$OPTARG
+         ;;
          x)
              EXTRA_CHECKS="yes"
          ;;
@@ -252,6 +258,10 @@ echo $PATH
 mkdir -p contrib/contrib-$SHORTARCH && cd contrib/contrib-$SHORTARCH
 if [ ! -z "$WITH_PDB" ]; then
     CONTRIBFLAGS="$CONTRIBFLAGS --enable-pdb"
+    if [ ! -z "$PDB_MAP" ]; then
+        CFLAGS="$CFLAGS -fdebug-prefix-map='$VLC_ROOT_PATH'='$PDB_MAP'"
+        CXXFLAGS="$CXXFLAGS -fdebug-prefix-map='$VLC_ROOT_PATH'='$PDB_MAP'"
+    fi
 fi
 if [ ! -z "$BREAKPAD" ]; then
      CONTRIBFLAGS="$CONTRIBFLAGS --enable-breakpad"
@@ -266,6 +276,10 @@ if [ ! -z "$WINSTORE" ]; then
     # we don't use a special toolchain to trigger the detection in contribs so force it manually
     export HAVE_WINSTORE=1
 fi
+
+export CFLAGS
+export CXXFLAGS
+
 ${VLC_ROOT_PATH}/contrib/bootstrap --host=$TRIPLET --prefix=../$CONTRIB_PREFIX $CONTRIBFLAGS
 
 # Rebuild the contribs or use the prebuilt ones
-- 
2.26.2



More information about the vlc-devel mailing list