[vlc-devel] [PATCH v3 05/19] nacl: Add new system type

Dennis Hamester dhamester at jusst.de
Mon Mar 20 17:57:22 CET 2017


From: Julian Scheel <julian at jusst.de>

Add system type for Google (Portable) Native Client. As Portable Native
Clients do not allow dynamic library loading the plugin loader is
worthless and thus replaced by a dummy stub.
As newlib does not provide strerror_l the existing replacement from
android platform is used.

Signed-off-by: Julian Scheel <julian at jusst.de>
---
 configure.ac      |  6 ++++++
 src/Makefile.am   | 12 ++++++++++++
 src/nacl/plugin.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 64 insertions(+)
 create mode 100644 src/nacl/plugin.c

diff --git a/configure.ac b/configure.ac
index 71f19c43f9..eb7bc0fb0c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -297,6 +297,10 @@ case "${host_os}" in
     AC_LIBOBJ([freeaddrinfo])
     AC_LIBOBJ([gai_strerror])
     ;;
+  *nacl*)
+    SYS=nacl
+    AC_DEFINE([_XOPEN_SOURCE], [700], [POSIX and XPG 7th edition])
+    ;;
   *)
     SYS="${host_os}"
     ;;
@@ -328,6 +332,8 @@ 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_WIN32,   test "${SYS}" = "mingw32")
 AM_CONDITIONAL(HAVE_WIN64,   test "${HAVE_WIN64}" = "1") dnl Only used for the packaging
 AM_CONDITIONAL([HAVE_WINSTORE], [test "$vlc_winstore_app" = "1"])
diff --git a/src/Makefile.am b/src/Makefile.am
index 7e9a615763..1c27cf817b 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -382,6 +382,17 @@ libvlccore_la_SOURCES += \
 	os2/rand.c \
 	os2/thread.c
 else
+if HAVE_NACL
+libvlccore_la_SOURCES += \
+	android/error.c \
+	nacl/plugin.c \
+	posix/dirs.c \
+	posix/filesystem.c \
+	posix/netconf.c \
+	posix/rand.c \
+	posix/specific.c \
+	posix/timer.c
+else
 libvlccore_la_SOURCES += \
 	posix/filesystem.c \
 	posix/plugin.c \
@@ -425,6 +436,7 @@ endif
 endif
 endif
 endif
+endif
 
 if BUILD_HTTPD
 libvlccore_la_SOURCES += network/httpd.c
diff --git a/src/nacl/plugin.c b/src/nacl/plugin.c
new file mode 100644
index 0000000000..c4cb50f76d
--- /dev/null
+++ b/src/nacl/plugin.c
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * plugin.c : Empty stubs for NaCl, which does not allow dynamic loading
+ *****************************************************************************
+ * Copyright (C) 2017 VLC authors and VideoLAN
+ *
+ * Authors: Julian Scheel <julian at 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.
+ *****************************************************************************/
+
+#include <vlc_common.h>
+#include "modules/modules.h"
+
+int module_Load (vlc_object_t *p_this, const char *path,
+                 module_handle_t *p_handle, bool lazy)
+{
+    VLC_UNUSED(p_this);
+    VLC_UNUSED(path);
+    VLC_UNUSED(p_handle);
+    VLC_UNUSED(lazy);
+    return -1;
+}
+
+void module_Unload(module_handle_t handle)
+{
+    VLC_UNUSED(handle);
+}
+
+void *module_Lookup(module_handle_t handle, const char *psz_function)
+{
+    VLC_UNUSED(handle);
+    VLC_UNUSED(psz_function);
+    return NULL;
+}
-- 
2.12.0



More information about the vlc-devel mailing list