[vlc-commits] package/win32: build.sh: add options to do build for Winstore

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


vlc | branch: master | Steve Lhomme <robux4 at ycbcr.xyz> | Mon May 18 15:16:14 2020 +0200| [e94843611e4d609074cd5a4c633f1d6f6be9f5f8] | committer: Steve Lhomme

package/win32: build.sh: add options to do build for Winstore

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.

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

 extras/package/win32/build.sh     | 67 ++++++++++++++++++++++++++++++++++++++-
 extras/package/win32/configure.sh |  2 --
 2 files changed, 66 insertions(+), 3 deletions(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index df34c9af27..c140e733b0 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
+    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
@@ -173,7 +204,18 @@ if [ ! -z "$BUILD_UCRT" ]; then
     WIDL=${TRIPLET}-widl
     CPPFLAGS="$CPPFLAGS -D_WIN32_WINNT=0x0A00 -DWINVER=0x0A00 -D_UCRT"
 
+    if [ ! -z "$WINSTORE" ]; then
+        SHORTARCH="$SHORTARCH-uwp"
+        CPPFLAGS="$CPPFLAGS -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_UNICODE -DUNICODE"
+
+        # WinstoreCompat: hopefully can go away someday
+        LDFLAGS="$LDFLAGS -lwindowsapp -lwinstorecompat"
+        CFLAGS="$CFLAGS -Wl,-lwindowsapp,-lwinstorecompat"
+        CXXFLAGS="$CXXFLAGS -Wl,-lwindowsapp,-lwinstorecompat"
+        CPPFLAGS="$CPPFLAGS -DWINSTORECOMPAT"
+    else
         SHORTARCH="$SHORTARCH-ucrt"
+    fi
 
     LDFLAGS="$LDFLAGS -lucrtbase -lucrt"
     if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
@@ -181,6 +223,13 @@ if [ ! -z "$BUILD_UCRT" ]; then
         CFLAGS="$CFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
         CXXFLAGS="$CXXFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
         LDFLAGS="$LDFLAGS -mcrtdll=ucrtbase -mcrtdll=ucrt"
+
+        if [ ! -z "$WINSTORE" ]; then
+            # trick to provide these libraries before -ladvapi32 -lshell32 -luser32 -lkernel32
+            CFLAGS="$CFLAGS -mcrtdll=windowsapp -mcrtdll=winstorecompat"
+            CXXFLAGS="$CXXFLAGS -mcrtdll=windowsapp -mcrtdll=winstorecompat"
+            LDFLAGS="$LDFLAGS -mcrtdll=windowsapp -mcrtdll=winstorecompat"
+        fi
     else
         CFLAGS="$CFLAGS -Wl,-lucrtbase,-lucrt"
         CXXFLAGS="$CXXFLAGS -Wl,-lucrtbase,-lucrt"
@@ -209,6 +258,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 to trigger the detection in contribs 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
@@ -279,6 +332,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 54f89646d1..1607c2f32b 100755
--- a/extras/package/win32/configure.sh
+++ b/extras/package/win32/configure.sh
@@ -10,10 +10,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



More information about the vlc-commits mailing list