Turn audio into a shareable video. forked from nypublicradio/audiogram

common.gypi 18KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526
  1. {
  2. 'variables': {
  3. 'configuring_node%': 0,
  4. 'asan%': 0,
  5. 'werror': '', # Turn off -Werror in V8 build.
  6. 'visibility%': 'hidden', # V8's visibility setting
  7. 'target_arch%': 'ia32', # set v8's target architecture
  8. 'host_arch%': 'ia32', # set v8's host architecture
  9. 'want_separate_host_toolset%': 0, # V8 should not build target and host
  10. 'library%': 'static_library', # allow override to 'shared_library' for DLL/.so builds
  11. 'component%': 'static_library', # NB. these names match with what V8 expects
  12. 'msvs_multi_core_compile': '0', # we do enable multicore compiles, but not using the V8 way
  13. 'enable_pgo_generate%': '0',
  14. 'enable_pgo_use%': '0',
  15. 'python%': 'python',
  16. 'node_shared%': 'false',
  17. 'force_dynamic_crt%': 0,
  18. 'node_use_v8_platform%': 'true',
  19. 'node_use_bundled_v8%': 'true',
  20. 'node_module_version%': '',
  21. 'node_with_ltcg%': '',
  22. 'node_shared_openssl%': 'false',
  23. 'node_tag%': '',
  24. 'uv_library%': 'static_library',
  25. 'clang%': 0,
  26. 'openssl_fips%': '',
  27. # Some STL containers (e.g. std::vector) do not preserve ABI compatibility
  28. # between debug and non-debug mode.
  29. 'disable_glibcxx_debug': 1,
  30. # Don't use ICU data file (icudtl.dat) from V8, we use our own.
  31. 'icu_use_data_file_flag%': 0,
  32. # Reset this number to 0 on major V8 upgrades.
  33. # Increment by one for each non-official patch applied to deps/v8.
  34. 'v8_embedder_string': '-node.16',
  35. ##### V8 defaults for Node.js #####
  36. # Old time default, now explicitly stated.
  37. 'v8_use_snapshot': 1,
  38. # Turn on SipHash for hash seed generation, addresses HashWick
  39. 'v8_use_siphash': 'true',
  40. # These are more relevant for V8 internal development.
  41. # Refs: https://github.com/nodejs/node/issues/23122
  42. # Refs: https://github.com/nodejs/node/issues/23167
  43. # Enable compiler warnings when using V8_DEPRECATED apis from V8 code.
  44. 'v8_deprecation_warnings': 0,
  45. # Enable compiler warnings when using V8_DEPRECATE_SOON apis from V8 code.
  46. 'v8_imminent_deprecation_warnings': 0,
  47. # Enable disassembler for `--print-code` v8 options
  48. 'v8_enable_disassembler': 1,
  49. # https://github.com/nodejs/node/pull/22920/files#r222779926
  50. 'v8_enable_handle_zapping': 0,
  51. # Disable V8 untrusted code mitigations.
  52. # See https://github.com/v8/v8/wiki/Untrusted-code-mitigations
  53. 'v8_untrusted_code_mitigations': 0,
  54. # This is more of a V8 dev setting
  55. # https://github.com/nodejs/node/pull/22920/files#r222779926
  56. 'v8_enable_fast_mksnapshot': 0,
  57. 'v8_win64_unwinding_info': 1,
  58. # TODO(refack): make v8-perfetto happen
  59. 'v8_use_perfetto': 0,
  60. ##### end V8 defaults #####
  61. 'conditions': [
  62. ['target_arch=="arm64"', {
  63. # Disabled pending https://github.com/nodejs/node/issues/23913.
  64. 'openssl_no_asm%': 1,
  65. }, {
  66. 'openssl_no_asm%': 0,
  67. }],
  68. ['OS == "win"', {
  69. 'os_posix': 0,
  70. 'v8_postmortem_support%': 0,
  71. }, {
  72. 'os_posix': 1,
  73. 'v8_postmortem_support%': 1,
  74. }],
  75. ['v8_use_snapshot==1', {
  76. 'conditions': [
  77. ['GENERATOR == "ninja"', {
  78. 'obj_dir': '<(PRODUCT_DIR)/obj',
  79. 'v8_base': '<(PRODUCT_DIR)/obj/tools/v8_gypfiles/libv8_snapshot.a',
  80. }, {
  81. 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
  82. 'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_snapshot.a',
  83. }],
  84. ['OS == "win"', {
  85. 'obj_dir': '<(PRODUCT_DIR)/obj',
  86. 'v8_base': '<(PRODUCT_DIR)/lib/libv8_snapshot.a',
  87. }],
  88. ['OS == "mac"', {
  89. 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
  90. 'v8_base': '<(PRODUCT_DIR)/libv8_snapshot.a',
  91. }],
  92. ],
  93. }, {
  94. 'conditions': [
  95. ['GENERATOR == "ninja"', {
  96. 'obj_dir': '<(PRODUCT_DIR)/obj',
  97. 'v8_base': '<(PRODUCT_DIR)/obj/tools/v8_gypfiles/libv8_nosnapshot.a',
  98. }, {
  99. 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
  100. 'v8_base': '<(PRODUCT_DIR)/obj.target/tools/v8_gypfiles/libv8_nosnapshot.a',
  101. }],
  102. ['OS == "win"', {
  103. 'obj_dir': '<(PRODUCT_DIR)/obj',
  104. 'v8_base': '<(PRODUCT_DIR)/lib/libv8_nosnapshot.a',
  105. }],
  106. ['OS == "mac"', {
  107. 'obj_dir%': '<(PRODUCT_DIR)/obj.target',
  108. 'v8_base': '<(PRODUCT_DIR)/libv8_nosnapshot.a',
  109. }],
  110. ],
  111. }],
  112. ['openssl_fips != ""', {
  113. 'openssl_product': '<(STATIC_LIB_PREFIX)crypto<(STATIC_LIB_SUFFIX)',
  114. }, {
  115. 'openssl_product': '<(STATIC_LIB_PREFIX)openssl<(STATIC_LIB_SUFFIX)',
  116. }],
  117. ['OS=="mac"', {
  118. 'clang%': 1,
  119. }],
  120. ],
  121. },
  122. 'target_defaults': {
  123. 'default_configuration': 'Release',
  124. 'configurations': {
  125. 'Debug': {
  126. 'variables': {
  127. 'v8_enable_handle_zapping': 1,
  128. 'conditions': [
  129. ['node_shared != "true"', {
  130. 'MSVC_runtimeType': 1, # MultiThreadedDebug (/MTd)
  131. }, {
  132. 'MSVC_runtimeType': 3, # MultiThreadedDebugDLL (/MDd)
  133. }],
  134. ],
  135. },
  136. 'defines': [ 'DEBUG', '_DEBUG', 'V8_ENABLE_CHECKS' ],
  137. 'cflags': [ '-g', '-O0' ],
  138. 'conditions': [
  139. ['OS=="aix"', {
  140. 'cflags': [ '-gxcoff' ],
  141. 'ldflags': [ '-Wl,-bbigtoc' ],
  142. }],
  143. ['OS == "android"', {
  144. 'cflags': [ '-fPIE' ],
  145. 'ldflags': [ '-fPIE', '-pie' ]
  146. }],
  147. ],
  148. 'msvs_settings': {
  149. 'VCCLCompilerTool': {
  150. 'BasicRuntimeChecks': 3, # /RTC1
  151. 'MinimalRebuild': 'false',
  152. 'OmitFramePointers': 'false',
  153. 'Optimization': 0, # /Od, no optimization
  154. 'RuntimeLibrary': '<(MSVC_runtimeType)',
  155. },
  156. 'VCLinkerTool': {
  157. 'LinkIncremental': 2, # enable incremental linking
  158. },
  159. },
  160. 'xcode_settings': {
  161. 'GCC_OPTIMIZATION_LEVEL': '0', # stop gyp from defaulting to -Os
  162. },
  163. },
  164. 'Release': {
  165. 'variables': {
  166. 'v8_enable_handle_zapping': 0,
  167. 'pgo_generate': ' -fprofile-generate ',
  168. 'pgo_use': ' -fprofile-use -fprofile-correction ',
  169. 'lto': ' -flto=4 -fuse-linker-plugin -ffat-lto-objects ',
  170. 'conditions': [
  171. ['node_shared != "true"', {
  172. 'MSVC_runtimeType': 0 # MultiThreaded (/MT)
  173. }, {
  174. 'MSVC_runtimeType': 2 # MultiThreadedDLL (/MD)
  175. }],
  176. ],
  177. },
  178. 'cflags': [ '-O3' ],
  179. 'conditions': [
  180. ['OS=="solaris"', {
  181. # pull in V8's postmortem metadata
  182. 'ldflags': [ '-Wl,-z,allextract' ]
  183. }],
  184. ['OS!="mac" and OS!="win"', {
  185. 'cflags': [ '-fno-omit-frame-pointer' ],
  186. }],
  187. ['OS=="linux"', {
  188. 'conditions': [
  189. ['enable_pgo_generate=="true"', {
  190. 'cflags': ['<(pgo_generate)'],
  191. 'ldflags': ['<(pgo_generate)'],
  192. },],
  193. ['enable_pgo_use=="true"', {
  194. 'cflags': ['<(pgo_use)'],
  195. 'ldflags': ['<(pgo_use)'],
  196. },],
  197. ['enable_lto=="true"', {
  198. 'cflags': ['<(lto)'],
  199. 'ldflags': ['<(lto)'],
  200. },],
  201. ],
  202. },],
  203. ['OS == "android"', {
  204. 'cflags': [ '-fPIE' ],
  205. 'ldflags': [ '-fPIE', '-pie' ]
  206. }],
  207. ],
  208. 'msvs_settings': {
  209. 'VCCLCompilerTool': {
  210. 'EnableFunctionLevelLinking': 'true',
  211. 'EnableIntrinsicFunctions': 'true',
  212. 'FavorSizeOrSpeed': 1, # /Ot, favor speed over size
  213. 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible
  214. 'OmitFramePointers': 'true',
  215. 'Optimization': 3, # /Ox, full optimization
  216. 'RuntimeLibrary': '<(MSVC_runtimeType)',
  217. 'RuntimeTypeInfo': 'false',
  218. }
  219. }
  220. }
  221. },
  222. # Defines these mostly for node-gyp to pickup, and warn addon authors of
  223. # imminent V8 deprecations, also to sync how dependencies are configured.
  224. 'defines': [
  225. 'V8_DEPRECATION_WARNINGS',
  226. 'V8_IMMINENT_DEPRECATION_WARNINGS',
  227. ],
  228. # Forcibly disable -Werror. We support a wide range of compilers, it's
  229. # simply not feasible to squelch all warnings, never mind that the
  230. # libraries in deps/ are not under our control.
  231. 'cflags!': ['-Werror'],
  232. 'msvs_settings': {
  233. 'VCCLCompilerTool': {
  234. 'BufferSecurityCheck': 'true',
  235. 'DebugInformationFormat': 1, # /Z7 embed info in .obj files
  236. 'ExceptionHandling': 0, # /EHsc
  237. 'MultiProcessorCompilation': 'true',
  238. 'StringPooling': 'true', # pool string literals
  239. 'SuppressStartupBanner': 'true',
  240. 'WarnAsError': 'false',
  241. 'WarningLevel': 3, # /W3
  242. },
  243. 'VCLinkerTool': {
  244. 'target_conditions': [
  245. ['_type=="executable"', {
  246. 'SubSystem': 1, # /SUBSYSTEM:CONSOLE
  247. }],
  248. ],
  249. 'conditions': [
  250. ['target_arch=="ia32"', {
  251. 'TargetMachine' : 1, # /MACHINE:X86
  252. }],
  253. ['target_arch=="x64"', {
  254. 'TargetMachine' : 17, # /MACHINE:X64
  255. }],
  256. ['target_arch=="arm64"', {
  257. 'TargetMachine' : 0, # NotSet. MACHINE:ARM64 is inferred from the input files.
  258. }],
  259. ],
  260. 'GenerateDebugInformation': 'true',
  261. 'SuppressStartupBanner': 'true',
  262. },
  263. },
  264. # Disable warnings:
  265. # - "C4251: class needs to have dll-interface"
  266. # - "C4275: non-DLL-interface used as base for DLL-interface"
  267. # Over 10k of these warnings are generated when compiling node,
  268. # originating from v8.h. Most of them are false positives.
  269. # See also: https://github.com/nodejs/node/pull/15570
  270. # TODO: re-enable when Visual Studio fixes these upstream.
  271. #
  272. # - "C4267: conversion from 'size_t' to 'int'"
  273. # Many any originate from our dependencies, and their sheer number
  274. # drowns out other, more legitimate warnings.
  275. # - "C4244: conversion from 'type1' to 'type2', possible loss of data"
  276. # Ususaly safe. Disable for `dep`, enable for `src`
  277. 'msvs_disabled_warnings': [4351, 4355, 4800, 4251, 4275, 4244, 4267],
  278. 'msvs_cygwin_shell': 0, # prevent actions from trying to use cygwin
  279. 'conditions': [
  280. [ 'configuring_node', {
  281. 'msvs_configuration_attributes': {
  282. 'OutputDirectory': '<(DEPTH)/out/$(Configuration)/',
  283. 'IntermediateDirectory': '$(OutDir)obj/$(ProjectName)/'
  284. },
  285. }],
  286. [ 'target_arch=="x64"', {
  287. 'msvs_configuration_platform': 'x64',
  288. }],
  289. [ 'target_arch=="arm64"', {
  290. 'msvs_configuration_platform': 'arm64',
  291. }],
  292. ['asan == 1 and OS != "mac"', {
  293. 'cflags+': [
  294. '-fno-omit-frame-pointer',
  295. '-fsanitize=address',
  296. '-DLEAK_SANITIZER'
  297. ],
  298. 'cflags!': [ '-fomit-frame-pointer' ],
  299. 'ldflags': [ '-fsanitize=address' ],
  300. }],
  301. ['asan == 1 and OS == "mac"', {
  302. 'xcode_settings': {
  303. 'OTHER_CFLAGS+': [
  304. '-fno-omit-frame-pointer',
  305. '-gline-tables-only',
  306. '-fsanitize=address',
  307. '-DLEAK_SANITIZER'
  308. ],
  309. 'OTHER_CFLAGS!': [
  310. '-fomit-frame-pointer',
  311. ],
  312. },
  313. 'target_conditions': [
  314. ['_type!="static_library"', {
  315. 'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
  316. }],
  317. ],
  318. }],
  319. ['OS == "win"', {
  320. 'defines': [
  321. 'WIN32',
  322. # we don't really want VC++ warning us about
  323. # how dangerous C functions are...
  324. '_CRT_SECURE_NO_DEPRECATE',
  325. # ... or that C implementations shouldn't use
  326. # POSIX names
  327. '_CRT_NONSTDC_NO_DEPRECATE',
  328. # Make sure the STL doesn't try to use exceptions
  329. '_HAS_EXCEPTIONS=0',
  330. 'BUILDING_V8_SHARED=1',
  331. 'BUILDING_UV_SHARED=1',
  332. ],
  333. }],
  334. [ 'OS in "linux freebsd openbsd solaris aix"', {
  335. 'cflags': [ '-pthread' ],
  336. 'ldflags': [ '-pthread' ],
  337. }],
  338. [ 'OS in "linux freebsd openbsd solaris android aix cloudabi"', {
  339. 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', ],
  340. 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=gnu++1y' ],
  341. 'ldflags': [ '-rdynamic' ],
  342. 'target_conditions': [
  343. # The 1990s toolchain on SmartOS can't handle thin archives.
  344. ['_type=="static_library" and OS=="solaris"', {
  345. 'standalone_static_library': 1,
  346. }],
  347. ['OS=="openbsd"', {
  348. 'cflags': [ '-I/usr/local/include' ],
  349. 'ldflags': [ '-Wl,-z,wxneeded' ],
  350. }],
  351. ],
  352. 'conditions': [
  353. [ 'target_arch=="ia32"', {
  354. 'cflags': [ '-m32' ],
  355. 'ldflags': [ '-m32' ],
  356. }],
  357. [ 'target_arch=="x32"', {
  358. 'cflags': [ '-mx32' ],
  359. 'ldflags': [ '-mx32' ],
  360. }],
  361. [ 'target_arch=="x64"', {
  362. 'cflags': [ '-m64' ],
  363. 'ldflags': [ '-m64' ],
  364. }],
  365. [ 'target_arch=="ppc" and OS!="aix"', {
  366. 'cflags': [ '-m32' ],
  367. 'ldflags': [ '-m32' ],
  368. }],
  369. [ 'target_arch=="ppc64" and OS!="aix"', {
  370. 'cflags': [ '-m64', '-mminimal-toc' ],
  371. 'ldflags': [ '-m64' ],
  372. }],
  373. [ 'target_arch=="s390x"', {
  374. 'cflags': [ '-m64', '-march=z196' ],
  375. 'ldflags': [ '-m64', '-march=z196' ],
  376. }],
  377. [ 'OS=="solaris"', {
  378. 'cflags': [ '-pthreads' ],
  379. 'ldflags': [ '-pthreads' ],
  380. 'cflags!': [ '-pthread' ],
  381. 'ldflags!': [ '-pthread' ],
  382. }],
  383. [ 'node_shared=="true"', {
  384. 'cflags': [ '-fPIC' ],
  385. }],
  386. ],
  387. }],
  388. [ 'OS=="aix"', {
  389. 'variables': {
  390. # Used to differentiate `AIX` and `OS400`(IBM i).
  391. 'aix_variant_name': '<!(uname -s)',
  392. },
  393. 'cflags': [ '-maix64', ],
  394. 'ldflags!': [ '-rdynamic', ],
  395. 'ldflags': [
  396. '-Wl,-bbigtoc',
  397. '-maix64',
  398. ],
  399. 'conditions': [
  400. [ '"<(aix_variant_name)"=="OS400"', { # a.k.a. `IBM i`
  401. 'ldflags': [
  402. '-Wl,-blibpath:/QOpenSys/pkgs/lib:/QOpenSys/usr/lib',
  403. '-Wl,-brtl',
  404. ],
  405. }, { # else it's `AIX`
  406. 'ldflags': [
  407. '-Wl,-blibpath:/usr/lib:/lib:/opt/freeware/lib/pthread/ppc64',
  408. ],
  409. }],
  410. ],
  411. }],
  412. ['OS=="android"', {
  413. 'target_conditions': [
  414. ['_toolset=="target"', {
  415. 'defines': [ '_GLIBCXX_USE_C99_MATH' ],
  416. 'libraries': [ '-llog' ],
  417. }],
  418. ],
  419. }],
  420. ['OS=="mac"', {
  421. 'defines': ['_DARWIN_USE_64_BIT_INODE=1'],
  422. 'xcode_settings': {
  423. 'ALWAYS_SEARCH_USER_PATHS': 'NO',
  424. 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
  425. 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
  426. # (Equivalent to -fPIC)
  427. 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
  428. 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
  429. 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
  430. 'PREBINDING': 'NO', # No -Wl,-prebind
  431. 'MACOSX_DEPLOYMENT_TARGET': '10.10', # -mmacosx-version-min=10.10
  432. 'USE_HEADERMAP': 'NO',
  433. 'OTHER_CFLAGS': [
  434. '-fno-strict-aliasing',
  435. ],
  436. 'WARNING_CFLAGS': [
  437. '-Wall',
  438. '-Wendif-labels',
  439. '-W',
  440. '-Wno-unused-parameter',
  441. ],
  442. },
  443. 'target_conditions': [
  444. ['_type!="static_library"', {
  445. 'xcode_settings': {
  446. 'OTHER_LDFLAGS': [
  447. '-Wl,-no_pie',
  448. '-Wl,-search_paths_first',
  449. ],
  450. },
  451. }],
  452. ],
  453. 'conditions': [
  454. ['target_arch=="ia32"', {
  455. 'xcode_settings': {'ARCHS': ['i386']},
  456. }],
  457. ['target_arch=="x64"', {
  458. 'xcode_settings': {'ARCHS': ['x86_64']},
  459. }],
  460. ['clang==1', {
  461. 'xcode_settings': {
  462. 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
  463. 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++1y', # -std=gnu++1y
  464. 'CLANG_CXX_LIBRARY': 'libc++',
  465. },
  466. }],
  467. ],
  468. }],
  469. ['OS=="freebsd" and node_use_dtrace=="true"', {
  470. 'libraries': [ '-lelf' ],
  471. }],
  472. ['OS=="freebsd"', {
  473. 'ldflags': [
  474. '-Wl,--export-dynamic',
  475. ],
  476. }],
  477. # if node is built as an executable,
  478. # the openssl mechanism for keeping itself "dload"-ed to ensure proper
  479. # atexit cleanup does not apply
  480. ['node_shared_openssl!="true" and node_shared!="true"', {
  481. 'defines': [
  482. # `OPENSSL_NO_PINSHARED` prevents openssl from dload
  483. # current node executable,
  484. # see https://github.com/nodejs/node/pull/21848
  485. # or https://github.com/nodejs/node/issues/27925
  486. 'OPENSSL_NO_PINSHARED'
  487. ],
  488. }],
  489. ['node_shared_openssl!="true"', {
  490. # `OPENSSL_THREADS` is defined via GYP for openSSL for all architectures.
  491. 'defines': [
  492. 'OPENSSL_THREADS',
  493. ],
  494. }],
  495. ['node_shared_openssl!="true" and openssl_no_asm==1', {
  496. 'defines': [
  497. 'OPENSSL_NO_ASM',
  498. ],
  499. }],
  500. ],
  501. }
  502. }