Skip to content

Commit

Permalink
Bug 792325: Build libsrtp in mozilla's system, and update script r=te…
Browse files Browse the repository at this point in the history
…d r=bsmedberg
  • Loading branch information
jesup committed Sep 21, 2012
1 parent 055739f commit a3e1913
Show file tree
Hide file tree
Showing 7 changed files with 173 additions and 0 deletions.
6 changes: 6 additions & 0 deletions configure.in
Original file line number Diff line number Diff line change
Expand Up @@ -2981,6 +2981,8 @@ 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
Expand Down Expand Up @@ -4189,6 +4191,7 @@ MOZ_MEDIA=
MOZ_OPUS=1
MOZ_WEBM=1
MOZ_WEBRTC=1
MOZ_SRTP=
MOZ_WEBRTC_SIGNALING=
MOZ_MEDIA_PLUGINS=
MOZ_MEDIA_NAVIGATOR=
Expand Down Expand Up @@ -5191,9 +5194,12 @@ if test -n "$MOZ_WEBRTC"; then
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*)
Expand Down
6 changes: 6 additions & 0 deletions netwerk/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ PARALLEL_DIRS = \
ipc \
$(NULL)

ifdef MOZ_SRTP
PARALLEL_DIRS += \
srtp/src \
$(NULL)
endif

ifdef NECKO_WIFI
PARALLEL_DIRS += wifi
endif
Expand Down
6 changes: 6 additions & 0 deletions netwerk/build/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ SHARED_LIBRARY_LIBS = \
../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)
Expand Down
117 changes: 117 additions & 0 deletions netwerk/srtp/src/Makefile.in
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions netwerk/srtp/src/include/config.h
Original file line number Diff line number Diff line change
@@ -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 */
Empty file added netwerk/srtp/srtp_update.log
Empty file.
32 changes: 32 additions & 0 deletions netwerk/srtp/update_srtp.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit a3e1913

Please sign in to comment.