[vlc-commits] package/win32: build.sh: add options to do build with Universal Runtime

Steve Lhomme git at videolan.org
Fri May 29 08:45:42 CEST 2020


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 18 14:47:08 2020 +0200| [04b91ecc79ea2c935282d1cd3f144c1e0fc63785] | committer: Steve Lhomme

package/win32: build.sh: add options to do build with Universal Runtime

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=04b91ecc79ea2c935282d1cd3f144c1e0fc63785
---

 extras/package/win32/build.sh | 41 +++++++++++++++++++++++++++++++++++++----
 1 file changed, 37 insertions(+), 4 deletions(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index fd00856696..df34c9af27 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -29,12 +29,13 @@ OPTIONS:
    -b <url>      Enable breakpad support and send crash reports to this URL
    -d            Create PDB files during the build
    -x            Add extra checks when compiling
+   -u            Use the Universal C Runtime (instead of msvcrt)
    -z            Build without GUI (libvlc only)
 EOF
 }
 
 ARCH="x86_64"
-while getopts "hra:pcli:sb:dxz" OPTION
+while getopts "hra:pcli:sb:dxuz" OPTION
 do
      case $OPTION in
          h)
@@ -72,6 +73,9 @@ do
          x)
              EXTRA_CHECKS="yes"
          ;;
+         u)
+             BUILD_UCRT="yes"
+         ;;
          z)
              DISABLEGUI="yes"
          ;;
@@ -149,8 +153,13 @@ fi
 
 cd ../../
 
+CONTRIB_PREFIX=$TRIPLET
+if [ ! -z "$BUILD_UCRT" ]; then
+        CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+fi
+
 export USE_FFMPEG=1
-export PATH="$PWD/contrib/$TRIPLET/bin":"$PATH"
+export PATH="$PWD/contrib/$CONTRIB_PREFIX/bin":"$PATH"
 
 if [ "$INTERACTIVE" = "yes" ]; then
 if [ "x$SHELL" != "x" ]; then
@@ -160,6 +169,30 @@ else
 fi
 fi
 
+if [ ! -z "$BUILD_UCRT" ]; then
+    WIDL=${TRIPLET}-widl
+    CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_UCRT"
+
+        SHORTARCH="$SHORTARCH-ucrt"
+
+    LDFLAGS="$LDFLAGS -lucrtbase -lucrt"
+    if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
+        # tell gcc to replace msvcrt with ucrtbase+ucrt
+        CFLAGS="$CFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
+        CXXFLAGS="$CXXFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
+        LDFLAGS="$LDFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
+    else
+        CFLAGS="$CFLAGS -Wl,-lucrtbase,-lucrt"
+        CXXFLAGS="$CXXFLAGS -Wl,-lucrtbase,-lucrt"
+    fi
+    CFLAGS="$CPPFLAGS $CFLAGS"
+    CXXFLAGS="$CPPFLAGS $CXXFLAGS"
+
+    # the values are not passed to the makefiles/configures
+    export LDFLAGS
+    export CPPFLAGS
+fi
+
 info "Building contribs"
 echo $PATH
 
@@ -176,7 +209,7 @@ fi
 if [ ! -z "$DISABLEGUI" ]; then
     CONTRIBFLAGS="$CONTRIBFLAGS --disable-qt --disable-qtsvg --disable-qtdeclarative --disable-qtgraphicaleffects --disable-qtquickcontrols2"
 fi
-${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET $CONTRIBFLAGS
+${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET --prefix=../$CONTRIB_PREFIX $CONTRIBFLAGS
 
 # Rebuild the contribs or use the prebuilt ones
 if [ "$PREBUILT" != "yes" ]; then
@@ -247,7 +280,7 @@ else
     CONFIGFLAGS="$CONFIGFLAGS --enable-qt --enable-skins2"
 fi
 
-${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$TRIPLET $CONFIGFLAGS
+${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$CONTRIB_PREFIX $CONFIGFLAGS
 
 info "Compiling"
 make -j$JOBS



More information about the vlc-commits mailing list