diff --git a/browser/branding/unofficial/locales/en-US/brand.dtd b/browser/branding/unofficial/locales/en-US/brand.dtd index 4190faf..301d9b4 100644 --- a/browser/branding/unofficial/locales/en-US/brand.dtd +++ b/browser/branding/unofficial/locales/en-US/brand.dtd @@ -2,7 +2,7 @@ - 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/. --> - - + + diff --git a/build/autoconf/nss.m4 b/build/autoconf/nss.m4 index 14e5857..12ca2ee 100644 --- a/build/autoconf/nss.m4 +++ b/build/autoconf/nss.m4 @@ -22,18 +22,18 @@ AC_ARG_WITH(nss-exec-prefix, if test -n "$nss_config_exec_prefix"; then nss_config_args="$nss_config_args --exec-prefix=$nss_config_exec_prefix" if test -z "$NSS_CONFIG"; then - NSS_CONFIG=$nss_config_exec_prefix/bin/nss-config + NSS_CONFIG=$nss_config_exec_prefix/bin/pkg-config fi fi if test -n "$nss_config_prefix"; then nss_config_args="$nss_config_args --prefix=$nss_config_prefix" if test -z "$NSS_CONFIG"; then - NSS_CONFIG=$nss_config_prefix/bin/nss-config + NSS_CONFIG=$nss_config_prefix/bin/pkg-config fi fi unset ac_cv_path_NSS_CONFIG - AC_PATH_PROG(NSS_CONFIG, nss-config, no) + AC_PATH_PROG(NSS_CONFIG, pkg-config, no) min_nss_version=ifelse([$1], ,3.0.0,$1) AC_MSG_CHECKING(for NSS - version >= $min_nss_version) @@ -41,14 +41,14 @@ AC_ARG_WITH(nss-exec-prefix, if test "$NSS_CONFIG" = "no"; then no_nss="yes" else - NSS_CFLAGS=`$NSS_CONFIG $nss_config_args --cflags` - NSS_LIBS=`$NSS_CONFIG $nss_config_args --libs` + NSS_CFLAGS=`$NSS_CONFIG $nss_config_args nss --cflags` + NSS_LIBS=`$NSS_CONFIG $nss_config_args nss --libs` - nss_config_major_version=`$NSS_CONFIG $nss_config_args --version | \ + nss_config_major_version=`$NSS_CONFIG $nss_config_args nss --modversion | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` - nss_config_minor_version=`$NSS_CONFIG $nss_config_args --version | \ + nss_config_minor_version=`$NSS_CONFIG $nss_config_args nss --modversion | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` - nss_config_micro_version=`$NSS_CONFIG $nss_config_args --version | \ + nss_config_micro_version=`$NSS_CONFIG $nss_config_args nss --modversion | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` min_nss_major_version=`echo $min_nss_version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` diff --git a/config/baseconfig.mk b/config/baseconfig.mk index ae69bae..a4faeee 100644 --- a/config/baseconfig.mk +++ b/config/baseconfig.mk @@ -1,9 +1,9 @@ INCLUDED_AUTOCONF_MK = 1 -includedir := $(includedir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) -idldir = $(datadir)/idl/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) -installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) -sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION) +includedir := $(includedir)/${MOZILLA_PKG_NAME} +idldir = $(datadir)/idl/${MOZILLA_PKG_NAME} +installdir = $(libdir)/${MOZILLA_PKG_NAME} +sdkdir = $(libdir)/${MOZILLA_PKG_NAME} DIST = $(DEPTH)/dist # We do magic with OBJ_SUFFIX in config.mk, the following ensures we don't diff --git a/config/stl_wrappers/ios b/config/stl_wrappers/ios new file mode 100644 index 0000000..8d9347f --- /dev/null +++ b/config/stl_wrappers/ios @@ -0,0 +1,3 @@ +#pragma GCC visibility push(default) +#include_next +#pragma GCC visibility pop diff --git a/config/stl_wrappers/ostream b/config/stl_wrappers/ostream new file mode 100644 index 0000000..805e8cb --- /dev/null +++ b/config/stl_wrappers/ostream @@ -0,0 +1,3 @@ +#pragma GCC visibility push(default) +#include_next +#pragma GCC visibility pop diff --git a/config/system-headers b/config/system-headers index 9dd2bd8..f0736e6 100644 --- a/config/system-headers +++ b/config/system-headers @@ -1126,3 +1126,5 @@ sys/thr.h sys/user.h kvm.h spawn.h +err.h +xlocale.h diff --git a/config/system_wrappers/unwind.h b/config/system_wrappers/unwind.h new file mode 100644 index 0000000..d9c39b8 --- /dev/null +++ b/config/system_wrappers/unwind.h @@ -0,0 +1,4 @@ +#pragma GCC system_header +#pragma GCC visibility push(default) +#include_next +#pragma GCC visibility pop diff --git a/configure.in b/configure.in index a9512a0..36209d5 100644 --- a/configure.in +++ b/configure.in @@ -1404,6 +1404,17 @@ if test "$GNU_CC"; then CFLAGS=$_SAVE_CFLAGS AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSSE3) + # Check for -msse4.1 on $CC + AC_MSG_CHECKING([if toolchain supports -msse4.1 option]) + HAVE_TOOLCHAIN_SUPPORT_MSSE4_1= + _SAVE_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS -msse4.1" + AC_TRY_COMPILE([asm ("pmulld %xmm6,%xmm0");],,AC_MSG_RESULT([yes]) + [HAVE_TOOLCHAIN_SUPPORT_MSSE4_1=1], + AC_MSG_RESULT([no])) + CFLAGS=$_SAVE_CFLAGS + AC_SUBST(HAVE_TOOLCHAIN_SUPPORT_MSSE4_1) + # Turn on GNU-specific warnings: # -Wall - turn on a lot of warnings # -Wpointer-arith - good to have @@ -2066,6 +2077,9 @@ ia64*-hpux*) if test -z "$MC"; then MC=mc.exe fi + if test "$LIBRUNPATH"; then + DSO_LDOPTS="-Wl,-R$LIBRUNPATH $DSO_LDOPTS" + fi ;; *-mingw*) DSO_CFLAGS= @@ -2848,6 +2862,7 @@ EOF #pragma GCC visibility push(hidden) #pragma GCC visibility push(default) #include +#include #pragma GCC visibility pop __attribute__ ((visibility ("default"))) void Func() { @@ -2856,7 +2871,7 @@ __attribute__ ((visibility ("default"))) void Func() { } EOF ac_cv_have_visibility_builtin_bug=no - if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then + if ! ${CXX-c++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then ac_cv_have_visibility_builtin_bug=yes else if test `grep -c "@PLT" conftest.S` = 0; then @@ -3018,6 +3033,9 @@ dnl ======================================================== case $target in *-hpux11.*) ;; +*-dragonfly*) + AC_CHECK_LIB(c, gethostbyname_r) + ;; *) AC_CHECK_LIB(c_r, gethostbyname_r) ;; @@ -3319,6 +3337,9 @@ AC_CACHE_CHECK( #ifdef linux #define _BSD_SOURCE 1 #endif + #ifdef __NetBSD__ + #error use of global _res variable in threaded programs is not portable + #endif #include ], [int foo = res_ninit(&_res);], @@ -3989,6 +4010,14 @@ if test -n "$YASM"; then _YASM_BUILD=` echo ${YASM_VERSION} | $AWK -F\. '{ print $4 }'` fi +if test -n "${LIBXUL_SDK_DIR}"; then + AC_MSG_WARN([pkgsrc: LIBXUL_SDK_DIR is set; assuming we want nss and nspr from xulrunner.]) + NSPR_CFLAGS="-I${prefix}/include/xulrunner/unstable `pkg-config --cflags mozilla-nspr`" + NSPR_LIBS="`pkg-config --libs mozilla-nspr`" + NSS_CFLAGS="`pkg-config --cflags mozilla-nss`" + NSS_LIBS="`pkg-config --libs mozilla-nss`" +fi + if test -z "$SKIP_LIBRARY_CHECKS"; then dnl system JPEG support dnl ======================================================== @@ -4016,11 +4045,7 @@ if test "$MOZ_NATIVE_JPEG" = 1; then #include ], [ #if JPEG_LIB_VERSION < $MOZJPEG #error "Insufficient JPEG library version ($MOZJPEG required)." - #endif - #ifndef JCS_EXTENSIONS - #error "libjpeg-turbo JCS_EXTENSIONS required" - #endif - ], + #endif ], MOZ_NATIVE_JPEG=1, AC_MSG_ERROR([Insufficient JPEG library version for --with-system-jpeg])) fi @@ -5212,7 +5237,11 @@ if test -n "$MOZ_WEBRTC"; then dnl Make sure doesn't get matched by *-linux* MOZ_WEBRTC= ;; - *-linux*|*-mingw*|*-darwin*) + *-netbsd*) + dnl Custom socketvar.h is not compatible with NetBSD. + MOZ_WEBRTC= + ;; + *-linux*|*-mingw*|*-darwin*|*-dragonfly*|*-freebsd*|*-openbsd*) dnl Leave enabled ;; *) @@ -5263,6 +5292,9 @@ if test -n "$MOZ_WEBRTC"; then MOZ_VP8_ENCODER=1 MOZ_VP8_ERROR_CONCEALMENT=1 + dnl with libv4l2 we can support more cameras + PKG_CHECK_MODULES(MOZ_LIBV4L2, libv4l2) + dnl OpenSLES is only available in Android 2.3 and later; we'll change this dnl hard dependency to a dynamic load with graceful runtime failure before dnl we make --enable-webrtc on by default in Android (bug 815905) @@ -5299,8 +5331,8 @@ AC_SUBST(MOZ_WEBRTC_IN_LIBXUL) AC_SUBST(MOZ_SCTP) AC_SUBST(MOZ_SRTP) -case "$target_cpu" in -arm*) +case "$target" in +arm-*-linux*|*-dragonfly*|*-freebsd*|*-netbsd*|*-openbsd*) MOZ_SAMPLE_TYPE_S16=1 AC_DEFINE(MOZ_SAMPLE_TYPE_S16) AC_SUBST(MOZ_SAMPLE_TYPE_S16) @@ -5704,7 +5736,7 @@ MOZ_ALSA=) if test -n "$MOZ_ALSA"; then AC_DEFINE(MOZ_CUBEB) - PKG_CHECK_MODULES(MOZ_ALSA, alsa, , + PKG_CHECK_MODULES(MOZ_ALSA, alsa, MOZ_ALSA=1, [echo "$MOZ_ALSA_PKG_ERRORS" AC_MSG_ERROR([Need alsa for Ogg, Wave or WebM decoding on Linux. Disable with --disable-ogg --disable-wave --disable-webm. (On Ubuntu, you might try installing the package libasound2-dev.)])]) fi @@ -8311,16 +8343,26 @@ MOZ_ARG_DISABLE_BOOL(necko-wifi, NECKO_WIFI=, NECKO_WIFI=1) -if test "$OS_ARCH" = "OS2"; then - dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566 - NECKO_WIFI= -fi -if test "$NECKO_WIFI" -a \ - "$OS_ARCH" != "Linux" -a \ - "$OS_ARCH" != "Darwin" -a \ - "$OS_ARCH" != "SunOS" -a \ - "$OS_ARCH" != "WINNT"; then - AC_MSG_ERROR([Necko WiFi scanning not supported on your platform, use --disable-necko-wifi]) +if test "$NECKO_WIFI"; then + case "$OS_TARGET" in + Android) + ;; + Darwin) + ;; + SunOS) + ;; + WINNT) + ;; + OS2) + dnl OS/2 implementation of Necko-WiFi support will be added in bug 506566 + NECKO_WIFI= + ;; + *) + if test -z "$MOZ_ENABLE_DBUS"; then + AC_MSG_ERROR([Necko WiFi scanning needs DBus on your platform, remove --disable-dbus or use --disable-necko-wifi]) + fi + ;; + esac fi if test "$NECKO_WIFI"; then @@ -8981,6 +9023,27 @@ elif test "${OS_TARGET}" = "Android"; then fi fi +# Keep libcubeb and audio_device backends in sync +if test -n "$MOZ_ALSA"; then + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=1" +else + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_alsa_audio=0" +fi +if test -n "$MOZ_PULSEAUDIO"; then + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=1" +else + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D include_pulse_audio=0" +fi + +# Don't try to compile sse4.1 code if toolchain doesn't support +if test -z "$HAVE_TOOLCHAIN_SUPPORT_MSSE4_1"; then + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D yuv_disable_asm=1" +fi + +if test -n "$MOZ_LIBV4L2_LIBS"; then + EXTRA_GYP_DEFINES="$EXTRA_GYP_DEFINES -D use_libv4l2=1" +fi + if test -n "$MOZ_WEBRTC"; then AC_MSG_RESULT("generating WebRTC Makefiles...") diff --git a/content/media/AudioStream.cpp b/content/media/AudioStream.cpp index 3b6dc60..a83630a 100644 --- a/content/media/AudioStream.cpp +++ b/content/media/AudioStream.cpp @@ -314,7 +314,7 @@ nsresult NativeAudioStream::Init(int32_t aNumChannels, int32_t aRate, mChannels = aNumChannels; if (sa_stream_create_pcm(reinterpret_cast(&mAudioHandle), - NULL, + "Mozilla", SA_MODE_WRONLY, SA_PCM_FORMAT_S16_NE, aRate, diff --git a/extensions/auth/nsAuthGSSAPI.cpp b/extensions/auth/nsAuthGSSAPI.cpp index 5873829..c8efa11 100644 --- a/extensions/auth/nsAuthGSSAPI.cpp +++ b/extensions/auth/nsAuthGSSAPI.cpp @@ -39,6 +39,9 @@ typedef KLStatus (*KLCacheHasValidTickets_type)( #endif #if defined(HAVE_RES_NINIT) +#include +#include +#include #include #endif diff --git a/extensions/spellcheck/hunspell/src/mozHunspell.cpp b/extensions/spellcheck/hunspell/src/mozHunspell.cpp index 90d44c6..be81581 100644 --- a/extensions/spellcheck/hunspell/src/mozHunspell.cpp +++ b/extensions/spellcheck/hunspell/src/mozHunspell.cpp @@ -400,6 +400,12 @@ mozHunspell::LoadDictionaryList() } } + // load system hunspell dictionaries + nsIFile* hunDir; + NS_NewNativeLocalFile(NS_LITERAL_CSTRING("%%LOCALBASE%%/share/hunspell"), + true, &hunDir); + LoadDictionariesFromDir(hunDir); + // find dictionaries from extensions requiring restart nsCOMPtr dictDirs; rv = dirSvc->Get(DICTIONARY_SEARCH_DIRECTORY_LIST, diff --git a/gfx/angle/src/compiler/osinclude.h b/gfx/angle/src/compiler/osinclude.h index 6912de2..f23e266 100644 --- a/gfx/angle/src/compiler/osinclude.h +++ b/gfx/angle/src/compiler/osinclude.h @@ -16,6 +16,7 @@ #define ANGLE_OS_WIN #elif defined(__APPLE__) || defined(__linux__) || \ defined(__FreeBSD__) || defined(__OpenBSD__) || \ + defined(__NetBSD__) || defined(__DragonFly__) || \ defined(__sun) || defined(ANDROID) || \ defined(__GLIBC__) || defined(__GNU__) || \ defined(__QNX__) diff --git a/gfx/skia/Makefile.in b/gfx/skia/Makefile.in index 4e282a9..6fe4691 100644 --- a/gfx/skia/Makefile.in +++ b/gfx/skia/Makefile.in @@ -356,10 +356,9 @@ CPPSRCS += \ SkMMapStream.cpp \ SkOSFile.cpp \ $(NULL) -ifeq (Linux,$(OS_TARGET)) +ifneq (,$(or $(MOZ_X11),$(filter Linux,$(OS_TARGET)))) CPPSRCS += \ SkFontHost_linux.cpp \ - SkFontHost_tables.cpp \ SkTime_Unix.cpp \ $(NULL) endif diff --git a/gfx/skia/src/sfnt/SkOTTable_head.h b/gfx/skia/src/sfnt/SkOTTable_head.h index 3d2c0f1..c934d39 100644 --- a/gfx/skia/src/sfnt/SkOTTable_head.h +++ b/gfx/skia/src/sfnt/SkOTTable_head.h @@ -12,7 +12,7 @@ #include "SkOTTableTypes.h" #include "SkTypedEnum.h" -#pragma pack(push, 1) +#pragma pack(1) struct SkOTTableHead { static const SK_OT_CHAR TAG0 = 'h'; @@ -140,7 +140,7 @@ struct SkOTTableHead { } glyphDataFormat; }; -#pragma pack(pop) +#pragma pack() #include diff --git a/gfx/skia/src/sfnt/SkOTTable_name.h b/gfx/skia/src/sfnt/SkOTTable_name.h index 3ee72f2..d779c39 100644 --- a/gfx/skia/src/sfnt/SkOTTable_name.h +++ b/gfx/skia/src/sfnt/SkOTTable_name.h @@ -12,7 +12,7 @@ #include "SkOTTableTypes.h" #include "SkTypedEnum.h" -#pragma pack(push, 1) +#pragma pack(1) struct SkOTTableName { static const SK_OT_CHAR TAG0 = 'n'; @@ -499,7 +499,7 @@ struct SkOTTableNameRecord { SK_OT_USHORT offset; //From start of storage area. }; -#pragma pack(pop) +#pragma pack() SK_COMPILE_ASSERT(sizeof(SkOTTableName) == 6, sizeof_SkOTTableName_not_6); diff --git a/gfx/skia/src/sfnt/SkSFNTHeader.h b/gfx/skia/src/sfnt/SkSFNTHeader.h index c220656..8b73d42 100644 --- a/gfx/skia/src/sfnt/SkSFNTHeader.h +++ b/gfx/skia/src/sfnt/SkSFNTHeader.h @@ -15,7 +15,7 @@ typedef uint16_t SK_SFNT_USHORT; typedef uint32_t SK_SFNT_ULONG; -#pragma pack(push, 1) +#pragma pack(1) struct SkSFNTHeader { SK_SFNT_ULONG fontType; @@ -61,7 +61,7 @@ struct SkSFNTTableDirectoryEntry { SK_SFNT_ULONG logicalLength; }; -#pragma pack(pop) +#pragma pack() SK_COMPILE_ASSERT(sizeof(SkSFNTHeader) == 12, sizeof_SkSFNTHeader_not_12); diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index 813f976..52e1d81 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -533,11 +533,9 @@ void SourceBufferDestroy(void *srcSurfUD) delete static_cast(srcSurfUD); } -void SourceSnapshotDetached(cairo_surface_t *nullSurf) +void SourceSnapshotDetached(void *nullSurf) { - gfxImageSurface* origSurf = - static_cast(cairo_surface_get_user_data(nullSurf, &kSourceSurface)); - + gfxImageSurface *origSurf = static_cast(nullSurf); origSurf->SetData(&kSourceSurface, NULL, NULL); } @@ -652,14 +650,9 @@ gfxPlatform::GetSourceSurfaceForSurface(DrawTarget *aTarget, gfxASurface *aSurfa } - cairo_surface_t *nullSurf = - cairo_null_surface_create(CAIRO_CONTENT_COLOR_ALPHA); - cairo_surface_set_user_data(nullSurf, - &kSourceSurface, - imgSurface, - NULL); - cairo_surface_attach_snapshot(imgSurface->CairoSurface(), nullSurf, SourceSnapshotDetached); - cairo_surface_destroy(nullSurf); + cairo_surface_set_mime_data(imgSurface->CairoSurface(), "mozilla/magic", + (const unsigned char *) "data", 4, + SourceSnapshotDetached, imgSurface.get()); } SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData; diff --git a/image/decoders/nsJPEGDecoder.cpp b/image/decoders/nsJPEGDecoder.cpp index 6a579f6..d28b581 100644 --- a/image/decoders/nsJPEGDecoder.cpp +++ b/image/decoders/nsJPEGDecoder.cpp @@ -19,13 +19,28 @@ extern "C" { #include "iccjpeg.h" -} +#ifdef JCS_EXTENSIONS #if defined(IS_BIG_ENDIAN) #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_XRGB #else #define MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB JCS_EXT_BGRX #endif +#else +/* Colorspace conversion (copied from jpegint.h) */ +struct jpeg_color_deconverter { + JMETHOD(void, start_pass, (j_decompress_ptr cinfo)); + JMETHOD(void, color_convert, (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows)); +}; + +METHODDEF(void) +ycc_rgb_convert_argb (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows); +#endif +} static void cmyk_convert_rgb(JSAMPROW row, JDIMENSION width); @@ -338,6 +353,7 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount) case JCS_GRAYSCALE: case JCS_RGB: case JCS_YCbCr: +#ifdef JCS_EXTENSIONS // if we're not color managing we can decode directly to // MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB if (mCMSMode != eCMSMode_All) { @@ -346,6 +362,9 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount) } else { mInfo.out_color_space = JCS_RGB; } +#else + mInfo.out_color_space = JCS_RGB; +#endif break; case JCS_CMYK: case JCS_YCCK: @@ -413,6 +432,15 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, uint32_t aCount) return; /* I/O suspension */ } +#ifndef JCS_EXTENSIONS + /* Force to use our YCbCr to Packed RGB converter when possible */ + if (!mTransform && (mCMSMode != eCMSMode_All) && + mInfo.jpeg_color_space == JCS_YCbCr && mInfo.out_color_space == JCS_RGB) { + /* Special case for the most common case: transform from YCbCr direct into packed ARGB */ + mInfo.out_color_components = 4; /* Packed ARGB pixels are always 4 bytes...*/ + mInfo.cconvert->color_convert = ycc_rgb_convert_argb; + } +#endif /* If this is a progressive JPEG ... */ mState = mInfo.buffered_image ? JPEG_DECOMPRESS_PROGRESSIVE : JPEG_DECOMPRESS_SEQUENTIAL; @@ -558,7 +586,11 @@ nsJPEGDecoder::OutputScanlines(bool* suspend) uint32_t *imageRow = ((uint32_t*)mImageData) + (mInfo.output_scanline * mInfo.output_width); +#ifdef JCS_EXTENSIONS if (mInfo.out_color_space == MOZ_JCS_EXT_NATIVE_ENDIAN_XRGB) { +#else + if (mInfo.cconvert->color_convert == ycc_rgb_convert_argb) { +#endif /* Special case: scanline will be directly converted into packed ARGB */ if (jpeg_read_scanlines(&mInfo, (JSAMPARRAY)&imageRow, 1) != 1) { *suspend = true; /* suspend */ @@ -868,6 +900,282 @@ term_source (j_decompress_ptr jd) } // namespace mozilla +#ifndef JCS_EXTENSIONS +/**************** YCbCr -> Cairo's RGB24/ARGB32 conversion: most common case **************/ + +/* + * YCbCr is defined per CCIR 601-1, except that Cb and Cr are + * normalized to the range 0..MAXJSAMPLE rather than -0.5 .. 0.5. + * The conversion equations to be implemented are therefore + * R = Y + 1.40200 * Cr + * G = Y - 0.34414 * Cb - 0.71414 * Cr + * B = Y + 1.77200 * Cb + * where Cb and Cr represent the incoming values less CENTERJSAMPLE. + * (These numbers are derived from TIFF 6.0 section 21, dated 3-June-92.) + * + * To avoid floating-point arithmetic, we represent the fractional constants + * as integers scaled up by 2^16 (about 4 digits precision); we have to divide + * the products by 2^16, with appropriate rounding, to get the correct answer. + * Notice that Y, being an integral input, does not contribute any fraction + * so it need not participate in the rounding. + * + * For even more speed, we avoid doing any multiplications in the inner loop + * by precalculating the constants times Cb and Cr for all possible values. + * For 8-bit JSAMPLEs this is very reasonable (only 256 entries per table); + * for 12-bit samples it is still acceptable. It's not very reasonable for + * 16-bit samples, but if you want lossless storage you shouldn't be changing + * colorspace anyway. + * The Cr=>R and Cb=>B values can be rounded to integers in advance; the + * values for the G calculation are left scaled up, since we must add them + * together before rounding. + */ + +#define SCALEBITS 16 /* speediest right-shift on some machines */ + +/* Use static tables for color processing. */ +/* Four tables, each 256 entries of 4 bytes totals 4K which is not bad... */ + +const int Cr_r_tab[(MAXJSAMPLE+1) * sizeof(int)] ={ + -0xb3, -0xb2, -0xb1, -0xaf, -0xae, -0xac, + -0xab, -0xaa, -0xa8, -0xa7, -0xa5, -0xa4, + -0xa3, -0xa1, -0xa0, -0x9e, -0x9d, -0x9c, + -0x9a, -0x99, -0x97, -0x96, -0x95, -0x93, + -0x92, -0x90, -0x8f, -0x8e, -0x8c, -0x8b, + -0x89, -0x88, -0x87, -0x85, -0x84, -0x82, + -0x81, -0x80, -0x7e, -0x7d, -0x7b, -0x7a, + -0x79, -0x77, -0x76, -0x74, -0x73, -0x72, + -0x70, -0x6f, -0x6d, -0x6c, -0x6b, -0x69, + -0x68, -0x66, -0x65, -0x64, -0x62, -0x61, + -0x5f, -0x5e, -0x5d, -0x5b, -0x5a, -0x58, + -0x57, -0x56, -0x54, -0x53, -0x51, -0x50, + -0x4f, -0x4d, -0x4c, -0x4a, -0x49, -0x48, + -0x46, -0x45, -0x43, -0x42, -0x40, -0x3f, + -0x3e, -0x3c, -0x3b, -0x39, -0x38, -0x37, + -0x35, -0x34, -0x32, -0x31, -0x30, -0x2e, + -0x2d, -0x2b, -0x2a, -0x29, -0x27, -0x26, + -0x24, -0x23, -0x22, -0x20, -0x1f, -0x1d, + -0x1c, -0x1b, -0x19, -0x18, -0x16, -0x15, + -0x14, -0x12, -0x11, -0x0f, -0x0e, -0x0d, + -0x0b, -0x0a, -0x08, -0x07, -0x06, -0x04, + -0x03, -0x01, 0x00, 0x01, 0x03, 0x04, + 0x06, 0x07, 0x08, 0x0a, 0x0b, 0x0d, + 0x0e, 0x0f, 0x11, 0x12, 0x14, 0x15, + 0x16, 0x18, 0x19, 0x1b, 0x1c, 0x1d, + 0x1f, 0x20, 0x22, 0x23, 0x24, 0x26, + 0x27, 0x29, 0x2a, 0x2b, 0x2d, 0x2e, + 0x30, 0x31, 0x32, 0x34, 0x35, 0x37, + 0x38, 0x39, 0x3b, 0x3c, 0x3e, 0x3f, + 0x40, 0x42, 0x43, 0x45, 0x46, 0x48, + 0x49, 0x4a, 0x4c, 0x4d, 0x4f, 0x50, + 0x51, 0x53, 0x54, 0x56, 0x57, 0x58, + 0x5a, 0x5b, 0x5d, 0x5e, 0x5f, 0x61, + 0x62, 0x64, 0x65, 0x66, 0x68, 0x69, + 0x6b, 0x6c, 0x6d, 0x6f, 0x70, 0x72, + 0x73, 0x74, 0x76, 0x77, 0x79, 0x7a, + 0x7b, 0x7d, 0x7e, 0x80, 0x81, 0x82, + 0x84, 0x85, 0x87, 0x88, 0x89, 0x8b, + 0x8c, 0x8e, 0x8f, 0x90, 0x92, 0x93, + 0x95, 0x96, 0x97, 0x99, 0x9a, 0x9c, + 0x9d, 0x9e, 0xa0, 0xa1, 0xa3, 0xa4, + 0xa5, 0xa7, 0xa8, 0xaa, 0xab, 0xac, + 0xae, 0xaf, 0xb1, 0xb2, + }; + +const int Cb_b_tab[(MAXJSAMPLE+1) * sizeof(int)] ={ + -0xe3, -0xe1, -0xdf, -0xde, -0xdc, -0xda, + -0xd8, -0xd6, -0xd5, -0xd3, -0xd1, -0xcf, + -0xce, -0xcc, -0xca, -0xc8, -0xc6, -0xc5, + -0xc3, -0xc1, -0xbf, -0xbe, -0xbc, -0xba, + -0xb8, -0xb7, -0xb5, -0xb3, -0xb1, -0xaf, + -0xae, -0xac, -0xaa, -0xa8, -0xa7, -0xa5, + -0xa3, -0xa1, -0x9f, -0x9e, -0x9c, -0x9a, + -0x98, -0x97, -0x95, -0x93, -0x91, -0x90, + -0x8e, -0x8c, -0x8a, -0x88, -0x87, -0x85, + -0x83, -0x81, -0x80, -0x7e, -0x7c, -0x7a, + -0x78, -0x77, -0x75, -0x73, -0x71, -0x70, + -0x6e, -0x6c, -0x6a, -0x69, -0x67, -0x65, + -0x63, -0x61, -0x60, -0x5e, -0x5c, -0x5a, + -0x59, -0x57, -0x55, -0x53, -0x52, -0x50, + -0x4e, -0x4c, -0x4a, -0x49, -0x47, -0x45, + -0x43, -0x42, -0x40, -0x3e, -0x3c, -0x3a, + -0x39, -0x37, -0x35, -0x33, -0x32, -0x30, + -0x2e, -0x2c, -0x2b, -0x29, -0x27, -0x25, + -0x23, -0x22, -0x20, -0x1e, -0x1c, -0x1b, + -0x19, -0x17, -0x15, -0x13, -0x12, -0x10, + -0x0e, -0x0c, -0x0b, -0x09, -0x07, -0x05, + -0x04, -0x02, 0x00, 0x02, 0x04, 0x05, + 0x07, 0x09, 0x0b, 0x0c, 0x0e, 0x10, + 0x12, 0x13, 0x15, 0x17, 0x19, 0x1b, + 0x1c, 0x1e, 0x20, 0x22, 0x23, 0x25, + 0x27, 0x29, 0x2b, 0x2c, 0x2e, 0x30, + 0x32, 0x33, 0x35, 0x37, 0x39, 0x3a, + 0x3c, 0x3e, 0x40, 0x42, 0x43, 0x45, + 0x47, 0x49, 0x4a, 0x4c, 0x4e, 0x50, + 0x52, 0x53, 0x55, 0x57, 0x59, 0x5a, + 0x5c, 0x5e, 0x60, 0x61, 0x63, 0x65, + 0x67, 0x69, 0x6a, 0x6c, 0x6e, 0x70, + 0x71, 0x73, 0x75, 0x77, 0x78, 0x7a, + 0x7c, 0x7e, 0x80, 0x81, 0x83, 0x85, + 0x87, 0x88, 0x8a, 0x8c, 0x8e, 0x90, + 0x91, 0x93, 0x95, 0x97, 0x98, 0x9a, + 0x9c, 0x9e, 0x9f, 0xa1, 0xa3, 0xa5, + 0xa7, 0xa8, 0xaa, 0xac, 0xae, 0xaf, + 0xb1, 0xb3, 0xb5, 0xb7, 0xb8, 0xba, + 0xbc, 0xbe, 0xbf, 0xc1, 0xc3, 0xc5, + 0xc6, 0xc8, 0xca, 0xcc, 0xce, 0xcf, + 0xd1, 0xd3, 0xd5, 0xd6, 0xd8, 0xda, + 0xdc, 0xde, 0xdf, 0xe1, + }; + +const int Cr_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={ + 0x5b6900, 0x5ab22e, 0x59fb5c, 0x59448a, 0x588db8, 0x57d6e6, + 0x572014, 0x566942, 0x55b270, 0x54fb9e, 0x5444cc, 0x538dfa, + 0x52d728, 0x522056, 0x516984, 0x50b2b2, 0x4ffbe0, 0x4f450e, + 0x4e8e3c, 0x4dd76a, 0x4d2098, 0x4c69c6, 0x4bb2f4, 0x4afc22, + 0x4a4550, 0x498e7e, 0x48d7ac, 0x4820da, 0x476a08, 0x46b336, + 0x45fc64, 0x454592, 0x448ec0, 0x43d7ee, 0x43211c, 0x426a4a, + 0x41b378, 0x40fca6, 0x4045d4, 0x3f8f02, 0x3ed830, 0x3e215e, + 0x3d6a8c, 0x3cb3ba, 0x3bfce8, 0x3b4616, 0x3a8f44, 0x39d872, + 0x3921a0, 0x386ace, 0x37b3fc, 0x36fd2a, 0x364658, 0x358f86, + 0x34d8b4, 0x3421e2, 0x336b10, 0x32b43e, 0x31fd6c, 0x31469a, + 0x308fc8, 0x2fd8f6, 0x2f2224, 0x2e6b52, 0x2db480, 0x2cfdae, + 0x2c46dc, 0x2b900a, 0x2ad938, 0x2a2266, 0x296b94, 0x28b4c2, + 0x27fdf0, 0x27471e, 0x26904c, 0x25d97a, 0x2522a8, 0x246bd6, + 0x23b504, 0x22fe32, 0x224760, 0x21908e, 0x20d9bc, 0x2022ea, + 0x1f6c18, 0x1eb546, 0x1dfe74, 0x1d47a2, 0x1c90d0, 0x1bd9fe, + 0x1b232c, 0x1a6c5a, 0x19b588, 0x18feb6, 0x1847e4, 0x179112, + 0x16da40, 0x16236e, 0x156c9c, 0x14b5ca, 0x13fef8, 0x134826, + 0x129154, 0x11da82, 0x1123b0, 0x106cde, 0x0fb60c, 0x0eff3a, + 0x0e4868, 0x0d9196, 0x0cdac4, 0x0c23f2, 0x0b6d20, 0x0ab64e, + 0x09ff7c, 0x0948aa, 0x0891d8, 0x07db06, 0x072434, 0x066d62, + 0x05b690, 0x04ffbe, 0x0448ec, 0x03921a, 0x02db48, 0x022476, + 0x016da4, 0x00b6d2, 0x000000, -0x00b6d2, -0x016da4, -0x022476, + -0x02db48, -0x03921a, -0x0448ec, -0x04ffbe, -0x05b690, -0x066d62, + -0x072434, -0x07db06, -0x0891d8, -0x0948aa, -0x09ff7c, -0x0ab64e, + -0x0b6d20, -0x0c23f2, -0x0cdac4, -0x0d9196, -0x0e4868, -0x0eff3a, + -0x0fb60c, -0x106cde, -0x1123b0, -0x11da82, -0x129154, -0x134826, + -0x13fef8, -0x14b5ca, -0x156c9c, -0x16236e, -0x16da40, -0x179112, + -0x1847e4, -0x18feb6, -0x19b588, -0x1a6c5a, -0x1b232c, -0x1bd9fe, + -0x1c90d0, -0x1d47a2, -0x1dfe74, -0x1eb546, -0x1f6c18, -0x2022ea, + -0x20d9bc, -0x21908e, -0x224760, -0x22fe32, -0x23b504, -0x246bd6, + -0x2522a8, -0x25d97a, -0x26904c, -0x27471e, -0x27fdf0, -0x28b4c2, + -0x296b94, -0x2a2266, -0x2ad938, -0x2b900a, -0x2c46dc, -0x2cfdae, + -0x2db480, -0x2e6b52, -0x2f2224, -0x2fd8f6, -0x308fc8, -0x31469a, + -0x31fd6c, -0x32b43e, -0x336b10, -0x3421e2, -0x34d8b4, -0x358f86, + -0x364658, -0x36fd2a, -0x37b3fc, -0x386ace, -0x3921a0, -0x39d872, + -0x3a8f44, -0x3b4616, -0x3bfce8, -0x3cb3ba, -0x3d6a8c, -0x3e215e, + -0x3ed830, -0x3f8f02, -0x4045d4, -0x40fca6, -0x41b378, -0x426a4a, + -0x43211c, -0x43d7ee, -0x448ec0, -0x454592, -0x45fc64, -0x46b336, + -0x476a08, -0x4820da, -0x48d7ac, -0x498e7e, -0x4a4550, -0x4afc22, + -0x4bb2f4, -0x4c69c6, -0x4d2098, -0x4dd76a, -0x4e8e3c, -0x4f450e, + -0x4ffbe0, -0x50b2b2, -0x516984, -0x522056, -0x52d728, -0x538dfa, + -0x5444cc, -0x54fb9e, -0x55b270, -0x566942, -0x572014, -0x57d6e6, + -0x588db8, -0x59448a, -0x59fb5c, -0x5ab22e, + }; + +const int Cb_g_tab[(MAXJSAMPLE+1) * sizeof(int)] ={ + 0x2c8d00, 0x2c34e6, 0x2bdccc, 0x2b84b2, 0x2b2c98, 0x2ad47e, + 0x2a7c64, 0x2a244a, 0x29cc30, 0x297416, 0x291bfc, 0x28c3e2, + 0x286bc8, 0x2813ae, 0x27bb94, 0x27637a, 0x270b60, 0x26b346, + 0x265b2c, 0x260312, 0x25aaf8, 0x2552de, 0x24fac4, 0x24a2aa, + 0x244a90, 0x23f276, 0x239a5c, 0x234242, 0x22ea28, 0x22920e, + 0x2239f4, 0x21e1da, 0x2189c0, 0x2131a6, 0x20d98c, 0x208172, + 0x202958, 0x1fd13e, 0x1f7924, 0x1f210a, 0x1ec8f0, 0x1e70d6, + 0x1e18bc, 0x1dc0a2, 0x1d6888, 0x1d106e, 0x1cb854, 0x1c603a, + 0x1c0820, 0x1bb006, 0x1b57ec, 0x1affd2, 0x1aa7b8, 0x1a4f9e, + 0x19f784, 0x199f6a, 0x194750, 0x18ef36, 0x18971c, 0x183f02, + 0x17e6e8, 0x178ece, 0x1736b4, 0x16de9a, 0x168680, 0x162e66, + 0x15d64c, 0x157e32, 0x152618, 0x14cdfe, 0x1475e4, 0x141dca, + 0x13c5b0, 0x136d96, 0x13157c, 0x12bd62, 0x126548, 0x120d2e, + 0x11b514, 0x115cfa, 0x1104e0, 0x10acc6, 0x1054ac, 0x0ffc92, + 0x0fa478, 0x0f4c5e, 0x0ef444, 0x0e9c2a, 0x0e4410, 0x0debf6, + 0x0d93dc, 0x0d3bc2, 0x0ce3a8, 0x0c8b8e, 0x0c3374, 0x0bdb5a, + 0x0b8340, 0x0b2b26, 0x0ad30c, 0x0a7af2, 0x0a22d8, 0x09cabe, + 0x0972a4, 0x091a8a, 0x08c270, 0x086a56, 0x08123c, 0x07ba22, + 0x076208, 0x0709ee, 0x06b1d4, 0x0659ba, 0x0601a0, 0x05a986, + 0x05516c, 0x04f952, 0x04a138, 0x04491e, 0x03f104, 0x0398ea, + 0x0340d0, 0x02e8b6, 0x02909c, 0x023882, 0x01e068, 0x01884e, + 0x013034, 0x00d81a, 0x008000, 0x0027e6, -0x003034, -0x00884e, + -0x00e068, -0x013882, -0x01909c, -0x01e8b6, -0x0240d0, -0x0298ea, + -0x02f104, -0x03491e, -0x03a138, -0x03f952, -0x04516c, -0x04a986, + -0x0501a0, -0x0559ba, -0x05b1d4, -0x0609ee, -0x066208, -0x06ba22, + -0x07123c, -0x076a56, -0x07c270, -0x081a8a, -0x0872a4, -0x08cabe, + -0x0922d8, -0x097af2, -0x09d30c, -0x0a2b26, -0x0a8340, -0x0adb5a, + -0x0b3374, -0x0b8b8e, -0x0be3a8, -0x0c3bc2, -0x0c93dc, -0x0cebf6, + -0x0d4410, -0x0d9c2a, -0x0df444, -0x0e4c5e, -0x0ea478, -0x0efc92, + -0x0f54ac, -0x0facc6, -0x1004e0, -0x105cfa, -0x10b514, -0x110d2e, + -0x116548, -0x11bd62, -0x12157c, -0x126d96, -0x12c5b0, -0x131dca, + -0x1375e4, -0x13cdfe, -0x142618, -0x147e32, -0x14d64c, -0x152e66, + -0x158680, -0x15de9a, -0x1636b4, -0x168ece, -0x16e6e8, -0x173f02, + -0x17971c, -0x17ef36, -0x184750, -0x189f6a, -0x18f784, -0x194f9e, + -0x19a7b8, -0x19ffd2, -0x1a57ec, -0x1ab006, -0x1b0820, -0x1b603a, + -0x1bb854, -0x1c106e, -0x1c6888, -0x1cc0a2, -0x1d18bc, -0x1d70d6, + -0x1dc8f0, -0x1e210a, -0x1e7924, -0x1ed13e, -0x1f2958, -0x1f8172, + -0x1fd98c, -0x2031a6, -0x2089c0, -0x20e1da, -0x2139f4, -0x21920e, + -0x21ea28, -0x224242, -0x229a5c, -0x22f276, -0x234a90, -0x23a2aa, + -0x23fac4, -0x2452de, -0x24aaf8, -0x250312, -0x255b2c, -0x25b346, + -0x260b60, -0x26637a, -0x26bb94, -0x2713ae, -0x276bc8, -0x27c3e2, + -0x281bfc, -0x287416, -0x28cc30, -0x29244a, -0x297c64, -0x29d47e, + -0x2a2c98, -0x2a84b2, -0x2adccc, -0x2b34e6, + }; + + +/* We assume that right shift corresponds to signed division by 2 with + * rounding towards minus infinity. This is correct for typical "arithmetic + * shift" instructions that shift in copies of the sign bit. But some + * C compilers implement >> with an unsigned shift. For these machines you + * must define RIGHT_SHIFT_IS_UNSIGNED. + * RIGHT_SHIFT provides a proper signed right shift of an INT32 quantity. + * It is only applied with constant shift counts. SHIFT_TEMPS must be + * included in the variables of any routine using RIGHT_SHIFT. + */ + +#ifdef RIGHT_SHIFT_IS_UNSIGNED +#define SHIFT_TEMPS INT32 shift_temp; +#define RIGHT_SHIFT(x,shft) \ + ((shift_temp = (x)) < 0 ? \ + (shift_temp >> (shft)) | ((~((INT32) 0)) << (32-(shft))) : \ + (shift_temp >> (shft))) +#else +#define SHIFT_TEMPS +#define RIGHT_SHIFT(x,shft) ((x) >> (shft)) +#endif + + +METHODDEF(void) +ycc_rgb_convert_argb (j_decompress_ptr cinfo, + JSAMPIMAGE input_buf, JDIMENSION input_row, + JSAMPARRAY output_buf, int num_rows) +{ + JDIMENSION num_cols = cinfo->output_width; + JSAMPLE * range_limit = cinfo->sample_range_limit; + + SHIFT_TEMPS + + /* This is used if we don't have SSE2 */ + + while (--num_rows >= 0) { + JSAMPROW inptr0 = input_buf[0][input_row]; + JSAMPROW inptr1 = input_buf[1][input_row]; + JSAMPROW inptr2 = input_buf[2][input_row]; + input_row++; + uint32_t *outptr = (uint32_t *) *output_buf++; + for (JDIMENSION col = 0; col < num_cols; col++) { + int y = GETJSAMPLE(inptr0[col]); + int cb = GETJSAMPLE(inptr1[col]); + int cr = GETJSAMPLE(inptr2[col]); + JSAMPLE * range_limit_y = range_limit + y; + /* Range-limiting is essential due to noise introduced by DCT losses. */ + outptr[col] = 0xFF000000 | + ( range_limit_y[Cr_r_tab[cr]] << 16 ) | + ( range_limit_y[((int) RIGHT_SHIFT(Cb_g_tab[cb] + Cr_g_tab[cr], SCALEBITS))] << 8 ) | + ( range_limit_y[Cb_b_tab[cb]] ); + } + } +} +#endif + + /**************** Inverted CMYK -> RGB conversion **************/ /* * Input is (Inverted) CMYK stored as 4 bytes per pixel. diff --git a/ipc/chromium/src/base/message_pump_libevent.cc b/ipc/chromium/src/base/message_pump_libevent.cc index b4670ed..92a226a 100644 --- a/ipc/chromium/src/base/message_pump_libevent.cc +++ b/ipc/chromium/src/base/message_pump_libevent.cc @@ -16,7 +16,7 @@ #include "base/scoped_ptr.h" #include "base/time.h" #include "nsDependentSubstring.h" -#include "third_party/libevent/event.h" +#include "event.h" // Lifecycle of struct event // Libevent uses two main data structures: diff --git a/ipc/chromium/src/base/platform_thread_posix.cc b/ipc/chromium/src/base/platform_thread_posix.cc index 9ce86f8..95a0ff8 100644 --- a/ipc/chromium/src/base/platform_thread_posix.cc +++ b/ipc/chromium/src/base/platform_thread_posix.cc @@ -10,7 +10,9 @@ #if defined(OS_MACOSX) #include #elif defined(OS_NETBSD) +_Pragma("GCC visibility push(default)") #include +_Pragma("GCC visibility pop") #elif defined(OS_LINUX) #include #include diff --git a/ipc/glue/GeckoChildProcessHost.cpp b/ipc/glue/GeckoChildProcessHost.cpp index bd16225..f410628 100644 --- a/ipc/glue/GeckoChildProcessHost.cpp +++ b/ipc/glue/GeckoChildProcessHost.cpp @@ -4,7 +4,13 @@ * 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/. */ +#if defined(__NetBSD__) +_Pragma("GCC visibility push(default)") +#endif #include "GeckoChildProcessHost.h" +#if defined(__NetBSD__) +_Pragma("GCC visibility pop") +#endif #include "base/command_line.h" #include "base/path_service.h" diff --git a/ipc/ipdl/ipdl/lower.py b/ipc/ipdl/ipdl/lower.py index a38c28a..b2d4498 100644 --- a/ipc/ipdl/ipdl/lower.py +++ b/ipc/ipdl/ipdl/lower.py @@ -1799,7 +1799,7 @@ def _generateMessageClass(clsname, msgid, typedefs, prettyName, compress): StmtExpr(ExprCall( ExprVar('StringAppendF'), args=[ ExprAddrOf(msgvar), - ExprLiteral.String('[time:%" PRId64 "][%d]'), + ExprLiteral.String('[time:%\\" PRId64 \\"][%d]'), ExprCall(ExprVar('PR_Now')), ExprCall(ExprVar('base::GetCurrentProcId')) ])), appendToMsg(pfxvar), diff --git a/js/src/Makefile.in b/js/src/Makefile.in index 962a5b2..d9820eb 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -791,6 +791,13 @@ EXTRA_LIBS += -lposix4 -ldl -lnsl -lsocket endif endif +# clang 3.3 + -O2 makes jaeger crash in FixupArity +ifdef CLANG_CXX +ifndef MOZ_DEBUG +Compiler.$(OBJ_SUFFIX): CXXFLAGS += -fno-inline-functions +endif +endif + # An AIX Optimization bug causes PR_dtoa() & JS_dtoa to produce wrong result. # This suppresses optimization for this single compilation unit. ifeq ($(OS_ARCH),AIX) diff --git a/js/src/config/system-headers b/js/src/config/system-headers index 9dd2bd8..f0736e6 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -1126,3 +1126,5 @@ sys/thr.h sys/user.h kvm.h spawn.h +err.h +xlocale.h diff --git a/js/src/configure.in b/js/src/configure.in index 2cb27e9..3344c11 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -2399,6 +2399,7 @@ EOF #pragma GCC visibility push(hidden) #pragma GCC visibility push(default) #include +#include #pragma GCC visibility pop __attribute__ ((visibility ("default"))) void Func() { @@ -2407,7 +2408,7 @@ __attribute__ ((visibility ("default"))) void Func() { } EOF ac_cv_have_visibility_builtin_bug=no - if ! ${CC-cc} ${CFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then + if ! ${CXX-c++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -O2 -S -o conftest.S conftest.c > /dev/null 2>&1 ; then ac_cv_have_visibility_builtin_bug=yes else if test `grep -c "@PLT" conftest.S` = 0; then @@ -2628,7 +2629,7 @@ then fi case "$target" in - *-*-freebsd*) + *-*-freebsd*|*-dragonfly*) AC_DEFINE(_REENTRANT) AC_DEFINE(_THREAD_SAFE) dnl -pthread links in -lpthread, so don't specify it explicitly. @@ -2711,6 +2712,9 @@ AC_CACHE_CHECK( #ifdef linux #define _BSD_SOURCE 1 #endif + #ifdef __NetBSD__ + #error use of global _res variable in threaded programs is not portable + #endif #include ], [int foo = res_ninit(&_res);], @@ -3486,7 +3490,7 @@ if test "$MOZ_MEMORY"; then *-darwin*) AC_DEFINE(MOZ_MEMORY_DARWIN) ;; - *-*freebsd*) + *-*freebsd*|*-*dragonfly*) AC_DEFINE(MOZ_MEMORY_BSD) ;; *-android*|*-linuxandroid*) diff --git a/js/src/ctypes/CTypes.cpp b/js/src/ctypes/CTypes.cpp index 8ff943e..e33fa39 100644 --- a/js/src/ctypes/CTypes.cpp +++ b/js/src/ctypes/CTypes.cpp @@ -5,6 +5,23 @@ #include "mozilla/FloatingPoint.h" +#if defined(__NetBSD__) +#include +/* XXX why do we have those funky __ #defines in stdint.h? */ +#warning this is a retarded workaround +#define uint8_t uint8_t +#define uint16_t uint16_t +#define uint32_t uint32_t +#define uint64_t uint64_t +#define int8_t int8_t +#define int16_t int16_t +#define int32_t int32_t +#define int64_t int64_t +#define intptr_t intptr_t +#define uintptr_t uintptr_t +#define off_t off_t +#endif + #include "CTypes.h" #include "Library.h" #include "jsnum.h" diff --git a/js/src/ctypes/libffi/configure b/js/src/ctypes/libffi/configure index dcff560..119227c 100755 --- a/js/src/ctypes/libffi/configure +++ b/js/src/ctypes/libffi/configure @@ -11278,7 +11278,7 @@ case "$host" in powerpc-*-aix* | rs6000-*-aix*) TARGET=POWERPC_AIX; TARGETDIR=powerpc ;; - powerpc-*-freebsd* | powerpc-*-openbsd*) + powerpc-*-freebsd* | powerpc-*-openbsd* | powerpc-*-netbsd*) TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc ;; powerpc*-*-rtems*) diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index 77deb1c..39b6620 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -596,12 +596,12 @@ class js::AutoDebugModeGC // The DEBUG_MODE_GC reason forces the collector to always throw // everything away, as required for debug mode transitions. if (needGC) - GC(rt, GC_NORMAL, gcreason::DEBUG_MODE_GC); + GC(rt, GC_NORMAL, js::gcreason::DEBUG_MODE_GC); } - void scheduleGC(Zone *zone) { + void scheduleGC(JS::Zone *zone) { JS_ASSERT(!rt->isHeapBusy()); - PrepareZoneForGC(zone); + js::PrepareZoneForGC(zone); needGC = true; } }; diff --git a/js/src/jsnativestack.cpp b/js/src/jsnativestack.cpp index 29cc77f..894afc4 100644 --- a/js/src/jsnativestack.cpp +++ b/js/src/jsnativestack.cpp @@ -19,7 +19,7 @@ #elif defined(XP_MACOSX) || defined(DARWIN) || defined(XP_UNIX) # include -# if defined(__FreeBSD__) || defined(__OpenBSD__) +# if defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # include # endif @@ -112,7 +112,7 @@ js::GetNativeStackBaseImpl() pthread_attr_init(&sattr); # if defined(__OpenBSD__) stack_t ss; -# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(NETBSD) +# elif defined(PTHREAD_NP_H) || defined(_PTHREAD_NP_H_) || defined(__DragonFly__) || defined(NETBSD) || defined(__NetBSD__) /* XXX tnn not sure why NETBSD isn't defined, it looks like it should be ... */ /* e.g. on FreeBSD 4.8 or newer, neundorf@kde.org */ pthread_attr_get_np(thread, &sattr); # else diff --git a/js/src/jspropertycacheinlines.h b/js/src/jspropertycacheinlines.h index a235392..a841172 100644 --- a/js/src/jspropertycacheinlines.h +++ b/js/src/jspropertycacheinlines.h @@ -32,7 +32,7 @@ JS_ALWAYS_INLINE void js::PropertyCache::test(JSContext *cx, jsbytecode *pc, JSObject **obj, JSObject **pobj, PropertyCacheEntry **entry, PropertyName **name) { - AutoAssertNoGC nogc; + js::AutoAssertNoGC nogc; JS_ASSERT(this == &cx->propertyCache()); @@ -65,7 +65,7 @@ JS_ALWAYS_INLINE bool js::PropertyCache::testForSet(JSContext *cx, jsbytecode *pc, JSObject *obj, PropertyCacheEntry **entryp, JSObject **obj2p, PropertyName **namep) { - AutoAssertNoGC nogc; + js::AutoAssertNoGC nogc; JS_ASSERT(this == &cx->propertyCache()); diff --git a/js/src/methodjit/MethodJIT.cpp b/js/src/methodjit/MethodJIT.cpp index 8794bbd..445ff49 100644 --- a/js/src/methodjit/MethodJIT.cpp +++ b/js/src/methodjit/MethodJIT.cpp @@ -138,7 +138,7 @@ PopActiveVMFrame(VMFrame &f) JS_STATIC_ASSERT(offsetof(FrameRegs, sp) == 0); -#if defined(__linux__) && defined(JS_CPU_X64) +#if defined(__ELF__) && defined(JS_CPU_X64) # define SYMBOL_STRING_RELOC(name) #name "@plt" #else # define SYMBOL_STRING_RELOC(name) SYMBOL_STRING(name) @@ -152,7 +152,7 @@ JS_STATIC_ASSERT(offsetof(FrameRegs, sp) == 0); #if defined(XP_MACOSX) # define HIDE_SYMBOL(name) ".private_extern _" #name -#elif defined(__linux__) +#elif defined(__ELF__) # define HIDE_SYMBOL(name) ".hidden" #name #else # define HIDE_SYMBOL(name) diff --git a/js/src/vm/ObjectImpl-inl.h b/js/src/vm/ObjectImpl-inl.h index 4999ec6..aed692c 100644 --- a/js/src/vm/ObjectImpl-inl.h +++ b/js/src/vm/ObjectImpl-inl.h @@ -164,9 +164,9 @@ js::ObjectImpl::initializeSlotRange(uint32_t start, uint32_t length) JSRuntime *rt = runtime(); uint32_t offset = start; for (HeapSlot *sp = fixedStart; sp < fixedEnd; sp++) - sp->init(rt, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue()); + sp->init(rt, this->asObjectPtr(), HeapSlot::Slot, offset++, js::UndefinedValue()); for (HeapSlot *sp = slotsStart; sp < slotsEnd; sp++) - sp->init(rt, this->asObjectPtr(), HeapSlot::Slot, offset++, UndefinedValue()); + sp->init(rt, this->asObjectPtr(), HeapSlot::Slot, offset++, js::UndefinedValue()); } inline bool @@ -321,7 +321,7 @@ js::ObjectImpl::sizeOfThis() const js::ObjectImpl::readBarrier(ObjectImpl *obj) { #ifdef JSGC_INCREMENTAL - Zone *zone = obj->zone(); + JS::Zone *zone = obj->zone(); if (zone->needsBarrier()) { MOZ_ASSERT(!zone->rt->isHeapBusy()); JSObject *tmp = obj->asObjectPtr(); @@ -335,7 +335,7 @@ inline void js::ObjectImpl::privateWriteBarrierPre(void **old) { #ifdef JSGC_INCREMENTAL - Zone *zone = this->zone(); + JS::Zone *zone = this->zone(); if (zone->needsBarrier()) { if (*old && getClass()->trace) getClass()->trace(zone->barrierTracer(), this->asObjectPtr()); @@ -362,7 +362,7 @@ js::ObjectImpl::writeBarrierPre(ObjectImpl *obj) if (uintptr_t(obj) < 32) return; - Zone *zone = obj->zone(); + JS::Zone *zone = obj->zone(); if (zone->needsBarrier()) { MOZ_ASSERT(!zone->rt->isHeapBusy()); JSObject *tmp = obj->asObjectPtr(); diff --git a/media/libsoundtouch/src/cpu_detect_x86.cpp b/media/libsoundtouch/src/cpu_detect_x86.cpp index a42008e..7a31aa9 100644 --- a/media/libsoundtouch/src/cpu_detect_x86.cpp +++ b/media/libsoundtouch/src/cpu_detect_x86.cpp @@ -101,7 +101,7 @@ uint detectCPUextensions(void) uint res = 0; -#if defined(__GNUC__) +#if defined(__GNUC__) && defined(HAVE_CPUID_H) // GCC version of cpuid. Requires GCC 4.3.0 or later for __cpuid intrinsic support. uint eax, ebx, ecx, edx; // unsigned int is the standard type. uint is defined by the compiler and not guaranteed to be portable. @@ -112,6 +112,9 @@ uint detectCPUextensions(void) if (edx & bit_SSE) res = res | SUPPORT_SSE; if (edx & bit_SSE2) res = res | SUPPORT_SSE2; +#elif defined(__GNUC__) + // No cpuid.h --> no cpuid support + return 0; #else // Window / VS version of cpuid. Notice that Visual Studio 2005 or later required // for __cpuid intrinsic support. diff --git a/media/libsydneyaudio/src/Makefile.in b/media/libsydneyaudio/src/Makefile.in index 66050cb..6ea3eff 100644 --- a/media/libsydneyaudio/src/Makefile.in +++ b/media/libsydneyaudio/src/Makefile.in @@ -70,6 +70,18 @@ CSRCS = \ $(NULL) endif +ifdef MOZ_PULSEAUDIO +CSRCS = \ + sydney_audio_pulseaudio.c \ + $(NULL) +endif + +ifdef MOZ_PULSEAUDIO +CSRCS = \ + sydney_audio_pulseaudio.c \ + $(NULL) +endif + ifeq ($(OS_ARCH),WINNT) OS_LIBS += winmm.lib endif diff --git a/media/libsydneyaudio/src/sydney_audio_oss.c b/media/libsydneyaudio/src/sydney_audio_oss.c index 086d180..c05ba10 100644 --- a/media/libsydneyaudio/src/sydney_audio_oss.c +++ b/media/libsydneyaudio/src/sydney_audio_oss.c @@ -23,7 +23,7 @@ // support only versions newer than 3.6.1 #define SUPP_OSS_VERSION OSS_VERSION(3,0,1) -#if (SOUND_VERSION < SUPP_OSS_VERSION) +#if 0 // (SOUND_VERSION < SUPP_OSS_VERSION) #error Unsupported OSS Version #else @@ -173,7 +173,12 @@ sa_stream_create_pcm( return SA_ERROR_SYSTEM; } +#if defined(__NetBSD__) + /* XXX should use DEVOSSAUDIO provided by pkgsrc. */ + s->output_unit = "/dev/audio"; +#else s->output_unit = "/dev/dsp"; +#endif s->output_fd = -1; s->thread_id = 0; s->playing = 0; @@ -446,6 +451,10 @@ static void audio_callback(void* data) printf("!"); /* not enough audio data */ #endif bytes = bytes-bytes_to_copy; + struct timespec ts = {0, 1000000}; + pthread_mutex_unlock(&s->mutex); + nanosleep(&ts, NULL); + pthread_mutex_lock(&s->mutex); break; } free(s->bl_head); diff --git a/media/mtransport/objs.mk b/media/mtransport/objs.mk index 2a731dc..af99fcb 100644 --- a/media/mtransport/objs.mk +++ b/media/mtransport/objs.mk @@ -23,12 +23,16 @@ LOCAL_INCLUDES += \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/event \ $(NULL) -ifeq ($(OS_TARGET), Darwin) +ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LOCAL_INCLUDES += \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include \ -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/generic/include \ $(NULL) +ifeq ($(OS_TARGET), Darwin) DEFINES += -DDARWIN +else +DEFINES += -DBSD +endif endif ifeq ($(OS_TARGET), Linux) diff --git a/media/mtransport/test/Makefile.in b/media/mtransport/test/Makefile.in index 8b7f8d8..cbc8e6f 100644 --- a/media/mtransport/test/Makefile.in +++ b/media/mtransport/test/Makefile.in @@ -78,12 +78,14 @@ endif endif endif -ifeq ($(OS_TARGET), Darwin) +ifneq (,$(filter Darwin DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/darwin/include +ifeq ($(OS_TARGET), Darwin) DEFINES += \ -DGTEST_USE_OWN_TR1_TUPLE=1 \ $(NULL) endif +endif ifeq ($(OS_TARGET), Linux) LOCAL_INCLUDES += -I$(topsrcdir)/media/mtransport/third_party/nrappkit/src/port/linux/include diff --git a/media/mtransport/third_party/nICEr/nicer.gyp b/media/mtransport/third_party/nICEr/nicer.gyp index fed0bb8..259b6d9 100644 --- a/media/mtransport/third_party/nICEr/nicer.gyp +++ b/media/mtransport/third_party/nICEr/nicer.gyp @@ -129,8 +129,19 @@ ], 'conditions' : [ - ## Mac + ## Mac and BSDs [ 'OS == "mac"', { + 'defines' : [ + 'DARWIN', + 'HAVE_XLOCALE', + ], + }], + [ 'os_bsd == 1', { + 'defines' : [ + 'BSD', + ], + }], + [ 'OS == "mac" or os_bsd == 1', { 'cflags_mozilla': [ '-Wall', '-Wno-parentheses', @@ -138,7 +149,6 @@ '-Wmissing-prototypes', ], 'defines' : [ - 'DARWIN', 'HAVE_LIBM=1', 'HAVE_STRDUP=1', 'HAVE_STRLCPY=1', diff --git a/media/mtransport/third_party/nICEr/src/stun/addrs.c b/media/mtransport/third_party/nICEr/src/stun/addrs.c index 9740a4c..6ec5013 100644 --- a/media/mtransport/third_party/nICEr/src/stun/addrs.c +++ b/media/mtransport/third_party/nICEr/src/stun/addrs.c @@ -55,7 +55,9 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex #endif #include #ifndef LINUX +#if !defined(__OpenBSD__) && !defined(__NetBSD__) #include +#endif #include #include #include @@ -80,7 +82,7 @@ static char *RCSSTRING __UNUSED__="$Id: addrs.c,v 1.2 2008/04/28 18:21:30 ekr Ex -#ifdef DARWIN +#if defined(BSD) || defined(DARWIN) /* * Copyright (c) 1983, 1993 * The Regents of the University of California. All rights reserved. @@ -690,7 +692,7 @@ nr_stun_get_addrs(nr_transport_addr addrs[], int maxaddrs, int drop_loopback, in int _status=0; int i; -#ifdef DARWIN +#if defined(BSD) || defined(DARWIN) _status = stun_get_mib_addrs(addrs, maxaddrs, count); #elif defined(WIN32) _status = stun_get_win32_addrs(addrs, maxaddrs, count); diff --git a/media/mtransport/third_party/nICEr/src/stun/stun.h b/media/mtransport/third_party/nICEr/src/stun/stun.h index a3c51f9..d278c79 100644 --- a/media/mtransport/third_party/nICEr/src/stun/stun.h +++ b/media/mtransport/third_party/nICEr/src/stun/stun.h @@ -41,11 +41,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #ifndef LINUX +#if !defined(__OpenBSD__) && !defined(__NetBSD__) #include +#endif #include #include #endif +#ifndef BSD #include +#endif #include #ifndef LINUX #include diff --git a/media/mtransport/third_party/nICEr/src/util/mbslen.c b/media/mtransport/third_party/nICEr/src/util/mbslen.c index dedbb30..a93dc60 100644 --- a/media/mtransport/third_party/nICEr/src/util/mbslen.c +++ b/media/mtransport/third_party/nICEr/src/util/mbslen.c @@ -43,9 +43,17 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #include #include -#ifdef DARWIN + +#ifdef __FreeBSD__ +#include +# if __FreeBSD_version > 900505 +# define HAVE_XLOCALE +# endif +#endif + +#ifdef HAVE_XLOCALE #include -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #include "nr_api.h" #include "mbslen.h" @@ -54,10 +62,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. int mbslen(const char *s, size_t *ncharsp) { -#ifdef DARWIN +#ifdef HAVE_XLOCALE static locale_t loc = 0; static int initialized = 0; -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #ifdef WIN32 char *my_locale=0; unsigned int i; @@ -67,7 +75,7 @@ mbslen(const char *s, size_t *ncharsp) int nchars; mbstate_t mbs; -#ifdef DARWIN +#ifdef HAVE_XLOCALE if (! initialized) { initialized = 1; loc = newlocale(LC_CTYPE_MASK, "UTF-8", LC_GLOBAL_LOCALE); @@ -76,7 +84,7 @@ mbslen(const char *s, size_t *ncharsp) if (loc == 0) { /* unable to create the UTF-8 locale */ assert(loc != 0); /* should never happen */ -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ #ifdef WIN32 if (!setlocale(LC_CTYPE, 0)) @@ -98,18 +106,18 @@ mbslen(const char *s, size_t *ncharsp) ABORT(R_NOT_FOUND); #endif -#ifdef DARWIN +#ifdef HAVE_XLOCALE } -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ memset(&mbs, 0, sizeof(mbs)); nchars = 0; -#ifdef DARWIN +#ifdef HAVE_XLOCALE while (*s != '\0' && (nbytes = mbrlen_l(s, strlen(s), &mbs, loc)) != 0) #else while (*s != '\0' && (nbytes = mbrlen(s, strlen(s), &mbs)) != 0) -#endif /* DARWIN */ +#endif /* HAVE_XLOCALE */ { if (nbytes == (size_t)-1) /* should never happen */ { assert(0); diff --git a/media/mtransport/third_party/nrappkit/nrappkit.gyp b/media/mtransport/third_party/nrappkit/nrappkit.gyp index 2c351ff..488ac8d 100644 --- a/media/mtransport/third_party/nrappkit/nrappkit.gyp +++ b/media/mtransport/third_party/nrappkit/nrappkit.gyp @@ -147,8 +147,18 @@ ], 'conditions' : [ - ## Mac + ## Mac and BSDs [ 'OS == "mac"', { + 'defines' : [ + 'DARWIN', + ], + }], + [ 'os_bsd == 1', { + 'defines' : [ + 'BSD', + ], + }], + [ 'OS == "mac" or os_bsd == 1', { 'cflags_mozilla': [ '-Wall', '-Wno-parentheses', @@ -156,7 +166,6 @@ '-Wmissing-prototypes', ], 'defines' : [ - 'DARWIN', 'HAVE_LIBM=1', 'HAVE_STRDUP=1', 'HAVE_STRLCPY=1', diff --git a/media/mtransport/third_party/nrappkit/src/log/r_log.c b/media/mtransport/third_party/nrappkit/src/log/r_log.c index b51d695..294b0bb 100644 --- a/media/mtransport/third_party/nrappkit/src/log/r_log.c +++ b/media/mtransport/third_party/nrappkit/src/log/r_log.c @@ -48,6 +48,7 @@ static char *RCSSTRING __UNUSED__ ="$Id: r_log.c,v 1.10 2008/11/25 22:25:18 adam #include "hex.h" #include +#include #ifndef _MSC_VER #include #include diff --git a/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h b/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h index bcb1ec0..5b50785 100644 --- a/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h +++ b/media/mtransport/third_party/nrappkit/src/port/generic/include/sys/queue.h @@ -33,7 +33,7 @@ #ifndef _SYS_QUEUE_H_ #define _SYS_QUEUE_H_ -#ifndef DARWIN +#if !defined(__FreeBSD__) && !defined(DARWIN) #include #define __offsetof offsetof #endif diff --git a/media/mtransport/third_party/nrappkit/src/util/util.c b/media/mtransport/third_party/nrappkit/src/util/util.c index a7d4ff1..ff11a60 100644 --- a/media/mtransport/third_party/nrappkit/src/util/util.c +++ b/media/mtransport/third_party/nrappkit/src/util/util.c @@ -45,6 +45,7 @@ static char *RCSSTRING __UNUSED__ ="$Id: util.c,v 1.5 2007/11/21 00:09:13 adamca #include #endif #include +#include #include #include #ifdef OPENSSL diff --git a/media/webrtc/signaling/signaling.gyp b/media/webrtc/signaling/signaling.gyp index 2f917eb..e7d2730 100644 --- a/media/webrtc/signaling/signaling.gyp +++ b/media/webrtc/signaling/signaling.gyp @@ -217,6 +217,19 @@ 'cflags_mozilla': [ ], }], + ['os_bsd==1', { + 'include_dirs': [ + ], + 'defines': [ + # avoiding pointless ifdef churn + 'SIP_OS_OSX', + 'OSX', + 'SECLIB_OPENSSL', + ], + + 'cflags_mozilla': [ + ], + }], ['OS=="mac"', { 'include_dirs': [ ], @@ -752,7 +765,7 @@ ], }], - ['OS=="mac"', { + ['OS=="mac" or os_bsd==1', { 'include_dirs': [ ], @@ -797,14 +810,13 @@ 'defines' : [ 'SIP_OS_OSX', - '_POSIX_SOURCE', + # using BSD extensions, leave _POSIX_SOURCE undefined 'CPR_MEMORY_LITTLE_ENDIAN', 'NO_SOCKET_POLLING', 'USE_TIMER_SELECT_BASED', 'FULL_BUILD', 'STUBBED_OUT', 'USE_PRINTF', - '_DARWIN_C_SOURCE', 'NO_NSPR_10_SUPPORT', ], diff --git a/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c b/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c index a7c47e1..4f191de 100644 --- a/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c +++ b/media/webrtc/signaling/src/sipcc/cpr/darwin/cpr_darwin_ipc.c @@ -322,11 +322,15 @@ cprGetMessage (cprMsgQueue_t msgQueue, boolean waitForever, void **ppUserData) cpr_msgq_node_t *node; struct timespec timeout; struct timeval tv; +#ifndef __APPLE__ + struct timezone tz; +#else // On the iPhone, there is a DarwinAlias problem with "timezone" struct _timezone { int tz_minuteswest; /* of Greenwich */ int tz_dsttime; /* type of dst correction to apply */ } tz; +#endif /* Initialize ppUserData */ if (ppUserData) { diff --git a/media/webrtc/signaling/test/Makefile.in b/media/webrtc/signaling/test/Makefile.in index b483cd1..254c687 100644 --- a/media/webrtc/signaling/test/Makefile.in +++ b/media/webrtc/signaling/test/Makefile.in @@ -17,6 +17,7 @@ LIBS = \ $(NSPR_LIBS) \ $(NSS_LIBS) \ $(REALTIME_LIBS) \ + $(MOZ_LIBV4L2_LIBS) \ $(DEPTH)/xpcom/glue/$(LIB_PREFIX)xpcomglue_s.$(LIB_SUFFIX) \ $(DEPTH)/media/mtransport/standalone/$(LIB_PREFIX)mtransport_s.$(LIB_SUFFIX) \ $(DEPTH)/media/webrtc/signalingtest/signaling_ecc/$(LIB_PREFIX)ecc.$(LIB_SUFFIX) \ @@ -86,7 +87,7 @@ LIBS += \ $(NULL) endif -ifeq ($(OS_TARGET),Linux) +ifneq (,$(filter Linux DragonFly FreeBSD NetBSD OpenBSD,$(OS_TARGET))) LIBS += \ $(MOZ_CAIRO_OSLIBS) \ $(NULL) diff --git a/media/webrtc/trunk/build/common.gypi b/media/webrtc/trunk/build/common.gypi index 949938a..7406cc1 100644 --- a/media/webrtc/trunk/build/common.gypi +++ b/media/webrtc/trunk/build/common.gypi @@ -80,12 +80,21 @@ ['use_ash==1', { 'use_aura%': 1, }], + + # A flag for BSD platforms + ['OS=="dragonfly" or OS=="freebsd" or OS=="netbsd" or \ + OS=="openbsd"', { + 'os_bsd%': 1, + }, { + 'os_bsd%': 0, + }], ], }, # Copy conditionally-set variables out one scope. 'chromeos%': '<(chromeos)', 'use_aura%': '<(use_aura)', 'use_ash%': '<(use_ash)', + 'os_bsd%': '<(os_bsd)', 'use_openssl%': '<(use_openssl)', 'use_ibus%': '<(use_ibus)', 'enable_viewport%': '<(enable_viewport)', @@ -119,7 +128,7 @@ }], # Set toolkit_uses_gtk for the Chromium browser on Linux. - ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_aura==0', { + ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_aura==0', { 'toolkit_uses_gtk%': 1, }, { 'toolkit_uses_gtk%': 0, @@ -144,6 +153,7 @@ 'toolkit_uses_gtk%': '<(toolkit_uses_gtk)', 'use_aura%': '<(use_aura)', 'use_ash%': '<(use_ash)', + 'os_bsd%': '<(os_bsd)', 'use_openssl%': '<(use_openssl)', 'use_ibus%': '<(use_ibus)', 'enable_viewport%': '<(enable_viewport)', @@ -406,15 +416,8 @@ 'os_posix%': 1, }], - # A flag for BSD platforms - ['OS=="freebsd" or OS=="openbsd"', { - 'os_bsd%': 1, - }, { - 'os_bsd%': 0, - }], - # NSS usage. - ['(OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris") and use_openssl==0', { + ['(OS=="linux" or OS=="solaris" or os_bsd==1) and use_openssl==0', { 'use_nss%': 1, }, { 'use_nss%': 0, diff --git a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h index e5a4551..06e5038 100644 --- a/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h +++ b/media/webrtc/trunk/testing/gtest/include/gtest/internal/gtest-port.h @@ -490,10 +490,10 @@ # define GTEST_ENV_HAS_TR1_TUPLE_ 1 # endif -// C++11 specifies that provides std::tuple. Users can't use -// gtest in C++11 mode until their standard library is at least that -// compliant. -# if GTEST_LANG_CXX11 +// C++11 specifies that provides std::tuple. Use that if gtest is used +// in C++11 mode and libstdc++ isn't very old (binaries targeting OS X 10.6 +// can build with clang but need to use gcc4.2's libstdc++). +# if GTEST_LANG_CXX11 && (!defined(__GLIBCXX__) || __GLIBCXX__ > 20110325) # define GTEST_ENV_HAS_STD_TUPLE_ 1 # endif diff --git a/media/webrtc/trunk/third_party/libyuv/libyuv.gyp b/media/webrtc/trunk/third_party/libyuv/libyuv.gyp index d82ed9a..8cc8770 100644 --- a/media/webrtc/trunk/third_party/libyuv/libyuv.gyp +++ b/media/webrtc/trunk/third_party/libyuv/libyuv.gyp @@ -9,6 +9,7 @@ { 'variables': { 'use_system_libjpeg%': 0, + 'yuv_disable_asm%': 0, }, 'targets': [ { @@ -50,6 +51,11 @@ ], }, 'conditions': [ + ['yuv_disable_asm==1', { + 'defines': [ + 'YUV_DISABLE_ASM', + ], + }], ['build_with_mozilla==1', { 'include_dirs': [ '$(DEPTH)/dist/include', diff --git a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py index c2da9aa..174d0fc 100644 --- a/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py +++ b/media/webrtc/trunk/tools/gyp/pylib/gyp/generator/mozmake.py @@ -9,6 +9,7 @@ import collections import gyp import gyp.common import sys +import platform import os import re import shlex @@ -111,20 +112,34 @@ def ensure_directory_exists(path): def GetFlavor(params): """Returns |params.flavor| if it's set, the system's default flavor else.""" + system = platform.system().lower() flavors = { - 'win32': 'win', - 'darwin': 'mac', - 'sunos5': 'solaris', - 'freebsd7': 'freebsd', - 'freebsd8': 'freebsd', + 'microsoft': 'win', + 'windows' : 'win', + 'darwin' : 'mac', + 'sunos' : 'solaris', + 'dragonfly': 'bsd', + 'freebsd' : 'bsd', + 'netbsd' : 'bsd', + 'openbsd' : 'bsd', } - flavor = flavors.get(sys.platform, 'linux') - return params.get('flavor', flavor) + + if 'flavor' in params: + return params['flavor'] + if system.startswith('cygwin'): + return 'win' + if system in flavors: + return flavors[system] + + return 'linux' def CalculateVariables(default_variables, params): + flavor = GetFlavor(params) + if flavor == 'bsd': + flavor = platform.system().lower() generator_flags = params.get('generator_flags', {}) - default_variables['OS'] = generator_flags.get('os', GetFlavor(params)) + default_variables['OS'] = generator_flags.get('os', flavor) def CalculateGeneratorInputInfo(params): diff --git a/media/webrtc/trunk/webrtc/build/common.gypi b/media/webrtc/trunk/webrtc/build/common.gypi index 7b2db93..b9e0b71 100644 --- a/media/webrtc/trunk/webrtc/build/common.gypi +++ b/media/webrtc/trunk/webrtc/build/common.gypi @@ -124,6 +124,11 @@ # and Java Implementation 'enable_android_opensl%': 0, }], + ['OS=="linux" or OS=="solaris" or os_bsd==1', { + 'include_v4l2_video_capture%': 1, + }, { + 'include_v4l2_video_capture%': 0, + }], ['OS=="ios"', { 'enable_video%': 0, 'enable_protobuf%': 0, @@ -210,6 +215,18 @@ }], ], }], + ['os_bsd==1', { + 'defines': [ + 'WEBRTC_BSD', + 'WEBRTC_THREAD_RR', + ], + }], + ['OS=="dragonfly" or OS=="netbsd"', { + 'defines': [ + # doesn't support pthread_condattr_setclock + 'WEBRTC_CLOCK_TYPE_REALTIME', + ], + }], ['OS=="ios"', { 'defines': [ 'WEBRTC_MAC', diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi index 640f732..28112ca 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi +++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device.gypi @@ -45,11 +45,15 @@ 'dummy/audio_device_utility_dummy.h', ], 'conditions': [ - ['OS=="linux"', { + ['include_alsa_audio==1 or include_pulse_audio==1', { 'include_dirs': [ 'linux', ], - }], # OS==linux + 'defines': [ + # avoid pointless rename + 'WEBRTC_LINUX', + ], + }], # include_alsa_audio==1 or include_pulse_audio==1 ['OS=="ios"', { 'include_dirs': [ 'ios', @@ -77,14 +81,8 @@ }], ['include_internal_audio_device==1', { 'sources': [ - 'linux/alsasymboltable_linux.cc', - 'linux/alsasymboltable_linux.h', - 'linux/audio_device_alsa_linux.cc', - 'linux/audio_device_alsa_linux.h', 'linux/audio_device_utility_linux.cc', 'linux/audio_device_utility_linux.h', - 'linux/audio_mixer_manager_alsa_linux.cc', - 'linux/audio_mixer_manager_alsa_linux.h', 'linux/latebindingsymboltable_linux.cc', 'linux/latebindingsymboltable_linux.h', 'ios/audio_device_ios.cc', @@ -134,28 +132,36 @@ ], }], ['OS=="linux"', { - 'defines': [ - 'LINUX_ALSA', - ], 'link_settings': { 'libraries': [ '-ldl', ], }, - 'conditions': [ - ['include_pulse_audio==1', { - 'defines': [ - 'LINUX_PULSE', - ], - 'sources': [ - 'linux/audio_device_pulse_linux.cc', - 'linux/audio_device_pulse_linux.h', - 'linux/audio_mixer_manager_pulse_linux.cc', - 'linux/audio_mixer_manager_pulse_linux.h', - 'linux/pulseaudiosymboltable_linux.cc', - 'linux/pulseaudiosymboltable_linux.h', - ], - }], + }], + ['include_alsa_audio==1', { + 'defines': [ + 'LINUX_ALSA', + ], + 'sources': [ + 'linux/alsasymboltable_linux.cc', + 'linux/alsasymboltable_linux.h', + 'linux/audio_device_alsa_linux.cc', + 'linux/audio_device_alsa_linux.h', + 'linux/audio_mixer_manager_alsa_linux.cc', + 'linux/audio_mixer_manager_alsa_linux.h', + ], + }], + ['include_pulse_audio==1', { + 'defines': [ + 'LINUX_PULSE', + ], + 'sources': [ + 'linux/audio_device_pulse_linux.cc', + 'linux/audio_device_pulse_linux.h', + 'linux/audio_mixer_manager_pulse_linux.cc', + 'linux/audio_mixer_manager_pulse_linux.h', + 'linux/pulseaudiosymboltable_linux.cc', + 'linux/pulseaudiosymboltable_linux.h', ], }], ['OS=="mac" or OS=="ios"', { diff --git a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_utility.cc b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_utility.cc index 203f09a..0b0b70e 100644 --- a/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_utility.cc +++ b/media/webrtc/trunk/webrtc/modules/audio_device/audio_device_utility.cc @@ -46,7 +46,7 @@ bool AudioDeviceUtility::StringCompare( } // namespace webrtc -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) // ============================================================================ // Linux & Mac @@ -109,6 +109,6 @@ bool AudioDeviceUtility::StringCompare( } // namespace webrtc -#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) diff --git a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc index bdad224..39e1132 100644 --- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc +++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/forward_error_correction.cc @@ -12,6 +12,7 @@ #include #include +#include // for abs() #include #include diff --git a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc index efc985c..d1d81a7 100644 --- a/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc +++ b/media/webrtc/trunk/webrtc/modules/rtp_rtcp/source/rtp_utility.cc @@ -18,7 +18,7 @@ #include // FILETIME #include // timeval #include // timeGetTime -#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC)) +#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC)) #include // gettimeofday #include #endif @@ -156,7 +156,7 @@ void get_time(WindowsHelpTimer* help_timer, FILETIME& current_time) { WindowsHelpTimer* _helpTimer; }; -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) // A clock reading times from the POSIX API. class UnixSystemClock : public RtpRtcpClock { @@ -214,7 +214,7 @@ void WindowsSystemClock::CurrentNTP(WebRtc_UWord32& secs, frac = (WebRtc_UWord32)dtemp; } -#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_MAC)) +#elif ((defined WEBRTC_LINUX) || (defined WEBRTC_BSD) || (defined WEBRTC_MAC)) WebRtc_Word64 UnixSystemClock::GetTimeInMS() { return TickTime::MillisecondTimestamp(); @@ -253,7 +253,7 @@ static WindowsHelpTimer global_help_timer = {0, 0, {{ 0, 0}, 0}, 0}; RtpRtcpClock* GetSystemClock() { #if defined(_WIN32) return new WindowsSystemClock(&global_help_timer); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return new UnixSystemClock(); #else return NULL; @@ -330,7 +330,7 @@ bool StringCompare(const char* str1, const char* str2, const WebRtc_UWord32 length) { return (_strnicmp(str1, str2, length) == 0) ? true : false; } -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) bool StringCompare(const char* str1, const char* str2, const WebRtc_UWord32 length) { return (strncasecmp(str1, str2, length) == 0) ? true : false; diff --git a/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc b/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc index b4c9279..183e964 100644 --- a/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/udp_transport/source/udp_transport_impl.cc @@ -18,16 +18,16 @@ #if defined(_WIN32) #include #include -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include #include #include +#include #include #include #include #include -#include #include #include #ifndef WEBRTC_IOS @@ -36,9 +36,11 @@ #endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) #if defined(WEBRTC_MAC) -#include #include #endif +#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC) +#include +#endif #if defined(WEBRTC_LINUX) #include #include @@ -51,7 +53,7 @@ #include "typedefs.h" #include "udp_socket_manager_wrapper.h" -#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #define GetLastError() errno #define IFRSIZE ((int)(size * sizeof (struct ifreq))) @@ -61,7 +63,7 @@ (int)(nlh)->nlmsg_len >= (int)sizeof(struct nlmsghdr) && \ (int)(nlh)->nlmsg_len <= (len)) -#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#endif // defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) namespace webrtc { @@ -2371,7 +2373,7 @@ WebRtc_Word32 UdpTransport::InetPresentationToNumeric(WebRtc_Word32 af, const char* src, void* dst) { -#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) const WebRtc_Word32 result = inet_pton(af, src, dst); return result > 0 ? 0 : -1; @@ -2493,7 +2495,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddressIPV6(char n_localIP[16]) "getaddrinfo failed to find address"); return -1; -#elif defined(WEBRTC_MAC) +#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC) struct ifaddrs* ptrIfAddrs = NULL; struct ifaddrs* ptrIfAddrsStart = NULL; @@ -2685,7 +2687,7 @@ WebRtc_Word32 UdpTransport::LocalHostAddress(WebRtc_UWord32& localIP) "gethostbyname failed, error:%d", error); return -1; } -#elif (defined(WEBRTC_MAC)) +#elif (defined(WEBRTC_BSD) || defined(WEBRTC_MAC)) char localname[255]; if (gethostname(localname, 255) != -1) { @@ -2824,7 +2826,7 @@ WebRtc_Word32 UdpTransport::IPAddress(const SocketAddress& address, sourcePort = htons(source_port); return 0; - #elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) + #elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) WebRtc_Word32 ipFamily = address._sockaddr_storage.sin_family; const void* ptrNumericIP = NULL; diff --git a/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc b/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc index 69a52ec..7ac226c 100644 --- a/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/utility/source/rtp_dump_impl.cc @@ -19,7 +19,7 @@ #if defined(_WIN32) #include #include -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include #include @@ -238,7 +238,7 @@ inline WebRtc_UWord32 RtpDumpImpl::GetTimeInMS() const { #if defined(_WIN32) return timeGetTime(); -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) struct timeval tv; struct timezone tz; unsigned long val; diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc b/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc index e0d5e7e..b26a7e0 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc +++ b/media/webrtc/trunk/webrtc/modules/video_capture/device_info_impl.cc @@ -54,7 +54,7 @@ WebRtc_Word32 DeviceInfoImpl::NumberOfCapabilities( if (_lastUsedDeviceNameLength == strlen((char*) deviceUniqueIdUTF8)) { // Is it the same device that is asked for again. -#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) +#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) if(strncasecmp((char*)_lastUsedDeviceName, (char*) deviceUniqueIdUTF8, _lastUsedDeviceNameLength)==0) @@ -91,7 +91,7 @@ WebRtc_Word32 DeviceInfoImpl::GetCapability(const char* deviceUniqueIdUTF8, ReadLockScoped cs(_apiLock); if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8)) -#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) +#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || (strncasecmp((char*)_lastUsedDeviceName, (char*) deviceUniqueIdUTF8, _lastUsedDeviceNameLength)!=0)) @@ -155,7 +155,7 @@ WebRtc_Word32 DeviceInfoImpl::GetBestMatchedCapability( ReadLockScoped cs(_apiLock); if ((_lastUsedDeviceNameLength != strlen((char*) deviceUniqueIdUTF8)) -#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) +#if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || (strncasecmp((char*)_lastUsedDeviceName, (char*) deviceUniqueIdUTF8, _lastUsedDeviceNameLength)!=0)) diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc b/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc index 239a292..50bffb3 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc +++ b/media/webrtc/trunk/webrtc/modules/video_capture/linux/device_info_linux.cc @@ -19,12 +19,30 @@ #include //v4l includes +#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) +#include +#elif defined(__sun) +#include +#else #include +#endif +#ifdef HAVE_LIBV4L2 +#include +#endif #include "ref_count.h" #include "trace.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule @@ -130,6 +148,11 @@ WebRtc_Word32 DeviceInfoLinux::GetDeviceName( memset(deviceNameUTF8, 0, deviceNameLength); memcpy(cameraName, cap.card, sizeof(cap.card)); + if (cameraName[0] == '\0') + { + sprintf(cameraName, "Camera at /dev/video%d", deviceNumber); + } + if (deviceNameLength >= strlen(cameraName)) { memcpy(deviceNameUTF8, cameraName, strlen(cameraName)); diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc b/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc index 12df1b3..305629d 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc +++ b/media/webrtc/trunk/webrtc/modules/video_capture/linux/video_capture_linux.cc @@ -12,12 +12,23 @@ #include #include #include -#include #include #include #include #include +//v4l includes +#if defined(__DragonFly__) || defined(__NetBSD__) || defined(__OpenBSD__) +#include +#elif defined(__sun) +#include +#else +#include +#endif +#ifdef HAVE_LIBV4L2 +#include +#endif + #include #include "ref_count.h" @@ -26,6 +37,15 @@ #include "critical_section_wrapper.h" #include "video_capture_linux.h" +#ifdef HAVE_LIBV4L2 +#define open v4l2_open +#define close v4l2_close +#define dup v4l2_dup +#define ioctl v4l2_ioctl +#define mmap v4l2_mmap +#define munmap v4l2_munmap +#endif + namespace webrtc { namespace videocapturemodule diff --git a/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi b/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi index d46b5aa..e4b26ef 100644 --- a/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi +++ b/media/webrtc/trunk/webrtc/modules/video_capture/video_capture.gypi @@ -7,6 +7,9 @@ # be found in the AUTHORS file in the root of the source tree. { + 'variables': { + 'use_libv4l2%': 0, + }, 'targets': [ { 'target_name': 'video_capture_module', @@ -48,7 +51,17 @@ ], }, { # include_internal_video_capture == 1 'conditions': [ - ['OS=="linux"', { + ['include_v4l2_video_capture==1', { + 'conditions': [ + ['use_libv4l2==1', { + 'defines': [ + 'HAVE_LIBV4L2', + ], + 'libraries': [ + '-lv4l2', + ], + }], + ], 'include_dirs': [ 'linux', ], @@ -157,7 +170,7 @@ 'test/video_capture_main_mac.mm', ], 'conditions': [ - ['OS=="mac" or OS=="linux"', { + ['OS!="win" and OS!="android"', { 'cflags': [ '-Wno-write-strings', ], @@ -165,13 +178,17 @@ '-lpthread -lm', ], }], - ['OS=="linux"', { + ['include_v4l2_video_capture==1', { 'libraries': [ - '-lrt', '-lXext', '-lX11', ], }], + ['OS=="linux"', { + 'libraries': [ + '-lrt', + ], + }], ['OS=="mac"', { 'dependencies': [ # Link with a special main for mac so we can use the webcam. diff --git a/media/webrtc/trunk/webrtc/system_wrappers/interface/asm_defines.h b/media/webrtc/trunk/webrtc/system_wrappers/interface/asm_defines.h index c9f99b7..55afc4f 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/interface/asm_defines.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/interface/asm_defines.h @@ -11,7 +11,7 @@ #ifndef WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ASM_DEFINES_H_ #define WEBRTC_SYSTEM_WRAPPERS_INTERFACE_ASM_DEFINES_H_ -#if defined(__linux__) && defined(__ELF__) +#if (defined(__linux__) || defined(__FreeBSD__)) && defined(__ELF__) .section .note.GNU-stack,"",%progbits #endif diff --git a/media/webrtc/trunk/webrtc/system_wrappers/interface/tick_util.h b/media/webrtc/trunk/webrtc/system_wrappers/interface/tick_util.h index acd16a5..a8102a0 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/interface/tick_util.h +++ b/media/webrtc/trunk/webrtc/system_wrappers/interface/tick_util.h @@ -194,7 +194,7 @@ inline WebRtc_Word64 TickTime::QueryOsForTicks() { } result.ticks_ = now + (num_wrap_time_get_time << 32); #endif -#elif defined(WEBRTC_LINUX) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) struct timespec ts; // TODO(wu): Remove CLOCK_REALTIME implementation. #ifdef WEBRTC_CLOCK_TYPE_REALTIME @@ -241,7 +241,7 @@ inline WebRtc_Word64 TickTime::MillisecondTimestamp() { #else return ticks; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return ticks / 1000000LL; #else return ticks / 1000LL; @@ -258,7 +258,7 @@ inline WebRtc_Word64 TickTime::MicrosecondTimestamp() { #else return ticks * 1000LL; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return ticks / 1000LL; #else return ticks; @@ -278,7 +278,7 @@ inline WebRtc_Word64 TickTime::MillisecondsToTicks(const WebRtc_Word64 ms) { #else return ms; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return ms * 1000000LL; #else return ms * 1000LL; @@ -294,7 +294,7 @@ inline WebRtc_Word64 TickTime::TicksToMilliseconds(const WebRtc_Word64 ticks) { #else return ticks; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return ticks / 1000000LL; #else return ticks / 1000LL; @@ -323,7 +323,7 @@ inline WebRtc_Word64 TickInterval::Milliseconds() const { // interval_ is in ms return interval_; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) // interval_ is in ns return interval_ / 1000000; #else @@ -342,7 +342,7 @@ inline WebRtc_Word64 TickInterval::Microseconds() const { // interval_ is in ms return interval_ * 1000LL; #endif -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) // interval_ is in ns return interval_ / 1000; #else diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/atomic32_posix.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/atomic32_posix.cc index 8a52617..d0e542e 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/atomic32_posix.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/atomic32_posix.cc @@ -12,7 +12,6 @@ #include #include -#include #include "common_types.h" diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc index d97f1d7..7691a5d 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable.cc @@ -8,14 +8,16 @@ * be found in the AUTHORS file in the root of the source tree. */ +#include "condition_variable_wrapper.h" + #if defined(_WIN32) #include #include "condition_variable_win.h" -#include "condition_variable_wrapper.h" -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include "condition_variable_posix.h" -#include "condition_variable_wrapper.h" +#else +#include // for NULL #endif namespace webrtc { @@ -23,7 +25,7 @@ namespace webrtc { ConditionVariableWrapper* ConditionVariableWrapper::CreateConditionVariable() { #if defined(_WIN32) return new ConditionVariableWindows; -#elif defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#elif defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) return ConditionVariablePosix::Create(); #else return NULL; diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable_posix.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable_posix.cc index a5df728..c62206c 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable_posix.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/condition_variable_posix.cc @@ -79,7 +79,7 @@ bool ConditionVariablePosix::SleepCS(CriticalSectionWrapper& crit_sect, unsigned long max_time_inMS) { const unsigned long INFINITE = 0xFFFFFFFF; const int MILLISECONDS_PER_SECOND = 1000; -#ifndef WEBRTC_LINUX +#if !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) const int MICROSECONDS_PER_MILLISECOND = 1000; #endif const int NANOSECONDS_PER_SECOND = 1000000000; diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu.cc index d81f015..3a3c74f 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu.cc @@ -14,7 +14,7 @@ #include "cpu_win.h" #elif defined(WEBRTC_MAC) #include "cpu_mac.h" -#elif defined(WEBRTC_ANDROID) +#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD) // Not implemented yet, might be possible to use Linux implementation #else // defined(WEBRTC_LINUX) #include "cpu_linux.h" @@ -26,7 +26,7 @@ CpuWrapper* CpuWrapper::CreateCpu() { return new CpuWindows(); #elif defined(WEBRTC_MAC) return new CpuWrapperMac(); -#elif defined(WEBRTC_ANDROID) +#elif defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD) return 0; #else return new CpuLinux(); diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc index dc00700..256d250 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/cpu_info.cc @@ -12,13 +12,15 @@ #if defined(_WIN32) #include -#elif defined(WEBRTC_MAC) -#include +#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include +#include #elif defined(WEBRTC_ANDROID) // Not implemented yet, might be possible to use Linux implementation -#else // defined(WEBRTC_LINUX) +#elif defined(WEBRTC_LINUX) #include +#else // defined(_SC_NPROCESSORS_ONLN) +#include #endif #include "trace.h" @@ -41,8 +43,15 @@ WebRtc_UWord32 CpuInfo::DetectNumberOfCores() { WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Available number of cores:%d", number_of_cores_); -#elif defined(WEBRTC_MAC) - int name[] = {CTL_HW, HW_AVAILCPU}; +#elif defined(WEBRTC_BSD) || defined(WEBRTC_MAC) + int name[] = { + CTL_HW, +#ifdef HW_AVAILCPU + HW_AVAILCPU, +#else + HW_NCPU, +#endif + }; int ncpu; size_t size = sizeof(ncpu); if (0 == sysctl(name, 2, &ncpu, &size, NULL, 0)) { @@ -54,6 +63,8 @@ WebRtc_UWord32 CpuInfo::DetectNumberOfCores() { "Failed to get number of cores"); number_of_cores_ = 1; } +#elif defined(_SC_NPROCESSORS_ONLN) + _numberOfCores = sysconf(_SC_NPROCESSORS_ONLN); #else WEBRTC_TRACE(kTraceWarning, kTraceUtility, -1, "No function to get number of cores"); diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp b/media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp index 2d1529a..8259711 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/spreadsortlib/spreadsort.hpp @@ -21,6 +21,13 @@ Scott McMurray #include "constants.hpp" #include +#ifdef __FreeBSD__ +# include +# if __FreeBSD_version < 900506 +# define getchar boost_getchar +# endif +#endif + namespace boost { namespace detail { //This only works on unsigned data types diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc index 3db5011..604eb91 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/thread_posix.cc @@ -59,6 +59,17 @@ #include #endif +#if defined(__NetBSD__) +#include +#elif defined(__FreeBSD__) +#include +#include +#endif + +#if defined(WEBRTC_BSD) && !defined(__NetBSD__) +#include +#endif + #include "webrtc/system_wrappers/interface/critical_section_wrapper.h" #include "webrtc/system_wrappers/interface/event_wrapper.h" #include "webrtc/system_wrappers/interface/trace.h" @@ -141,6 +152,20 @@ uint32_t ThreadWrapper::GetThreadId() { return static_cast(syscall(__NR_gettid)); #elif defined(WEBRTC_MAC) || defined(WEBRTC_IOS) return pthread_mach_thread_np(pthread_self()); +#elif defined(__NetBSD__) + return _lwp_self(); +#elif defined(__DragonFly__) + return lwp_gettid(); +#elif defined(__OpenBSD__) + return reinterpret_cast (pthread_self()); +#elif defined(__FreeBSD__) +# if __FreeBSD_version > 900030 + return pthread_getthreadid_np(); +# else + long lwpid; + thr_self(&lwpid); + return lwpid; +# endif #else return reinterpret_cast(pthread_self()); #endif @@ -172,7 +197,7 @@ ThreadPosix::~ThreadPosix() { delete crit_state_; } -#define HAS_THREAD_ID !defined(WEBRTC_IOS) && !defined(WEBRTC_MAC) +#define HAS_THREAD_ID !defined(WEBRTC_IOS) && !defined(WEBRTC_MAC) && !defined(WEBRTC_BSD) bool ThreadPosix::Start(unsigned int& thread_id) { @@ -237,13 +262,18 @@ bool ThreadPosix::Start(unsigned int& thread_id) // CPU_ZERO and CPU_SET are not available in NDK r7, so disable // SetAffinity on Android for now. -#if (defined(WEBRTC_LINUX) && (!defined(WEBRTC_ANDROID))) +#if defined(__FreeBSD__) || (defined(WEBRTC_LINUX) && \ + (!defined(WEBRTC_ANDROID))) bool ThreadPosix::SetAffinity(const int* processor_numbers, const unsigned int amount_of_processors) { if (!processor_numbers || (amount_of_processors == 0)) { return false; } +#if defined(__FreeBSD__) + cpuset_t mask; +#else cpu_set_t mask; +#endif CPU_ZERO(&mask); for (unsigned int processor = 0; @@ -251,7 +281,11 @@ bool ThreadPosix::SetAffinity(const int* processor_numbers, ++processor) { CPU_SET(processor_numbers[processor], &mask); } -#if defined(WEBRTC_ANDROID) +#if defined(__FreeBSD__) + const int result = pthread_setaffinity_np(thread_, + sizeof(mask), + &mask); +#elif defined(WEBRTC_ANDROID) // Android. const int result = syscall(__NR_sched_setaffinity, pid_, @@ -325,6 +359,10 @@ void ThreadPosix::Run() { if (set_thread_name_) { #ifdef WEBRTC_LINUX prctl(PR_SET_NAME, (unsigned long)name_, 0, 0, 0); +#elif defined(__NetBSD__) + pthread_setname_np(pthread_self(), "%s", (void *)name_); +#elif defined(WEBRTC_BSD) + pthread_set_name_np(pthread_self(), name_); #endif WEBRTC_TRACE(kTraceStateInfo, kTraceUtility, -1, "Thread with name:%s started ", name_); diff --git a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_posix.cc b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_posix.cc index 2c7e59a..6f23fcb 100644 --- a/media/webrtc/trunk/webrtc/system_wrappers/source/trace_posix.cc +++ b/media/webrtc/trunk/webrtc/system_wrappers/source/trace_posix.cc @@ -54,7 +54,7 @@ WebRtc_Word32 TracePosix::AddTime(char* trace_message, } struct tm buffer; const struct tm* system_time = - localtime_r(&system_time_high_res.tv_sec, &buffer); + localtime_r((const time_t *)(&system_time_high_res.tv_sec), &buffer); const WebRtc_UWord32 ms_time = system_time_high_res.tv_usec / 1000; WebRtc_UWord32 prev_tickCount = 0; diff --git a/media/webrtc/trunk/webrtc/typedefs.h b/media/webrtc/trunk/webrtc/typedefs.h index e82bbef..fec664d 100644 --- a/media/webrtc/trunk/webrtc/typedefs.h +++ b/media/webrtc/trunk/webrtc/typedefs.h @@ -21,7 +21,7 @@ // For access to standard POSIXish features, use WEBRTC_POSIX instead of a // more specific macro. #if defined(WEBRTC_MAC) || defined(WEBRTC_LINUX) || \ - defined(WEBRTC_ANDROID) + defined(WEBRTC_ANDROID) || defined(WEBRTC_BSD) #define WEBRTC_POSIX #endif diff --git a/media/webrtc/trunk/webrtc/video_engine/vie_defines.h b/media/webrtc/trunk/webrtc/video_engine/vie_defines.h index 42c91b5..bed9a06 100644 --- a/media/webrtc/trunk/webrtc/video_engine/vie_defines.h +++ b/media/webrtc/trunk/webrtc/video_engine/vie_defines.h @@ -173,7 +173,7 @@ inline int ChannelId(const int moduleId) { // Linux specific. #ifndef WEBRTC_ANDROID -#ifdef WEBRTC_LINUX +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) // Build information macros. #if defined(_DEBUG) #define BUILDMODE "d" diff --git a/media/webrtc/trunk/webrtc/voice_engine/voe_network_impl.cc b/media/webrtc/trunk/webrtc/voice_engine/voe_network_impl.cc index d0b9895..f6a7f94 100644 --- a/media/webrtc/trunk/webrtc/voice_engine/voe_network_impl.cc +++ b/media/webrtc/trunk/webrtc/voice_engine/voe_network_impl.cc @@ -472,7 +472,7 @@ int VoENetworkImpl::SetSendTOS(int channel, "SetSendTOS(channel=%d, DSCP=%d, useSetSockopt=%d)", channel, DSCP, useSetSockopt); -#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC) +#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC) _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning, "SetSendTOS() is not supported on this platform"); return -1; @@ -528,7 +528,7 @@ int VoENetworkImpl::SetSendTOS(int channel, "SetSendTOS() external transport is enabled"); return -1; } -#if defined(WEBRTC_LINUX) || defined(WEBRTC_MAC) +#if defined(WEBRTC_LINUX) || defined(WEBRTC_BSD) || defined(WEBRTC_MAC) useSetSockopt = true; WEBRTC_TRACE(kTraceInfo, kTraceVoice, VoEId(_shared->instance_id(), -1), " force useSetSockopt=true since there is no alternative" @@ -551,7 +551,7 @@ int VoENetworkImpl::GetSendTOS(int channel, WEBRTC_TRACE(kTraceApiCall, kTraceVoice, VoEId(_shared->instance_id(), -1), "GetSendTOS(channel=%d)", channel); -#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_MAC) +#if !defined(_WIN32) && !defined(WEBRTC_LINUX) && !defined(WEBRTC_BSD) && !defined(WEBRTC_MAC) _shared->SetLastError(VE_FUNC_NOT_SUPPORTED, kTraceWarning, "GetSendTOS() is not supported on this platform"); return -1; diff --git a/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h b/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h index 88fdc7e..3b63a3b 100644 --- a/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h +++ b/media/webrtc/trunk/webrtc/voice_engine/voice_engine_defines.h @@ -414,7 +414,7 @@ namespace webrtc // *** WEBRTC_MAC *** // including iPhone -#ifdef WEBRTC_MAC +#if defined(WEBRTC_BSD) || defined(WEBRTC_MAC) #include #include @@ -431,6 +431,7 @@ namespace webrtc #include #include #include +#if !defined(WEBRTC_BSD) #include #if !defined(WEBRTC_IOS) #include @@ -439,6 +440,7 @@ namespace webrtc #include #include #endif +#endif #define DWORD unsigned long int #define WINAPI @@ -531,7 +533,7 @@ namespace webrtc #else #define IPHONE_NOT_SUPPORTED(stat) -#endif // #ifdef WEBRTC_MAC +#endif // #if defined(WEBRTC_BSD) || defined(WEBRTC_MAC) diff --git a/media/webrtc/webrtc_config.gypi b/media/webrtc/webrtc_config.gypi index 2a5d23d..ef770c6 100644 --- a/media/webrtc/webrtc_config.gypi +++ b/media/webrtc/webrtc_config.gypi @@ -14,7 +14,6 @@ 'include_internal_video_render': 0, 'clang_use_chrome_plugins': 0, 'enable_protobuf': 0, - 'include_pulse_audio': 0, 'include_tests': 0, # use_system_lib* still seems to be in use in trunk/build 'use_system_libjpeg': 0, diff --git a/netwerk/sctp/src/Makefile.in b/netwerk/sctp/src/Makefile.in index 28af07a..2eb286b 100644 --- a/netwerk/sctp/src/Makefile.in +++ b/netwerk/sctp/src/Makefile.in @@ -114,11 +114,18 @@ DEFINES += \ -U__FreeBSD__ \ $(NULL) else +ifeq ($(OS_TARGET),NetBSD) +DEFINES += \ + -D__Userspace_os_NetBSD=1 \ + -U__NetBSD__ \ + $(NULL) +else #error Unsupported platform! endif endif endif endif +endif include $(topsrcdir)/config/config.mk include $(topsrcdir)/ipc/chromium/chromium-config.mk diff --git a/netwerk/sctp/src/netinet/sctp_os_userspace.h b/netwerk/sctp/src/netinet/sctp_os_userspace.h index b1a555b..f692499 100755 --- a/netwerk/sctp/src/netinet/sctp_os_userspace.h +++ b/netwerk/sctp/src/netinet/sctp_os_userspace.h @@ -395,7 +395,9 @@ typedef pthread_t userland_thread_t; #define MA_OWNED 7 /* sys/mutex.h typically on FreeBSD */ #if !defined(__Userspace_os_FreeBSD) struct mtx {int dummy;}; +#if !defined(__Userspace_os_NetBSD) struct selinfo {int dummy;}; +#endif struct sx {int dummy;}; #endif diff --git a/netwerk/sctp/src/user_recv_thread.c b/netwerk/sctp/src/user_recv_thread.c index e420a64..600c0cc 100755 --- a/netwerk/sctp/src/user_recv_thread.c +++ b/netwerk/sctp/src/user_recv_thread.c @@ -35,7 +35,7 @@ #include #include #include -#if !defined(__Userspace_os_FreeBSD) +#if !defined(__Userspace_os_FreeBSD) && !defined(__Userspace_os_NetBSD) #include #else #include diff --git a/netwerk/sctp/src/user_socketvar.h b/netwerk/sctp/src/user_socketvar.h index 0ebdd21..db73633 100755 --- a/netwerk/sctp/src/user_socketvar.h +++ b/netwerk/sctp/src/user_socketvar.h @@ -47,7 +47,7 @@ /* #include was 0 byte file */ /* #include was 0 byte file */ /* #include */ /*__Userspace__ alternative?*/ -#if !defined(__Userspace_os_Windows) && !defined(__Userspace_os_FreeBSD) +#if !defined(__Userspace_os_Windows) && !defined(__Userspace_os_FreeBSD) && !defined(__Userspace_os_NetBSD) #include #endif #define SOCK_MAXADDRLEN 255 @@ -64,16 +64,18 @@ #define ERESTART (-1) #endif -#if !defined(__Userspace_os_Darwin) +#if !defined(__Userspace_os_Darwin) && !defined(__Userspace_os_NetBSD) enum uio_rw { UIO_READ, UIO_WRITE }; #endif +#if !defined(__Userspace_os_NetBSD) /* Segment flag values. */ enum uio_seg { UIO_USERSPACE, /* from user data space */ UIO_SYSSPACE, /* from system space */ UIO_NOCOPY /* don't copy, already in object */ }; +#endif struct proc { int stub; /* struct proc is a dummy for __Userspace__ */ diff --git a/nsprpub/pr/include/private/pprthred.h b/nsprpub/pr/include/private/pprthred.h index eb60bae..e88d217 100644 --- a/nsprpub/pr/include/private/pprthred.h +++ b/nsprpub/pr/include/private/pprthred.h @@ -19,6 +19,8 @@ #include #endif +#include + PR_BEGIN_EXTERN_C /*--------------------------------------------------------------------------- @@ -59,7 +61,7 @@ NSPR_API(void) PR_DetachThread(void); ** Get the id of the named thread. Each thread is assigned a unique id ** when it is created or attached. */ -NSPR_API(PRUint32) PR_GetThreadID(PRThread *thread); +NSPR_API(pthread_t) PR_GetThreadID(PRThread *thread); /* ** Set the procedure that is called when a thread is dumped. The procedure diff --git a/nsprpub/pr/src/pthreads/ptthread.c b/nsprpub/pr/src/pthreads/ptthread.c index abc2760..7619317 100644 --- a/nsprpub/pr/src/pthreads/ptthread.c +++ b/nsprpub/pr/src/pthreads/ptthread.c @@ -1099,12 +1099,12 @@ PR_IMPLEMENT(void) PR_ProcessExit(PRIntn status) _exit(status); } -PR_IMPLEMENT(PRUint32) PR_GetThreadID(PRThread *thred) +PR_IMPLEMENT(pthread_t) PR_GetThreadID(PRThread *thred) { #if defined(_PR_DCETHREADS) return (PRUint32)&thred->id; /* this is really a sham! */ #else - return (PRUint32)thred->id; /* and I don't know what they will do with it */ + return thred->id; /* and I don't know what they will do with it */ #endif } diff --git a/security/coreconf/SunOS5.mk b/security/coreconf/SunOS5.mk index 57cc8b8..355cfe1 100644 --- a/security/coreconf/SunOS5.mk +++ b/security/coreconf/SunOS5.mk @@ -113,6 +113,10 @@ endif endif DSO_LDOPTS += -z combreloc -z defs -z ignore +ifdef LIBRUNPATH +DSO_LDOPTS += -R$(LIBRUNPATH) +endif + # -KPIC generates position independent code for use in shared libraries. # (Similarly for -fPIC in case of gcc.) ifdef NS_USE_GCC diff --git a/security/manager/ssl/src/nsNSSComponent.cpp b/security/manager/ssl/src/nsNSSComponent.cpp index ed0499b..1922b58 100644 --- a/security/manager/ssl/src/nsNSSComponent.cpp +++ b/security/manager/ssl/src/nsNSSComponent.cpp @@ -72,6 +72,7 @@ #include "nss.h" #include "pk11func.h" #include "ssl.h" +#define NSS_ENABLE_ECC 1 #include "sslproto.h" #include "secmod.h" #include "sechash.h" diff --git a/security/nss/lib/freebl/Makefile b/security/nss/lib/freebl/Makefile index 9b4b095..b0e459a 100644 --- a/security/nss/lib/freebl/Makefile +++ b/security/nss/lib/freebl/Makefile @@ -257,7 +257,7 @@ endif # to bind the blapi function references in FREEBLVector vector # (ldvector.c) to the blapi functions defined in the freebl # shared libraries. -ifeq (,$(filter-out BSD_OS FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) +ifeq (,$(filter-out BSD_OS DragonFly FreeBSD Linux NetBSD OpenBSD, $(OS_TARGET))) MKSHLIB += -Wl,-Bsymbolic endif diff --git a/security/nss/lib/freebl/blapi.h b/security/nss/lib/freebl/blapi.h index b94edfc..91c4267 100644 --- a/security/nss/lib/freebl/blapi.h +++ b/security/nss/lib/freebl/blapi.h @@ -1022,6 +1022,8 @@ extern void SHA1_DestroyContext(SHA1Context *cx, PRBool freeit); */ extern void SHA1_Begin(SHA1Context *cx); +#define SHA1_Update NSS_SHA1_Update + /* ** Update the SHA-1 hash function with more data. ** "cx" the context diff --git a/security/nss/lib/freebl/sha-fast-amd64-sun.s b/security/nss/lib/freebl/sha-fast-amd64-sun.s index 71996f0..8c7ed94 100644 --- a/security/nss/lib/freebl/sha-fast-amd64-sun.s +++ b/security/nss/lib/freebl/sha-fast-amd64-sun.s @@ -1680,9 +1680,9 @@ shaCompress: .LFE7: .size shaCompress, .-shaCompress .align 16 -.globl SHA1_Update - .type SHA1_Update, @function -SHA1_Update: +.globl NSS_SHA1_Update + .type NSS_SHA1_Update, @function +NSS_SHA1_Update: .LFB5: pushq %rbp .LCFI5: @@ -1768,7 +1768,7 @@ SHA1_Update: call shaCompress jmp .L245 .LFE5: - .size SHA1_Update, .-SHA1_Update + .size NSS_SHA1_Update, .-NSS_SHA1_Update .section .rodata .align 32 .type bulk_pad.0, @object @@ -1870,7 +1870,7 @@ SHA1_End: subl %r8d, %edx andl $63, %edx incl %edx - call SHA1_Update@PLT + call NSS_SHA1_Update@PLT movq %rbx, %rdi movq %r12, %rsi shrq $32, %rdi @@ -1986,7 +1986,7 @@ SHA1_HashBuf: movl %r12d, %edx movq %r13, %rsi movq %rbx, %rdi - call SHA1_Update@PLT + call NSS_SHA1_Update@PLT leaq -292(%rbp), %rdx movq %r14, %rsi movq %rbx, %rdi diff --git a/storage/src/SQLiteMutex.h b/storage/src/SQLiteMutex.h index bd0ed6c..b097a81 100644 --- a/storage/src/SQLiteMutex.h +++ b/storage/src/SQLiteMutex.h @@ -108,15 +108,19 @@ public: void assertCurrentThreadOwns() { NS_ASSERTION(mMutex, "No mutex associated with this wrapper!"); +#if 0 /* XXX tnn: this breaks the debug build. */ NS_ASSERTION(sqlite3_mutex_held(mMutex), "Mutex is not held, but we expect it to be!"); +#endif } void assertNotCurrentThreadOwns() { NS_ASSERTION(mMutex, "No mutex associated with this wrapper!"); +#if 0 /* XXX tnn: this breaks the debug build. */ NS_ASSERTION(sqlite3_mutex_notheld(mMutex), "Mutex is held, but we expect it to not be!"); +#endif } #endif // ifndef DEBUG diff --git a/storage/src/mozStorageConnection.cpp b/storage/src/mozStorageConnection.cpp index da19f6e..54c77dd 100644 --- a/storage/src/mozStorageConnection.cpp +++ b/storage/src/mozStorageConnection.cpp @@ -635,6 +635,11 @@ Connection::initializeInternal(nsIFile* aDatabaseFile) break; } + // XXX tnn: the configure script demands that sqlite3 is compiled with + // SECURE_DELETE on by default. sqlite3 in pkgsrc does not have that, + // so instead we enable secure_delete manually here. + (void)ExecuteSimpleSQL(NS_LITERAL_CSTRING("PRAGMA secure_delete = 1;")); + return NS_OK; } diff --git a/toolkit/library/Makefile.in b/toolkit/library/Makefile.in index b3e3f86..2041025 100644 --- a/toolkit/library/Makefile.in +++ b/toolkit/library/Makefile.in @@ -405,6 +405,7 @@ endif EXTRA_DSO_LDOPTS += $(call EXPAND_LIBNAME_PATH,gkmedias,$(DIST)/lib) ifdef MOZ_WEBRTC +EXTRA_DSO_LDOPTS += $(MOZ_LIBV4L2_LIBS) ifdef MOZ_PEERCONNECTION COMPONENT_LIBS += peerconnection endif diff --git a/toolkit/mozapps/installer/packager.mk b/toolkit/mozapps/installer/packager.mk index 27b6e40..341d54c 100644 --- a/toolkit/mozapps/installer/packager.mk +++ b/toolkit/mozapps/installer/packager.mk @@ -652,8 +652,8 @@ endif (cd $(DIST)/$(MOZ_PKG_DIR) && $(TAR) --exclude=precomplete $(TAR_CREATE_FLAGS) - .) | \ (cd $(DESTDIR)$(installdir) && tar -xf -) $(NSINSTALL) -D $(DESTDIR)$(bindir) - $(RM) -f $(DESTDIR)$(bindir)/$(MOZ_APP_NAME) - ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir) + $(RM) -f $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME) + ln -s $(installdir)/$(MOZ_APP_NAME) $(DESTDIR)$(bindir)/$(MOZILLA_PKG_NAME) ifdef INSTALL_SDK # Here comes the hard part $(NSINSTALL) -D $(DESTDIR)$(includedir) (cd $(DIST)/include && $(TAR) $(TAR_CREATE_FLAGS) - .) | \ diff --git a/toolkit/toolkit-tiers.mk b/toolkit/toolkit-tiers.mk index 798d3c3..f80e2e1 100644 --- a/toolkit/toolkit-tiers.mk +++ b/toolkit/toolkit-tiers.mk @@ -63,7 +63,7 @@ ifdef MOZ_UPDATER ifndef MOZ_NATIVE_BZ2 tier_platform_dirs += modules/libbz2 endif -tier_platform_dirs += other-licenses/bsdiff +#tier_platform_dirs += other-licenses/bsdiff endif tier_platform_dirs += gfx/qcms diff --git a/xpcom/Makefile.in b/xpcom/Makefile.in index 66fa77a..34b3d9a 100644 --- a/xpcom/Makefile.in +++ b/xpcom/Makefile.in @@ -35,6 +35,10 @@ DIRS += windbgdlg endif endif +ifeq ($(OS_ARCH),NetBSD) +EXTRA_DSO_LDOPTS += -Wl,-rpath,${PREFIX}/lib/xulrunner/sdk/lib +endif + ifdef ENABLE_TESTS TOOL_DIRS += \ tests \ diff --git a/xpcom/ds/TimeStamp.h b/xpcom/ds/TimeStamp.h index 0fa3de9..530248d 100644 --- a/xpcom/ds/TimeStamp.h +++ b/xpcom/ds/TimeStamp.h @@ -151,11 +151,11 @@ private: // NOTE: this MUST be a >= test, because int64_t(double(INT64_MAX)) // overflows and gives INT64_MIN. if (aTicks >= double(INT64_MAX)) - return TimeDuration::FromTicks(INT64_MAX); + return TimeDuration::FromTicks(int64_t(INT64_MAX)); // This MUST be a <= test. if (aTicks <= double(INT64_MIN)) - return TimeDuration::FromTicks(INT64_MIN); + return TimeDuration::FromTicks(int64_t(INT64_MIN)); return TimeDuration::FromTicks(int64_t(aTicks)); } diff --git a/xpcom/io/nsMultiplexInputStream.cpp b/xpcom/io/nsMultiplexInputStream.cpp index 03accc8..bc1ada2 100644 --- a/xpcom/io/nsMultiplexInputStream.cpp +++ b/xpcom/io/nsMultiplexInputStream.cpp @@ -529,7 +529,7 @@ nsMultiplexInputStream::Seek(int32_t aWhence, int64_t aOffset) rv = stream->Tell(&avail); NS_ENSURE_SUCCESS(rv, rv); - int64_t newPos = streamPos + XPCOM_MIN(avail, std::abs(remaining)); + int64_t newPos = streamPos + XPCOM_MIN(avail, (int64_t)std::abs(remaining)); rv = stream->Seek(NS_SEEK_END, -newPos); NS_ENSURE_SUCCESS(rv, rv); diff --git a/xpcom/reflect/xptcall/src/md/unix/Makefile.in b/xpcom/reflect/xptcall/src/md/unix/Makefile.in index c4a9807..e1722b1 100644 --- a/xpcom/reflect/xptcall/src/md/unix/Makefile.in +++ b/xpcom/reflect/xptcall/src/md/unix/Makefile.in @@ -50,7 +50,7 @@ endif endif endif -ifneq (,$(filter NetBSD OpenBSD GNU,$(OS_ARCH))) +ifneq (,$(filter GNU,$(OS_ARCH))) ifeq (86,$(findstring 86,$(OS_TEST))) CPPSRCS := xptcinvoke_gcc_x86_unix.cpp xptcstubs_gcc_x86_unix.cpp endif @@ -59,7 +59,7 @@ endif # New code for Linux, et. al., with gcc # Migrate other platforms here after testing # -ifneq (,$(filter Linux FreeBSD GNU_%,$(OS_ARCH))) +ifneq (,$(filter Linux FreeBSD DragonFly NetBSD OpenBSD GNU_%,$(OS_ARCH))) # Linux/x86-64 ifeq (x86_64,$(OS_TEST)) CPPSRCS := xptcinvoke_x86_64_unix.cpp xptcstubs_x86_64_linux.cpp @@ -158,7 +158,7 @@ endif # NetBSD/ARM # ifeq ($(OS_ARCH),NetBSD) -ifneq (,$(filter arm% sa110,$(OS_TEST))) +ifneq (,$(filter arm%,$(TARGET_CPU))) CPPSRCS := xptcinvoke_arm_netbsd.cpp xptcstubs_arm_netbsd.cpp endif endif @@ -215,7 +215,7 @@ endif # NetBSD/m68k # ifeq ($(OS_ARCH),NetBSD) -ifneq (,$(filter amiga atari hp300 mac68k mvme68k next68k sun3 sun3x x68k,$(OS_TEST))) +ifneq (,$(filter m68k,$(TARGET_CPU))) CPPSRCS := xptcinvoke_netbsd_m68k.cpp xptcstubs_netbsd_m68k.cpp endif endif @@ -287,7 +287,7 @@ endif # # NetBSD/PPC # -ifneq (,$(filter NetBSDmacppc NetBSDbebox NetBSDofppc NetBSDprep NetBSDamigappc,$(OS_ARCH)$(OS_TEST))) +ifeq ($(OS_ARCH)$(OS_TEST),NetBSDpowerpc) CPPSRCS := xptcinvoke_ppc_netbsd.cpp xptcstubs_ppc_netbsd.cpp ASFILES := xptcinvoke_asm_ppc_netbsd.s xptcstubs_asm_ppc_netbsd.s endif @@ -346,6 +346,13 @@ CPPSRCS := xptcinvoke_sparc64_openbsd.cpp xptcstubs_sparc64_openbsd.cpp ASFILES := xptcinvoke_asm_sparc64_openbsd.s xptcstubs_asm_sparc64_openbsd.s endif # +# NetBSD/SPARC64 +# +ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc64) +CPPSRCS := xptcinvoke_sparc64_netbsd.cpp xptcstubs_sparc64_netbsd.cpp +ASFILES := xptcinvoke_asm_sparc64_netbsd.s xptcstubs_asm_sparc64_netbsd.s +endif +# # Solaris/SPARC # ifeq ($(OS_ARCH),SunOS) diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s index a3e3b8a..2f6cb0b 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_mips.s @@ -16,6 +16,47 @@ #include #endif +#ifdef __NetBSD__ +# include +# include +# ifndef fp +# define fp s8 +# endif +# ifndef PTRLOG +# if SZREG == 4 +# define PTRLOG 2 +# else +# define PTRLOG 3 +# endif +# endif +# ifndef SETUP_GP +# if defined(__mips_o32) +# define SETUP_GP \ + .set push; \ + .set noreorder; \ + .cpload t9; \ + .set pop +# define SAVE_GP(x) \ + .cprestore x +# else +# define SETUP_GP +# define SAVE_GP(x) +# endif +# endif +# ifndef ALSZ +# if defined(__mips_n32) || defined(__mips_n64) +# define ALSZ 15 +# define ALMASK ~15 +# else +# define ALSZ 7 +# define ALMASK ~7 +# endif +# endif +#else +# include +# include +#endif + # NARGSAVE is the argument space in the callers frame, including extra # 'shadowed' space for the argument registers. The minimum of 4 # argument slots is sometimes predefined in the header files. diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s index 33650f3..1fd8a7d 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_ppc_netbsd.s @@ -20,41 +20,42 @@ .section ".text" .align 2 - .globl XPTC_InvokeByIndex - .type XPTC_InvokeByIndex,@function + .globl NS_InvokeByIndex_P + .type NS_InvokeByIndex_P,@function -# -# XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex, -# uint32_t paramCount, nsXPTCVariant* params) -# +// +// NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, +// PRUint32 paramCount, nsXPTCVariant* params) +// + +NS_InvokeByIndex_P: + stwu sp,-32(sp) // setup standard stack frame + mflr r0 // save LR + stw r3,8(sp) // r3 <= that + stw r4,12(sp) // r4 <= methodIndex -XPTC_InvokeByIndex: - stwu sp,-32(sp) # setup standard stack frame - mflr r0 # save LR - stw r3,8(sp) # r3 <= that - stw r4,12(sp) # r4 <= methodIndex stw r30,16(sp) stw r31,20(sp) - stw r0,36(sp) # store LR backchain + stw r0,36(sp) // store LR backchain mr r31,sp - rlwinm r10,r5,3,0,27 # r10 = (ParamCount * 2 * 4) & ~0x0f - addi r0,r10,96 # reserve stack for GPR and FPR register save area r0 = r10 + 96 - lwz r9,0(sp) # r9 = backchain + rlwinm r10,r5,3,0,27 // r10 = (ParamCount * 2 * 4) & ~0x0f + addi r0,r10,96 // reserve stack for GPR and FPR register save area r0 = r10 + 96 + lwz r9,0(sp) // r9 = backchain neg r0,r0 - stwux r9,sp,r0 # reserve stack sapce and save SP backchain + stwux r9,sp,r0 // reserve stack sapce and save SP backchain - addi r3,sp,8 # r3 <= args - mr r4,r5 # r4 <= paramCount - mr r5,r6 # r5 <= params - add r6,r3,r10 # r6 <= gpregs ( == args + r10 ) - mr r30,r6 # store in r30 for use later... - addi r7,r6,32 # r7 <= fpregs ( == gpregs + 32 ) + addi r3,sp,8 // r3 <= args + mr r4,r5 // r4 <= paramCount + mr r5,r6 // r5 <= params + add r6,r3,r10 // r6 <= gpregs ( == args + r10 ) + mr r30,r6 // store in r30 for use later... + addi r7,r6,32 // r7 <= fpregs ( == gpregs + 32 ) - bl invoke_copy_to_stack@local # (args, paramCount, params, gpregs, fpregs) + bl invoke_copy_to_stack@local // (args, paramCount, params, gpregs, fpregs) - lfd f1,32(r30) # load FP registers with method parameters + lfd f1,32(r30) // load FP registers with method parameters lfd f2,40(r30) lfd f3,48(r30) lfd f4,56(r30) diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_netbsd.s b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_netbsd.s new file mode 100644 index 0000000..c501f4f --- /dev/null +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_asm_sparc64_netbsd.s @@ -0,0 +1,112 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + .global NS_InvokeByIndex_P + .type NS_InvokeByIndex_P, #function +/* + NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, + PRUint32 paramCount, nsXPTCVariant* params); + +*/ +/* + * Note: To simplify stack handling we allocate an extra stack + * frame here. In principle invoke_copy_to_stack() could + * save the parameters our caller's frame and we could + * reclaim the stackframe and do a tail call to the + * function. However, this gets complicated.... + * + * The vtable consist of be: + * + * struct { + * short __delta; + * short __index; + * union { + * P __pfn; + * short __delta2; + * } __pfn_or_delta2; + * }; + * + * See gcc/cp/cp-tree.h + */ + +NS_InvokeByIndex_P: + save %sp,-(128 + 64),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 64 + sll %i2,4,%l0 ! assume the worst case + ! paramCount * 2 * 8 bytes + cmp %l0, 0 ! are there any args? If not, + be .invoke ! no need to copy args to stack + nop + + sub %sp,%l0,%sp ! create the additional stack space + add %sp,0x7ff+136,%o0 ! step past the register window, the + ! struct result pointer and the 'this' slot + mov %i2,%o1 ! paramCount + call invoke_copy_to_stack + mov %i3,%o2 ! params + +! +! load arguments from stack into the outgoing registers +! BIAS is 0x7ff (2047) +! + +! load the %o1..5 64bit (extended word) output registers registers + ldx [%sp + 0x7ff + 136],%o1 ! %i1 + ldx [%sp + 0x7ff + 144],%o2 ! %i2 + ldx [%sp + 0x7ff + 152],%o3 ! %i3 + ldx [%sp + 0x7ff + 160],%o4 ! %i4 + ldx [%sp + 0x7ff + 168],%o5 ! %i5 + +! load the even number double registers starting with %f2 + ldd [%sp + 0x7ff + 136],%f2 + ldd [%sp + 0x7ff + 144],%f4 + ldd [%sp + 0x7ff + 152],%f6 + ldd [%sp + 0x7ff + 160],%f8 + ldd [%sp + 0x7ff + 168],%f10 + ldd [%sp + 0x7ff + 176],%f12 + ldd [%sp + 0x7ff + 184],%f14 + ldd [%sp + 0x7ff + 192],%f16 + ldd [%sp + 0x7ff + 200],%f18 + ldd [%sp + 0x7ff + 208],%f20 + ldd [%sp + 0x7ff + 216],%f22 + ldd [%sp + 0x7ff + 224],%f24 + ldd [%sp + 0x7ff + 232],%f26 + ldd [%sp + 0x7ff + 240],%f28 + ldd [%sp + 0x7ff + 248],%f30 + +! +! calculate the target address from the vtable +! +.invoke: + sll %i1,3,%l0 ! index *= 8 + ldx [%i0],%l1 ! *this --> address of vtable + ldx [%l0 + %l1],%l0 ! this->vtable[index] --> address + + jmpl %l0,%o7 ! call the routine + mov %i0,%o0 ! move 'this' pointer to out register + + mov %o0,%i0 ! propagate return value + ret + restore + + .size NS_InvokeByIndex_P, .-NS_InvokeByIndex_P diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp index fce1c53..6dcb848 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_gcc_x86_unix.cpp @@ -9,7 +9,7 @@ #include "xptc_gcc_x86_unix.h" extern "C" { -static void ATTRIBUTE_USED __attribute__ ((regparm(3))) +void ATTRIBUTE_USED __attribute__ ((regparm(3))) invoke_copy_to_stack(uint32_t paramCount, nsXPTCVariant* s, uint32_t* d) { for(uint32_t i = paramCount; i >0; i--, d++, s++) diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp index 47e0e76..995607f 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_netbsd_m68k.cpp @@ -100,6 +100,15 @@ extern "C" { } } +/* + * SYMBOL PREFIX must be "_" for aout symbols and "" for ELF + */ +#ifndef __ELF__ +#define SYMBOLPREFIX "_" +#else +#define SYMBOLPREFIX +#endif + XPTC_PUBLIC_API(nsresult) XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex, uint32_t paramCount, nsXPTCVariant* params) @@ -107,30 +116,30 @@ XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex, uint32_t result; __asm__ __volatile__( - "movl %4, sp@-\n\t" - "movl %3, sp@-\n\t" - "jbsr _invoke_count_words\n\t" /* count words */ - "addql #8, sp\n\t" - "lsll #2, d0\n\t" /* *= 4 */ - "movl sp, a2\n\t" /* save original sp */ - "subl d0, sp\n\t" /* make room for params */ - "movl sp, a0\n\t" - "movl %4, sp@-\n\t" - "movl %3, sp@-\n\t" - "movl a0, sp@-\n\t" - "jbsr _invoke_copy_to_stack\n\t" /* copy params */ - "addl #12, sp\n\t" - "movl %1, a0\n\t" - "movl a0@, a1\n\t" - "movl %2, d0\n\t" /* function index */ - "movl a0, d1\n\t" - "movw a1@(8,d0:l:8), a0\n\t" - "addl a0, d1\n\t" - "movl a1@(12,d0:l:8), a1\n\t" - "movl d1, sp@-\n\t" - "jbsr a1@\n\t" - "movl a2, sp\n\t" /* restore original sp */ - "movl d0, %0\n\t" + "movl %4, %%sp@-\n\t" + "movl %3, %%sp@-\n\t" + "jbsr "SYMBOLPREFIX"invoke_count_words\n\t" /* count words */ + "addql #8, %%sp\n\t" + "lsll #2, %%d0\n\t" /* *= 4 */ + "movl %%sp, %%a2\n\t" /* save original sp */ + "subl %%d0, %%sp\n\t" /* make room for params */ + "movl %%sp, %%a0\n\t" + "movl %4, %%sp@-\n\t" + "movl %3, %%sp@-\n\t" + "movl %%a0, %%sp@-\n\t" + "jbsr "SYMBOLPREFIX"invoke_copy_to_stack\n\t" /* copy params */ + "addl #12, %%sp\n\t" + "movl %1, %%a0\n\t" + "movl %%a0@, %%a1\n\t" + "movl %2, %%d0\n\t" /* function index */ + "movl %%a0, %%d1\n\t" + "movw %%a1@(8,%%d0:l:8), %%a0\n\t" + "addl %%a0, %%d1\n\t" + "movl %%a1@(12,%%d0:l:8), %%a1\n\t" + "movl %%d1, %%sp@-\n\t" + "jbsr %%a1@\n\t" + "movl %%a2, %%sp\n\t" /* restore original sp */ + "movl %%d0, %0\n\t" : "=g" (result) /* %0 */ : "g" (that), /* %1 */ "g" (methodIndex), /* %2 */ diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp index 069d608..9f9d8af 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_ppc_netbsd.cpp @@ -5,9 +5,9 @@ // Platform specific code to invoke XPCOM methods on native objects -// The purpose of XPTC_InvokeByIndex() is to map a platform +// The purpose of NS_InvokeByIndex_P() is to map a platform // indepenpent call to the platform ABI. To do that, -// XPTC_InvokeByIndex() has to determine the method to call via vtable +// NS_InvokeByIndex_P() has to determine the method to call via vtable // access. The parameters for the method are read from the // nsXPTCVariant* and prepared for the native ABI. For the Linux/PPC // ABI this means that the first 8 integral and floating point @@ -69,8 +69,10 @@ invoke_copy_to_stack(uint32_t* d, if ((uint32_t) d & 4) d++; // doubles are 8-byte aligned on stack *((double*) d) = s->val.d; d += 2; +#if __GXX_ABI_VERSION < 100 if (gpr < GPR_COUNT) gpr += 2; +#endif } } else if (!s->IsPtrData() && s->type == nsXPTType::T_FLOAT) { @@ -79,8 +81,10 @@ invoke_copy_to_stack(uint32_t* d, else { *((float*) d) = s->val.f; d += 1; +#if __GXX_ABI_VERSION < 100 if (gpr < GPR_COUNT) gpr += 1; +#endif } } else if (!s->IsPtrData() && (s->type == nsXPTType::T_I64 @@ -107,6 +111,6 @@ invoke_copy_to_stack(uint32_t* d, } extern "C" -XPTC_PUBLIC_API(nsresult) -XPTC_InvokeByIndex(nsISupports* that, uint32_t methodIndex, +EXPORT_XPCOM_API(nsresult) +NS_InvokeByIndex_P(nsISupports* that, PRUint32 methodIndex, uint32_t paramCount, nsXPTCVariant* params); diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp new file mode 100644 index 0000000..82d7c9c --- /dev/null +++ b/xpcom/reflect/xptcall/src/md/unix/xptcinvoke_sparc64_netbsd.cpp @@ -0,0 +1,84 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1998 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Platform specific code to invoke XPCOM methods on native objects */ + +#include "xptcprivate.h" + +#if !defined(__sparc64__) && !defined(_LP64) +#error "This code is for Sparc64 only" +#endif + +extern "C" PRUint32 +invoke_copy_to_stack(PRUint64* d, PRUint32 paramCount, nsXPTCVariant* s) +{ + /* + We need to copy the parameters for this function to locals and use them + from there since the parameters occupy the same stack space as the stack + we're trying to populate. + */ + PRUint64 *l_d = d; + nsXPTCVariant *l_s = s; + PRUint64 l_paramCount = paramCount; + PRUint64 regCount = 0; // return the number of registers to load from the stack + + for(PRUint64 i = 0; i < l_paramCount; i++, l_d++, l_s++) + { + if (regCount < 5) regCount++; + + if (l_s->IsPtrData()) + { + *l_d = (PRUint64)l_s->ptr; + continue; + } + switch (l_s->type) + { + case nsXPTType::T_I8 : *((PRInt64*)l_d) = l_s->val.i8; break; + case nsXPTType::T_I16 : *((PRInt64*)l_d) = l_s->val.i16; break; + case nsXPTType::T_I32 : *((PRInt64*)l_d) = l_s->val.i32; break; + case nsXPTType::T_I64 : *((PRInt64*)l_d) = l_s->val.i64; break; + + case nsXPTType::T_U8 : *((PRUint64*)l_d) = l_s->val.u8; break; + case nsXPTType::T_U16 : *((PRUint64*)l_d) = l_s->val.u16; break; + case nsXPTType::T_U32 : *((PRUint64*)l_d) = l_s->val.u32; break; + case nsXPTType::T_U64 : *((PRUint64*)l_d) = l_s->val.u64; break; + + /* in the case of floats, we want to put the bits in to the + 64bit space right justified... floats in the paramter array on + sparcv9 use odd numbered registers.. %f1, %f3, so we have to skip + the space that would be occupied by %f0, %f2, etc. + */ + case nsXPTType::T_FLOAT : *(((float*)l_d) + 1) = l_s->val.f; break; + case nsXPTType::T_DOUBLE: *((double*)l_d) = l_s->val.d; break; + case nsXPTType::T_BOOL : *((PRInt64*)l_d) = l_s->val.b; break; + case nsXPTType::T_CHAR : *((PRUint64*)l_d) = l_s->val.c; break; + case nsXPTType::T_WCHAR : *((PRInt64*)l_d) = l_s->val.wc; break; + + default: + // all the others are plain pointer types + *((void**)l_d) = l_s->val.p; + break; + } + } + + return regCount; +} diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp index e626af1..f8189b4 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_arm_netbsd.cpp @@ -86,18 +86,23 @@ PrepareAndDispatch(nsXPTCStubBase* self, uint32_t methodIndex, uint32_t* args) * so they are contiguous with values passed on the stack, and then calls * PrepareAndDispatch() to do the dirty work. */ +#ifndef __ELF__ +#define SYMBOLPREFIX "_" +#else +#define SYMBOLPREFIX +#endif #define STUB_ENTRY(n) \ __asm__( \ - ".global _Stub"#n"__14nsXPTCStubBase\n\t" \ -"_Stub"#n"__14nsXPTCStubBase:\n\t" \ + ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \ +SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \ "stmfd sp!, {r1, r2, r3} \n\t" \ "mov ip, sp \n\t" \ "stmfd sp!, {fp, ip, lr, pc} \n\t" \ "sub fp, ip, #4 \n\t" \ "mov r1, #"#n" \n\t" /* = methodIndex */ \ "add r2, sp, #16 \n\t" \ - "bl _PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \ + "bl "SYMBOLPREFIX"PrepareAndDispatch__FP14nsXPTCStubBaseUiPUi \n\t" \ "ldmea fp, {fp, sp, lr} \n\t" \ "add sp, sp, #12 \n\t" \ "mov pc, lr \n\t" \ diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s index d173016..add92fd 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_mips.s @@ -14,6 +14,47 @@ #include #endif +#ifdef __NetBSD__ +# include +# include +# ifndef fp +# define fp s8 +# endif +# ifndef PTRLOG +# if SZREG == 4 +# define PTRLOG 2 +# else +# define PTRLOG 3 +# endif +# endif +# ifndef SETUP_GP +# if defined(__mips_o32) +# define SETUP_GP \ + .set push; \ + .set noreorder; \ + .cpload t9; \ + .set pop +# define SAVE_GP(x) \ + .cprestore x +# else +# define SETUP_GP +# define SAVE_GP(x) +# endif +# endif +# ifndef ALSZ +# if defined(__mips_n32) || defined(__mips_n64) +# define ALSZ 15 +# define ALMASK ~15 +# else +# define ALSZ 7 +# define ALMASK ~7 +# endif +# endif +#else +# include +# include +#endif + # NARGSAVE is the argument space in the callers frame, including extra # 'shadowed' space for the argument registers. The minimum of 4 # argument slots is sometimes predefined in the header files. diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s index 8d43165..1ce0f2d 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_netbsd.s @@ -25,23 +25,23 @@ .type SharedStub,@function SharedStub: - stwu sp,-112(sp) # room for - # linkage (8), - # gprData (32), - # fprData (64), - # stack alignment(8) + stwu sp,-112(sp) // room for + // linkage (8), + // gprData (32), + // fprData (64), + // stack alignment(8) mflr r0 - stw r0,116(sp) # save LR backchain + stw r0,116(sp) // save LR backchain - stw r4,12(sp) # save GP registers - stw r5,16(sp) # (n.b. that we don't save r3 - stw r6,20(sp) # because PrepareAndDispatch() is savvy) + stw r4,12(sp) // save GP registers + stw r5,16(sp) // (n.b. that we don't save r3 + stw r6,20(sp) // because PrepareAndDispatch() is savvy) stw r7,24(sp) stw r8,28(sp) stw r9,32(sp) stw r10,36(sp) - stfd f1,40(sp) # save FP registers + stfd f1,40(sp) // save FP registers stfd f2,48(sp) stfd f3,56(sp) stfd f4,64(sp) @@ -50,21 +50,21 @@ SharedStub: stfd f7,88(sp) stfd f8,96(sp) - # r3 has the 'self' pointer already + // r3 has the 'self' pointer already - mr r4,r11 # r4 <= methodIndex selector, passed - # via r11 in the nsXPTCStubBase::StubXX() call + mr r4,r11 // r4 <= methodIndex selector, passed + // via r11 in the nsXPTCStubBase::StubXX() call - addi r5,sp,120 # r5 <= pointer to callers args area, - # beyond r3-r10/f1-f8 mapped range + addi r5,sp,120 // r5 <= pointer to callers args area, + // beyond r3-r10/f1-f8 mapped range - addi r6,sp,8 # r6 <= gprData - addi r7,sp,40 # r7 <= fprData + addi r6,sp,8 // r6 <= gprData + addi r7,sp,40 // r7 <= fprData - bl PrepareAndDispatch@local # Go! + bl PrepareAndDispatch@local // Go! - lwz r0,116(sp) # restore LR + lwz r0,116(sp) // restore LR mtlr r0 - la sp,112(sp) # clean up the stack + la sp,112(sp) // clean up the stack blr diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s new file mode 100644 index 0000000..6557db7 --- /dev/null +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_sparc64_netbsd.s @@ -0,0 +1,66 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + + .global SharedStub + +/* + in the frame for the function that called SharedStub are the + rest of the parameters we need + +*/ + +SharedStub: +! we don't create a new frame yet, but work within the frame of the calling +! function to give ourselves the other parameters we want + + mov %o0, %o1 ! shuffle the index up to 2nd place + mov %i0, %o0 ! the original 'this' + add %fp, 0x7ff + 136, %o2 ! previous stack top adjusted to the first argument slot (beyond 'this') + +! save off the original incoming parameters that arrived in +! registers, the ABI guarantees the space for us to do this + stx %i1, [%fp + 0x7ff + 136] + stx %i2, [%fp + 0x7ff + 144] + stx %i3, [%fp + 0x7ff + 152] + stx %i4, [%fp + 0x7ff + 160] + stx %i5, [%fp + 0x7ff + 168] +! now we can build our own stack frame + save %sp,-(128 + 64),%sp ! room for the register window and + ! struct pointer, rounded up to 0 % 64 +! our function now appears to have been called +! as SharedStub(nsISupports* that, PRUint32 index, PRUint32* args) +! so we can just copy these through + + mov %i0, %o0 + mov %i1, %o1 + mov %i2, %o2 + call PrepareAndDispatch + nop + mov %o0,%i0 ! propagate return value + b .LL1 + nop +.LL1: + ret + restore + + .size SharedStub, .-SharedStub + .type SharedStub, #function diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp index 16b6c8b..737c60b 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_gcc_x86_unix.cpp @@ -10,7 +10,7 @@ #include "xptc_gcc_x86_unix.h" extern "C" { -static nsresult ATTRIBUTE_USED +nsresult ATTRIBUTE_USED __attribute__ ((regparm (3))) PrepareAndDispatch(uint32_t methodIndex, nsXPTCStubBase* self, uint32_t* args) { diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp index ed9e696..05308cf 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_netbsd_m68k.cpp @@ -91,17 +91,27 @@ extern "C" { } } +/* + * Beware: use % instead of %% for register identifiers in a preprocessor macro + * SYMBOL PREFIX must be "_" for aout and "" for ELF + */ +#ifndef __ELF__ +#define SYMBOLPREFIX "_" +#else +#define SYMBOLPREFIX +#endif + #define STUB_ENTRY(n) \ __asm__( \ - ".global _Stub"#n"__14nsXPTCStubBase\n\t" \ -"_Stub"#n"__14nsXPTCStubBase:\n\t" \ - "link a6,#0 \n\t" \ - "lea a6@(12), a0 \n\t" /* pointer to args */ \ - "movl a0, sp@- \n\t" \ - "movl #"#n", sp@- \n\t" /* method index */ \ - "movl a6@(8), sp@- \n\t" /* this */ \ - "jbsr _PrepareAndDispatch \n\t" \ - "unlk a6 \n\t" \ + ".global "SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase\n\t" \ +SYMBOLPREFIX"Stub"#n"__14nsXPTCStubBase:\n\t" \ + "link %a6,#0 \n\t" \ + "lea %a6@(12), %a0 \n\t" /* pointer to args */ \ + "movl %a0, %sp@- \n\t" \ + "movl #"#n", %sp@- \n\t" /* method index */ \ + "movl %a6@(8), %sp@- \n\t" /* this */ \ + "jbsr "SYMBOLPREFIX"PrepareAndDispatch\n\t" \ + "unlk %a6 \n\t" \ "rts \n\t" \ ); diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp index d6fa01d..b379b44 100644 --- a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_ppc_netbsd.cpp @@ -6,6 +6,7 @@ // Implement shared vtbl methods. #include "xptcprivate.h" +#include "xptiprivate.h" // The Linux/PPC ABI (aka PPC/SYSV ABI) passes the first 8 integral // parameters and the first 8 floating point parameters in registers @@ -36,7 +37,6 @@ PrepareAndDispatch(nsXPTCStubBase* self, { nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; nsXPTCMiniVariant* dispatchParams = NULL; - nsIInterfaceInfo* iface_info = NULL; const nsXPTMethodInfo* info; uint32_t paramCount; uint32_t i; @@ -44,11 +44,7 @@ PrepareAndDispatch(nsXPTCStubBase* self, NS_ASSERTION(self,"no self"); - self->GetInterfaceInfo(&iface_info); - NS_ASSERTION(iface_info,"no interface info"); - if (! iface_info) - return NS_ERROR_UNEXPECTED; - + self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info); iface_info->GetMethodInfo(uint16_t(methodIndex), &info); NS_ASSERTION(info,"no method info"); if (! info) @@ -84,8 +80,10 @@ PrepareAndDispatch(nsXPTCStubBase* self, if ((uint32_t) ap & 4) ap++; // doubles are 8-byte aligned on stack dp->val.d = *(double*) ap; ap += 2; +#if __GXX_ABI_VERSION < 100 if (gpr < GPR_COUNT) gpr += 2; +#endif } continue; } @@ -95,8 +93,10 @@ PrepareAndDispatch(nsXPTCStubBase* self, else { dp->val.f = *(float*) ap; ap += 1; +#if __GXX_ABI_VERSION < 100 if (gpr < GPR_COUNT) gpr += 1; +#endif } continue; } @@ -144,9 +144,9 @@ PrepareAndDispatch(nsXPTCStubBase* self, } } - result = self->CallMethod((uint16_t) methodIndex, info, dispatchParams); - - NS_RELEASE(iface_info); + result = self->mOuter->CallMethod((PRUint16) methodIndex, + info, + dispatchParams); if (dispatchParams != paramBuffer) delete [] dispatchParams; @@ -160,7 +160,9 @@ PrepareAndDispatch(nsXPTCStubBase* self, // however, it's quick, dirty, and'll break when the ABI changes on // us, which is what we want ;-). -#define STUB_ENTRY(n) \ +#if __GXX_ABI_VERSION < 100 +// gcc-2 version +# define STUB_ENTRY(n) \ __asm__ ( \ ".section \".text\" \n\t" \ ".align 2 \n\t" \ @@ -171,6 +173,46 @@ __asm__ ( \ "li 11,"#n" \n\t" \ "b SharedStub@local \n" \ ); +#else +// gcc-3 version +// +// As G++3 ABI contains the length of the functionname in the mangled +// name, it is difficult to get a generic assembler mechanism like +// in the G++ 2.95 case. +// Create names would be like: +// _ZN14nsXPTCStubBase5Stub1Ev +// _ZN14nsXPTCStubBase6Stub12Ev +// _ZN14nsXPTCStubBase7Stub123Ev +// _ZN14nsXPTCStubBase8Stub1234Ev +// etc. +// Use assembler directives to get the names right... + +# define STUB_ENTRY(n) \ +__asm__ ( \ + ".align 2 \n\t" \ + ".if "#n" < 10 \n\t" \ + ".globl _ZN14nsXPTCStubBase5Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase5Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase5Stub"#n"Ev: \n\t" \ + \ + ".elseif "#n" < 100 \n\t" \ + ".globl _ZN14nsXPTCStubBase6Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase6Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase6Stub"#n"Ev: \n\t" \ + \ + ".elseif "#n" < 1000 \n\t" \ + ".globl _ZN14nsXPTCStubBase7Stub"#n"Ev \n\t" \ + ".type _ZN14nsXPTCStubBase7Stub"#n"Ev,@function \n\n" \ +"_ZN14nsXPTCStubBase7Stub"#n"Ev: \n\t" \ + \ + ".else \n\t" \ + ".err \"stub number "#n" >= 1000 not yet supported\"\n" \ + ".endif \n\t" \ + \ + "li 11,"#n" \n\t" \ + "b SharedStub@local \n" \ +); +#endif #define SENTINEL_ENTRY(n) \ nsresult nsXPTCStubBase::Sentinel##n() \ diff --git a/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_netbsd.cpp b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_netbsd.cpp new file mode 100644 index 0000000..0b5ce39 --- /dev/null +++ b/xpcom/reflect/xptcall/src/md/unix/xptcstubs_sparc64_netbsd.cpp @@ -0,0 +1,119 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * The contents of this file are subject to the Netscape Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/NPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is mozilla.org code. + * + * The Initial Developer of the Original Code is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All + * Rights Reserved. + * + * Contributor(s): + */ + +/* Implement shared vtbl methods. */ + +#include "xptcprivate.h" +#include "xptiprivate.h" + +#if defined(sparc) || defined(__sparc__) + +extern "C" nsresult +PrepareAndDispatch(nsXPTCStubBase* self, PRUint64 methodIndex, PRUint64* args) +{ + +#define PARAM_BUFFER_COUNT 16 + + nsXPTCMiniVariant paramBuffer[PARAM_BUFFER_COUNT]; + nsXPTCMiniVariant* dispatchParams = NULL; + const nsXPTMethodInfo* info; + PRUint8 paramCount; + PRUint8 i; + nsresult result = NS_ERROR_FAILURE; + + NS_ASSERTION(self,"no self"); + + self->mEntry->GetMethodInfo(PRUint16(methodIndex), &info); + NS_ASSERTION(info,"no interface info"); + + paramCount = info->GetParamCount(); + + // setup variant array pointer + if(paramCount > PARAM_BUFFER_COUNT) + dispatchParams = new nsXPTCMiniVariant[paramCount]; + else + dispatchParams = paramBuffer; + NS_ASSERTION(dispatchParams,"no place for params"); + if (!dispatchParams) + return NS_ERROR_OUT_OF_MEMORY; + + PRUint64* ap = args; + for(i = 0; i < paramCount; i++, ap++) + { + const nsXPTParamInfo& param = info->GetParam(i); + const nsXPTType& type = param.GetType(); + nsXPTCMiniVariant* dp = &dispatchParams[i]; + + if(param.IsOut() || !type.IsArithmetic()) + { + dp->val.p = (void*) *ap; + continue; + } + // else + switch(type) + { + case nsXPTType::T_BOOL : dp->val.b = *((PRInt64*) ap); break; + case nsXPTType::T_CHAR : dp->val.c = *((PRUint64*) ap); break; + case nsXPTType::T_WCHAR : dp->val.wc = *((PRInt64*) ap); break; + case nsXPTType::T_I8 : dp->val.i8 = *((PRInt64*) ap); break; + case nsXPTType::T_I16 : dp->val.i16 = *((PRInt64*) ap); break; + case nsXPTType::T_I32 : dp->val.i32 = *((PRInt64*) ap); break; + case nsXPTType::T_I64 : dp->val.i64 = *((PRInt64*) ap); break; + case nsXPTType::T_U8 : dp->val.u8 = *((PRUint64*) ap); break; + case nsXPTType::T_U16 : dp->val.u16 = *((PRUint64*)ap); break; + case nsXPTType::T_U32 : dp->val.u32 = *((PRUint64*)ap); break; + case nsXPTType::T_U64 : dp->val.u64 = *((PRUint64*) ap); break; + case nsXPTType::T_FLOAT : dp->val.f = ((float*) ap)[1]; break; + case nsXPTType::T_DOUBLE : dp->val.d = *((double*) ap); break; + default: + NS_ASSERTION(0, "bad type"); + break; + } + } + + result = self->mOuter->CallMethod((PRUint16)methodIndex, info, dispatchParams); + + if(dispatchParams != paramBuffer) + delete [] dispatchParams; + + return result; +} + +extern "C" int SharedStub(int, int*); + +#define STUB_ENTRY(n) \ +nsresult nsXPTCStubBase::Stub##n() \ +{ \ + int dummy; /* defeat tail-call optimization */ \ + return SharedStub(n, &dummy); \ +} + +#define SENTINEL_ENTRY(n) \ +nsresult nsXPTCStubBase::Sentinel##n() \ +{ \ + NS_ASSERTION(0,"nsXPTCStubBase::Sentinel called"); \ + return NS_ERROR_NOT_IMPLEMENTED; \ +} + +#include "xptcstubsdef.inc" + +#endif /* sparc || __sparc__ */ diff --git a/xpcom/string/public/nsAlgorithm.h b/xpcom/string/public/nsAlgorithm.h index a2d63d0..aaf5fef 100644 --- a/xpcom/string/public/nsAlgorithm.h +++ b/xpcom/string/public/nsAlgorithm.h @@ -45,7 +45,10 @@ XPCOM_MAX( const T& a, const T& b ) return a > b ? a : b; } -#if defined(_MSC_VER) && (_MSC_VER < 1600) +#if (defined(_MSC_VER) && (_MSC_VER < 1600)) || \ + ((defined(__GLIBCXX__) && __GLIBCXX__ < 20121005) && \ + (defined(_GLIBCXX_USE_LONG_LONG) && \ + (!_GLIBCXX_USE_C99 || _GLIBCXX_USE_C99_LONG_LONG_DYNAMIC))) namespace std { inline long long diff --git a/xulrunner/installer/libxul-embedding.pc.in b/xulrunner/installer/libxul-embedding.pc.in index 100e0a7..889fdab 100644 --- a/xulrunner/installer/libxul-embedding.pc.in +++ b/xulrunner/installer/libxul-embedding.pc.in @@ -6,5 +6,6 @@ idldir=%idldir% Name: libxul-embedding Description: Static library for version-independent embedding of the Mozilla runtime Version: %MOZILLA_VERSION% -Libs: -L${sdkdir}/lib -lxpcomglue -ldl +# XXXtnn -ldl removed +Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lxpcomglue Cflags: -DXPCOM_GLUE -I${includedir} %WCHAR_CFLAGS% diff --git a/xulrunner/installer/libxul.pc.in b/xulrunner/installer/libxul.pc.in index ccce9aa..8f24862 100644 --- a/xulrunner/installer/libxul.pc.in +++ b/xulrunner/installer/libxul.pc.in @@ -7,5 +7,5 @@ Name: libxul Description: The Mozilla Runtime and Embedding Engine Version: %MOZILLA_VERSION% Requires: %NSPR_NAME% >= %NSPR_VERSION% -Libs: -L${sdkdir}/lib %MOZ_XUL_LINK% +Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner %MOZ_XUL_LINK% Cflags: -I${includedir} %WCHAR_CFLAGS% diff --git a/xulrunner/installer/mozilla-js.pc.in b/xulrunner/installer/mozilla-js.pc.in index c1428f1..8a5c928 100644 --- a/xulrunner/installer/mozilla-js.pc.in +++ b/xulrunner/installer/mozilla-js.pc.in @@ -6,5 +6,5 @@ Name: JavaScript Description: The Mozilla JavaScript Library Version: %MOZILLA_VERSION% Requires: %NSPR_NAME% >= %NSPR_VERSION% -Libs: -L${sdkdir}/lib %MOZ_JS_LINK% +Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner %MOZ_JS_LINK% Cflags: -I${includedir} -DXP_UNIX -DJS_THREADSAFE diff --git a/xulrunner/installer/mozilla-nspr.pc.in b/xulrunner/installer/mozilla-nspr.pc.in index 86ba304..d60199d 100644 --- a/xulrunner/installer/mozilla-nspr.pc.in +++ b/xulrunner/installer/mozilla-nspr.pc.in @@ -5,7 +5,5 @@ includedir=%includedir% Name: NSPR Description: The Netscape Portable Runtime Version: %NSPR_VERSION% -Libs: %FULL_NSPR_LIBS% -Cflags: %FULL_NSPR_CFLAGS% - - +Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lplds4 -lplc4 -lnspr4 -pthread +Cflags: -I${includedir} diff --git a/xulrunner/installer/mozilla-nss.pc.in b/xulrunner/installer/mozilla-nss.pc.in index 088832a..03aaa9d 100644 --- a/xulrunner/installer/mozilla-nss.pc.in +++ b/xulrunner/installer/mozilla-nss.pc.in @@ -6,5 +6,5 @@ Name: NSS Description: Mozilla Network Security Services Version: %MOZILLA_VERSION% Requires: %NSPR_NAME% >= %NSPR_VERSION% -Libs: -L${sdkdir}/lib -lsmime3 -lssl3 -lnss3 -lnssutil3 +Libs: -Wl,-R${prefix}/lib/xulrunner -Wl,-R${prefix}/lib/xulrunner -L${prefix}/lib/xulrunner -lsmime3 -lssl3 -lnss3 -lnssutil3 Cflags: -I${includedir}