Bug 792325: Build libsrtp in mozilla's system, and update script r=ted r=bsmedberg
authorRandell Jesup <rjesup@jesup.org>
Fri, 21 Sep 2012 16:37:29 -0400
changeset 107748 765f725ff4196f1542b02d9591dff2431e628101
parent 107747 94111544f20110014fcd56d0011db26b49cf53f6
child 107749 5691ca0b22bae2b7ee4d05df7e87ee693f6c589b
push id1
push userroot
push dateMon, 20 Oct 2014 17:29:22 +0000
reviewersted, bsmedberg
bugs792325
milestone18.0a1
Bug 792325: Build libsrtp in mozilla's system, and update script r=ted r=bsmedberg
configure.in
netwerk/Makefile.in
netwerk/build/Makefile.in
netwerk/srtp/src/Makefile.in
netwerk/srtp/src/include/config.h
netwerk/srtp/srtp_update.log
netwerk/srtp/update_srtp.sh
--- a/configure.in
+++ b/configure.in
@@ -2976,16 +2976,18 @@ dnl Quota support
 MOZ_CHECK_HEADERS(sys/quota.h sys/sysmacros.h)
 MOZ_CHECK_HEADERS(linux/quota.h)
 
 dnl Try for MMX support
 dnl NB - later gcc versions require -mmmx for this header to be successfully
 dnl included (or another option which implies it, such as -march=pentium-mmx)
 MOZ_CHECK_HEADERS(mmintrin.h)
 
+MOZ_CHECK_HEADERS(sys/types.h netinet/in.h byteswap.h)
+
 dnl Check whether the compiler supports the new-style C++ standard
 dnl library headers (i.e. <new>) or needs the old "new.h"
 AC_LANG_CPLUSPLUS
 NEW_H=new.h
 MOZ_CHECK_HEADER(new, [NEW_H=new])
 AC_DEFINE_UNQUOTED(NEW_H, <$NEW_H>)
 AC_LANG_C
 
@@ -4184,16 +4186,17 @@ MOZ_VORBIS=
 MOZ_TREMOR=
 MOZ_WAVE=1
 MOZ_SAMPLE_TYPE_FLOAT32=
 MOZ_SAMPLE_TYPE_S16=
 MOZ_MEDIA=
 MOZ_OPUS=1
 MOZ_WEBM=1
 MOZ_WEBRTC=1
+MOZ_SRTP=
 MOZ_WEBRTC_SIGNALING=
 MOZ_MEDIA_PLUGINS=
 MOZ_MEDIA_NAVIGATOR=
 MOZ_OMX_PLUGIN=
 MOZ_VP8=
 MOZ_VP8_ERROR_CONCEALMENT=
 MOZ_VP8_ENCODER=
 VPX_AS=
@@ -5186,19 +5189,22 @@ MOZ_ARG_DISABLE_BOOL(webrtc,
 
 if test -n "$MOZ_WEBRTC"; then
     AC_DEFINE(MOZ_WEBRTC)
     MOZ_MEDIA=1
     MOZ_RAW=1
     MOZ_VP8=1
     MOZ_VP8_ENCODER=1
     MOZ_VP8_ERROR_CONCEALMENT=1
+    MOZ_SRTP=1
+    AC_DEFINE(MOZ_SRTP)
 fi
 
 AC_SUBST(MOZ_WEBRTC)
+AC_SUBST(MOZ_SRTP)
 
 case "$target_cpu" in
 arm*)
     MOZ_SAMPLE_TYPE_S16=1
     AC_DEFINE(MOZ_SAMPLE_TYPE_S16)
     AC_SUBST(MOZ_SAMPLE_TYPE_S16)
 ;;
 *)
--- a/netwerk/Makefile.in
+++ b/netwerk/Makefile.in
@@ -20,16 +20,22 @@ PARALLEL_DIRS = \
   mime \
   streamconv \
   cache \
   protocol \
   system \
   ipc  \
   $(NULL)
 
+ifdef MOZ_SRTP
+PARALLEL_DIRS += \
+  srtp/src \
+  $(NULL)
+endif
+
 ifdef NECKO_WIFI
 PARALLEL_DIRS += wifi
 endif
 
 PARALLEL_DIRS += locales
 
 ifdef MOZ_DASH
 PARALLEL_DIRS += dash
--- a/netwerk/build/Makefile.in
+++ b/netwerk/build/Makefile.in
@@ -31,16 +31,22 @@ SHARED_LIBRARY_LIBS = \
   ../mime/$(LIB_PREFIX)nkmime_s.$(LIB_SUFFIX) \
   ../cache/$(LIB_PREFIX)nkcache_s.$(LIB_SUFFIX) \
   ../protocol/about/$(LIB_PREFIX)nkabout_s.$(LIB_SUFFIX) \
   $(foreach d,$(filter-out about,$(NECKO_PROTOCOLS)), \
     ../protocol/$(d)/$(LIB_PREFIX)nk$(d)_s.$(LIB_SUFFIX)) \
   ../ipc/$(LIB_PREFIX)neckoipc_s.$(LIB_SUFFIX) \
   $(NULL)
 
+ifdef MOZ_SRTP
+SHARED_LIBRARY_LIBS += \
+  ../srtp/src/$(LIB_PREFIX)nksrtp_s.$(LIB_SUFFIX) \
+  $(NULL)
+endif
+
 ifeq ($(OS_ARCH),WINNT)
     SHARED_LIBRARY_LIBS += \
         ../system/win32/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
     SHARED_LIBRARY_LIBS += \
         ../system/mac/$(LIB_PREFIX)neckosystem_s.$(LIB_SUFFIX)
