[vlc-devel] [PATCH v3 2/3] package/win32: build.sh: add options to do build with Universal Runtime

Steve Lhomme robux4 at ycbcr.xyz
Mon May 18 16:33:23 CEST 2020


v3 uses ucrtbase+ucrt instead of ucrt+vcruntime140_app (and vcruntime140 
doesn't exist in mingw).

On 2020-05-18 16:30, Steve Lhomme wrote:
> ---
>   extras/package/win32/build.sh | 46 ++++++++++++++++++++++++++++++++---
>   1 file changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
> index a98e5bd81f7b..14e6b982a40c 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,35 @@ else
>   fi
>   fi
>   
> +if [ ! -z "$BUILD_UCRT" ]; then
> +    WIDL=${TRIPLET}-widl
> +    CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00"
> +
> +    WINRUNTIME="-lwindowsapp"
> +    # rather than using API-MS-WIN-CRT-PRIVATE-L1-1-0.DLL for memchr, memcmp, memcpy, memmove, memset, strchr, strrchr, strstr
> +    CRUNTIME_EXTRA="-lucrtbase"
> +
> +    SHORTARCH="$SHORTARCH-ucrt"
> +
> +    if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
> +        ${CC} -dumpspecs | sed -e "s/-lmsvcrt/$CRUNTIME_EXTRA -lucrt/" -e "s/-lkernel32/$WINRUNTIME/" > ../newspecfile
> +        NEWSPECFILE="$PWD/../newspecfile"
> +        CC="${CC} -specs=$NEWSPECFILE"
> +        CXX="${CXX} -specs=$NEWSPECFILE"
> +    else
> +        # Clang doesn't support spec files, but will skip the builtin -lmsvcrt and -lkernel32 etc if it detects -lmsvcr* or -lucrt*
> +        LDFLAGS="$LDFLAGS $CRUNTIME_EXTRA -lucrt $WINRUNTIME"
> +        CFLAGS="$CFLAGS -Wl,$CRUNTIME_EXTRA,-lucrt,$WINRUNTIME"
> +        CXXFLAGS="$CXXFLAGS -Wl,$CRUNTIME_EXTRA,-lucrt,$WINRUNTIME"
> +    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 +214,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 +285,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
> -- 
> 2.26.2
> 
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
> 


More information about the vlc-devel mailing list