Commit 0bf87189 authored by Mehdi Sabwat's avatar Mehdi Sabwat

add vlc.js build dockerfile

this will set the environment and sdk to run vlc.js
build script

MR !67

next steps would be :
- source $EMSCRIPTEN_SDK/emsdk_env.sh
- git clone git@code.videolan.org:b1ue/vlc.git --branch vlcjs/wip/upstream.ci.2
- /bin/bash vlc/extras/package/wasm-emscripten/build.sh
- emrun --no_browser vlc.js/vlc.html
parent 7602c01c
Pipeline #26570 passed with stage
in 3 minutes and 58 seconds
FROM debian:bullseye-slim
ENV IMAGE_DATE=20201009100000
ARG VIDEOLAN_UID=499
COPY patches /patches
RUN set -x && \
mkdir /usr/share/man/man1/ && \
apt-get update && \
apt-get install -y git-core libtool automake autoconf autopoint make \
gettext pkg-config subversion cmake cvs zip bzip2 p7zip-full wget dos2unix \
ragel yasm g++ protobuf-compiler m4 ant build-essential libtool-bin \
flex bison curl nasm meson python3 && \
apt-get clean -y && rm -rf /var/lib/apt/lists/* && \
addgroup --quiet --gid ${VIDEOLAN_UID} videolan && \
adduser --quiet --uid ${VIDEOLAN_UID} --ingroup videolan videolan && \
echo "videolan:videolan" | chpasswd && \
cd /usr/share/misc && \
patch -l < /patches/emscripten-automake.patch
USER videolan
WORKDIR /home/videolan
RUN git clone --depth=1 https://github.com/emscripten-core/emsdk/ && \
cd emsdk && ./emsdk install latest && \
./emsdk activate latest && \
cd upstream/emscripten && \
patch -p1 < /patches/emscripten-nativefs.patch
ENV EMSCRIPTEN_SDK="/home/videolan/emsdk"
\ No newline at end of file
--- config.sub.orig 2020-10-08 19:39:39.226665594 +0000
+++ config.sub 2020-10-08 20:10:12.573332266 +0000
@@ -1522,6 +1522,9 @@
;;
-ios)
;;
+ -emscripten)
+ os=-emscripten
+ ;;
-none)
;;
*)
From 854d7bd12555ffd31696f957955099c40cb8ac2b Mon Sep 17 00:00:00 2001
From: Mehdi Sabwat <mehdisabwat@gmail.com>
Date: Mon, 21 Sep 2020 19:26:11 +0200
Subject: [PATCH 1/1] wip: add fs support
---
src/library_pthread.js | 3 +++
src/settings.js | 25 +++++++++++++++++++++++++
src/worker.js | 18 ++++++++++++++++--
3 files changed, 44 insertions(+), 2 deletions(-)
diff --git a/src/library_pthread.js b/src/library_pthread.js
index a7621c1f6..e677ef292 100644
--- a/src/library_pthread.js
+++ b/src/library_pthread.js
@@ -408,6 +408,9 @@ var LibraryPThread = {
#endif
#if USE_OFFSET_CONVERTER
'wasmOffsetConverter': wasmOffsetConverter,
+#endif
+#if VLCJS_PATCH_FILESYSTEM
+ 'fileHandle': Module["fileHandle"],
#endif
});
},
diff --git a/src/settings.js b/src/settings.js
index ae3bf3e56..ada16059a 100644
--- a/src/settings.js
+++ b/src/settings.js
@@ -1696,3 +1696,28 @@ var LEGACY_SETTINGS = [
['EXPORT_FUNCTION_TABLES', [0], 'No longer needed'],
['BINARYEN_SCRIPTS', [""], 'No longer needed'],
];
+
+// VLCJS_PATCH_... settings
+// added in src/library_pthread.js and src/worker.js
+// goal is to have the fileHandle updated in the pthread workers, when have
+// this startup code:
+// <button type="button" id="btn">NativeFSOpen</button>
+// <input type="file" id="fileManager" multiple/>
+// ...
+// <script>
+// if (window.chooseFileSystemEntries === undefined) {
+// document.getElementById("btn").style.display = "none";
+// }
+// else {
+// document.getElementById("fileManager").style.display = "none";
+// }
+// document.getElementById("fileManager").addEventListener('change', function(event) {
+// Module["fileHandle"] = event.target.files[0];
+// console.log("file api : sent file handle all pthread workers");
+// }, false); // document.getElementById("btn").addEventListener('click', async (e) => {
+// Module["fileHandle"] = await window.chooseFileSystemEntries();
+// console.log("native fs: sent file handle all pthread workers");
+// });
+// </script>
+
+var VLCJS_PATCH_FILESYSTEM = 0;
diff --git a/src/worker.js b/src/worker.js
index 77507729e..ac7d39286 100644
--- a/src/worker.js
+++ b/src/worker.js
@@ -83,8 +83,22 @@ this.onmessage = function(e) {
Module['wasmModule'] = e.data.wasmModule;
#endif // MINIMAL_RUNTIME
- {{{ makeAsmImportsAccessInPthread('wasmMemory') }}} = e.data.wasmMemory;
-
+ {{{ makeAsmImportsAccessInPthread('wasmMemory') }}} = e.data.wasmMemory;
+#if VLCJS_PATCH_FILESYSTEM
+ if (e.data.fileHandle) {
+ if (typeof FileSystemFileHandle != "undefined") {
+ if (e.data.fileHandle instanceof FileSystemFileHandle) {
+ e.data.fileHandle.getFile().then((fileHandle) => {
+ Module["fileHandle"] = fileHandle;
+ });
+ }
+ }
+ if (e.data.fileHandle instanceof File) {
+ Module["fileHandle"] = e.data.fileHandle;
+ }
+ console.log("EMSCRIPTEN DEBUG: fileHandle received in pthread workers");
+ }
+#endif
#if LOAD_SOURCE_MAP
wasmSourceMapData = e.data.wasmSourceMap;
#endif
--
2.28.0
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment