[vlc-commits] [Git][videolan/vlc][master] 2 commits: extras/tools/libtool: Add sideloading info for emscripten-host

Steve Lhomme (@robUx4) gitlab at videolan.org
Mon Aug 21 05:59:25 UTC 2023



Steve Lhomme pushed to branch master at VideoLAN / VLC


Commits:
9edd92ec by Khalid Masum at 2023-08-21T05:20:45+00:00
extras/tools/libtool: Add sideloading info for emscripten-host

Currently libtool.m4 does not have information about
wasm32-unknown-emscripten in host_os. Which causes failure in
enabling shared libraries.

This patch will create a new host_os case named emscripten in
libtool.m4 to allow us to enable shared library compilation
and add emscripten specific shared library building flags.
This patch will also add some shared library configuration in
libtool for emscripten host.

- - - - -
181697c7 by Khalid Masum at 2023-08-21T05:20:45+00:00
emscripten: build: Enable shared module

Currently emscripten builds all its libraris statically. This commit
will make necessary changes to the build script to make it possible.

The shared module based building can be triggered with the parameter
--enable-emscripten

- - - - -


3 changed files:

- extras/package/wasm-emscripten/build.sh
- + extras/tools/libtool-2.4.7-emscripten-dlinker.patch
- extras/tools/tools.mak


Changes:

=====================================
extras/package/wasm-emscripten/build.sh
=====================================
@@ -49,6 +49,9 @@ do
         --with-sanitizer=*)
             VLC_USE_SANITIZER="${1#--with-sanitizer=}"
             ;;
+        --enable-shared)
+            VLC_COMPILE_SHARED=1
+            ;;
         --gen-contrib-archive|-c)
             GENERATE_ARCHIVE=1
             ;;
@@ -66,6 +69,7 @@ VLC_PREBUILT_CONTRIBS_URL=${VLC_PREBUILT_CONTRIBS_URL:-""}
 BUILDDIR_NAME="build-emscripten"
 GENERATE_ARCHIVE=${GENERATE_ARCHIVE:=0}
 VLC_USE_PREBUILT_CONTRIBS=${VLC_USE_PREBUILT_CONTRIBS:=0}
+VLC_COMPILE_SHARED=${VLC_COMPILE_SHARED:=0}
 
 diagnostic "setting MAKEFLAGS"
 if [ -z "$MAKEFLAGS" ]; then
@@ -92,7 +96,13 @@ echo "$VLC_SRCPATH";
 
 diagnostic "vlc tools: bootstrap"
 cd "$VLC_SRCPATH"/extras/tools
-./bootstrap
+
+# Force libtool build when compiling with shared library
+if [ "$VLC_COMPILE_SHARED" -eq "1" ] && [ ! -d "libtool" ]; then
+    NEEDED="$NEEDED libtool" ./bootstrap
+else
+    ./bootstrap
+fi
 
 diagnostic "vlc tools: make"
 make
@@ -157,6 +167,15 @@ mkdir -p "$BUILD_PATH"
 diagnostic "vlc build dir: "
 echo "$BUILD_PATH";
 
+if [ "$VLC_COMPILE_SHARED" -eq "1" ]; then
+#enable shared, while disabling some of the incompatible dependencies
+    SHARED_CONFIGURE_FLAGS=" --enable-shared --disable-avcodec --disable-avformat \
+                             --disable-swscale --disable-postproc "
+else
+    SHARED_CONFIGURE_FLAGS=" --disable-shared --enable-avcodec --enable-avformat \
+                             --enable-swscale --enable-postproc "
+fi
+
 cd "$BUILD_PATH"
 if [ $BUILD_MODE -eq 1 ]; then
     diagnostic "libvlc build: bootstrap"
@@ -174,7 +193,7 @@ if [ $BUILD_MODE -eq 1 ]; then
         SANITIZER_OPTIONS="--with-sanitizer=${VLC_USE_SANITIZER}"
     fi
     emconfigure "$VLC_SRCPATH"/configure --host=wasm32-unknown-emscripten --enable-debug \
-                        --disable-shared --disable-vlc \
+                        $SHARED_CONFIGURE_FLAGS --disable-vlc \
                         --disable-sout --disable-vlm --disable-a52 --disable-xcb --disable-lua \
                         --disable-addonmanagermodules --disable-ssp --disable-nls \
                         --enable-gles2 \
@@ -194,12 +213,14 @@ echo "creating module list"
 FUN_PROTOS=""
 FUN_LIST=""
 
+if [ "$VLC_COMPILE_SHARED" -ne "1" ]; then
 for file in "$BUILD_PATH"/modules/.libs/*plugin.a
 do
     ENTRY=$(get_entryname "$file")
     FUN_PROTOS="$FUN_PROTOS""VLC_ENTRY_FUNC($ENTRY);\n"
     FUN_LIST="$FUN_LIST""$ENTRY,\n"
 done;
+fi
 
 printf "// This file is autogenerated
 #include <stddef.h>


=====================================
extras/tools/libtool-2.4.7-emscripten-dlinker.patch
=====================================
@@ -0,0 +1,26 @@
+diff --git a/m4/libtool.m4 b/m4/libtool.m4
+index 009155ee..797604af 100644
+--- a/m4/libtool.m4
++++ b/m4/libtool.m4
+@@ -3081,6 +3081,21 @@ uts4*)
+   shlibpath_var=LD_LIBRARY_PATH
+   ;;
+
++emscripten*)
++  version_type=none
++  need_lib_prefix=no
++  need_version=no
++  library_names_spec='$libname$release$shared_ext'
++  soname_spec='$libname$release$shared_ext'
++  finish_cmds=
++  dynamic_linker="Emscripten linker"
++  _LT_COMPILER_PIC($1)='-fPIC'
++  _LT_TAGVAR(archive_cmds, $1)='$CC -sSIDE_MODULE=2 -shared -fPIC $libobjs $deplibs $compiler_flags -o $lib'
++  _LT_TAGVAR(archive_expsym_cmds, $1)=
++  _LT_TAGVAR(archive_cmds_need_lc, $1)=no
++  _LT_TAGVAR(no_undefined_flag, $1)=
++  ;;
++
+ *)
+   dynamic_linker=no
+   ;;


=====================================
extras/tools/tools.mak
=====================================
@@ -117,6 +117,7 @@ libtool: libtool-$(LIBTOOL_VERSION).tar.gz
 	$(APPLY) $(TOOLS)/libtool-2.4.7-response-files.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.7-lpthread.patch
 	$(APPLY) $(TOOLS)/libtool-2.4.7-embed-bitcode.patch
+	$(APPLY) $(TOOLS)/libtool-2.4.7-emscripten-dlinker.patch
 	$(MOVE)
 
 .buildlibtool: libtool .automake .help2man



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b862a0067110e9a7647403a96e6f83c6cd59ab5...181697c7b70ca46715d58db61c1ce571682465a1

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/3b862a0067110e9a7647403a96e6f83c6cd59ab5...181697c7b70ca46715d58db61c1ce571682465a1
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list