From d06b3d8f59f70d516258c7282f3888995a263ec9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> Date: Wed, 20 Oct 2021 11:22:34 +0200 Subject: [PATCH 1/2] Rebase over current vlc.git master --- compile.sh | 3 +- ...ntrib-set-RANLIB-for-toolchain.cmake.patch | 30 -- .../0001-logger-add-emscripten-module.patch | 16 +- ...ass-add-support-for-wasm-emscripten.patch} | 27 +- ...Create-a-target-for-emscripten-in-co.patch | 39 -- ...ock_nanosleep-support-for-emscripten.patch | 52 --- ...ypt-add-support-for-wasm-emscripten.patch} | 16 +- .../0003-compat-remove-nacl-support.patch | 348 ------------------ ...gmp-add-support-for-wasm-emscripten.patch} | 10 +- .../0004-compat-remove-pathconf.patch | 67 ---- ...roc-add-support-for-wasm-emscripten.patch} | 21 +- ...tls-add-support-for-wasm-emscripten.patch} | 21 +- ...-wasm-emscripten-toolchain-variables.patch | 92 ----- ...jpeg-add-support-for-wasm-emscripten.patch | 61 --- ...mpeg-add-support-for-wasm-emscripten.patch | 79 ---- ...4-contrib-remove-deprecated-platform.patch | 144 -------- ...e-add-initial-support-for-emscripten.patch | 156 -------- ...0016-nacl-remove-deprecated-platform.patch | 133 ------- ...kage-add-wasm-emscriten-build-script.patch | 209 ----------- .../0018-ci-add-wasm32-emscripten-job.patch | 59 --- 20 files changed, 54 insertions(+), 1529 deletions(-) delete mode 100644 vlc_patches/0001-contrib-set-RANLIB-for-toolchain.cmake.patch rename vlc_patches/nacl-wasm/{0007-contrib-ass-add-support-for-wasm-emscripten.patch => 0001-contrib-ass-add-support-for-wasm-emscripten.patch} (91%) delete mode 100644 vlc_patches/nacl-wasm/0001-wasm-emscripten-Create-a-target-for-emscripten-in-co.patch delete mode 100644 vlc_patches/nacl-wasm/0002-compat-add-clock_nanosleep-support-for-emscripten.patch rename vlc_patches/nacl-wasm/{0008-contrib-gcrypt-add-support-for-wasm-emscripten.patch => 0002-contrib-gcrypt-add-support-for-wasm-emscripten.patch} (86%) delete mode 100644 vlc_patches/nacl-wasm/0003-compat-remove-nacl-support.patch rename vlc_patches/nacl-wasm/{0009-contrib-gmp-add-support-for-wasm-emscripten.patch => 0003-contrib-gmp-add-support-for-wasm-emscripten.patch} (67%) delete mode 100644 vlc_patches/nacl-wasm/0004-compat-remove-pathconf.patch rename vlc_patches/nacl-wasm/{0010-contrib-postproc-add-support-for-wasm-emscripten.patch => 0004-contrib-postproc-add-support-for-wasm-emscripten.patch} (50%) rename vlc_patches/nacl-wasm/{0011-contrib-gnutls-add-support-for-wasm-emscripten.patch => 0005-contrib-gnutls-add-support-for-wasm-emscripten.patch} (60%) delete mode 100644 vlc_patches/nacl-wasm/0005-contrib-set-wasm-emscripten-toolchain-variables.patch delete mode 100644 vlc_patches/nacl-wasm/0012-contrib-openjpeg-add-support-for-wasm-emscripten.patch delete mode 100644 vlc_patches/nacl-wasm/0013-contrib-ffmpeg-add-support-for-wasm-emscripten.patch delete mode 100644 vlc_patches/nacl-wasm/0014-contrib-remove-deprecated-platform.patch delete mode 100644 vlc_patches/nacl-wasm/0015-core-add-initial-support-for-emscripten.patch delete mode 100644 vlc_patches/nacl-wasm/0016-nacl-remove-deprecated-platform.patch delete mode 100644 vlc_patches/nacl-wasm/0017-package-add-wasm-emscriten-build-script.patch delete mode 100644 vlc_patches/nacl-wasm/0018-ci-add-wasm32-emscripten-job.patch diff --git a/compile.sh b/compile.sh index 967ad94..ec18c04 100755 --- a/compile.sh +++ b/compile.sh @@ -29,7 +29,7 @@ if [ ! -d emsdk ]; then fi cd $WORK_DIR -TESTED_HASH="721cf129" +TESTED_HASH="3379c7bdba42984d56d311fcdc9810308b3a08b7" # Go go go vlc if [ ! -d vlc ]; then diagnostic "VLC source not found, cloning" @@ -41,7 +41,6 @@ if [ ! -d vlc ]; then if [ -d ../vlc_patches ] && [ "$(ls -A ../vlc_patches)" ]; then # core patches git am -3 ../vlc_patches/0001-configure-improve-testing-unsupported-GL-functions-f.patch - git am -3 ../vlc_patches/0001-contrib-set-RANLIB-for-toolchain.cmake.patch git am -3 ../vlc_patches/0001-modules-disable-libvlc_json-and-ytbdl-vlc.js-17.patch git am -3 ../vlc_patches/nacl-wasm/00*.patch git am -3 ../vlc_patches/audio_output/00*.patch diff --git a/vlc_patches/0001-contrib-set-RANLIB-for-toolchain.cmake.patch b/vlc_patches/0001-contrib-set-RANLIB-for-toolchain.cmake.patch deleted file mode 100644 index 4bc0a0a..0000000 --- a/vlc_patches/0001-contrib-set-RANLIB-for-toolchain.cmake.patch +++ /dev/null @@ -1,30 +0,0 @@ -From 982c6ce6720bca35524a1f06d0c1a64afd77e918 Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Thu, 3 Jun 2021 22:50:44 +0200 -Subject: [PATCH 1/1] contrib: set RANLIB for toolchain.cmake - -This commit will allow taking into account $RANLIB when we are cross compiling contribs that use cmake. - -When cross compiling Openjpeg with emscripten sdk, for example, the build system -won't be able to use emranlib (ranlib targetting the $HOST). - -cf: https://emscripten.org/docs/compiling/Building-Projects.html#troubleshooting ---- - contrib/src/main.mak | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/contrib/src/main.mak b/contrib/src/main.mak -index fb71479d68..2d4bce03ee 100644 ---- a/contrib/src/main.mak -+++ b/contrib/src/main.mak -@@ -597,6 +597,7 @@ else - endif - endif - echo "set(CMAKE_AR $(AR) CACHE FILEPATH \"Archiver\")" >> $@ -+ echo "set(CMAKE_RANLIB $(RANLIB) CACHE FILEPATH \"Add index to Archive\")" >> $@ - ifdef HAVE_CROSS_COMPILE - echo "set(_CMAKE_TOOLCHAIN_PREFIX $(HOST)-)" >> $@ - ifdef HAVE_ANDROID --- -2.32.0 - diff --git a/vlc_patches/logger/0001-logger-add-emscripten-module.patch b/vlc_patches/logger/0001-logger-add-emscripten-module.patch index dca6857..02f0b1f 100644 --- a/vlc_patches/logger/0001-logger-add-emscripten-module.patch +++ b/vlc_patches/logger/0001-logger-add-emscripten-module.patch @@ -1,7 +1,7 @@ -From a51bb9046ce9670a1ad6636f2f0d1f85b3f342a5 Mon Sep 17 00:00:00 2001 +From 58c9af72a3cc04f39700369fbeb5579c0c384221 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Mon, 9 Nov 2020 22:35:32 +0100 -Subject: [PATCH 1/1] logger: add emscripten module +Subject: [PATCH] logger: add emscripten module --- modules/logger/Makefile.am | 6 +++ @@ -10,13 +10,13 @@ Subject: [PATCH 1/1] logger: add emscripten module create mode 100644 modules/logger/emscripten.c diff --git a/modules/logger/Makefile.am b/modules/logger/Makefile.am -index 4addf6dcfd..87c675abaf 100644 +index 8ab485c8fe..1d10a6e3a4 100644 --- a/modules/logger/Makefile.am +++ b/modules/logger/Makefile.am -@@ -22,3 +22,9 @@ libandroid_logger_plugin_la_LIBADD = -llog - if HAVE_ANDROID - logger_LTLIBRARIES += libandroid_logger_plugin.la - endif +@@ -25,3 +25,9 @@ endif + + libjson_tracer_plugin_la_SOURCES = logger/json.c + logger_LTLIBRARIES += libjson_tracer_plugin.la + +libemscripten_logger_plugin_la_SOURCES = logger/emscripten.c + @@ -122,5 +122,5 @@ index 0000000000..85fdedb0d6 + set_callbacks(Open, NULL) +vlc_module_end () -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0007-contrib-ass-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0001-contrib-ass-add-support-for-wasm-emscripten.patch similarity index 91% rename from vlc_patches/nacl-wasm/0007-contrib-ass-add-support-for-wasm-emscripten.patch rename to vlc_patches/nacl-wasm/0001-contrib-ass-add-support-for-wasm-emscripten.patch index 856d731..f7c023b 100644 --- a/vlc_patches/nacl-wasm/0007-contrib-ass-add-support-for-wasm-emscripten.patch +++ b/vlc_patches/nacl-wasm/0001-contrib-ass-add-support-for-wasm-emscripten.patch @@ -1,7 +1,7 @@ -From dc694cbab1a8b17c3cc459395e58c72094ef518a Mon Sep 17 00:00:00 2001 +From fd1e539e2a585fb69ede782bd0180579e853597f Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Sun, 30 May 2021 19:22:31 +0200 -Subject: [PATCH 07/18] contrib: ass: add support for wasm-emscripten +Subject: [PATCH 1/5] contrib: ass: add support for wasm-emscripten --- contrib/src/ass/rules.mak | 5 + @@ -12,28 +12,21 @@ Subject: [PATCH 07/18] contrib: ass: add support for wasm-emscripten create mode 100644 contrib/src/fontconfig/add-initial-support-for-wasm32-emscripten.patch diff --git a/contrib/src/ass/rules.mak b/contrib/src/ass/rules.mak -index 364afbad17..9068432908 100644 +index fc6a90bb03..d84b209e77 100644 --- a/contrib/src/ass/rules.mak +++ b/contrib/src/ass/rules.mak -@@ -27,6 +27,10 @@ ifdef HAVE_NACL +@@ -25,6 +25,11 @@ WITH_DWRITE = 1 + else WITH_FONTCONFIG = 1 WITH_HARFBUZZ = 1 - WITH_ASS_ASM = 0 +ifdef HAVE_EMSCRIPTEN +WITH_FONTCONFIG = 1 +WITH_HARFBUZZ = 1 +WITH_ASS_ASM = 0 - else - WITH_FONTCONFIG = 1 - WITH_HARFBUZZ = 1 -@@ -34,6 +38,7 @@ endif ++endif endif endif endif -+endif - - $(TARBALLS)/libass-$(ASS_VERSION).tar.gz: - $(call download_pkg,$(ASS_URL),ass) diff --git a/contrib/src/fontconfig/add-initial-support-for-wasm32-emscripten.patch b/contrib/src/fontconfig/add-initial-support-for-wasm32-emscripten.patch new file mode 100644 index 0000000000..b1308fb19e @@ -146,7 +139,7 @@ index 0000000000..b1308fb19e +2.32.0 + diff --git a/contrib/src/fontconfig/rules.mak b/contrib/src/fontconfig/rules.mak -index 08b6a04cc0..f91e6f9f2e 100644 +index b761d44bd5..d187d211ae 100644 --- a/contrib/src/fontconfig/rules.mak +++ b/contrib/src/fontconfig/rules.mak @@ -23,6 +23,10 @@ ifdef HAVE_WIN32 @@ -161,10 +154,10 @@ index 08b6a04cc0..f91e6f9f2e 100644 FONTCONFIG_CONF := $(HOSTCONF) \ diff --git a/contrib/src/harfbuzz/rules.mak b/contrib/src/harfbuzz/rules.mak -index 70a45ecaa2..e7c7c2b802 100644 +index 1ea81242e3..c1bc7fa5c3 100644 --- a/contrib/src/harfbuzz/rules.mak +++ b/contrib/src/harfbuzz/rules.mak -@@ -30,7 +30,8 @@ HARFBUZZ_CONF += --with-coretext +@@ -29,7 +29,8 @@ HARFBUZZ_CONF += --with-coretext endif .harfbuzz: harfbuzz @@ -175,5 +168,5 @@ index 70a45ecaa2..e7c7c2b802 100644 cd $< && $(MAKE) install touch $@ -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0001-wasm-emscripten-Create-a-target-for-emscripten-in-co.patch b/vlc_patches/nacl-wasm/0001-wasm-emscripten-Create-a-target-for-emscripten-in-co.patch deleted file mode 100644 index 5d322df..0000000 --- a/vlc_patches/nacl-wasm/0001-wasm-emscripten-Create-a-target-for-emscripten-in-co.patch +++ /dev/null @@ -1,39 +0,0 @@ -From 9ab65e4debb1f0e5499fcb521e21fa267ff00a55 Mon Sep 17 00:00:00 2001 -From: Etienne Brateau <etienne.brateau@gmail.com> -Date: Thu, 6 Jul 2017 14:50:28 +0200 -Subject: [PATCH 01/18] wasm-emscripten: Create a target for emscripten in - configure.ac - ---- - configure.ac | 8 ++++++++ - 1 file changed, 8 insertions(+) - -diff --git a/configure.ac b/configure.ac -index 374ce00cc7..af0a57f774 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -378,6 +378,12 @@ case "${host_os}" in - AC_LIBOBJ([recvmsg]) - AC_LIBOBJ([sendmsg]) - ;; -+ *emscripten*) -+ SYS=emscripten -+ # tdestroy() is a GNU extension -+ CFLAGS="${CFLAGS} -pthread -D_GNU_SOURCE" -+ CXXFLAGS="${CXXFLAGS} -pthread" -+ ;; - *) - SYS="${host_os}" - ;; -@@ -451,6 +457,8 @@ AS_IF([test x$with_pic = xyes], [X86ASMDEFS="${X86ASMDEFS} -DPIC"]) - AC_SUBST([X86ASMFLAGS]) - AC_SUBST([X86ASMDEFS]) - -+AM_CONDITIONAL([HAVE_EMSCRIPTEN], [test "${SYS}" = "emscripten"]) -+ - dnl - dnl Sadly autoconf does not think about testing foo.exe when ask to test - dnl for program foo on win32 --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0002-compat-add-clock_nanosleep-support-for-emscripten.patch b/vlc_patches/nacl-wasm/0002-compat-add-clock_nanosleep-support-for-emscripten.patch deleted file mode 100644 index d3a9f47..0000000 --- a/vlc_patches/nacl-wasm/0002-compat-add-clock_nanosleep-support-for-emscripten.patch +++ /dev/null @@ -1,52 +0,0 @@ -From 7c3b7e7b64dd63107286ca2861f4d2381ade59c2 Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Wed, 20 May 2020 01:31:35 +0000 -Subject: [PATCH 02/18] compat: add clock_nanosleep support for emscripten - ---- - compat/clock_nanosleep.c | 9 +++++++-- - configure.ac | 1 + - 2 files changed, 8 insertions(+), 2 deletions(-) - -diff --git a/compat/clock_nanosleep.c b/compat/clock_nanosleep.c -index 494540b8b9..986d201e02 100644 ---- a/compat/clock_nanosleep.c -+++ b/compat/clock_nanosleep.c -@@ -20,7 +20,7 @@ - * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. - *****************************************************************************/ - --#ifdef __APPLE__ -+#if defined(__APPLE__) || defined (__EMSCRIPTEN__) - - #ifdef HAVE_CONFIG_H - # include <config.h> -@@ -32,7 +32,12 @@ - #include <sys/types.h> - #include <sys/time.h> - #include <sys/sysctl.h> --#include <mach/clock_types.h> -+ -+#ifdef __APPLE__ -+# include <mach/clock_types.h> -+#else -+# define NSEC_PER_SEC 1000000000L -+#endif - - int clock_nanosleep(clockid_t clock_id, int flags, - const struct timespec *rqtp, struct timespec *rmtp) -diff --git a/configure.ac b/configure.ac -index af0a57f774..946eeec99d 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -380,6 +380,7 @@ case "${host_os}" in - ;; - *emscripten*) - SYS=emscripten -+ AC_LIBOBJ([clock_nanosleep]) - # tdestroy() is a GNU extension - CFLAGS="${CFLAGS} -pthread -D_GNU_SOURCE" - CXXFLAGS="${CXXFLAGS} -pthread" --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0008-contrib-gcrypt-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0002-contrib-gcrypt-add-support-for-wasm-emscripten.patch similarity index 86% rename from vlc_patches/nacl-wasm/0008-contrib-gcrypt-add-support-for-wasm-emscripten.patch rename to vlc_patches/nacl-wasm/0002-contrib-gcrypt-add-support-for-wasm-emscripten.patch index 541a52c..84ab617 100644 --- a/vlc_patches/nacl-wasm/0008-contrib-gcrypt-add-support-for-wasm-emscripten.patch +++ b/vlc_patches/nacl-wasm/0002-contrib-gcrypt-add-support-for-wasm-emscripten.patch @@ -1,7 +1,7 @@ -From 9954c63c28eefac54c32ecd53751b6e2d237f3f1 Mon Sep 17 00:00:00 2001 +From ca88c8936b94312f6bfe844c9dacb310d7fee957 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Sun, 30 May 2021 20:38:46 +0200 -Subject: [PATCH 08/18] contrib: gcrypt: add support for wasm-emscripten +Subject: [PATCH 2/5] contrib: gcrypt: add support for wasm-emscripten --- contrib/src/gcrypt/rules.mak | 6 ++++ @@ -11,12 +11,12 @@ Subject: [PATCH 08/18] contrib: gcrypt: add support for wasm-emscripten create mode 100644 contrib/src/gpg-error/emscripten.patch diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak -index e710f90e70..3139c5e910 100644 +index c9c9be3efa..0275e21fe8 100644 --- a/contrib/src/gcrypt/rules.mak +++ b/contrib/src/gcrypt/rules.mak -@@ -78,6 +78,12 @@ GCRYPT_CONF += --disable-avx-support --disable-avx2-support --disable-padlock-su - GCRYPT_CONF += --disable-amd64-as-feature-detection --disable-drng-support - GCRYPT_CONF += --disable-pclmul-support +@@ -72,6 +72,12 @@ ifeq ($(ARCH),aarch64) + GCRYPT_CONF += --disable-arm-crypto-support + endif endif +ifdef HAVE_EMSCRIPTEN +GCRYPT_CONF += --disable-asm --disable-aesni-support ac_cv_func_syslog=no --disable-sse41-support @@ -77,7 +77,7 @@ index 0000000000..f60695c513 +2.31.1 + diff --git a/contrib/src/gpg-error/rules.mak b/contrib/src/gpg-error/rules.mak -index a22c778632..68aa8dd1ff 100644 +index 4e283c77cb..0f1053587d 100644 --- a/contrib/src/gpg-error/rules.mak +++ b/contrib/src/gpg-error/rules.mak @@ -25,6 +25,7 @@ endif @@ -89,5 +89,5 @@ index a22c778632..68aa8dd1ff 100644 ifdef HAVE_ANDROID ifeq ($(ARCH),aarch64) -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0003-compat-remove-nacl-support.patch b/vlc_patches/nacl-wasm/0003-compat-remove-nacl-support.patch deleted file mode 100644 index e281c73..0000000 --- a/vlc_patches/nacl-wasm/0003-compat-remove-nacl-support.patch +++ /dev/null @@ -1,348 +0,0 @@ -From 54ced6dab58a718f4750c62c26d33fb2950fa52a Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Wed, 2 Jun 2021 00:53:12 +0200 -Subject: [PATCH 03/18] compat: remove nacl support - -Nacl is now deprecated : -cf. https://blog.chromium.org/2020/08/changes-to-chrome-app-support-timeline.html - -The removed compat functions were tested and are part of the toolchain, -and a stub for sigwait will land in the next emscripten release. - -cf. https://github.com/emscripten-core/emscripten/commit/3bb97f8a1818822f84b6962ede543e31bc3fa5cd ---- - compat/flockfile.c | 11 ------ - compat/getpid.c | 2 -- - compat/pathconf.c | 9 +---- - compat/recvmsg.c | 79 -------------------------------------------- - compat/sendmsg.c | 61 ---------------------------------- - compat/sigwait.c | 49 --------------------------- - configure.ac | 7 ---- - include/vlc_fixups.h | 13 -------- - 8 files changed, 1 insertion(+), 230 deletions(-) - delete mode 100644 compat/sigwait.c - -diff --git a/compat/flockfile.c b/compat/flockfile.c -index 1db85a23a1..f3c4fff284 100644 ---- a/compat/flockfile.c -+++ b/compat/flockfile.c -@@ -54,17 +54,6 @@ int putc_unlocked (int c, FILE *stream) - { - return _putc_nolock (c, stream); - } -- --#elif defined __native_client__ --void flockfile (FILE *stream) --{ -- _flockfile(stream); --} -- --void funlockfile (FILE *stream) --{ -- _funlockfile(stream); --} - #else - # error flockfile not implemented on your platform! - #endif -diff --git a/compat/getpid.c b/compat/getpid.c -index d6275e7df3..5645d50bb4 100644 ---- a/compat/getpid.c -+++ b/compat/getpid.c -@@ -31,8 +31,6 @@ pid_t getpid (void) - { - #if defined (_WIN32) - return (pid_t) GetCurrentProcessId (); --#elif defined (__native_client__) -- return 1; - #else - # error Unimplemented! - #endif -diff --git a/compat/pathconf.c b/compat/pathconf.c -index 34f990ab19..fb13e290c7 100644 ---- a/compat/pathconf.c -+++ b/compat/pathconf.c -@@ -26,14 +26,7 @@ - - #include <vlc_common.h> - --#ifdef __native_client__ --long pathconf (const char *path, int name) --{ -- VLC_UNUSED(path); -- VLC_UNUSED(name); -- return -1; --} --#elif defined(_WIN32) -+#if defined(_WIN32) - /* Windows does not have pathconf, but that is OK */ - #else - # error pathconf not implemented on your platform! -diff --git a/compat/recvmsg.c b/compat/recvmsg.c -index 1c348fcee2..d110232f1e 100644 ---- a/compat/recvmsg.c -+++ b/compat/recvmsg.c -@@ -83,85 +83,6 @@ ssize_t recvmsg(int fd, struct msghdr *msg, int flags) - return -1; - } - --#elif defined __native_client__ --#include <errno.h> --#include <limits.h> --#include <stdlib.h> --#include <string.h> --#ifdef HAVE_SYS_SOCKET_H --#include <sys/socket.h> --#endif --#ifdef HAVE_SYS_UIO_H --#include <sys/uio.h> --#endif -- --ssize_t recvmsg(int fd, struct msghdr *msg, int flags) --{ -- if (msg->msg_controllen != 0) -- { -- errno = ENOSYS; -- return -1; -- } -- -- if ((msg->msg_iovlen <= 0) || (msg->msg_iovlen > IOV_MAX)) -- { -- errno = EMSGSIZE; -- return -1; -- } -- -- size_t full_size = 0; -- for (int i = 0; i < msg->msg_iovlen; ++i) -- full_size += msg->msg_iov[i].iov_len; -- -- if (full_size > SSIZE_MAX) { -- errno = EINVAL; -- return -1; -- } -- -- /** -- * We always allocate here, because whether recv/recvfrom allow NULL message -- * or not is unspecified. -- */ -- char *data = malloc(full_size ? full_size : 1); -- if (!data) { -- errno = ENOMEM; -- return -1; -- } -- -- ssize_t res; -- if (msg->msg_name) -- res = recvfrom(fd, data, full_size, flags, msg->msg_name, &msg->msg_namelen); -- else -- res = recv(fd, data, full_size, flags); -- -- if (res > 0) { -- size_t left; -- if ((size_t)res <= full_size) { -- left = res; -- msg->msg_flags = 0; -- } -- else { -- left = full_size; -- msg->msg_flags = MSG_TRUNC; -- } -- -- const char *src = data; -- for (int i = 0; (i < msg->msg_iovlen) && (left > 0); ++i) -- { -- size_t to_copy = msg->msg_iov[i].iov_len; -- if (to_copy > left) -- to_copy = left; -- -- memcpy(msg->msg_iov[i].iov_base, src, to_copy); -- src += to_copy; -- left -= to_copy; -- } -- } -- -- free(data); -- return res; --} -- - #else - #error recvmsg not implemented on your platform! - #endif -diff --git a/compat/sendmsg.c b/compat/sendmsg.c -index 0b08ce0942..3b5a6c42fd 100644 ---- a/compat/sendmsg.c -+++ b/compat/sendmsg.c -@@ -73,67 +73,6 @@ ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) - return -1; - } - --#elif defined __native_client__ --#include <errno.h> --#include <limits.h> --#include <stdlib.h> --#include <string.h> --#ifdef HAVE_SYS_SOCKET_H --#include <sys/socket.h> --#endif --#ifdef HAVE_SYS_UIO_H --#include <sys/uio.h> --#endif -- --ssize_t sendmsg(int fd, const struct msghdr *msg, int flags) --{ -- if (msg->msg_controllen != 0) -- { -- errno = ENOSYS; -- return -1; -- } -- -- if ((msg->msg_iovlen <= 0) || (msg->msg_iovlen > IOV_MAX)) -- { -- errno = EMSGSIZE; -- return -1; -- } -- -- size_t full_size = 0; -- for (int i = 0; i < msg->msg_iovlen; ++i) -- full_size += msg->msg_iov[i].iov_len; -- -- if (full_size > SSIZE_MAX) { -- errno = EINVAL; -- return -1; -- } -- -- /** -- * We always allocate here, because whether send/sento allow NULL message or -- * not is unspecified. -- */ -- char *data = malloc(full_size ? full_size : 1); -- if (!data) { -- errno = ENOMEM; -- return -1; -- } -- -- size_t tmp = 0; -- for (int i = 0; i < msg->msg_iovlen; ++i) { -- memcpy(data + tmp, msg->msg_iov[i].iov_base, msg->msg_iov[i].iov_len); -- tmp += msg->msg_iov[i].iov_len; -- } -- -- ssize_t res; -- if (msg->msg_name) -- res = sendto(fd, data, full_size, flags, msg->msg_name, msg->msg_namelen); -- else -- res = send(fd, data, full_size, flags); -- -- free(data); -- return res; --} -- - #else - #error sendmsg not implemented on your platform! - #endif -diff --git a/compat/sigwait.c b/compat/sigwait.c -deleted file mode 100644 -index e5a082d2d6..0000000000 ---- a/compat/sigwait.c -+++ /dev/null -@@ -1,49 +0,0 @@ --/***************************************************************************** -- * sigwait.c: POSIX sigwait() replacement -- ***************************************************************************** -- * Copyright © 2017 VLC authors and VideoLAN -- * -- * Author: Julian Scheel <julian@jusst.de> -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU Lesser General Public License as published by -- * the Free Software Foundation; either version 2.1 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public License -- * along with this program; if not, write to the Free Software Foundation, -- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -- *****************************************************************************/ -- --#ifdef HAVE_CONFIG_H --# include <config.h> --#endif -- --#ifdef __native_client__ --/* NaCl has no working sigwait, but SIGPIPE, for which vlc uses sigwait -- * currently, is never generated in NaCl. So for SIGPIPE it's safe to instantly -- * return, for all others run into an assertion. */ -- --#include <assert.h> --#include <signal.h> -- --int sigwait(const sigset_t *set, int *sig) --{ -- sigset_t s = *set; -- if (sigemptyset(&s)) -- return 0; -- assert(sigismember(&s, SIGPIPE)); -- sigdelset(&s, SIGPIPE); -- assert(sigemptyset(&s)); -- -- *sig = SIGPIPE; -- return 0; --} --#else --# error sigwait not implemented on your platform! --#endif -diff --git a/configure.ac b/configure.ac -index 946eeec99d..25cf3d1b50 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -371,13 +371,6 @@ case "${host_os}" in - X86ASMFLAGS="-f aout" - X86ASMDEFS="-DARCH_X86_32=1 -DARCH_X86_64=0 -DPREFIX" - ;; -- *nacl*) -- SYS=nacl -- AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition]) -- AC_LIBOBJ([sigwait]) -- AC_LIBOBJ([recvmsg]) -- AC_LIBOBJ([sendmsg]) -- ;; - *emscripten*) - SYS=emscripten - AC_LIBOBJ([clock_nanosleep]) -diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h -index 9149c7519f..4263893420 100644 ---- a/include/vlc_fixups.h -+++ b/include/vlc_fixups.h -@@ -121,15 +121,6 @@ extern "C" { - # define VLC_NOTHROW - #endif - --/* signal.h */ --#if !defined(HAVE_SIGWAIT) && defined(__native_client__) --/* NaCl does not define sigwait in signal.h. We need to include it here to -- * define sigwait, because sigset_t is allowed to be either an integral or a -- * struct. */ --#include <signal.h> --int sigwait(const sigset_t *set, int *sig); --#endif -- - /* stddef.h */ - #if !defined (__cplusplus) && !defined (HAVE_MAX_ALIGN_T) - typedef struct { -@@ -269,10 +260,6 @@ pid_t getpid (void) VLC_NOTHROW; - int fsync (int fd); - #endif - --#ifndef HAVE_PATHCONF --long pathconf (const char *path, int name); --#endif -- - /* dirent.h */ - #ifndef HAVE_DIRFD - int (dirfd) (DIR *); --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0009-contrib-gmp-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0003-contrib-gmp-add-support-for-wasm-emscripten.patch similarity index 67% rename from vlc_patches/nacl-wasm/0009-contrib-gmp-add-support-for-wasm-emscripten.patch rename to vlc_patches/nacl-wasm/0003-contrib-gmp-add-support-for-wasm-emscripten.patch index 227482f..3fce285 100644 --- a/vlc_patches/nacl-wasm/0009-contrib-gmp-add-support-for-wasm-emscripten.patch +++ b/vlc_patches/nacl-wasm/0003-contrib-gmp-add-support-for-wasm-emscripten.patch @@ -1,17 +1,17 @@ -From e4ca45f25ef467e54246dd61fb83e23d8b4a7209 Mon Sep 17 00:00:00 2001 +From cc28db23a9fc0fc2b116c33a26d72abf2dad7a4f Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Sun, 30 May 2021 21:22:40 +0200 -Subject: [PATCH 09/18] contrib: gmp: add support for wasm-emscripten +Subject: [PATCH 3/5] contrib: gmp: add support for wasm-emscripten --- contrib/src/gmp/rules.mak | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/src/gmp/rules.mak b/contrib/src/gmp/rules.mak -index de2ce20175..809d8b0edc 100644 +index 11fe8acdfa..d6cd702ce0 100644 --- a/contrib/src/gmp/rules.mak +++ b/contrib/src/gmp/rules.mak -@@ -18,6 +18,9 @@ ifeq ($(ARCH),x86_64) +@@ -13,6 +13,9 @@ ifeq ($(ARCH),mips64el) GMP_CONF += --disable-assembly endif endif @@ -22,5 +22,5 @@ index de2ce20175..809d8b0edc 100644 ifdef HAVE_WIN32 ifeq ($(ARCH),arm) -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0004-compat-remove-pathconf.patch b/vlc_patches/nacl-wasm/0004-compat-remove-pathconf.patch deleted file mode 100644 index b7307ff..0000000 --- a/vlc_patches/nacl-wasm/0004-compat-remove-pathconf.patch +++ /dev/null @@ -1,67 +0,0 @@ -From 81479b692451c8e65a60ee46b06370c6b61010d0 Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Wed, 2 Jun 2021 00:55:52 +0200 -Subject: [PATCH 04/18] compat: remove pathconf - -this function is not used anywhere anymore. ---- - compat/pathconf.c | 33 --------------------------------- - configure.ac | 2 +- - 2 files changed, 1 insertion(+), 34 deletions(-) - delete mode 100644 compat/pathconf.c - -diff --git a/compat/pathconf.c b/compat/pathconf.c -deleted file mode 100644 -index fb13e290c7..0000000000 ---- a/compat/pathconf.c -+++ /dev/null -@@ -1,33 +0,0 @@ --/***************************************************************************** -- * pathconf.c: POSIX pathconf() replacement -- ***************************************************************************** -- * Copyright (C) 2017 VLC authors and VideoLAN -- * -- * Authors: Dennis Hamester <dhamester@jusst.de> -- * -- * This program is free software; you can redistribute it and/or modify it -- * under the terms of the GNU Lesser General Public License as published by -- * the Free Software Foundation; either version 2.1 of the License, or -- * (at your option) any later version. -- * -- * This program is distributed in the hope that it will be useful, -- * but WITHOUT ANY WARRANTY; without even the implied warranty of -- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- * GNU Lesser General Public License for more details. -- * -- * You should have received a copy of the GNU Lesser General Public License -- * along with this program; if not, write to the Free Software Foundation, -- * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -- *****************************************************************************/ -- --#ifdef HAVE_CONFIG_H --# include <config.h> --#endif -- --#include <vlc_common.h> -- --#if defined(_WIN32) --/* Windows does not have pathconf, but that is OK */ --#else --# error pathconf not implemented on your platform! --#endif -diff --git a/configure.ac b/configure.ac -index 25cf3d1b50..74d42df6dc 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -699,7 +699,7 @@ need_libc=false - - dnl Check for usual libc functions - AC_CHECK_FUNCS([accept4 dup3 fcntl flock fstatat fstatvfs fork getmntent_r getenv getpwuid_r isatty memalign mkostemp mmap open_memstream newlocale pipe2 pread posix_fadvise posix_madvise setlocale stricmp strnicmp strptime uselocale wordexp]) --AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp pathconf]) -+AC_REPLACE_FUNCS([aligned_alloc atof atoll dirfd fdopendir flockfile fsync getdelim getpid lfind lldiv memrchr nrand48 poll posix_memalign recvmsg rewind sendmsg setenv strcasecmp strcasestr strdup strlcpy strndup strnlen strnstr strsep strtof strtok_r strtoll swab tdestroy tfind timegm timespec_get strverscmp]) - AC_REPLACE_FUNCS([gettimeofday]) - AC_CHECK_FUNC(fdatasync,, - [AC_DEFINE(fdatasync, fsync, [Alias fdatasync() to fsync() if missing.]) --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0010-contrib-postproc-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0004-contrib-postproc-add-support-for-wasm-emscripten.patch similarity index 50% rename from vlc_patches/nacl-wasm/0010-contrib-postproc-add-support-for-wasm-emscripten.patch rename to vlc_patches/nacl-wasm/0004-contrib-postproc-add-support-for-wasm-emscripten.patch index 45be9f7..9d7e904 100644 --- a/vlc_patches/nacl-wasm/0010-contrib-postproc-add-support-for-wasm-emscripten.patch +++ b/vlc_patches/nacl-wasm/0004-contrib-postproc-add-support-for-wasm-emscripten.patch @@ -1,26 +1,27 @@ -From c3b56957dffe04521ed20e40ad5821c1b8148bc0 Mon Sep 17 00:00:00 2001 +From 1e1459946fce7442ec6ca942d27227c8b19ff9ef Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Sun, 30 May 2021 22:00:12 +0200 -Subject: [PATCH 10/18] contrib: postproc: add support for wasm-emscripten +Subject: [PATCH 4/5] contrib: postproc: add support for wasm-emscripten --- - contrib/src/postproc/rules.mak | 3 +++ - 1 file changed, 3 insertions(+) + contrib/src/postproc/rules.mak | 4 ++++ + 1 file changed, 4 insertions(+) diff --git a/contrib/src/postproc/rules.mak b/contrib/src/postproc/rules.mak -index 655acd5217..d9adb3cb32 100644 +index 252d6b384d..8a008f6ad2 100644 --- a/contrib/src/postproc/rules.mak +++ b/contrib/src/postproc/rules.mak -@@ -106,6 +106,9 @@ endif - ifdef HAVE_NACL - POSTPROCCONF += --target-os=linux +@@ -103,6 +103,10 @@ ifdef HAVE_SOLARIS + POSTPROCCONF += --enable-pic endif + +ifdef HAVE_EMSCRIPTEN +POSTPROCCONF += --arch=wasm32 --target-os=linux +endif - ++ # Build + ifdef GPL -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0011-contrib-gnutls-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0005-contrib-gnutls-add-support-for-wasm-emscripten.patch similarity index 60% rename from vlc_patches/nacl-wasm/0011-contrib-gnutls-add-support-for-wasm-emscripten.patch rename to vlc_patches/nacl-wasm/0005-contrib-gnutls-add-support-for-wasm-emscripten.patch index 89050f2..bc353a8 100644 --- a/vlc_patches/nacl-wasm/0011-contrib-gnutls-add-support-for-wasm-emscripten.patch +++ b/vlc_patches/nacl-wasm/0005-contrib-gnutls-add-support-for-wasm-emscripten.patch @@ -1,28 +1,29 @@ -From 5287ed34bd7a660aa4141b8056d0c4e25e99f5ea Mon Sep 17 00:00:00 2001 +From 1627322eb7b9a485ce5380978e4db1fd5b331ee5 Mon Sep 17 00:00:00 2001 From: Mehdi Sabwat <mehdi@videolabs.io> Date: Mon, 31 May 2021 00:18:18 +0200 -Subject: [PATCH 11/18] contrib: gnutls: add support for wasm-emscripten +Subject: [PATCH 5/5] contrib: gnutls: add support for wasm-emscripten the contrib is temporarily disabled until this pr is merged: https://github.com/emscripten-core/emscripten/pull/14352 --- - contrib/src/gnutls/rules.mak | 3 +++ - 1 file changed, 3 insertions(+) + contrib/src/gnutls/rules.mak | 4 ++++ + 1 file changed, 4 insertions(+) diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak -index ae2b07afd0..c0b61a07bd 100644 +index a5431693c1..012384d65b 100644 --- a/contrib/src/gnutls/rules.mak +++ b/contrib/src/gnutls/rules.mak -@@ -78,6 +78,9 @@ endif - ifdef HAVE_NACL - GNUTLS_CONF += --disable-hardware-acceleration +@@ -78,6 +78,10 @@ ifeq ($(ARCH),aarch64) endif + endif + +ifdef HAVE_EMSCRIPTEN + GNUTLS_CONF += --disable-hardware-acceleration +endif - ++ .gnutls: gnutls cd $< && $(GNUTLS_ENV) ./configure $(GNUTLS_CONF) + cd $< && $(MAKE) -C gl install -- -2.32.0 +2.30.2 diff --git a/vlc_patches/nacl-wasm/0005-contrib-set-wasm-emscripten-toolchain-variables.patch b/vlc_patches/nacl-wasm/0005-contrib-set-wasm-emscripten-toolchain-variables.patch deleted file mode 100644 index e4823ed..0000000 --- a/vlc_patches/nacl-wasm/0005-contrib-set-wasm-emscripten-toolchain-variables.patch +++ /dev/null @@ -1,92 +0,0 @@ -From 6fb3ac22f0d18cc4c01a9536a8ee711643c4d539 Mon Sep 17 00:00:00 2001 -From: Etienne Brateau <etienne.brateau@gmail.com> -Date: Thu, 6 Jul 2017 14:50:28 +0200 -Subject: [PATCH 05/18] contrib: set wasm-emscripten toolchain variables - -- add meson_system_name for emscripten -- add CMAKE_SYSTEM_NAME -- add EMSCRIPTEN to toolchain.cmake to workaround the fact that it is not a valid -CMAKE variable. -- add RANLIB to toolchain.cmake file -- add -pthread to CFLAGS/CXXFLAGS -This is to enable bulk-memory and atomics in all objects. There is no -downside to adding the option in objects that do not use the feature, -but not adding it will disallow linking with shared-memory because -clang relies on the presence of the feature to allow/prevent stripping -atomic operations. (cf: https://code.videolan.org/-/snippets/1333) ---- - contrib/bootstrap | 3 +++ - contrib/src/main.mak | 16 ++++++++++++++++ - 2 files changed, 19 insertions(+) - -diff --git a/contrib/bootstrap b/contrib/bootstrap -index e395a02652..6f83d310a2 100755 ---- a/contrib/bootstrap -+++ b/contrib/bootstrap -@@ -358,6 +358,9 @@ case "${OS}" in - *nacl*) - add_make_enabled "HAVE_NACL" - ;; -+ *emscripten*) -+ add_make_enabled "HAVE_EMSCRIPTEN" -+ ;; - esac - - # -diff --git a/contrib/src/main.mak b/contrib/src/main.mak -index fb71479d68..5157593f68 100644 ---- a/contrib/src/main.mak -+++ b/contrib/src/main.mak -@@ -129,6 +129,11 @@ EXTRA_CFLAGS += -fno-stack-check - XCODE_FLAGS += OTHER_CFLAGS=-fno-stack-check - endif - -+ifdef HAVE_EMSCRIPTEN -+CFLAGS="-pthread" -+CXXFLAGS="-pthread" -+endif -+ - ifdef HAVE_MACOSX - EXTRA_CXXFLAGS += -stdlib=libc++ - ifeq ($(ARCH),aarch64) -@@ -564,6 +569,9 @@ endif - ifdef HAVE_DARWIN_OS - CMAKE_SYSTEM_NAME = Darwin - endif -+ifdef HAVE_EMSCRIPTEN -+CMAKE_SYSTEM_NAME = Emscripten -+endif - - ifdef HAVE_ANDROID - CFLAGS += -DANDROID_NATIVE_API_LEVEL=$(ANDROID_API) -@@ -618,6 +626,10 @@ ifdef HAVE_CROSS_COMPILE - echo "set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)" >> $@ - echo "set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)" >> $@ - endif -+ifdef HAVE_EMSCRIPTEN -+ # https://github.com/emscripten-core/emscripten/blob/main/cmake/Modules/Platform/Emscripten.cmake#L268 -+ echo "set(EMSCRIPTEN 1)" >> $@ -+endif - - MESON_SYSTEM_NAME = - ifdef HAVE_WIN32 -@@ -632,12 +644,16 @@ else - ifdef HAVE_LINUX - # android has also system = linux and defines HAVE_LINUX - MESON_SYSTEM_NAME = linux -+else -+ifdef HAVE_EMSCRIPTEN -+ MESON_SYSTEM_NAME = emscripten - else - $(error "No meson system name known for this target") - endif - endif - endif - endif -+endif - - crossfile.meson: $(SRC)/gen-meson-crossfile.py - $(HOSTVARS_MESON) \ --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0012-contrib-openjpeg-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0012-contrib-openjpeg-add-support-for-wasm-emscripten.patch deleted file mode 100644 index 5b276a2..0000000 --- a/vlc_patches/nacl-wasm/0012-contrib-openjpeg-add-support-for-wasm-emscripten.patch +++ /dev/null @@ -1,61 +0,0 @@ -From 32c16223b66076fed990d2368e6d7915fa8493ae Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Tue, 19 May 2020 13:24:42 +0000 -Subject: [PATCH 12/18] contrib: openjpeg: add support for wasm-emscripten - ---- - contrib/src/openjpeg/emscripten.patch | 29 +++++++++++++++++++++++++++ - contrib/src/openjpeg/rules.mak | 1 + - 2 files changed, 30 insertions(+) - create mode 100644 contrib/src/openjpeg/emscripten.patch - -diff --git a/contrib/src/openjpeg/emscripten.patch b/contrib/src/openjpeg/emscripten.patch -new file mode 100644 -index 0000000000..36f57451cf ---- /dev/null -+++ b/contrib/src/openjpeg/emscripten.patch -@@ -0,0 +1,29 @@ -+From c4c22e82c1fb1d722509e5005cb3ee4b3600b919 Mon Sep 17 00:00:00 2001 -+From: Mehdi Sabwat <mehdisabwat@gmail.com> -+Date: Mon, 26 Apr 2021 15:37:44 +0200 -+Subject: [PATCH 1/1] emscripten: disable big endian test -+ -+This test should not run on the emscripten platform because of : -+https://github.com/emscripten-core/emscripten/blob/dff33368427fba16745c8ce52f11484a67b2855d/cmake/Modules/TestBigEndian.cmake#L5 -+--- -+ CMakeLists.txt | 2 ++ -+ 1 file changed, 2 insertions(+) -+ -+diff --git a/CMakeLists.txt b/CMakeLists.txt -+index 299f74c3..d343905b 100644 -+--- a/CMakeLists.txt -++++ b/CMakeLists.txt -+@@ -162,8 +162,10 @@ endif() -+ -+ #----------------------------------------------------------------------------- -+ # Big endian test: -++if (NOT EMSCRIPTEN) -+ include (${CMAKE_ROOT}/Modules/TestBigEndian.cmake) -+ TEST_BIG_ENDIAN(OPJ_BIG_ENDIAN) -++endif() -+ -+ #----------------------------------------------------------------------------- -+ # Setup file for setting custom ctest vars -+-- -+2.31.1 -+ -diff --git a/contrib/src/openjpeg/rules.mak b/contrib/src/openjpeg/rules.mak -index e485651354..42f299ce51 100644 ---- a/contrib/src/openjpeg/rules.mak -+++ b/contrib/src/openjpeg/rules.mak -@@ -22,6 +22,7 @@ endif - $(APPLY) $(SRC)/openjpeg/install.patch - $(APPLY) $(SRC)/openjpeg/pic.patch - $(APPLY) $(SRC)/openjpeg/openjp2_pthread.patch -+ $(APPLY) $(SRC)/openjpeg/emscripten.patch - $(call pkg_static,"./src/lib/openjp2/libopenjp2.pc.cmake.in") - $(MOVE) - --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0013-contrib-ffmpeg-add-support-for-wasm-emscripten.patch b/vlc_patches/nacl-wasm/0013-contrib-ffmpeg-add-support-for-wasm-emscripten.patch deleted file mode 100644 index 6cc5a16..0000000 --- a/vlc_patches/nacl-wasm/0013-contrib-ffmpeg-add-support-for-wasm-emscripten.patch +++ /dev/null @@ -1,79 +0,0 @@ -From 1d553120150631296918f87d268772f2d312646e Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Wed, 4 Sep 2019 19:35:17 +0200 -Subject: [PATCH 13/18] contrib: ffmpeg: add support for wasm-emscripten - -We need to specify the pthread flag for compilation and linking, otherwise tests will fail. ---- - ...001-configure-add-emscripten-support.patch | 33 +++++++++++++++++++ - contrib/src/ffmpeg/rules.mak | 7 ++-- - 2 files changed, 38 insertions(+), 2 deletions(-) - create mode 100644 contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch - -diff --git a/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch b/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch -new file mode 100644 -index 0000000000..cb8471c90e ---- /dev/null -+++ b/contrib/src/ffmpeg/0001-configure-add-emscripten-support.patch -@@ -0,0 +1,33 @@ -+From da7782c47f1f3d84eefb4ccce1c95e40d3b65fde Mon Sep 17 00:00:00 2001 -+From: Mehdi Sabwat <mehdisabwat@gmail.com> -+Date: Tue, 13 Aug 2019 21:14:56 +0200 -+Subject: [PATCH 1/1] configure: add emscripten support -+ -+--- -+ configure | 3 +++ -+ 1 file changed, 3 insertions(+) -+ -+diff --git a/configure b/configure -+index 7cea9d4d73..bafcbc87fc 100755 -+--- a/configure -++++ b/configure -+@@ -4239,6 +4239,7 @@ fi -+ exesuf() { -+ case $1 in -+ mingw32*|mingw64*|win32|win64|cygwin*|*-dos|freedos|opendos|os/2*|symbian) echo .exe ;; -++ emscripten) echo .js ;; -+ esac -+ } -+ -+@@ -5428,6 +5429,8 @@ case $target_os in -+ ;; -+ minix) -+ ;; -++ emscripten) -++ ;; -+ none) -+ ;; -+ *) -+-- -+2.23.0 -+ -diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak -index 5897a1de0f..593023569e 100644 ---- a/contrib/src/ffmpeg/rules.mak -+++ b/contrib/src/ffmpeg/rules.mak -@@ -211,8 +211,10 @@ endif - FFMPEGCONF += --target-os=sunos --enable-pic - endif - --ifdef HAVE_NACL --FFMPEGCONF+=--disable-inline-asm --disable-asm --target-os=linux -+ifdef HAVE_EMSCRIPTEN -+FFMPEGCONF+=--disable-inline-asm --disable-asm \ -+ --target-os=emscripten --arch=wasm32 --ranlib=emranlib \ -+ --extra-ldflags="-pthread" --extra-ldexeflags="-pthread" - endif - - # Build -@@ -246,6 +248,7 @@ endif - ifdef USE_LIBAV - $(APPLY) $(SRC)/ffmpeg/libav_gsm.patch - endif -+ $(APPLY) $(SRC)/ffmpeg/0001-configure-add-emscripten-support.patch - $(MOVE) - - .ffmpeg: ffmpeg --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0014-contrib-remove-deprecated-platform.patch b/vlc_patches/nacl-wasm/0014-contrib-remove-deprecated-platform.patch deleted file mode 100644 index d133b86..0000000 --- a/vlc_patches/nacl-wasm/0014-contrib-remove-deprecated-platform.patch +++ /dev/null @@ -1,144 +0,0 @@ -From f76dff8151c8027c33628e1cc0de8261dfdbb726 Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Mon, 31 May 2021 00:23:40 +0200 -Subject: [PATCH 14/18] contrib: remove deprecated platform - ---- - contrib/bootstrap | 3 --- - contrib/src/fontconfig/rules.mak | 4 ---- - contrib/src/gcrypt/rules.mak | 6 ------ - contrib/src/gmp/rules.mak | 5 ----- - contrib/src/gnutls/rules.mak | 3 --- - contrib/src/gpg-error/rules.mak | 9 --------- - contrib/src/mpg123/rules.mak | 4 ---- - contrib/src/postproc/rules.mak | 3 --- - 8 files changed, 37 deletions(-) - -diff --git a/contrib/bootstrap b/contrib/bootstrap -index 6f83d310a2..68db3fbf7c 100755 ---- a/contrib/bootstrap -+++ b/contrib/bootstrap -@@ -355,9 +355,6 @@ case "${OS}" in - *solaris*) - add_make_enabled "HAVE_SOLARIS" - ;; -- *nacl*) -- add_make_enabled "HAVE_NACL" -- ;; - *emscripten*) - add_make_enabled "HAVE_EMSCRIPTEN" - ;; -diff --git a/contrib/src/fontconfig/rules.mak b/contrib/src/fontconfig/rules.mak -index f91e6f9f2e..d187d211ae 100644 ---- a/contrib/src/fontconfig/rules.mak -+++ b/contrib/src/fontconfig/rules.mak -@@ -54,10 +54,6 @@ FONTCONFIG_ENV += LIBXML2_CFLAGS=`xml2-config --cflags` - FONTCONFIG_ENV += LIBXML2_LIBS=`xml2-config --libs` - endif - --ifdef HAVE_NACL --FONTCONFIG_ENV += ac_cv_func_random=no --endif -- - DEPS_fontconfig = freetype2 $(DEPS_freetype2) libxml2 $(DEPS_libxml2) - - .fontconfig: fontconfig -diff --git a/contrib/src/gcrypt/rules.mak b/contrib/src/gcrypt/rules.mak -index 3139c5e910..0275e21fe8 100644 ---- a/contrib/src/gcrypt/rules.mak -+++ b/contrib/src/gcrypt/rules.mak -@@ -72,12 +72,6 @@ ifeq ($(ARCH),aarch64) - GCRYPT_CONF += --disable-arm-crypto-support - endif - endif --ifdef HAVE_NACL --GCRYPT_CONF += --disable-asm --disable-aesni-support ac_cv_func_syslog=no --disable-sse41-support --GCRYPT_CONF += --disable-avx-support --disable-avx2-support --disable-padlock-support --GCRYPT_CONF += --disable-amd64-as-feature-detection --disable-drng-support --GCRYPT_CONF += --disable-pclmul-support --endif - ifdef HAVE_EMSCRIPTEN - GCRYPT_CONF += --disable-asm --disable-aesni-support ac_cv_func_syslog=no --disable-sse41-support - GCRYPT_CONF += --disable-avx-support --disable-avx2-support --disable-padlock-support -diff --git a/contrib/src/gmp/rules.mak b/contrib/src/gmp/rules.mak -index 809d8b0edc..d6cd702ce0 100644 ---- a/contrib/src/gmp/rules.mak -+++ b/contrib/src/gmp/rules.mak -@@ -13,11 +13,6 @@ ifeq ($(ARCH),mips64el) - GMP_CONF += --disable-assembly - endif - endif --ifdef HAVE_NACL --ifeq ($(ARCH),x86_64) --GMP_CONF += --disable-assembly --endif --endif - ifdef HAVE_EMSCRIPTEN - GMP_CONF += --disable-assembly - endif -diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak -index c0b61a07bd..de03200b50 100644 ---- a/contrib/src/gnutls/rules.mak -+++ b/contrib/src/gnutls/rules.mak -@@ -75,9 +75,6 @@ ifeq ($(ARCH),aarch64) - endif - endif - --ifdef HAVE_NACL -- GNUTLS_CONF += --disable-hardware-acceleration --endif - ifdef HAVE_EMSCRIPTEN - GNUTLS_CONF += --disable-hardware-acceleration - endif -diff --git a/contrib/src/gpg-error/rules.mak b/contrib/src/gpg-error/rules.mak -index 68aa8dd1ff..73491b50ce 100644 ---- a/contrib/src/gpg-error/rules.mak -+++ b/contrib/src/gpg-error/rules.mak -@@ -35,15 +35,6 @@ else - cp $@/src/syscfg/lock-obj-pub.arm-unknown-linux-androideabi.h $@/src/syscfg/lock-obj-pub.linux-android.h - endif - endif --ifdef HAVE_NACL --ifeq ($(ARCH),i386) # 32bits intel -- cp $@/src/syscfg/lock-obj-pub.i686-pc-linux-gnu.h $@/src/syscfg/lock-obj-pub.nacl.h --else --ifeq ($(ARCH),x86_64) -- cp $@/src/syscfg/lock-obj-pub.x86_64-pc-linux-gnu.h $@/src/syscfg/lock-obj-pub.nacl.h --endif --endif --endif - - GPGERROR_CONF := $(HOSTCONF) \ - --disable-nls \ -diff --git a/contrib/src/mpg123/rules.mak b/contrib/src/mpg123/rules.mak -index e46f3efd03..545f5e41a2 100644 ---- a/contrib/src/mpg123/rules.mak -+++ b/contrib/src/mpg123/rules.mak -@@ -30,10 +30,6 @@ MPG123CONF += --with-cpu=generic_dither - endif - endif - --ifdef HAVE_NACL --MPG123CONF += ac_cv_header_sys_select_h=no --endif -- - $(TARBALLS)/mpg123-$(MPG123_VERSION).tar.bz2: - $(call download_pkg,$(MPG123_URL),mpg123) - -diff --git a/contrib/src/postproc/rules.mak b/contrib/src/postproc/rules.mak -index d9adb3cb32..4acbb6c5f8 100644 ---- a/contrib/src/postproc/rules.mak -+++ b/contrib/src/postproc/rules.mak -@@ -103,9 +103,6 @@ ifdef HAVE_SOLARIS - POSTPROCCONF += --enable-pic - endif - --ifdef HAVE_NACL --POSTPROCCONF += --target-os=linux --endif - ifdef HAVE_EMSCRIPTEN - POSTPROCCONF += --arch=wasm32 --target-os=linux - endif --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0015-core-add-initial-support-for-emscripten.patch b/vlc_patches/nacl-wasm/0015-core-add-initial-support-for-emscripten.patch deleted file mode 100644 index 72f4998..0000000 --- a/vlc_patches/nacl-wasm/0015-core-add-initial-support-for-emscripten.patch +++ /dev/null @@ -1,156 +0,0 @@ -From 9b6851f7221750f8025106840cc3f13ff365793f Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Tue, 27 Apr 2021 15:33:10 +0200 -Subject: [PATCH 15/18] core: add initial support for emscripten - -posix/sort.c won't be added because qsort_r is not supported. - -- add vlc_getProxyUrl stub for emscripten - -- implement vlc_thread_id() for emscripten - -- add weak attribute support for wasm - -Co-Authored-By: Jean-Baptiste Kempf <jb@videolan.org> ---- - include/vlc_common.h | 2 +- - src/Makefile.am | 17 ++++++++++++++++- - src/emscripten/netconf.c | 39 +++++++++++++++++++++++++++++++++++++++ - src/emscripten/thread.c | 30 ++++++++++++++++++++++++++++++ - 4 files changed, 86 insertions(+), 2 deletions(-) - create mode 100644 src/emscripten/netconf.c - create mode 100644 src/emscripten/thread.c - -diff --git a/include/vlc_common.h b/include/vlc_common.h -index f62ff86d04..3f64caa455 100644 ---- a/include/vlc_common.h -+++ b/include/vlc_common.h -@@ -185,7 +185,7 @@ - # define VLC_USED - #endif - --#if defined (__ELF__) || defined (__MACH__) -+#if defined (__ELF__) || defined (__MACH__) || defined (__wasm__) - # define VLC_WEAK __attribute__((weak)) - #else - /** -diff --git a/src/Makefile.am b/src/Makefile.am -index 88bfad5ebb..780c94446c 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -442,6 +442,19 @@ libvlccore_la_SOURCES += \ - posix/timer.c - endif - -+if HAVE_EMSCRIPTEN -+libvlccore_la_SOURCES += \ -+ posix/thread.c \ -+ posix/getaddrinfo.c \ -+ posix/error.c \ -+ posix/dirs.c \ -+ posix/filesystem.c \ -+ posix/specific.c \ -+ posix/timer.c \ -+ emscripten/netconf.c \ -+ emscripten/thread.c -+endif -+ - if HAVE_DARWIN - libvlccore_la_SOURCES += \ - darwin/error.c \ -@@ -485,8 +498,10 @@ if !HAVE_LINUX - libvlccore_la_SOURCES += posix/wait.c - endif - if !HAVE_ANDROID -+if !HAVE_EMSCRIPTEN -+libvlccore_la_SOURCES += posix/sort.c -+endif - libvlccore_la_SOURCES += \ -- posix/sort.c \ - posix/thread.c - if !HAVE_DARWIN - libvlccore_la_SOURCES += \ -diff --git a/src/emscripten/netconf.c b/src/emscripten/netconf.c -new file mode 100644 -index 0000000000..f44a11b77d ---- /dev/null -+++ b/src/emscripten/netconf.c -@@ -0,0 +1,39 @@ -+/***************************************************************************** -+ * vlc_getProxyUrl for emscripten -+ ***************************************************************************** -+ * Copyright (C) 2021 - VideoLabs, VideoLAN and VLC Authors -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this program; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -+ *****************************************************************************/ -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+#include <strings.h> -+#include <vlc_common.h> -+ -+char *vlc_getProxyUrl(const char *url); -+ -+/** -+ * Determines the network proxy server to use (if any). -+ * @param url absolute URL for which to get the proxy server -+ * @return proxy URL, NULL if no proxy or error -+ */ -+char *vlc_getProxyUrl(const char *url) -+{ -+ VLC_UNUSED(url); -+ // TODO: add proxy url to url -+ return NULL; -+} -diff --git a/src/emscripten/thread.c b/src/emscripten/thread.c -new file mode 100644 -index 0000000000..44f5beddfe ---- /dev/null -+++ b/src/emscripten/thread.c -@@ -0,0 +1,30 @@ -+/***************************************************************************** -+ * vlc_thread implementation for emscripten -+ ***************************************************************************** -+ * Copyright (C) 2021 - VideoLabs, VideoLAN and VLC Authors -+ * -+ * This program is free software; you can redistribute it and/or modify it -+ * under the terms of the GNU Lesser General Public License as published -+ * by the Free Software Foundation; either version 2.1 of the License, or -+ * (at your option) any later version. -+ * -+ * This program is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -+ * GNU Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public License -+ * along with this program; if not, write to the Free Software Foundation, -+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. -+ *****************************************************************************/ -+ -+#ifdef HAVE_CONFIG_H -+# include "config.h" -+#endif -+ -+#include <pthread.h> -+ -+unsigned long vlc_thread_id(void) -+{ -+ return pthread_self(); -+} --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0016-nacl-remove-deprecated-platform.patch b/vlc_patches/nacl-wasm/0016-nacl-remove-deprecated-platform.patch deleted file mode 100644 index 0a1f602..0000000 --- a/vlc_patches/nacl-wasm/0016-nacl-remove-deprecated-platform.patch +++ /dev/null @@ -1,133 +0,0 @@ -From 41b8eee8ed3097b452f454c57c6aa1f891c80cbf Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Sun, 30 May 2021 16:35:00 +0200 -Subject: [PATCH 16/18] nacl: remove deprecated platform - -Nacl is now deprecated : -cf. https://blog.chromium.org/2020/08/changes-to-chrome-app-support-timeline.html - -This commit removes remaining conditional code for the Nacl platform. ---- - configure.ac | 1 - - include/vlc_fixups.h | 11 +---------- - m4/dolt.m4 | 2 +- - src/Makefile.am | 13 ------------- - src/network/getaddrinfo.c | 3 +-- - 5 files changed, 3 insertions(+), 27 deletions(-) - -diff --git a/configure.ac b/configure.ac -index 74d42df6dc..eb55428e8b 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -427,7 +427,6 @@ AM_CONDITIONAL([HAVE_IOS], [test "${HAVE_IOS}" = "1"]) - AM_CONDITIONAL([HAVE_OSX], [test "${HAVE_OSX}" = "1"]) - AM_CONDITIONAL([HAVE_TVOS], [test "${HAVE_TVOS}" = "1"]) - --AM_CONDITIONAL([HAVE_NACL], [test "${SYS}" = "nacl"]) - AM_CONDITIONAL([HAVE_LIBANL], [test "${HAVE_LIBANL}" = "1"]) - - AM_CONDITIONAL([HAVE_WIN32], [test "${SYS}" = "mingw32"]) -diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h -index 4263893420..60dd6e9d27 100644 ---- a/include/vlc_fixups.h -+++ b/include/vlc_fixups.h -@@ -33,7 +33,7 @@ - - /* C++11 says there's no need to define __STDC_*_MACROS when including - * inttypes.h and stdint.h. */ --#if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__) || defined(__native_client__)) -+#if defined (__cplusplus) && (defined(__MINGW32__) || defined(__UCLIBC__)) - # ifndef __STDC_FORMAT_MACROS - # define __STDC_FORMAT_MACROS 1 - # endif -@@ -311,10 +311,6 @@ void *aligned_alloc(size_t, size_t); - #define aligned_free(ptr) free(ptr) - #endif - --#if defined(__native_client__) && defined(__cplusplus) --# define HAVE_USELOCALE --#endif -- - #if !defined(HAVE_NEWLOCALE) && defined(HAVE_CXX_LOCALE_T) && defined(__cplusplus) - # include <locale> - # define HAVE_NEWLOCALE -@@ -380,11 +376,6 @@ int inet_pton(int, const char *, void *); - const char *inet_ntop(int, const void *, char *, socklen_t); - #endif - --/* NaCl has a broken netinet/tcp.h, so TCP_NODELAY is not set */ --#if defined(__native_client__) && !defined( HAVE_NETINET_TCP_H ) --# define TCP_NODELAY 1 --#endif -- - #ifndef HAVE_STRUCT_POLLFD - enum - { -diff --git a/m4/dolt.m4 b/m4/dolt.m4 -index ff28bef516..0daae70ff7 100644 ---- a/m4/dolt.m4 -+++ b/m4/dolt.m4 -@@ -21,7 +21,7 @@ AS_IF([test x$GCC != xyes], [dolt_supported=no]) - AS_CASE([$host], - [*-*-linux*|*-*-freebsd*], [pic_options='-fPIC'], - [*-apple-darwin*], [pic_options='-fno-common'], -- [*mingw*|*nacl*], [pic_options=''] -+ [*mingw*], [pic_options=''] - [*], [dolt_supported=no] - ) - AS_IF([test x$dolt_supported = xno], [ -diff --git a/src/Makefile.am b/src/Makefile.am -index 780c94446c..9b73288f7c 100644 ---- a/src/Makefile.am -+++ b/src/Makefile.am -@@ -431,17 +431,6 @@ libvlccore_la_SOURCES += \ - os2/thread.c - endif - --if HAVE_NACL --libvlccore_la_SOURCES += \ -- android/error.c \ -- posix/dirs.c \ -- posix/filesystem.c \ -- posix/netconf.c \ -- posix/rand.c \ -- posix/specific.c \ -- posix/timer.c --endif -- - if HAVE_EMSCRIPTEN - libvlccore_la_SOURCES += \ - posix/thread.c \ -@@ -488,7 +477,6 @@ endif - - if !HAVE_WIN32 - if !HAVE_OS2 --if !HAVE_NACL - libvlccore_la_SOURCES += \ - posix/filesystem.c \ - posix/plugin.c \ -@@ -523,7 +511,6 @@ endif - endif - endif - endif --endif - - if ENABLE_SOUT - libvlccore_la_SOURCES += \ -diff --git a/src/network/getaddrinfo.c b/src/network/getaddrinfo.c -index 14496d5b09..c592b884cc 100644 ---- a/src/network/getaddrinfo.c -+++ b/src/network/getaddrinfo.c -@@ -120,8 +120,7 @@ int vlc_getaddrinfo (const char *node, unsigned port, - } - - #if defined (_WIN32) || defined (__OS2__) \ -- || defined (__ANDROID__) || defined (__APPLE__) \ -- || defined (__native_client__) -+ || defined (__ANDROID__) || defined (__APPLE__) - #warning vlc_getaddrinfo_i11e() not implemented! - int vlc_getaddrinfo_i11e(const char *node, unsigned port, - const struct addrinfo *hints, struct addrinfo **res) --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0017-package-add-wasm-emscriten-build-script.patch b/vlc_patches/nacl-wasm/0017-package-add-wasm-emscriten-build-script.patch deleted file mode 100644 index 14f1a05..0000000 --- a/vlc_patches/nacl-wasm/0017-package-add-wasm-emscriten-build-script.patch +++ /dev/null @@ -1,209 +0,0 @@ -From faa967d300aab7dae13e465370087e2765b1274b Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Thu, 29 Apr 2021 00:48:05 +0200 -Subject: [PATCH] package: add wasm-emscriten build script - -Co-Authored-By: Jean-Baptiste Kempf <jb@videolan.org> -Co-Authored-By: Etienne Brateau <etienne.brateau@gmail.com> ---- - extras/package/wasm-emscripten/build.sh | 188 ++++++++++++++++++++++++ - 1 file changed, 188 insertions(+) - create mode 100755 extras/package/wasm-emscripten/build.sh - -diff --git a/extras/package/wasm-emscripten/build.sh b/extras/package/wasm-emscripten/build.sh -new file mode 100755 -index 0000000000..ad208e8981 ---- /dev/null -+++ b/extras/package/wasm-emscripten/build.sh -@@ -0,0 +1,188 @@ -+#! /bin/sh -+# Copyright (C) 2003-2021 the VideoLAN team -+# -+# This file is under the same license as the vlc package. -+ -+set -e -+ -+diagnostic() -+{ -+ echo "### build logs ###: " "$@" 1>&2; -+} -+ -+usage() -+{ -+ echo "Usage: $0 [--mode=(default=1)]" -+ echo " --mode=1 build all " -+ echo " --mode=0 incremental build (do not bootstrap and configure) " -+} -+ -+NM="$EMSDK/upstream/bin/llvm-nm" -+get_symbol() -+{ -+ echo "$1" | grep vlc_entry_"$2" | cut -d " " -f 3 -+} -+ -+get_entryname() -+{ -+ symbols=$($NM -g "$1") -+ entryname=$(get_symbol "$symbols" _) -+ echo "$entryname" -+} -+ -+while test -n "$1" -+do -+ case "$1" in -+ --help|-h) -+ usage -+ exit 0 -+ ;; -+ --mode=*) -+ BUILD_MODE="${1#--mode=}" -+ ;; -+ *) -+ echo "Unrecognized options $1" -+ usage -+ exit 1 -+ ;; -+ esac -+ shift -+done -+ -+BUILD_MODE=${BUILD_MODE:=1} -+ -+diagnostic "setting MAKEFLAGS" -+if [ -z "$MAKEFLAGS" ]; then -+ UNAMES=$(uname -s) -+ MAKEFLAGS= -+ if which nproc >/dev/null; then -+ MAKEFLAGS=-j$(nproc) -+ elif [ "$UNAMES" = "Darwin" ] && which sysctl >/dev/null; then -+ MAKEFLAGS=-j$(sysctl -n machdep.cpu.thread_count) -+ fi -+fi -+ -+diagnostic "setting up dir paths" -+if [ "$(basename "$PWD")" = "vlc" ]; then #CI -+ VLC_SRCPATH="$PWD"; -+ BUILD_PATH="$PWD/extras/package/wasm-emscripten/build"; -+elif [ "$(basename "$PWD")" = "wasm-emscripten" ] \ -+ && [ "$(basename "$(dirname "$PWD")")" = "package" ]; then #user -+ BUILD_PATH="$PWD/build"; -+ VLC_SRCPATH="$BUILD_PATH/../../../../"; -+fi -+mkdir -p "$BUILD_PATH" -+ -+diagnostic "build path: " -+echo "$BUILD_PATH"; -+ -+diagnostic "vlc sources path: " -+echo "$VLC_SRCPATH"; -+ -+diagnostic "vlc tools: bootstrap" -+mkdir -p "$BUILD_PATH"/extras/tools -+cd "$BUILD_PATH"/extras/tools -+"$VLC_SRCPATH"/extras/tools/bootstrap -+ -+diagnostic "vlc tools: make" -+make -C "$BUILD_PATH"/extras/tools "${MAKEFLAGS}" -+cd "$BUILD_PATH" -+# update the PATH -+export PATH=$BUILD_PATH/extras/tools/build/bin:$PATH -+ -+diagnostic "sdk tests: checking if autoconf supports emscripten" -+# https://code.videolan.org/-/snippets/1283 -+for file in /usr/share/automake-* -+do -+ # This will pick the latest automake version -+ VERSION="$(echo "$file" | cut -d- -f2)" -+done -+ -+diagnostic "using automake version: /usr/share/automake-$VERSION" -+eval "$(test -f /usr/share/automake-"$VERSION"/config.sub)" -+/usr/share/automake-"$VERSION"/config.sub wasm32-unknown-emscripten -+ -+mkdir -p "$BUILD_PATH"/contrib-emscripten -+cd "$BUILD_PATH"/contrib-emscripten -+ -+diagnostic "vlc contribs: bootstrap" -+"$VLC_SRCPATH"/contrib/bootstrap --disable-disc --disable-sout --disable-net \ -+ --disable-asdcplib --disable-caca --disable-gettext \ -+ --disable-goom --disable-harfbuzz --disable-libplacebo \ -+ --disable-lua --disable-luac --disable-sqlite \ -+ --disable-medialibrary --disable-mpcdec --disable-schroedinger \ -+ --disable-orc --disable-protobuf --disable-sidplay2 \ -+ --disable-soxr --disable-spatialaudio --disable-speex \ -+ --disable-speexdsp --disable-taglib --disable-zvbi \ -+ --disable-rnnoise \ -+ --host=wasm32-unknown-emscripten -+ -+diagnostic "vlc contribs: make" -+emmake make "${MAKEFLAGS}" -+cd "$BUILD_PATH" -+ -+diagnostic "starting libvlc build" -+BUILDDIR_NAME="build-emscripten" -+mkdir -p "$BUILD_PATH"/$BUILDDIR_NAME -+cd "$BUILD_PATH"/$BUILDDIR_NAME -+if [ $BUILD_MODE -eq 1 ]; then -+ diagnostic "libvlc build: bootstrap" -+ "$VLC_SRCPATH"/bootstrap -+ -+ diagnostic "libvlc build: configure" -+ # if_nameindex is not supported in emscripten -+ # ie: not exposed from musl to src/library.js -+ # the test in configure.ac fails because htons is not -+ # in tools/deps_info.py -+ -+ # shm.h is a blacklisted module -+ emconfigure "$VLC_SRCPATH"/configure --host=wasm32-unknown-emscripten --enable-debug --enable-gles2 \ -+ --disable-shared --disable-vlc \ -+ --disable-sout --disable-vlm --disable-xcb --disable-lua \ -+ --disable-addonmanagermodules --disable-ssp \ -+ ac_cv_func_if_nameindex=yes ac_cv_header_sys_shm_h=no \ -+ --with-contrib="$BUILD_PATH"/wasm32-unknown-emscripten -+fi -+ -+diagnostic "libvlc build: make" -+emmake make "${MAKEFLAGS}" -+cd "$BUILD_PATH" -+ -+diagnostic "libvlc build: generate static modules entry points" -+# start by deleting the previous version so that it's not overwritten -+rm -fr $BUILDDIR_NAME/vlc-modules.c $BUILDDIR_NAME/vlc-modules.bc -+cd $BUILDDIR_NAME/modules/.libs -+ -+# create module list -+echo "creating module list" -+touch "$BUILD_PATH"/$BUILDDIR_NAME/vlc-modules.c -+printf "// This file is autogenerated\n" > "$BUILD_PATH"/$BUILDDIR_NAME/vlc-modules.c -+printf "#include <unistd.h>\n\n" >> "$BUILD_PATH"/$BUILDDIR_NAME/vlc-modules.c -+VLCMODULES="" -+for file in ./*plugin.a -+do -+ VLCMODULES="$file $VLCMODULES" -+done; -+ -+for file in $VLCMODULES -+do -+ printf 'int %s (int (*)(void *, void *, int, ...), void *);\n' \ -+ "$(get_entryname "$file")" \ -+ >> "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.c -+done; -+ -+printf "const void *vlc_static_modules[] = {\n" \ -+ >> "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.c -+for file in $VLCMODULES -+do -+ printf '%s,\n' "$(get_entryname "$file")" \ -+ >> "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.c -+done; -+printf "NULL};\n" >> "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.c -+ -+diagnostic "vlc static modules: compiling static modules entry points" -+# compile vlc-modules.c -+emcc -pthread -c "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.c -o "$BUILD_PATH"/"$BUILDDIR_NAME"/vlc-modules.bc -+cd "$BUILD_PATH" -+ -+echo "VLC for wasm32-unknown-emscripten built!" --- -2.32.0 - diff --git a/vlc_patches/nacl-wasm/0018-ci-add-wasm32-emscripten-job.patch b/vlc_patches/nacl-wasm/0018-ci-add-wasm32-emscripten-job.patch deleted file mode 100644 index 75f16b6..0000000 --- a/vlc_patches/nacl-wasm/0018-ci-add-wasm32-emscripten-job.patch +++ /dev/null @@ -1,59 +0,0 @@ -From 65950997f1c6f24b1f5d31ddece20a7c45365596 Mon Sep 17 00:00:00 2001 -From: Mehdi Sabwat <mehdi@videolabs.io> -Date: Thu, 29 Apr 2021 00:48:33 +0200 -Subject: [PATCH 18/18] ci : add wasm32-emscripten job - ---- - extras/ci/gitlab-ci.yml | 22 ++++++++++++++++++++++ - 1 file changed, 22 insertions(+) - -diff --git a/extras/ci/gitlab-ci.yml b/extras/ci/gitlab-ci.yml -index a6f2273fae..7d46139e21 100644 ---- a/extras/ci/gitlab-ci.yml -+++ b/extras/ci/gitlab-ci.yml -@@ -20,6 +20,7 @@ variables: - VLC_ANDROID_IMAGE: registry.videolan.org/vlc-debian-android:20200529135226 - VLC_SNAP_IMAGE: registry.videolan.org/vlc-ubuntu-focal:20210611174203 - VLC_RASPBIAN_IMAGE: registry.videolan.org/vlc-debian-raspbian:20200213203125 -+ VLC_WASM_EMSCRIPTEN: registry.videolan.org/vlc-debian-wasm-emscripten:20210601090557 - - .variables-debian: &variables-debian - HOST_ARCH: x86_64 -@@ -102,6 +103,11 @@ variables: - ANDROID_ARCH: x86_64 - TRIPLET: x86_64-linux-android - -+.variables-emscripten-wasm32: &variables-emscripten-wasm32 -+ HOST_ARCH: wasm32 -+ TRIPLET: $HOST_ARCH-unknown-emscripten -+ EMSDK_VERSION: 2.0.23 -+ - # Common rules - .base-template: - stage: build -@@ -457,6 +463,22 @@ android-x86_64: - extends: .android-common - variables: *variables-android-x86_64 - -+# -+# Webassembly -+# -+ -+wasm32-emscripten-build : -+ extends: .base-template -+ variables: *variables-emscripten-wasm32 -+ tags: -+ - wasm32-emscripten-build -+ image: -+ name: $VLC_WASM_EMSCRIPTEN -+ script: -+ - source $EMSCRIPTEN_SDK/emsdk_env.sh -+ - ./extras/package/wasm-emscripten/build.sh -+ - tar -cvjSf contrib/vlc-contrib-alpha.tar.bz2 ./extras/package/wasm-emscripten/build/wasm32-unknown-emscripten -+ - # - # VLC Documentation - # --- -2.32.0 - -- GitLab From 40e257836983d6b17b631b37c3c77b2b350b1820 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr> Date: Wed, 20 Oct 2021 11:31:49 +0200 Subject: [PATCH 2/2] create_main: Fix paths to binaries The VLC buildscript now builds everything in vlc/build-emscripten and contrib/wasm32-unknown-emscripten, instead of doing everything in a subfolder in vlc/extras/package/wasm-emscripten --- create_main.sh | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/create_main.sh b/create_main.sh index 6499dc1..32b8cb4 100755 --- a/create_main.sh +++ b/create_main.sh @@ -25,7 +25,6 @@ fi PATH_VLC=${PATH_VLC:=./vlc} SAMPLE_DIR=${SAMPLE_DIR:=./samples} -PROJECT_DIR=${PROJECT_DIR:=./vlc/extras/package/wasm-emscripten/build} # For release builds, remove '--profiling-funcs' and add '-Os' # Note that we use '-s MODULARIZE', but no '-s EXPORT_ES6', which would @@ -34,13 +33,13 @@ emcc --bind -s USE_PTHREADS=1 -s TOTAL_MEMORY=1GB -s PTHREAD_POOL_SIZE=15 \ -s OFFSCREEN_FRAMEBUFFER=1 -s USE_WEBGL2=1 --profiling-funcs \ -s MODULARIZE=1 -s EXPORT_NAME="VlcModule" \ -s EXTRA_EXPORTED_RUNTIME_METHODS="allocateUTF8" \ - -I $PATH_VLC/include/ -I $PROJECT_DIR/wasm32-unknown-emscripten/include/ \ + -I $PATH_VLC/include/ -I $PATH_VLC/wasm32-unknown-emscripten/include/ \ main.c exports_media_player.c exports_media.c \ - $PROJECT_DIR/build-emscripten/lib/.libs/libvlc.a \ - $PROJECT_DIR/build-emscripten/vlc-modules.bc \ - $PROJECT_DIR/build-emscripten/modules/.libs/*.a \ - $PROJECT_DIR/wasm32-unknown-emscripten/lib/*.a \ - $PROJECT_DIR/build-emscripten/src/.libs/libvlccore.a \ - $PROJECT_DIR/build-emscripten/compat/.libs/libcompat.a \ + $PATH_VLC/build-emscripten/lib/.libs/libvlc.a \ + $PATH_VLC/build-emscripten/vlc-modules.bc \ + $PATH_VLC/build-emscripten/modules/.libs/*.a \ + $PATH_VLC/contrib/wasm32-unknown-emscripten/lib/*.a \ + $PATH_VLC/build-emscripten/src/.libs/libvlccore.a \ + $PATH_VLC/build-emscripten/compat/.libs/libcompat.a \ --js-library lib/wasm-imports.js \ -o experimental.js --preload-file ${SAMPLE_DIR} -- GitLab