[vlc-devel] [PATCH v3 3/3] package/win32: build.sh: add options to do build for Winstore
Steve Lhomme
robux4 at ycbcr.xyz
Mon May 18 16:30:41 CEST 2020
This is mostly a port of this build script to our build script:
https://code.videolan.org/videolan/vlc-winrt/-/blob/master/libvlc/compile.sh
The Winstore build tweaks are only enabled with the Universal Runtime flag.
There are less disabled modules.
SQUASH winstore
---
extras/package/win32/build.sh | 79 +++++++++++++++++++++++++++++--
extras/package/win32/configure.sh | 2 -
2 files changed, 74 insertions(+), 7 deletions(-)
diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 14e6b982a40c..fcec3ad0ed3f 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -30,12 +30,13 @@ OPTIONS:
-d Create PDB files during the build
-x Add extra checks when compiling
-u Use the Universal C Runtime (instead of msvcrt)
+ -w Restrict to Windows Store APIs
-z Build without GUI (libvlc only)
EOF
}
ARCH="x86_64"
-while getopts "hra:pcli:sb:dxuz" OPTION
+while getopts "hra:pcli:sb:dxuwz" OPTION
do
case $OPTION in
h)
@@ -76,6 +77,9 @@ do
u)
BUILD_UCRT="yes"
;;
+ w)
+ WINSTORE="yes"
+ ;;
z)
DISABLEGUI="yes"
;;
@@ -155,7 +159,34 @@ cd ../../
CONTRIB_PREFIX=$TRIPLET
if [ ! -z "$BUILD_UCRT" ]; then
- CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+ if [ ! -z "$WINSTORE" ]; then
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-disc --disable-srt --disable-sdl --disable-SDL_image --disable-caca"
+ # modplug uses GlobalAlloc/Free and lstrcpyA/wsprintfA/lstrcpynA
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-modplug"
+ # x265 uses too many forbidden APIs
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-x265"
+ # aribb25 uses ANSI strings in WIDE APIs
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-aribb25"
+ # gettext uses sys/socket.h improperly
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-gettext"
+ # fontconfig uses GetWindowsDirectory and SHGetFolderPath
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-fontconfig"
+ # asdcplib uses some fordbidden SetErrorModes, GetModuleFileName in fileio.cpp
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-asdcplib"
+ # projectM is openGL based
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-projectM"
+ # gpg-error doesn't know minwg32uwp
+ # CONTRIBFLAGS="$CONTRIBFLAGS --disable-gpg-error"
+ # x264 build system claims it needs MSVC to build for WinRT
+ CONTRIBFLAGS="$CONTRIBFLAGS --disable-x264"
+
+ # libdsm is not enabled by default
+ CONTRIBFLAGS="$CONTRIBFLAGS --enable-libdsm"
+
+ CONTRIB_PREFIX="${CONTRIB_PREFIX}uwp"
+ else
+ CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+ fi
fi
export USE_FFMPEG=1
@@ -177,15 +208,37 @@ if [ ! -z "$BUILD_UCRT" ]; then
# 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 [ ! -z "$WINSTORE" ]; then
+ SHORTARCH="$SHORTARCH-uwp"
+ CPPFLAGS="$CPPFLAGS -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_UNICODE -DUNICODE"
+ WINSTORECOMPAT="-lwinstorecompat"
+
+ # WinstoreCompat: hopefully can go away someday
+ LDFLAGS="$LDFLAGS $WINSTORECOMPAT"
+ CPPFLAGS="$CPPFLAGS -DWINSTORECOMPAT"
+ CFLAGS="$CFLAGS -Wl,$WINSTORECOMPAT"
+ CXXFLAGS="$CXXFLAGS -Wl,$WINSTORECOMPAT"
+ else
+ SHORTARCH="$SHORTARCH-ucrt"
+ fi
if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
- ${CC} -dumpspecs | sed -e "s/-lmsvcrt/$CRUNTIME_EXTRA -lucrt/" -e "s/-lkernel32/$WINRUNTIME/" > ../newspecfile
+ if [ ! -z "$WINSTORE" ]; then
+ ${CC} -dumpspecs | sed -e "s/-lmsvcrt/$CRUNTIME_EXTRA -lucrt/" -e "s/-lkernel32/$WINRUNTIME/" -e "s/-lmingwex/$WINSTORECOMPAT -lmingwex $WINSTORECOMPAT -lruntimeobject -lsynchronization/" > ../newspecfile
+ else
+ ${CC} -dumpspecs | sed -e "s/-lmsvcrt/$CRUNTIME_EXTRA -lucrt/" -e "s/-lkernel32/$WINRUNTIME/" > ../newspecfile
+ fi
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*
+ # Clang doesn't support spec files, but will skip the builtin -lmsvcrt and -lkernel32 etc if it detects -lmsvcr* or -lucrt*, and
+ # -lmincore/-lwindowsapp on the command line.
+ if [ ! -z "$WINSTORE" ]; then
+ LDFLAGS="$LDFLAGS -lruntimeobject -lsynchronization -lnormaliz"
+ CFLAGS="$CFLAGS -Wl,-lruntimeobject,-lsynchronization,-lnormaliz"
+ CXXFLAGS="$CXXFLAGS -Wl,-lruntimeobject,-lsynchronization,-lnormaliz"
+ fi
LDFLAGS="$LDFLAGS $CRUNTIME_EXTRA -lucrt $WINRUNTIME"
CFLAGS="$CFLAGS -Wl,$CRUNTIME_EXTRA,-lucrt,$WINRUNTIME"
CXXFLAGS="$CXXFLAGS -Wl,$CRUNTIME_EXTRA,-lucrt,$WINRUNTIME"
@@ -214,6 +267,10 @@ fi
if [ ! -z "$DISABLEGUI" ]; then
CONTRIBFLAGS="$CONTRIBFLAGS --disable-qt --disable-qtsvg --disable-qtdeclarative --disable-qtgraphicaleffects --disable-qtquickcontrols2"
fi
+if [ ! -z "$WINSTORE" ]; then
+ # we don't use a special toolchain so force it manually
+ export HAVE_WINSTORE=1
+fi
${SCRIPT_PATH}/../../../contrib/bootstrap --host=$TRIPLET --prefix=../$CONTRIB_PREFIX $CONTRIBFLAGS
# Rebuild the contribs or use the prebuilt ones
@@ -284,6 +341,18 @@ if [ ! -z "$DISABLEGUI" ]; then
else
CONFIGFLAGS="$CONFIGFLAGS --enable-qt --enable-skins2"
fi
+if [ ! -z "$WINSTORE" ]; then
+ CONFIGFLAGS="$CONFIGFLAGS --enable-winstore-app"
+ # uses CreateFile to access files/drives outside of the app
+ CONFIGFLAGS="$CONFIGFLAGS --disable-vcd"
+ # OpenGL is not supported in UWP
+ CONFIGFLAGS="$CONFIGFLAGS --disable-gl"
+ # other modules that were disabled in the old UWP builds
+ CONFIGFLAGS="$CONFIGFLAGS --disable-crystalhd --disable-dxva2"
+
+else
+ CONFIGFLAGS="$CONFIGFLAGS --enable-dvdread --enable-caca"
+fi
${SCRIPT_PATH}/configure.sh --host=$TRIPLET --with-contrib=../contrib/$CONTRIB_PREFIX $CONFIGFLAGS
diff --git a/extras/package/win32/configure.sh b/extras/package/win32/configure.sh
index 370dd31c6eb8..52b6d000bf95 100755
--- a/extras/package/win32/configure.sh
+++ b/extras/package/win32/configure.sh
@@ -11,10 +11,8 @@ OPTIONS="
--enable-libass
--enable-schroedinger
--enable-live555
- --enable-dvdread
--enable-shout
--enable-goom
- --enable-caca
--enable-sse --enable-mmx
--enable-libcddb
--enable-zvbi --disable-telx
--
2.26.2
More information about the vlc-devel
mailing list