moz.build (3983B)
1 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*- 2 # vim: set filetype=python: 3 # This Source Code Form is subject to the terms of the Mozilla Public 4 # License, v. 2.0. If a copy of the MPL was not distributed with this 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 6 7 EXPORTS += [ 8 "RLBoxSoundTouch.h", 9 "RLBoxSoundTouchTypes.h", 10 ] 11 12 EXPORTS.soundtouch += [ 13 'FIFOSamplePipe.h', 14 'RLBoxSoundTouchFactory.h', 15 'SoundTouch.h', 16 'soundtouch_config.h', 17 'SoundTouchFactory.h', 18 'STTypes.h', 19 ] 20 21 LOCAL_INCLUDES += ["!/security/rlbox"] 22 23 LOCAL_INCLUDES += [ 24 "/third_party/simde/", 25 "/third_party/wasm2c/wasm2c/", 26 ] 27 28 SOURCES += ["RLBoxSoundTouch.cpp"] 29 # Some xpcom things are #included indirectly (but not actually used), and 30 # it's simpler to set MOZILLA_INTERNAL_API to make it compile than to 31 # disentangle the whole thing. 32 SOURCES["RLBoxSoundTouch.cpp"].flags += ["-DMOZILLA_INTERNAL_API"] 33 34 if CONFIG["MOZ_WASM_SANDBOXING_SOUNDTOUCH"]: 35 include("/security/rlbox/rlbox.mozbuild") 36 37 # Disabling Segue as other rlboxed libraries (the non-GPL rlboxed libraries) 38 # use Segue under the assumption that they have exclusive use of the segment 39 # register. This assumption speeds up the rlboxed libraries significantly. 40 # However, it does mean that the below rlboxed library can either avoid 41 # Segue or use Segue with non-exclusive segment use. We opt for disabling 42 # Segue since Segue with non-exclusive segment use can introduce some extra 43 # costs when invoking functions in the library. 44 RLBoxLibrary("rlboxsoundtouch", use_segue=False) 45 46 DEFINES["WASM_RT_GROW_FAILED_CRASH"] = True 47 48 SOURCES += [ 49 "/config/external/rlbox_wasm2c_sandbox/rlbox_wasm2c_thread_locals.cpp", 50 "/third_party/rlbox_wasm2c_sandbox/src/wasm2c_rt_mem.c", 51 "/third_party/rlbox_wasm2c_sandbox/src/wasm2c_rt_minwasi.c", 52 ] 53 if CONFIG['OS_ARCH'] != 'WINNT': 54 OS_LIBS += ["m"] 55 56 if CONFIG["MOZ_SAMPLE_TYPE_FLOAT32"]: 57 WASM_DEFINES["MOZ_SAMPLE_TYPE_FLOAT32"] = 1 58 59 # Clang older than version 14 does not have the necessary 60 # WASMSIMD intrinsics, so we disable SoundTouch WASMSIMD. 61 # See Bug 1851301 62 if int(CONFIG["WASM_CC_VERSION"].split(".")[0]) > 13: 63 WASM_SOURCES += ['sse_optimized.cpp'] 64 65 WASM_DEFINES["SOUNDTOUCH_ALLOW_SSE"] = 1 66 WASM_DEFINES["SOUNDTOUCH_WASM_SIMD"] = 1 67 WASM_DEFINES["SIMDE_ENABLE_NATIVE_ALIASES"] = 1 68 69 soundtouch_sources = WASM_SOURCES 70 soundtouch_defines = WASM_DEFINES 71 72 else: 73 SOURCES += ["/config/external/rlbox/rlbox_thread_locals.cpp"] 74 if CONFIG['INTEL_ARCHITECTURE']: 75 if CONFIG['MOZ_SAMPLE_TYPE_FLOAT32']: 76 SOURCES += ['sse_optimized.cpp'] 77 SOURCES['sse_optimized.cpp'].flags += CONFIG['SSE2_FLAGS'] 78 else: 79 SOURCES += ['mmx_optimized.cpp'] 80 SOURCES['mmx_optimized.cpp'].flags += CONFIG['MMX_FLAGS'] 81 82 if CONFIG['OS_ARCH'] != 'WINNT': 83 # GCC/Clang require permissions to be explicitly set for the soundtouch 84 # header. 85 CXXFLAGS += ['-include', SRCDIR + '/soundtouch_perms.h'] 86 else: 87 # Windows need alloca renamed to _alloca 88 DEFINES['alloca'] = '_alloca' 89 90 soundtouch_sources = UNIFIED_SOURCES 91 soundtouch_defines = DEFINES 92 93 soundtouch_sources += [ 94 'AAFilter.cpp', 95 'cpu_detect_x86.cpp', 96 'FIFOSampleBuffer.cpp', 97 'FIRFilter.cpp', 98 'InterpolateCubic.cpp', 99 'InterpolateLinear.cpp', 100 'InterpolateShannon.cpp', 101 'RateTransposer.cpp', 102 'RLBoxSoundTouchFactory.cpp', 103 'SoundTouch.cpp', 104 'SoundTouchFactory.cpp', 105 'TDStretch.cpp', 106 ] 107 108 for k, v in ( 109 ('BUILDING_SOUNDTOUCH', 1), 110 # Use abort() instead of exception in SoundTouch. 111 ('ST_NO_EXCEPTION_HANDLING', 1) 112 ): 113 soundtouch_defines[k] = v 114 115 116 # We allow warnings for third-party code that can be updated from upstream. 117 AllowCompilerWarnings() 118 119 FINAL_LIBRARY = 'lgpllibs'