1 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Use of this source code is governed by a BSD-style license that can be 3 # found in the LICENSE file. 4 5 import("//build/config/crypto.gni") 6 7 config("usrsctp_config") { 8 include_dirs = [ 9 "usrsctplib", 10 "usrsctplib/netinet", 11 ] 12 } 13 14 static_library("usrsctp") { 15 sources = [ 16 "usrsctplib/netinet/sctp.h", 17 "usrsctplib/netinet/sctp_asconf.c", 18 "usrsctplib/netinet/sctp_asconf.h", 19 "usrsctplib/netinet/sctp_auth.c", 20 "usrsctplib/netinet/sctp_auth.h", 21 "usrsctplib/netinet/sctp_bsd_addr.c", 22 "usrsctplib/netinet/sctp_bsd_addr.h", 23 "usrsctplib/netinet/sctp_callout.c", 24 "usrsctplib/netinet/sctp_callout.h", 25 "usrsctplib/netinet/sctp_cc_functions.c", 26 "usrsctplib/netinet/sctp_constants.h", 27 "usrsctplib/netinet/sctp_crc32.c", 28 "usrsctplib/netinet/sctp_crc32.h", 29 "usrsctplib/netinet/sctp_header.h", 30 "usrsctplib/netinet/sctp_indata.c", 31 "usrsctplib/netinet/sctp_indata.h", 32 "usrsctplib/netinet/sctp_input.c", 33 "usrsctplib/netinet/sctp_input.h", 34 "usrsctplib/netinet/sctp_lock_userspace.h", 35 "usrsctplib/netinet/sctp_os.h", 36 "usrsctplib/netinet/sctp_os_userspace.h", 37 "usrsctplib/netinet/sctp_output.c", 38 "usrsctplib/netinet/sctp_output.h", 39 "usrsctplib/netinet/sctp_pcb.c", 40 "usrsctplib/netinet/sctp_pcb.h", 41 "usrsctplib/netinet/sctp_peeloff.c", 42 "usrsctplib/netinet/sctp_peeloff.h", 43 "usrsctplib/netinet/sctp_process_lock.h", 44 "usrsctplib/netinet/sctp_sha1.c", 45 "usrsctplib/netinet/sctp_sha1.h", 46 "usrsctplib/netinet/sctp_ss_functions.c", 47 "usrsctplib/netinet/sctp_structs.h", 48 "usrsctplib/netinet/sctp_sysctl.c", 49 "usrsctplib/netinet/sctp_sysctl.h", 50 "usrsctplib/netinet/sctp_timer.c", 51 "usrsctplib/netinet/sctp_timer.h", 52 "usrsctplib/netinet/sctp_uio.h", 53 "usrsctplib/netinet/sctp_userspace.c", 54 "usrsctplib/netinet/sctp_usrreq.c", 55 "usrsctplib/netinet/sctp_var.h", 56 "usrsctplib/netinet/sctputil.c", 57 "usrsctplib/netinet/sctputil.h", 58 "usrsctplib/netinet6/sctp6_usrreq.c", 59 "usrsctplib/netinet6/sctp6_var.h", 60 "usrsctplib/user_atomic.h", 61 "usrsctplib/user_environment.c", 62 "usrsctplib/user_environment.h", 63 "usrsctplib/user_inpcb.h", 64 "usrsctplib/user_ip6_var.h", 65 "usrsctplib/user_ip_icmp.h", 66 "usrsctplib/user_malloc.h", 67 "usrsctplib/user_mbuf.c", 68 "usrsctplib/user_mbuf.h", 69 "usrsctplib/user_queue.h", 70 "usrsctplib/user_recv_thread.c", 71 "usrsctplib/user_recv_thread.h", 72 "usrsctplib/user_route.h", 73 "usrsctplib/user_sctp_timer_iterate.c", 74 "usrsctplib/user_socket.c", 75 "usrsctplib/user_socketvar.h", 76 "usrsctplib/user_uma.h", 77 "usrsctplib/usrsctp.h" 78 ] 79 80 defines = [ 81 "SCTP_PROCESS_LEVEL_LOCKS", 82 "SCTP_SIMPLE_ALLOCATOR", 83 "__Userspace__", 84 # "SCTP_DEBUG", # Uncomment for SCTP debugging. 85 ] 86 87 configs -= [ "//build/config/compiler:chromium_code" ] 88 configs += [ "//build/config/compiler:no_chromium_code" ] 89 90 public_configs = [ ":usrsctp_config" ] 91 92 if (use_openssl) { 93 defines += [ "SCTP_USE_OPENSSL_SHA1" ] 94 } else { 95 defines += [ "SCTP_USE_NSS_SHA1" ] 96 } 97 98 if (is_linux || is_android) { 99 defines += [ "__Userspace_os_Linux" ] 100 } else if (is_mac || is_ios) { 101 defines += [ 102 "HAVE_SA_LEN", 103 "HAVE_SCONN_LEN", 104 "__APPLE_USE_RFC_2292", 105 "__Userspace_os_Darwin", 106 ] 107 } 108 109 if (is_win) { 110 defines += [ 111 "__Userspace_os_Windows", 112 # Manually setting WINVER and _WIN32_WINNT is needed because Chrome 113 # sets WINVER to a newer version of windows. But compiling usrsctp 114 # this way would is incompatible with windows XP. 115 "WINVER=0x0502", 116 "_WIN32_WINNT=0x0502", 117 ] 118 } else { 119 defines += [ "NON_WINDOWS_DEFINE" ] 120 } 121 122 if (is_clang) { 123 cflags = [ "-Wno-incompatible-pointer-types" ] 124 } 125 126 deps = [ 127 "//crypto:platform", 128 ] 129 } 130