diff options
-rw-r--r-- | SConstruct | 26 | ||||
-rw-r--r-- | site_scons/mongo/platform.py | 2 | ||||
-rw-r--r-- | src/mongo/platform/pause.h | 5 | ||||
-rw-r--r-- | src/mongo/platform/random.cpp | 3 | ||||
-rw-r--r-- | src/mongo/platform/stack_locator_emscripten.cpp | 29 | ||||
-rw-r--r-- | src/mongo/util/dns_query.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/errno_util.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/processinfo_emscripten.cpp | 29 | ||||
-rw-r--r-- | src/mongo/util/processinfo_unknown.cpp | 4 | ||||
-rw-r--r-- | src/mongo/util/time_support.cpp | 2 | ||||
-rwxr-xr-x | src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h | 35 | ||||
-rw-r--r-- | src/third_party/IntelRDFPMathLib20U1/SConscript | 2 |
12 files changed, 121 insertions, 20 deletions
diff --git a/SConstruct b/SConstruct index c840aaa2480..922ab79ef34 100644 --- a/SConstruct +++ b/SConstruct @@ -727,10 +727,6 @@ env_vars.Add('MONGO_BUILDINFO_ENVIRONMENT_DATA', help='Sets the info returned from the buildInfo command and --version command-line flag', default=mongo_generators.default_buildinfo_environment_data()) -# Exposed to be able to cross compile Android/*nix from Windows without ending up with the .exe suffix. -env_vars.Add('PROGSUFFIX', - help='Sets the suffix for built executable files') - env_vars.Add('MONGO_DIST_SRC_PREFIX', help='Sets the prefix for files in the source distribution archive', converter=variable_distsrc_converter, @@ -773,6 +769,10 @@ env_vars.Add('OBJCOPY', help='Sets the path to objcopy', default=WhereIs('objcopy')) +# Exposed to be able to cross compile Android/*nix from Windows without ending up with the .exe suffix. +env_vars.Add('PROGSUFFIX', + help='Sets the suffix for built executable files') + env_vars.Add('RPATH', help='Set the RPATH for dynamic libraries and executables', converter=variable_shlex_converter) @@ -1049,13 +1049,14 @@ elif endian == "big": # NOTE: Remember to add a trailing comma to form any required one # element tuples, or your configure checks will fail in strange ways. processor_macros = { - 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, - 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, - 'i386' : { 'endian': 'little', 'defines': ('__i386', '_M_IX86')}, - 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, - 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, - 'sparc' : { 'endian': 'big', 'defines': ('__sparc',)}, - 'x86_64' : { 'endian': 'little', 'defines': ('__x86_64', '_M_AMD64')}, + 'arm' : { 'endian': 'little', 'defines': ('__arm__',) }, + 'aarch64' : { 'endian': 'little', 'defines': ('__arm64__', '__aarch64__')}, + 'i386' : { 'endian': 'little', 'defines': ('__i386', '_M_IX86')}, + 'ppc64le' : { 'endian': 'little', 'defines': ('__powerpc64__',)}, + 's390x' : { 'endian': 'big', 'defines': ('__s390x__',)}, + 'sparc' : { 'endian': 'big', 'defines': ('__sparc',)}, + 'x86_64' : { 'endian': 'little', 'defines': ('__x86_64', '_M_AMD64')}, + 'emscripten' : { 'endian': 'little', 'defines': ('__EMSCRIPTEN__', )}, } def CheckForProcessor(context, which_arch): @@ -1109,6 +1110,7 @@ os_macros = { "macOS": "defined(__APPLE__) && (TARGET_OS_OSX || (TARGET_OS_MAC && !TARGET_OS_IPHONE))", "linux": "defined(__linux__)", "android": "defined(__ANDROID__)", + "emscripten": "defined(__EMSCRIPTEN__)", } def CheckForOS(context, which_os): @@ -1711,7 +1713,7 @@ if env.TargetOSIs('posix'): # -Winvalid-pch Warn if a precompiled header (see Precompiled Headers) is found in the search path but can't be used. env.Append( CCFLAGS=["-fno-omit-frame-pointer", "-fno-strict-aliasing", - "-ggdb", + "-ggdb" if not env.TargetOSIs('emscripten') else "-g", "-pthread", "-Wall", "-Wsign-compare", diff --git a/site_scons/mongo/platform.py b/site_scons/mongo/platform.py index 9e86da95c8c..05df9017ac4 100644 --- a/site_scons/mongo/platform.py +++ b/site_scons/mongo/platform.py @@ -40,7 +40,7 @@ def env_get_os_name_wrapper(self): def is_os_raw(target_os, os_list_to_check): darwin_os_list = [ 'macOS', 'tvOS', 'tvOS-sim', 'iOS', 'iOS-sim', 'watchOS', 'watchOS-sim' ] linux_os_list = [ 'android', 'linux' ] - posix_os_list = [ 'openbsd', 'freebsd', 'solaris' ] + darwin_os_list + linux_os_list + posix_os_list = [ 'openbsd', 'freebsd', 'solaris', 'emscripten' ] + darwin_os_list + linux_os_list os_families = { "darwin": darwin_os_list, diff --git a/src/mongo/platform/pause.h b/src/mongo/platform/pause.h index 5003de534a8..64aa6c16a2b 100644 --- a/src/mongo/platform/pause.h +++ b/src/mongo/platform/pause.h @@ -67,6 +67,11 @@ #define MONGO_YIELD_CORE_FOR_SMT() __asm__ volatile("rd %%ccr, %%g0" ::: "memory") +#elif defined(__EMSCRIPTEN__) + +// TODO: What should this be? +#define MONGO_YIELD_CORE_FOR_SMT() + #else #error "No processor pause implementation for this architecture." #endif diff --git a/src/mongo/platform/random.cpp b/src/mongo/platform/random.cpp index 910fac54b72..839fb3aa3b8 100644 --- a/src/mongo/platform/random.cpp +++ b/src/mongo/platform/random.cpp @@ -147,7 +147,8 @@ std::unique_ptr<SecureRandom> SecureRandom::create() { return stdx::make_unique<WinSecureRandom>(); } -#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) +#elif defined(__linux__) || defined(__sun) || defined(__APPLE__) || defined(__FreeBSD__) || \ + defined(__EMSCRIPTEN__) class InputStreamSecureRandom : public SecureRandom { public: diff --git a/src/mongo/platform/stack_locator_emscripten.cpp b/src/mongo/platform/stack_locator_emscripten.cpp new file mode 100644 index 00000000000..adebcbe933c --- /dev/null +++ b/src/mongo/platform/stack_locator_emscripten.cpp @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#include "stack_locator_pthread_getattr_np.cpp" diff --git a/src/mongo/util/dns_query.cpp b/src/mongo/util/dns_query.cpp index 5d10b2fb82e..f73b23c049a 100644 --- a/src/mongo/util/dns_query.cpp +++ b/src/mongo/util/dns_query.cpp @@ -50,7 +50,7 @@ #define MONGO_UTIL_DNS_QUERY_PLATFORM_INCLUDE_WHITELIST #ifdef WIN32 #include "mongo/util/dns_query_windows-impl.h" -#elif __ANDROID__ +#elif defined(__ANDROID__) || defined(__EMSCRIPTEN__) #include "mongo/util/dns_query_android-impl.h" #else #include "mongo/util/dns_query_posix-impl.h" diff --git a/src/mongo/util/errno_util.cpp b/src/mongo/util/errno_util.cpp index aa6733de737..5f34233af10 100644 --- a/src/mongo/util/errno_util.cpp +++ b/src/mongo/util/errno_util.cpp @@ -58,7 +58,7 @@ std::string errnoWithDescription(int errNumber) { char buf[kBuflen]; char* msg{nullptr}; -#if defined(__GNUC__) && defined(_GNU_SOURCE) && (__ANDROID_API__ > 22) +#if defined(__GNUC__) && defined(_GNU_SOURCE) && !(__ANDROID_API__ <= 22) && !defined(EMSCRIPTEN) msg = strerror_r(errNumber, buf, kBuflen); #elif defined(_WIN32) diff --git a/src/mongo/util/processinfo_emscripten.cpp b/src/mongo/util/processinfo_emscripten.cpp new file mode 100644 index 00000000000..df5f48c9540 --- /dev/null +++ b/src/mongo/util/processinfo_emscripten.cpp @@ -0,0 +1,29 @@ +/** + * Copyright (C) 2018 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * 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 Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#include "processinfo_unknown.cpp" diff --git a/src/mongo/util/processinfo_unknown.cpp b/src/mongo/util/processinfo_unknown.cpp index 8984012b13c..0bb22588a87 100644 --- a/src/mongo/util/processinfo_unknown.cpp +++ b/src/mongo/util/processinfo_unknown.cpp @@ -76,4 +76,8 @@ bool ProcessInfo::blockInMemory(const void* start) { bool ProcessInfo::pagesInMemory(const void* start, size_t numPages, vector<char>* out) { verify(0); } + +boost::optional<unsigned long> ProcessInfo::getNumCoresForProcess() { + return boost::none; +} } diff --git a/src/mongo/util/time_support.cpp b/src/mongo/util/time_support.cpp index e943aca2a50..4f7a47c9fa9 100644 --- a/src/mongo/util/time_support.cpp +++ b/src/mongo/util/time_support.cpp @@ -935,7 +935,7 @@ private: // Find minimum timer resolution of OS Nanoseconds getMinimumTimerResolution() { Nanoseconds minTimerResolution; -#if defined(__linux__) || defined(__FreeBSD__) +#if defined(__linux__) || defined(__FreeBSD__) || defined(__EMSCRIPTEN__) struct timespec tp; clock_getres(CLOCK_REALTIME, &tp); minTimerResolution = Nanoseconds{tp.tv_nsec}; diff --git a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h index f6fad71c59f..bbd712a1d20 100755 --- a/src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h +++ b/src/third_party/IntelRDFPMathLib20U1/LIBRARY/float128/op_system.h @@ -43,7 +43,8 @@ # undef ultrix
# undef win64
# undef darwin
-# undef interix
+# undef interix
+# undef emscripten
# define dos 1
# define OP_SYSTEM dos
@@ -62,6 +63,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define vms 2
# define OP_SYSTEM vms
@@ -80,6 +82,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define wnt 3
# define OP_SYSTEM wnt
@@ -98,6 +101,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define linux 8
# define OP_SYSTEM linux
@@ -117,6 +121,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define osf 4
# define OP_SYSTEM osf
@@ -135,6 +140,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define hp_ux 5
# define OP_SYSTEM hp_ux
@@ -153,6 +159,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define unicos 6
# define OP_SYSTEM unicos
@@ -171,6 +178,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define ultrix 7
# define OP_SYSTEM ultrix
@@ -188,6 +196,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define win64 9
# define OP_SYSTEM win64
@@ -205,6 +214,7 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define darwin 10
# define OP_SYSTEM darwin
@@ -221,9 +231,29 @@ # undef win64
# undef darwin
# undef interix
+# undef emscripten
# define interix 11
# define OP_SYSTEM interix
+
+#elif defined(__EMSCRIPTEN__)
+
+# undef dos
+# undef vms
+# undef wnt
+# undef osf
+# undef hp_ux
+# undef linux
+# undef unicos
+# undef ultrix
+# undef win64
+# undef darwin
+# undef interix
+# undef emscripten
+
+# define emscripten 12
+# define OP_SYSTEM emscripten
+
#else
# error Operating system must be specified.
@@ -235,7 +265,8 @@ OP_SYSTEM == linux || \
OP_SYSTEM == osf || \
OP_SYSTEM == ultrix || \
- OP_SYSTEM == unicos \
+ OP_SYSTEM == unicos || \
+ OP_SYSTEM == emscripten \
)
#endif /* OP_SYSTEM_H */
diff --git a/src/third_party/IntelRDFPMathLib20U1/SConscript b/src/third_party/IntelRDFPMathLib20U1/SConscript index c8eb827c28d..f23c071c6d2 100644 --- a/src/third_party/IntelRDFPMathLib20U1/SConscript +++ b/src/third_party/IntelRDFPMathLib20U1/SConscript @@ -302,7 +302,7 @@ if env.TargetOSIs('freebsd') or env.TargetOSIs('openbsd'): # Set Architecture Defines processor = env['TARGET_ARCH'] # Using 32 bit -if processor == 'i386': +if processor == 'i386' or processor == 'emscripten': cpp_defines['IA32'] = '1' cpp_defines['ia32'] = '1' elif processor == 'arm': |