new file mode 100644
--- /dev/null
+++ b/netwerk/srtp/src/Makefile.in
@@ -0,0 +1,117 @@
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH = @DEPTH@
+topsrcdir = @top_srcdir@
+srcdir = @srcdir@
+VPATH = \
+  @srcdir@ \
+  @srcdir@/srtp \
+  @srcdir@/crypto \
+  @srcdir@/crypto/cipher \
+  @srcdir@/crypto/hash \
+  @srcdir@/crypto/kernel \
+  @srcdir@/crypto/math \
+  @srcdir@/crypto/replay \
+  @srcdir@/crypto/rng \
+  $(NULL)
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = necko
+LIBRARY_NAME = nksrtp_s
+LIBXUL_LIBRARY = 1
+XPIDL_MODULE = necko_srtp
+GRE_MODULE = 1
+FORCE_STATIC_LIB = 1
+
+EXPORTS_NAMESPACES = mozilla/net
+
+ifdef GNU_CC
+OS_CFLAGS := $(filter-out -pedantic,$(OS_CFLAGS))
+endif
+
+CSRCS := \
+  ekt.c \
+  srtp.c \
+  aes.c \
+  aes_cbc.c \
+  aes_icm.c \
+  cipher.c \
+  null_cipher.c \
+  auth.c \
+  hmac.c \
+  null_auth.c \
+  sha1.c \
+  alloc.c \
+  crypto_kernel.c \
+  err.c \
+  key.c \
+  datatypes.c \
+  gf2_8.c \
+  stat.c \
+  rdb.c \
+  rdbx.c \
+  ut_sim.c \
+  ctr_prng.c \
+  prng.c \
+  rand_source.c \
+  $(NULL)
+
+LOCAL_INCLUDES = \
+  -I$(srcdir)/include \
+  -I$(srcdir)/crypto/include \
+  $(NULL)
+
+DEFINES += \
+  -DHAVE_STDLIB_H=1 \
+  -DHAVE_STRING_H=1 \
+  $(NULL)
+
+ifeq ($(HAVE_64BIT_OS),0)
+DEFINES += \
+  -DSIZEOF_UNSIGNED_LONG=4 \
+  -DSIZEOF_UNSIGNED_LONG_LONG=8 \
+  $(NULL)
+else
+DEFINES += \
+  -DSIZEOF_UNSIGNED_LONG=8 \
+  -DSIZEOF_UNSIGNED_LONG_LONG=8 \
+  $(NULL)
+endif
+
+ifeq ($(CPU_ARCH),arm)
+DEFINES += -DCPU_RISC=1
+else ifeq ($(CPU_ARCH),x86)
+DEFINES += \
+  -DCPU_CISC=1 \
+  -DHAVE_X86 \
+  $(NULL)
+else ifeq ($(CPU_ARCH),x86_64)
+DEFINES += \
+  -DCPU_CISC=1 \
+  -DHAVE_X86 \
+  $(NULL)
+else
+# best guess
+DEFINES += -DCPU_RISC=1
+endif
+
+ifeq ($(OS_TARGET),WINNT)
+DEFINES += \
+  -DHAVE_WINSOCK2_H=1 \
+  -Dinline=__inline \
+  $(NULL)
+endif
+
+include $(topsrcdir)/config/config.mk
+include $(topsrcdir)/ipc/chromium/chromium-config.mk
+include $(topsrcdir)/config/rules.mk
+
+ifdef GNU_CC
+CFLAGS += -std=gnu99
+endif
+
+DEFINES += -DIMPL_NS_NET
new file mode 100644
--- /dev/null
+++ b/netwerk/srtp/src/include/config.h
@@ -0,0 +1,6 @@
+/*
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+/* empty file; config done via Makefile.in & configure.in */
new file mode 100644
new file mode 100755
--- /dev/null
+++ b/netwerk/srtp/update_srtp.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+# assume $1 is the directory with a SVN checkout of the libsrtp source
+#
+# srtp source is available (via cvs) at:
+# cvs -d:pserver:anonymous@srtp.cvs.sourceforge.net:/cvsroot/srtp login
+# cvs -z3 -d:pserver:anonymous@srtp.cvs.sourceforge.net:/cvsroot/srtp co -P srtp
+#
+# also assumes we've made *NO* changes to the SRTP sources!  If we do, we have to merge by
+# hand after this process, or use a more complex one.
+#
+# For example, one could update an srtp library import head, and merge back to default.  Or keep a
+# separate repo with this in it, and pull from there to m-c and merge.
+if [ "$1" ] ; then
+  export date=`date`
+#  export revision=`(cd $1; svnversion -n)`
+  export CVSREAD=0
+  cp -rf $1/srtp $1/crypto $1/include $1/VERSION $1/LICENSE $1/README $1/configure.in netwerk/srtp/src
+
+  hg addremove netwerk/srtp/src --include "netwerk/srtp/src/VERSION" --include "netwerk/srtp/src/LICENSE" --include "netwerk/srtp/src/configure.in" --include "netwerk/srtp/src/README" --include "**.c" --include "**.h" --similarity 90
+
+  echo "srtp updated from CVS on $date" >> netwerk/srtp/srtp_update.log
+  echo "srtp updated from CVS on $date"
+  echo "WARNING: reapply any local patches!"
+else
+  echo "usage: $0 path_to_srtp_directory"
+  echo "run from the root of your m-c clone"
+fi