[vlc-devel] [PATCH v2 1/3] package/win32: build.sh: add options to do build with Universal Runtime
Steve Lhomme
robux4 at ycbcr.xyz
Thu Apr 30 17:23:46 CEST 2020
---
extras/package/win32/build.sh | 39 ++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index d3648f0423c..88d05785a5e 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -29,11 +29,12 @@ 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
EOF
}
ARCH="x86_64"
-while getopts "hra:pcli:sb:dx" OPTION
+while getopts "hra:pcli:sb:dxu" OPTION
do
case $OPTION in
h)
@@ -71,6 +72,9 @@ do
x)
EXTRA_CHECKS="yes"
;;
+ u)
+ BUILD_UCRT="yes"
+ ;;
esac
done
shift $(($OPTIND - 1))
@@ -156,9 +160,28 @@ else
fi
fi
+if [ ! -z "$BUILD_UCRT" ]; then
+ CPPFLAGS="$CPPFLAGS -Wl,-lucrt -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00"
+ if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
+ ${CC} -dumpspecs | sed -e "s/-lmsvcrt/-lucrt/" > ../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 if it detects -lmsvcr* or -lucrt*
+ # on the command line.
+ LDFLAGS="$LDFLAGS -lucrt"
+ fi
+ SHORTARCH="$SHORTARCH-ucrt"
+
+ CFLAGS="$CFLAGS $CPPFLAGS"
+ CXXFLAGS="$CXXFLAGS $CPPFLAGS"
+fi
+
info "Building contribs"
echo $PATH
+CONTRIB_PREFIX=$TRIPLET
mkdir -p contrib/contrib-$SHORTARCH && cd contrib/contrib-$SHORTARCH
if [ ! -z "$WITH_PDB" ]; then
CONTRIBFLAGS="$CONTRIBFLAGS --enable-pdb"
@@ -169,7 +192,17 @@ fi
if [ "$RELEASE" != "yes" ]; then
CONTRIBFLAGS="$CONTRIBFLAGS --disable-optim"
fi
-${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET $CONTRIBFLAGS
+if [ ! -z "$BUILD_UCRT" ]; then
+ CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+ echo "EXTRA_CFLAGS=${CFLAGS}" >> config.mak
+ echo "LDFLAGS=${LDFLAGS}" >> config.mak
+ if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
+ echo "CC=${CC}" >> config.mak
+ echo "CXX=${CXX}" >> config.mak
+ fi
+fi
+
+${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET --prefix=../$CONTRIB_PREFIX $CONTRIBFLAGS
# Rebuild the contribs or use the prebuilt ones
if [ "$PREBUILT" != "yes" ]; then
@@ -235,7 +268,7 @@ if [ ! -z "$EXTRA_CHECKS" ]; then
CXXFLAGS="$CXXFLAGS -Werror=missing-field-initializers"
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.17.1
More information about the vlc-devel
mailing list