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

Steve Lhomme robux4 at ycbcr.xyz
Thu Apr 30 17:23:47 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     | 44 ++++++++++++++++++++++++++++---
 extras/package/win32/configure.sh |  4 ---
 2 files changed, 41 insertions(+), 7 deletions(-)

diff --git a/extras/package/win32/build.sh b/extras/package/win32/build.sh
index 88d05785a5e..789874a004d 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))
@@ -172,7 +177,18 @@ if [ ! -z "$BUILD_UCRT" ]; then
         # on the command line.
         LDFLAGS="$LDFLAGS -lucrt"
     fi
-    SHORTARCH="$SHORTARCH-ucrt"
+    if [ ! -z "$WINSTORE" ]; then
+        SHORTARCH="$SHORTARCH-uwp"
+        CPPFLAGS="$CPPFLAGS -DWINSTORECOMPAT -DWINAPI_FAMILY=WINAPI_FAMILY_APP -D_UNICODE -DUNICODE -Wl,-lwindowsapp"
+        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"
+        fi
+    else
+        SHORTARCH="$SHORTARCH-ucrt"
+    fi
 
     CFLAGS="$CFLAGS $CPPFLAGS"
     CXXFLAGS="$CXXFLAGS $CPPFLAGS"
@@ -193,7 +209,20 @@ if [ "$RELEASE" != "yes" ]; then
      CONTRIBFLAGS="$CONTRIBFLAGS --disable-optim"
 fi
 if [ ! -z "$BUILD_UCRT" ]; then
-    CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+    if [ ! -z "$WINSTORE" ]; then
+        CONTRIB_PREFIX="${CONTRIB_PREFIX}uwp"
+        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"
+
+        # we use the regular mingw32 triplet so force the WINSTORE manually
+        echo "HAVE_WINSTORE := 1" >> config.mak
+    else
+        CONTRIB_PREFIX="${CONTRIB_PREFIX}ucrt"
+    fi
     echo "EXTRA_CFLAGS=${CFLAGS}" >> config.mak
     echo "LDFLAGS=${LDFLAGS}" >> config.mak
     if [ ! "$COMPILING_WITH_CLANG" -gt 0 ]; then
@@ -263,6 +292,15 @@ fi
 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
+else
+    CONFIGFLAGS="$CONFIGFLAGS --enable-dvdread --enable-caca"
+fi
 if [ ! -z "$EXTRA_CHECKS" ]; then
     CFLAGS="$CFLAGS -Werror=incompatible-pointer-types -Werror=missing-field-initializers"
     CXXFLAGS="$CXXFLAGS -Werror=missing-field-initializers"
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