[vlc-devel] [PATCH 2/3] package/win32: build.sh: add options to do build for Winstore

Steve Lhomme robux4 at ycbcr.xyz
Thu Apr 30 12:15:04 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.
---
 extras/package/win32/build.sh     | 34 +++++++++++++++++++++++++++++--
 extras/package/win32/configure.sh |  4 ----
 2 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 68e09ab90d4..63429300488 100755
--- a/extras/package/win32/build.sh
+++ b/extras/package/win32/build.sh
@@ -30,11 +30,12 @@ OPTIONS:
    -d            Create PDB files during the build
    -x            Add extra checks when compiling
    -u            Use the Universal C Runtime
+   -w            Restrict to Windows Store APIs
 EOF
 }
 
 ARCH="x86_64"
-while getopts "hra:pcli:sb:dxu" OPTION
+while getopts "hra:pcli:sb:dxuw" OPTION
 do
      case $OPTION in
          h)
@@ -75,6 +76,10 @@ do
          u)
              BUILD_UCRT="yes"
          ;;
+         w)
+             WINSTORE="yes"
+             TRIPLET_SUFFIX=uwp
+         ;;
      esac
 done
 shift $(($OPTIND - 1))
@@ -107,7 +112,8 @@ esac
 SCRIPT_PATH="$( cd "$(dirname "$0")" ; pwd -P )"
 
 : ${JOBS:=$(getconf _NPROCESSORS_ONLN 2>&1)}
-TRIPLET=$ARCH-w64-mingw32
+BASE_TRIPLET=$ARCH-w64-mingw32
+TRIPLET=$BASE_TRIPLET$TRIPLET_SUFFIX
 
 # Check if compiling with clang
 CC=${CC:-$TRIPLET-gcc}
@@ -173,6 +179,16 @@ if [ ! -z "$BUILD_UCRT" ]; then
         # on the command line.
         LDFLAGS="$LDFLAGS -lucrt"
     fi
+    if [ ! -z "$WINSTORE" ]; then
+        SHORTARCH="$SHORTARCH-uwp"
+        CPPFLAGS="$CPPFLAGS -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP"
+        if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
+            sed -i.orig -e "s/-lmingwex/-lmingwex -lruntimeobject -lsynchronization/" -e "s/-lkernel32/-lwindowsapp -lwindowsappcompat/" $NEWSPECFILE
+        else
+            # Clang doesn't support spec files, but will skip the builtin -lkernel32 etc if it detects -lwindowsapp on the command line.
+            LDFLAGS="$LDFLAGS -lruntimeobject -lsynchronization -lnormaliz -lwindowsapp -lwindowsappcompat"
+        endif
+    fi
 fi
 
 info "Building contribs"
@@ -190,6 +206,15 @@ if [ "$RELEASE" != "yes" ]; then
      CONTRIBFLAGS="$CONTRIBFLAGS --disable-optim"
 fi
 if [ ! -z "$BUILD_UCRT" ]; then
+    if [ ! -z "$WINSTORE" ]; then
+        CONTRIBFLAGS="$CONTRIBFLAGS --disable-qt --disable-qtsvg --disable-qtdeclarative --disable-qtgraphicaleffects --disable-qtquickcontrols2"
+        CONTRIBFLAGS="$CONTRIBFLAGS --disable-disc --disable-srt --disable-sdl --disable-SDL_image --disable-caca"
+        # modplug uses GlobalAlloc/Free (now allowed) and lstrcpyA/wsprintfA/lstrcpynA
+        CONTRIBFLAGS="$CONTRIBFLAGS --disable-modplug"
+        # x265 uses too many forbidden APIs
+        CONTRIBFLAGS="$CONTRIBFLAGS --disable-x265"
+    fi
+else
     CONTRIB_PREFIX="$CONTRIB_PREFIX$BUILD_UCRT"
 fi
 
@@ -266,6 +291,11 @@ if [ ! -z "$WITH_PDB" ]; then
     CONFIGFLAGS="$CONFIGFLAGS --enable-pdb"
 fi
 if [ ! -z "$BUILD_UCRT" ]; then
+    if [ ! -z "$WINSTORE" ]; then
+        CONFIGFLAGS="$CONFIGFLAGS --enable-winstore-app --disable-vlc --disable-qt --disable-skins2"
+    else
+        CONFIGFLAGS="$CONFIGFLAGS --enable-dvdread --enable-caca"
+    fi
     CFLAGS="$CFLAGS $CPPFLAGS"
     CXXFLAGS="$CXXFLAGS $CPPFLAGS"
 fi
diff --git a/extras/package/win32/configure.sh b/extras/package/win32/configure.sh
index ddf441a90ec..52b6d000bf9 100755
--- a/extras/package/win32/configure.sh
+++ b/extras/package/win32/configure.sh
@@ -11,12 +11,8 @@ OPTIONS="
       --enable-libass
       --enable-schroedinger
       --enable-live555
-      --enable-dvdread
       --enable-shout
       --enable-goom
-      --enable-caca
-      --enable-qt
-      --enable-skins2
       --enable-sse --enable-mmx
       --enable-libcddb
       --enable-zvbi --disable-telx
-- 
2.17.1



More information about the vlc-devel mailing list