##################################################################### ## ## SeaMonkey 2.0.3 for AIX 5.1 ## ## Build platform: RS/6000 7044P 170 ## Compilers used: IBM XLC/C++ 7.0 (Patchlevel July 2007) ## Build date : Feb 07 2010 ## BuildID : 20100207 ## Built by : Uli Link ( ul.mcamafia (-at-) linkitup.de ) ## ##################################################################### This build of SeaMonkey 2.0.3 was produced on a powerpc-ibm-aix5.1.0.0 platform, but configured to use the common processor model running on all RS/6000 machines. It is a 32bit executable, so you'll need 32bit Java for using the Java plugin. It is tested to run on AIX 5.1ML09, AIX 5.2TL10 and AIX 5.3TL6. 256 MB RAM is absolute minimum, 512 MB recommended. TrueColour Display mandatory. For more detailed information visit my website: http://www.linkitup.de/ForAIX/Mozilla Questions about this build can be addressed to Uli Link ( ul.mcamafia (-at-) linkitup.de ). Any bugs or issues should be reported to the Mozilla Bugzilla site (http://bugzilla.mozilla.org). This README blatantly ripped off from the README for previous Solaris 8/GTK1 Seamonkey releases by Michael Kelleher. ##################################################################### ## COMPILERS AND LIBRARIES USED ##################################################################### The following tools/libraries were used during compilation: IBM AIX 5.1 with Maintenance Level 9 IBM XLC/C++ 7.0 with July 2007 service pack and the following RPM packages r atk-1.12.3-1 atk-devel-1.12.3-1 r cairo-1.8.8-2 cairo-devel-1.8.8-2 r expat-1.95.7-4 expat-devel-1.95.7-4 r fontconfig-2.3.2-3 fontconfig-devel-2.3.2-3 r freetype2-2.3.9-2 freetype2-devel-2.3.9-2 r gettext-0.10.40-6 r glib2-2.12.4-1 glib2-devel-2.12.4-1 r gtk2-2.10.6-1 gtk2-devel-2.10.6-1 r libIDL-0.8.6-2 libIDL-devel-0.8.6-2 r libjpeg-6b-6 libjpeg-devel-6b-6 r libpng-1.2.8-5 libpng-devel-1.2.8-5 r libtiff-3.6.1-4 libtiff-devel-3.6.1-4 m4-1.4.1-1 make-3.80-1 r pango-1.14.5-1 pango-devel-1.14.5-1 r pixman-0.16.0-2 pixman-devel-0.16.0-2 pkg-config-0.19-1 renderproto-0.9.3-1 r xcursor-1.1.7-2 xcursor-devel-1.1.7-2 r xft-2.1.10-1 xft-devel-2.1.10-1 xorg-compat-aix-1.0-1 r xrender-0.9.4-1 zip-2.3-3 r zlib-1.2.3-1 zlib-devel-1.2.3-1 The RPMs marked with a leading (r) are needed for runtime, the others are needed at built-time only. Earlier versions for cairo (1.6.4), pixman(0.10.0), xrender/libXrender(0.8.4), xft/libXft (2.1.6) and xcursor/libXcursor (1.0.2) are expected to work, you may need to install with --nodeps flag. ##################################################################### ## INSTALLATION NOTES ##################################################################### * With root privileges run # # rpm -Uhv //seamonkey-2.0.2-1.aix*.ppc.rpm * For easy execution, symbolically link the firefox application: # cd /usr/bin # ln -s /opt/seamonkey/seamonkey * Executables are dynamically linked against GTK2, but should not require the setting of any additional locations in LD_LIBRARY_PATH on a AIX 5.x installation. * No other special installation requirements should exist. ##################################################################### ## BUILD ENVIRONMENT AND COMMANDS ##################################################################### The following build environment and commands were used: $ CONFIG_SHELL=/usr/bin/bash $ CONFIGURE_ENV_ARGS=/usr/bin/bash $ LDFLAGS=-bh:5 $ export CONFIG_SHELL CONFIGURE_ENV_ARGS LDFLAGS $ gmake -f client.mk build $ cd $MOZ_OBJDIR $ gmake -C mail/installer and the following patch after unpacking the source tarball: ##################################################################### ## PATCH BUNDLE ## if you want to build yourself on AIX 5.3 or AIX 5.3 you may omit ## the patch of mozilla/toolkit/xre/nsNativeAppSupportUnix.cpp ## if you compile on AIX 5.2 ## you must additionally fix ./mozilla/js/src/jsgc.c ## with a line #define HAS_POSIX_MEMALIGN 0 ## or you'll get unresolved external symbol .posix_memalign ## You'll need a working python 2.5 in your PATH for building ##################################################################### diff -U 8 -pr a/.mozconfig a/.mozconfig --- a/.mozconfig 2010-01-04 22:01:30.000000000 +0100 +++ a/.mozconfig 2010-01-05 16:09:02.000000000 +0100 @@ -0,0 +1,22 @@ +export OBJECT_MODE=32 +#export OBJECT_MODE=64 +export CC=xlc_r +export CXX=xlC_r +export AUTOCONF=/opt/freeware/bin/autoconf-2.13 +#export MOZILLA_OFFICIAL=1 +#export BUILD_OFFICIAL=1 +mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/SM2_OBJ32 +#mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/SM2_OBJ64 +#mk_add_options MOZILLA_OFFICIAL=1 +#mk_add_options BUILD_OFFICIAL=1 +ac_add_options --enable-application=suite + +ac_add_options --disable-dbus +ac_add_options --disable-accessibility +ac_add_options --with-system-zlib +ac_add_options --enable-system-cairo + +ac_add_options --enable-optimize="-O2 -qarch=com -qmaxmem=-1 -qalias=noansi" +#ac_add_options --enable-optimize="-O2 -qarch=ppc64 -qmaxmem=-1 -qalias=noansi" +ac_add_options --disable-debug +ac_add_options --disable-tests diff -U 8 -pr a/mail/app/Makefile.in a/mail/app/Makefile.in --- a/mail/app/Makefile.in 2010-01-04 22:01:31.000000000 +0100 +++ a/mail/app/Makefile.in 2010-01-05 16:08:02.000000000 +0100 @@ -365,8 +365,14 @@ endif find $(DIST)/$(APP_NAME).app -type d -name "CVS" -prune -exec rm -rf {} \; clean clobber:: rm -rf $(DIST)/$(APP_NAME).app endif # Note that anything you do to dist/ down here isn't going to make it into the # Mac build, since it's already been copied over to the .app, above. + +ifeq ($(OS_ARCH),AIX) +ifdef BUILD_STATIC_LIBS +LDFLAGS += -bbigtoc +endif +endif diff -U 8 -pr a/mailnews/base/public/msgCore.h a/mailnews/base/public/msgCore.h --- a/mailnews/base/public/msgCore.h 2010-01-04 22:01:32.000000000 +0100 +++ a/mailnews/base/public/msgCore.h 2010-01-05 16:08:02.000000000 +0100 @@ -39,16 +39,17 @@ NSPR, memory, and string header files among others */ #ifndef msgCore_h__ #define msgCore_h__ #include "nscore.h" #include "plstr.h" #include "nsCRTGlue.h" +#include "nsCRT.h" #include "nsVoidArray.h" class nsIMsgDBHdr; class nsIMsgFolder; // include common interfaces such as the service manager and the repository.... #include "nsIServiceManager.h" #include "nsIComponentManager.h" @@ -215,27 +216,29 @@ NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODUL #endif #endif // MOZ_STATIC_MAIL_BUILD /* * Copied this from nsCRT.h */ #ifndef FILE_PATH_SEPARATOR +#ifndef FILE_ILLEGAL_CHARACTERS #if defined(XP_MACOSX) #define FILE_PATH_SEPARATOR "/" #define FILE_ILLEGAL_CHARACTERS ":" #elif defined(XP_WIN) || defined(XP_OS2) #define FILE_PATH_SEPARATOR "\\" #define FILE_ILLEGAL_CHARACTERS "/:*?\"<>|" #elif defined(XP_UNIX) || defined(XP_BEOS) #define FILE_PATH_SEPARATOR "/" #define FILE_ILLEGAL_CHARACTERS "" #else #error need_to_define_your_file_path_separator_and_illegal_characters #endif -#endif +#endif /* FILE_ILLEGAL_CHARACTERS */ +#endif /* FILE_PATH_SEPARATOR */ #ifndef CRLF #define CRLF "\015\012" #endif #endif diff -U 8 -pr a/mailnews/imap/src/nsAutoSyncManager.cpp a/mailnews/imap/src/nsAutoSyncManager.cpp --- a/mailnews/imap/src/nsAutoSyncManager.cpp 2010-01-04 22:01:33.000000000 +0100 +++ a/mailnews/imap/src/nsAutoSyncManager.cpp 2010-01-05 16:08:02.000000000 +0100 @@ -228,17 +228,17 @@ nsDefaultAutoSyncFolderStrategy::IsExclu } \ PR_END_MACRO #define NOTIFY_LISTENERS(propertyfunc_, params_) \ NOTIFY_LISTENERS_STATIC(this, propertyfunc_, params_) nsAutoSyncManager::nsAutoSyncManager() { - mGroupSize = kDefaultGroupSize; + mGroupSize = (const)kDefaultGroupSize; mIdleState = notIdle; mStartupDone = PR_FALSE; mDownloadModel = dmChained; mUpdateState = completed; mPaused = PR_FALSE; nsresult rv; @@ -1102,17 +1102,17 @@ PRUint32 nsAutoSyncManager::GetUpdateInt NS_IMETHODIMP nsAutoSyncManager::GetGroupSize(PRUint32 *aGroupSize) { NS_ENSURE_ARG_POINTER(aGroupSize); *aGroupSize = mGroupSize; return NS_OK; } NS_IMETHODIMP nsAutoSyncManager::SetGroupSize(PRUint32 aGroupSize) { - mGroupSize = aGroupSize ? aGroupSize : kDefaultGroupSize; + mGroupSize = aGroupSize ? aGroupSize : (const)kDefaultGroupSize; return NS_OK; } NS_IMETHODIMP nsAutoSyncManager::GetMsgStrategy(nsIAutoSyncMsgStrategy * *aMsgStrategy) { NS_ENSURE_ARG_POINTER(aMsgStrategy); // lazily create if it is not done already diff -U 8 -pr a/mozilla/dom/src/base/nsJSEnvironment.cpp a/mozilla/dom/src/base/nsJSEnvironment.cpp --- a/mozilla/dom/src/base/nsJSEnvironment.cpp 2010-01-04 22:03:46.000000000 +0100 +++ a/mozilla/dom/src/base/nsJSEnvironment.cpp 2010-01-05 16:08:02.000000000 +0100 @@ -4099,21 +4099,25 @@ protected: nsJSArgArray::nsJSArgArray(JSContext *aContext, PRUint32 argc, jsval *argv, nsresult *prv) : mContext(aContext), mArgv(argv), mArgc(argc) { // copy the array - we don't know its lifetime, and ours is tied to xpcom // refcounting. Alloc zero'd array so cleanup etc is safe. - mArgv = (jsval *) PR_CALLOC(argc * sizeof(jsval)); - if (!mArgv) { - *prv = NS_ERROR_OUT_OF_MEMORY; - return; - } + + // #Bug 488423 + if (argc > 0) { + mArgv = (jsval *) PR_CALLOC(argc * sizeof(jsval)); + if (!mArgv) { + *prv = NS_ERROR_OUT_OF_MEMORY; + return; + } + } // Callers are allowed to pass in a null argv even for argc > 0. They can // then use GetArgs to initialize the values. if (argv) { for (PRUint32 i = 0; i < argc; ++i) mArgv[i] = argv[i]; } diff -U 8 -pr a/mozilla/gfx/src/thebes/nsThebesDeviceContext.cpp a/mozilla/gfx/src/thebes/nsThebesDeviceContext.cpp --- a/mozilla/gfx/src/thebes/nsThebesDeviceContext.cpp 2010-01-04 22:03:50.000000000 +0100 +++ a/mozilla/gfx/src/thebes/nsThebesDeviceContext.cpp 2010-01-05 16:08:03.000000000 +0100 @@ -192,17 +192,17 @@ nsThebesDeviceContext::SetDPI() if (NS_FAILED(rv)) { prefDPI = -1; } } #if defined(MOZ_ENABLE_GTK2) GdkScreen *screen = gdk_screen_get_default(); gtk_settings_get_for_screen(screen); // Make sure init is run so we have a resolution - PRInt32 OSVal = PRInt32(round(gdk_screen_get_resolution(screen))); + PRInt32 OSVal = PRInt32(rint(gdk_screen_get_resolution(screen))); if (prefDPI == 0) // Force the use of the OS dpi dpi = OSVal; else // Otherwise, the minimum dpi is 96dpi dpi = PR_MAX(OSVal, 96); #elif defined(XP_WIN) // XXX we should really look at the widget if !dc but it is currently always null diff -U 8 -pr a/mozilla/gfx/thebes/public/gfxFont.h a/mozilla/gfx/thebes/public/gfxFont.h --- a/mozilla/gfx/thebes/public/gfxFont.h 2010-01-04 22:03:50.000000000 +0100 +++ a/mozilla/gfx/thebes/public/gfxFont.h 2010-01-05 16:08:03.000000000 +0100 @@ -1340,17 +1340,17 @@ public: * the caller retains ownership. */ void SetSimpleGlyph(PRUint32 aCharIndex, CompressedGlyph aGlyph) { NS_ASSERTION(aGlyph.IsSimpleGlyph(), "Should be a simple glyph here"); if (mCharacterGlyphs) { mCharacterGlyphs[aCharIndex] = aGlyph; } if (mDetailedGlyphs) { - mDetailedGlyphs[aCharIndex] = nsnull; + (mDetailedGlyphs.get())[aCharIndex] = nsnull; } } void SetGlyphs(PRUint32 aCharIndex, CompressedGlyph aGlyph, const DetailedGlyph *aGlyphs); void SetMissingGlyph(PRUint32 aCharIndex, PRUint32 aUnicodeChar); void SetSpaceGlyph(gfxFont *aFont, gfxContext *aContext, PRUint32 aCharIndex); /** @@ -1360,17 +1360,17 @@ public: * errors. */ void FetchGlyphExtents(gfxContext *aRefContext); // API for access to the raw glyph data, needed by gfxFont::Draw // and gfxFont::GetBoundingBox const CompressedGlyph *GetCharacterGlyphs() { return mCharacterGlyphs; } const DetailedGlyph *GetDetailedGlyphs(PRUint32 aCharIndex) { - return mDetailedGlyphs ? mDetailedGlyphs[aCharIndex].get() : nsnull; + return mDetailedGlyphs ? (mDetailedGlyphs.get())[aCharIndex].get() : nsnull; } PRBool HasDetailedGlyphs() { return mDetailedGlyphs.get() != nsnull; } PRUint32 CountMissingGlyphs(); const GlyphRun *GetGlyphRuns(PRUint32 *aNumGlyphRuns) { *aNumGlyphRuns = mGlyphRuns.Length(); return mGlyphRuns.Elements(); } // Returns the index of the GlyphRun containing the given offset. diff -U 8 -pr a/mozilla/js/src/jsstdint.h a/mozilla/js/src/jsstdint.h --- a/mozilla/js/src/jsstdint.h 2010-01-04 22:03:51.000000000 +0100 +++ a/mozilla/js/src/jsstdint.h 2010-01-05 16:08:03.000000000 +0100 @@ -43,16 +43,18 @@ #ifndef jsstdint_h___ #define jsstdint_h___ #include "js-config.h" /* If we have a working stdint.h, use it. */ #if defined(JS_HAVE_STDINT_H) #include +#elif defined(HAVE_SYS_INTTYPES_H) +#include /* If the configure script was able to find appropriate types for us, use those. */ #elif defined(JS_INT8_TYPE) typedef signed JS_INT8_TYPE int8_t; typedef signed JS_INT16_TYPE int16_t; typedef signed JS_INT32_TYPE int32_t; diff -U 8 -pr a/mozilla/media/libfishsound/src/libfishsound/debug.h a/mozilla/media/libfishsound/src/libfishsound/debug.h --- a/mozilla/media/libfishsound/src/libfishsound/debug.h 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/libfishsound/src/libfishsound/debug.h 2010-01-05 16:08:03.000000000 +0100 @@ -24,16 +24,20 @@ /* MSVC can't handle C99 */ #if (defined (_MSCVER) || defined (_MSC_VER)) #define debug_printf // #else #ifdef DEBUG #ifndef DEBUG_LEVEL #define DEBUG_LEVEL 1 +#ifdef AIX +#undef DEBUG_LEVEL 1 +#define DEBUG_LEVEL 0 +#endif #endif #endif #if (DEBUG_LEVEL > 0) #define DEBUG_MAXLINE 4096 #include @@ -78,15 +82,17 @@ debug_print_err (const char * func, int * debug_printf (level, fmt) * * Print a formatted debugging message of level 'level' to stderr */ #define debug_printf(x,y...) {if (x <= DEBUG_LEVEL) debug_print_err (__func__, __LINE__, y);} #undef MAXLINE +#elif defined AIX +#define debug_printf /* */ #else #define debug_printf(x,y...) #endif #endif /* non-C99 */ #endif /* __DEBUG_H__ */ diff -U 8 -pr a/mozilla/media/liboggplay/src/liboggplay/oggplay_data.c a/mozilla/media/liboggplay/src/liboggplay/oggplay_data.c --- a/mozilla/media/liboggplay/src/liboggplay/oggplay_data.c 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/liboggplay/src/liboggplay/oggplay_data.c 2010-01-05 16:08:03.000000000 +0100 @@ -404,17 +404,17 @@ get_uv_offset(OggPlayTheoraDecode *decod if (decode->y_height != 0 && decode->uv_height != 0 && decode->y_height/decode->uv_height != 0) { yo = (buffer->uv_stride)*(decode->video_info.offset_y/(decode->y_height/decode->uv_height)); } return xo + yo; } -int +OggPlayErrorCode oggplay_data_handle_theora_frame (OggPlayTheoraDecode *decode, const yuv_buffer *buffer) { size_t size = sizeof (OggPlayVideoRecord); int i, ret; long y_size, uv_size, y_offset, uv_offset; unsigned char * p; unsigned char * q; diff -U 8 -pr a/mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h a/mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h --- a/mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/liboggz/include/oggz/oggz_off_t_generated.h 2010-01-05 16:08:03.000000000 +0100 @@ -54,17 +54,17 @@
    echo "gcc -E oggz.h | grep oggz_off_t
  
* */ #include -#if defined(__APPLE__) || defined(SOLARIS) || defined(OS2) +#if defined(__APPLE__) || defined(SOLARIS) || defined(OS2) || defined (_AIX) typedef off_t oggz_off_t; #else typedef loff_t oggz_off_t; #endif #define PRI_OGGZ_OFF_T "PRId64" #endif /* __OGGZ_OFF_T_GENERATED__ */ diff -U 8 -pr a/mozilla/media/liboggz/src/liboggz/dirac.c a/mozilla/media/liboggz/src/liboggz/dirac.c --- a/mozilla/media/liboggz/src/liboggz/dirac.c 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/liboggz/src/liboggz/dirac.c 2010-01-05 16:08:03.000000000 +0100 @@ -1,21 +1,22 @@ /* dirac.c */ #include "config.h" -#ifdef HAVE_STDINT_H +#if defined AIX && HAVE_SYS_INTTYPES_H +#include +#elif defined HAVE_STDINT_H #include #endif #include "dirac.h" - typedef struct dirac_bs_s { uint8_t *p_start; uint8_t *p; uint8_t *p_end; int i_left; /* i_count number of available bits */ diff -U 8 -pr a/mozilla/media/libsydneyaudio/include/sydney_audio.h a/mozilla/media/libsydneyaudio/include/sydney_audio.h --- a/mozilla/media/libsydneyaudio/include/sydney_audio.h 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/libsydneyaudio/include/sydney_audio.h 2010-01-05 16:08:03.000000000 +0100 @@ -80,16 +80,18 @@ async-signal safe. # define SA_LITTLE_ENDIAN 1 # endif #elif defined(SOLARIS) # if defined(_BIG_ENDIAN) # define SA_BIG_ENDIAN 1 # else # define SA_LITTLE_ENDIAN 1 # endif +#elif defined(AIX) +# define SA_BIG_ENDIAN 1 #else # error "Cannot determine byte order!" #endif #if defined(WIN32) #if !defined(int32_t) typedef __int32 int32_t; #endif diff -U 8 -pr a/mozilla/media/libsydneyaudio/src/Makefile.in a/mozilla/media/libsydneyaudio/src/Makefile.in --- a/mozilla/media/libsydneyaudio/src/Makefile.in 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/libsydneyaudio/src/Makefile.in 2010-01-05 16:08:03.000000000 +0100 @@ -72,13 +72,19 @@ OS_LIBS += -framework CoreAudio -framewo endif ifeq ($(OS_ARCH),SunOS) CSRCS = \ sydney_audio_sunaudio.c \ $(NULL) endif +ifeq ($(OS_ARCH),AIX) +CSRCS = \ + sydney_audio_aix.c \ + $(NULL) +endif + ifeq ($(OS_ARCH),WINNT) OS_LIBS += winmm.lib endif include $(topsrcdir)/config/rules.mk diff -U 8 -pr a/mozilla/media/libsydneyaudio/src/sydney_audio_aix.c a/mozilla/media/libsydneyaudio/src/sydney_audio_aix.c --- a/mozilla/media/libsydneyaudio/src/sydney_audio_aix.c 2010-01-04 22:01:30.000000000 +0100 +++ a/mozilla/media/libsydneyaudio/src/sydney_audio_aix.c 2010-01-05 16:08:03.000000000 +0100 @@ -0,0 +1,484 @@ +/* ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla 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/MPL/ + * + * 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 Initial Developer of the Original Code is + * Shailendra N Jain + * + * Contributor(s): + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "sydney_audio.h" + +#ifndef DEFAULT_AUDIO_DEVICE +#define DEFAULT_AUDIO_DEVICE "/dev/paud0/1" +#endif + +#define LOOP_WHILE_EINTR(v,func) do { (v) = (func); } \ + while ((v) == -1 && errno == EINTR); + +typedef struct sa_buf sa_buf; +struct sa_buf { + unsigned int size; /* the size of data */ + sa_buf *next; + unsigned char data[]; /* sound data */ +}; + +struct sa_stream +{ + int audio_fd; + pthread_mutex_t mutex; + pthread_t thread_id; + int playing; + int64_t bytes_played; + + /* audio format info */ + /* default setting */ + unsigned int default_n_channels; + unsigned int default_rate; + unsigned int default_precision; + + /* used settings */ + unsigned int rate; + unsigned int n_channels; + unsigned int precision; + + /* buffer list */ + sa_buf *bl_head; + sa_buf *bl_tail; +}; + +/* Use a default buffer size with enough room for one second of audio, + * assuming stereo data at 44.1kHz with 32 bits per channel, and impose + * a generous limit on the number of buffers. + */ +#define BUF_SIZE (2 * 44100 * 4) + +static void* audio_callback(void* s); + +static sa_buf *new_buffer(int size); + +/* + * ----------------------------------------------------------------------------- + * Startup and shutdown functions + * ----------------------------------------------------------------------------- + */ + +int +sa_stream_create_pcm( + sa_stream_t ** _s, + const char * client_name, + sa_mode_t mode, + sa_pcm_format_t format, + unsigned int rate, + unsigned int n_channels +) +{ + sa_stream_t * s = 0; + + /* Make sure we return a NULL stream pointer on failure. */ + if (_s == NULL) + return SA_ERROR_INVALID; + + *_s = NULL; + + if (mode != SA_MODE_WRONLY) + return SA_ERROR_NOT_SUPPORTED; + + if (format != SA_PCM_FORMAT_S16_LE) + return SA_ERROR_NOT_SUPPORTED; + + /* + * Allocate the instance and required resources. + */ + if ((s = malloc(sizeof(sa_stream_t))) == NULL) + return SA_ERROR_OOM; + + if (pthread_mutex_init(&s->mutex, NULL) != 0) { + free(s); + return SA_ERROR_SYSTEM; + } + + s->audio_fd = NULL; + s->rate = rate; + s->n_channels = n_channels; + s->precision = 16; + + s->playing = 0; + s->bytes_played = 0; + s->bl_tail = s->bl_head = NULL; + + *_s = s; + + return SA_SUCCESS; +} + + +int +sa_stream_open(sa_stream_t *s) +{ + int fd,err; + char *device_name; + + audio_init init; + audio_control control; + audio_change change; + + device_name = DEFAULT_AUDIO_DEVICE; + + if (s == NULL) + return SA_ERROR_NO_INIT; + + if (s->audio_fd != NULL) + return SA_ERROR_INVALID; + + fd = open(device_name,O_WRONLY | O_NONBLOCK); + if (fd >= 0) + { + close (fd); + fd = open (device_name, O_WRONLY); + } + + if ( fd < 0 ) + { + printf("Open %s failed:%s ",device_name,strerror(errno)); + return SA_ERROR_NO_DEVICE; + } + + init.srate = s->rate; + init.channels = s->n_channels; + init.mode = AUDIO_PCM; + init.flags = AUDIO_BIG_ENDIAN | AUDIO_TWOS_COMPLEMENT; + init.operation = AUDIO_PLAY; + + if (ioctl(s->audio_fd, AUDIO_INIT, &init) < 0) { + close(s->audio_fd); + return 0; + } + + change.balance = 0x3fff0000; + change.volume = 0x3fff0000; + change.monitor = AUDIO_IGNORE; + change.input = AUDIO_IGNORE; + change.output = AUDIO_OUTPUT_1; + + control.ioctl_request = AUDIO_CHANGE; + control.position = 0; + control.request_info = &change; + + if (ioctl(s->audio_fd, AUDIO_CONTROL, &control) < 0) { + close(s->audio_fd); + return 0; + } + + control.ioctl_request = AUDIO_START; + control.request_info = NULL; + + if (ioctl(s->audio_fd, AUDIO_CONTROL, &control) < 0) { + close(s->audio_fd); + return 0; + } + + return SA_SUCCESS; +} + +int +sa_stream_destroy(sa_stream_t *s) +{ + int result; + + if (s == NULL) + return SA_SUCCESS; + + + pthread_mutex_lock(&s->mutex); + + result = SA_SUCCESS; + + /* + * Shut down the audio output device. + * and release resources + */ + if (s->audio_fd != NULL) + { + if (close(s->audio_fd) < 0) + { + perror("Close aix audio fd failed"); + result = SA_ERROR_SYSTEM; + } + } + + s->thread_id = 0; + + while (s->bl_head != NULL) { + sa_buf * next = s->bl_head->next; + free(s->bl_head); + s->bl_head = next; + } + + pthread_mutex_unlock(&s->mutex); + + if (pthread_mutex_destroy(&s->mutex) != 0) { + result = SA_ERROR_SYSTEM; + } + + free(s); + + return result; +} + +/* + * ----------------------------------------------------------------------------- + * Data read and write functions + * ----------------------------------------------------------------------------- + */ + +int +sa_stream_write(sa_stream_t *s, const void *data, size_t nbytes) +{ + + int result; + sa_buf *buf; + + if (s == NULL || s->audio_fd == NULL) + return SA_ERROR_NO_INIT; + + if (nbytes == 0) + return SA_SUCCESS; + + + /* + * Append the new data to the end of our buffer list. + */ + result = SA_SUCCESS; + buf = new_buffer(nbytes); + + if (buf == NULL) + return SA_ERROR_OOM; + + memcpy(buf->data,data, nbytes); + + pthread_mutex_lock(&s->mutex); + if (!s->bl_head) + s->bl_head = buf; + else + s->bl_tail->next = buf; + + s->bl_tail = buf; + + pthread_mutex_unlock(&s->mutex); + + /* + * Once we have our first block of audio data, enable the audio callback + * function. This doesn't need to be protected by the mutex, because + * s->playing is not used in the audio callback thread, and it's probably + * better not to be inside the lock when we enable the audio callback. + */ + if (!s->playing) { + s->playing = 1; + if (pthread_create(&s->thread_id, NULL, audio_callback, s) != 0) { + result = SA_ERROR_SYSTEM; + } + } + + return result; +} + +static void* +audio_callback(void* data) +{ + sa_stream_t* s = (sa_stream_t*)data; + sa_buf *buf; + int fd,nbytes_written,bytes,nbytes; + + fd = s->audio_fd; + + while (1) + { + if (s->thread_id == 0) + break; + + pthread_mutex_lock(&s->mutex); + while (s->bl_head) + { + buf = s->bl_head; + s->bl_head = s->bl_head->next; + + nbytes_written = 0; + nbytes = buf->size; + + while (nbytes_written < nbytes) + { + LOOP_WHILE_EINTR(bytes,(write(fd, (void *)((buf->data)+nbytes_written), nbytes-nbytes_written))); + + nbytes_written += bytes; + if (nbytes_written != nbytes) + printf("AixAudio\tWrite completed short - %d vs %d. Write more data\n",nbytes_written,nbytes); + } + + free(buf); + s->bytes_played += nbytes; + } + pthread_mutex_unlock(&s->mutex); + } + + return NULL; +} + +/* + * ----------------------------------------------------------------------------- + * General query and support functions + * ----------------------------------------------------------------------------- + */ + +int +sa_stream_get_write_size(sa_stream_t *s, size_t *size) +{ + sa_buf * b; + size_t used = 0; + + if (s == NULL ) + return SA_ERROR_NO_INIT; + + /* there is no interface to get the avaiable writing buffer size + * in aix audio, we return max size here to force sa_stream_write() to + * be called when there is data to be played + */ + *size = BUF_SIZE; + + return SA_SUCCESS; +} + +/* --------------------------------------------------------------------------- + * General query and support functions + * ----------------------------------------------------------------------------- + */ + +int +sa_stream_get_position(sa_stream_t *s, sa_position_t position, int64_t *pos) +{ + if (s == NULL) { + return SA_ERROR_NO_INIT; + } + if (position != SA_POSITION_WRITE_SOFTWARE) { + return SA_ERROR_NOT_SUPPORTED; + } + + pthread_mutex_lock(&s->mutex); + *pos = s->bytes_played; + pthread_mutex_unlock(&s->mutex); + return SA_SUCCESS; +} + +static sa_buf * +new_buffer(int size) +{ + sa_buf * b = malloc(sizeof(sa_buf) + size); + if (b != NULL) { + b->size = size; + b->next = NULL; + } + return b; +} + +/* + * ----------------------------------------------------------------------------- + * Unsupported functions + * ----------------------------------------------------------------------------- + */ +#define UNSUPPORTED(func) func { return SA_ERROR_NOT_SUPPORTED; } + +UNSUPPORTED(int sa_stream_pause(sa_stream_t *s)) +UNSUPPORTED(int sa_stream_resume(sa_stream_t *s)) +UNSUPPORTED(int sa_stream_create_opaque(sa_stream_t **s, const char *client_name, sa_mode_t mode, const char *codec)) +UNSUPPORTED(int sa_stream_set_write_lower_watermark(sa_stream_t *s, size_t size)) +UNSUPPORTED(int sa_stream_set_read_lower_watermark(sa_stream_t *s, size_t size)) +UNSUPPORTED(int sa_stream_set_write_upper_watermark(sa_stream_t *s, size_t size)) +UNSUPPORTED(int sa_stream_set_read_upper_watermark(sa_stream_t *s, size_t size)) +UNSUPPORTED(int sa_stream_set_channel_map(sa_stream_t *s, const sa_channel_t map[], unsigned int n)) +UNSUPPORTED(int sa_stream_set_xrun_mode(sa_stream_t *s, sa_xrun_mode_t mode)) +UNSUPPORTED(int sa_stream_set_non_interleaved(sa_stream_t *s, int enable)) +UNSUPPORTED(int sa_stream_set_dynamic_rate(sa_stream_t *s, int enable)) +UNSUPPORTED(int sa_stream_set_driver(sa_stream_t *s, const char *driver)) +UNSUPPORTED(int sa_stream_start_thread(sa_stream_t *s, sa_event_callback_t callback)) +UNSUPPORTED(int sa_stream_stop_thread(sa_stream_t *s)) +UNSUPPORTED(int sa_stream_change_device(sa_stream_t *s, const char *device_name)) +UNSUPPORTED(int sa_stream_change_read_volume(sa_stream_t *s, const int32_t vol[], unsigned int n)) +UNSUPPORTED(int sa_stream_change_write_volume(sa_stream_t *s, const int32_t vol[], unsigned int n)) +UNSUPPORTED(int sa_stream_change_rate(sa_stream_t *s, unsigned int rate)) +UNSUPPORTED(int sa_stream_change_meta_data(sa_stream_t *s, const char *name, const void *data, size_t size)) +UNSUPPORTED(int sa_stream_change_user_data(sa_stream_t *s, const void *value)) +UNSUPPORTED(int sa_stream_set_adjust_rate(sa_stream_t *s, sa_adjust_t direction)) +UNSUPPORTED(int sa_stream_set_adjust_nchannels(sa_stream_t *s, sa_adjust_t direction)) +UNSUPPORTED(int sa_stream_set_adjust_pcm_format(sa_stream_t *s, sa_adjust_t direction)) +UNSUPPORTED(int sa_stream_set_adjust_watermarks(sa_stream_t *s, sa_adjust_t direction)) +UNSUPPORTED(int sa_stream_get_mode(sa_stream_t *s, sa_mode_t *access_mode)) +UNSUPPORTED(int sa_stream_get_codec(sa_stream_t *s, char *codec, size_t *size)) +UNSUPPORTED(int sa_stream_get_pcm_format(sa_stream_t *s, sa_pcm_format_t *format)) +UNSUPPORTED(int sa_stream_get_rate(sa_stream_t *s, unsigned int *rate)) +UNSUPPORTED(int sa_stream_get_nchannels(sa_stream_t *s, int *nchannels)) +UNSUPPORTED(int sa_stream_get_user_data(sa_stream_t *s, void **value)) +UNSUPPORTED(int sa_stream_get_write_lower_watermark(sa_stream_t *s, size_t *size)) +UNSUPPORTED(int sa_stream_get_read_lower_watermark(sa_stream_t *s, size_t *size)) +UNSUPPORTED(int sa_stream_get_write_upper_watermark(sa_stream_t *s, size_t *size)) +UNSUPPORTED(int sa_stream_get_read_upper_watermark(sa_stream_t *s, size_t *size)) +UNSUPPORTED(int sa_stream_get_channel_map(sa_stream_t *s, sa_channel_t map[], unsigned int *n)) +UNSUPPORTED(int sa_stream_get_xrun_mode(sa_stream_t *s, sa_xrun_mode_t *mode)) +UNSUPPORTED(int sa_stream_get_non_interleaved(sa_stream_t *s, int *enabled)) +UNSUPPORTED(int sa_stream_get_dynamic_rate(sa_stream_t *s, int *enabled)) +UNSUPPORTED(int sa_stream_get_driver(sa_stream_t *s, char *driver_name, size_t *size)) +UNSUPPORTED(int sa_stream_get_device(sa_stream_t *s, char *device_name, size_t *size)) +UNSUPPORTED(int sa_stream_get_read_volume(sa_stream_t *s, int32_t vol[], unsigned int *n)) +UNSUPPORTED(int sa_stream_get_write_volume(sa_stream_t *s, int32_t vol[], unsigned int *n)) +UNSUPPORTED(int sa_stream_get_meta_data(sa_stream_t *s, const char *name, void*data, size_t *size)) +UNSUPPORTED(int sa_stream_get_adjust_rate(sa_stream_t *s, sa_adjust_t *direction)) +UNSUPPORTED(int sa_stream_get_adjust_nchannels(sa_stream_t *s, sa_adjust_t *direction)) +UNSUPPORTED(int sa_stream_get_adjust_pcm_format(sa_stream_t *s, sa_adjust_t *direction)) +UNSUPPORTED(int sa_stream_get_adjust_watermarks(sa_stream_t *s, sa_adjust_t *direction)) +UNSUPPORTED(int sa_stream_get_state(sa_stream_t *s, sa_state_t *state)) +UNSUPPORTED(int sa_stream_get_event_error(sa_stream_t *s, sa_error_t *error)) +UNSUPPORTED(int sa_stream_get_event_notify(sa_stream_t *s, sa_notify_t *notify)) +UNSUPPORTED(int sa_stream_read(sa_stream_t *s, void *data, size_t nbytes)) +UNSUPPORTED(int sa_stream_read_ni(sa_stream_t *s, unsigned int channel, void *data, size_t nbytes)) +UNSUPPORTED(int sa_stream_write_ni(sa_stream_t *s, unsigned int channel, const void *data, size_t nbytes)) +UNSUPPORTED(int sa_stream_pwrite(sa_stream_t *s, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence)) +UNSUPPORTED(int sa_stream_pwrite_ni(sa_stream_t *s, unsigned int channel, const void *data, size_t nbytes, int64_t offset, sa_seek_t whence)) +UNSUPPORTED(int sa_stream_get_read_size(sa_stream_t *s, size_t *size)) +UNSUPPORTED(int sa_stream_drain(sa_stream_t *s)) + +const char *sa_strerror(int code) { return NULL; } + diff -U 8 -pr a/mozilla/media/libvorbis/lib/Makefile.in a/mozilla/media/libvorbis/lib/Makefile.in --- a/mozilla/media/libvorbis/lib/Makefile.in 2010-01-04 22:04:00.000000000 +0100 +++ a/mozilla/media/libvorbis/lib/Makefile.in 2010-01-05 16:08:03.000000000 +0100 @@ -64,8 +64,12 @@ CSRCS = \ vorbis_registry.c \ vorbis_codebook.c \ vorbis_sharedbook.c \ vorbis_lookup.c \ vorbis_bitrate.c \ $(NULL) include $(topsrcdir)/config/rules.mk + +ifeq ($(OS_ARCH),AIX) +CFLAGS += -qalloca +endif diff -U 8 -pr a/mozilla/widget/src/gtk2/nsWindow.cpp a/mozilla/widget/src/gtk2/nsWindow.cpp --- a/mozilla/widget/src/gtk2/nsWindow.cpp 2010-01-04 22:04:12.000000000 +0100 +++ a/mozilla/widget/src/gtk2/nsWindow.cpp 2010-01-05 16:08:03.000000000 +0100 @@ -59,17 +59,23 @@ #include "nsIDragSessionGTK.h" #include "nsGtkKeyUtils.h" #include "nsGtkCursors.h" #include #ifdef MOZ_X11 #include + +#ifdef AIX /* #Bug 458057 */ +#include +#else #include +#endif + #include "gtk2xtbin.h" #endif /* MOZ_X11 */ #include #include "nsWidgetAtoms.h" #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION #define SN_API_NOT_YET_FROZEN @@ -3182,16 +3188,17 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWi || aEvent->keyval == GDK_Alt_L || aEvent->keyval == GDK_Alt_R || aEvent->keyval == GDK_Meta_L || aEvent->keyval == GDK_Meta_R) { return TRUE; } #ifdef MOZ_X11 +#if ! defined AIX // no XFree86 on AIX 5L // Look for specialized app-command keys switch (aEvent->keyval) { case XF86XK_Back: return DispatchCommandEvent(nsWidgetAtoms::Back); case XF86XK_Forward: return DispatchCommandEvent(nsWidgetAtoms::Forward); case XF86XK_Refresh: return DispatchCommandEvent(nsWidgetAtoms::Reload); @@ -3199,16 +3206,17 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWi return DispatchCommandEvent(nsWidgetAtoms::Stop); case XF86XK_Search: return DispatchCommandEvent(nsWidgetAtoms::Search); case XF86XK_Favorites: return DispatchCommandEvent(nsWidgetAtoms::Bookmarks); case XF86XK_HomePage: return DispatchCommandEvent(nsWidgetAtoms::Home); } +#endif /* ! AIX */ #endif /* MOZ_X11 */ nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this); InitKeyEvent(event, aEvent); if (isKeyDownCancelled) { // If prevent default set for onkeydown, do the same for onkeypress event.flags |= NS_EVENT_FLAG_NO_DEFAULT; } diff -U 8 -pr a/mozilla/xpcom/io/nsLocalFileUnix.h a/mozilla/xpcom/io/nsLocalFileUnix.h --- a/mozilla/xpcom/io/nsLocalFileUnix.h 2010-01-04 22:04:13.000000000 +0100 +++ a/mozilla/xpcom/io/nsLocalFileUnix.h 2010-01-05 16:08:03.000000000 +0100 @@ -81,16 +81,21 @@ // so we can statfs on freebsd #if defined(__FreeBSD__) #define HAVE_SYS_STATFS_H #define STATFS statfs #include #include #endif +// #Bug 526457 +#if defined (_AIX41) && (__IBMCPP__) +#undef STAT +#endif /* AIX with IBM Compiler */ + #if defined(HAVE_STAT64) && defined(HAVE_LSTAT64) #define STAT stat64 #define LSTAT lstat64 #define HAVE_STATS64 1 #else #define STAT stat #define LSTAT lstat #endif diff -U 8 -pr a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 --- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 2010-01-04 22:04:13.000000000 +0100 +++ a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix.s.m4 2010-01-05 16:08:03.000000000 +0100 @@ -105,18 +105,18 @@ include(xptcstubsdef.inc) stfd f12,156(sp) stfd f13,164(sp) addi r6,sp,44 # gprData addi r7,sp,72 # fprData # r3 has the 'self' pointer already mr r4,r12 # methodIndex selector (it is now LATER) - addi r5,sp,208 # pointer to callers args area, beyond r3-r10 - # mapped range + addi r5,sp,232 # pointer to callers args area, beyond r3-r10 + # mapped range, Bug 516667 bl .PrepareAndDispatch nop lwz r0,184(sp) addi sp,sp,176 mtlr r0 diff -U 8 -pr a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 --- a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 2010-01-04 22:04:13.000000000 +0100 +++ a/mozilla/xpcom/reflect/xptcall/src/md/unix/xptcstubs_asm_ppc_aix64.s.m4 2010-01-05 16:08:03.000000000 +0100 @@ -89,18 +89,18 @@ include(xptcstubsdef.inc) stfd f10,216(sp) stfd f11,224(sp) stfd f12,232(sp) stfd f13,240(sp) addi r6,sp,88 # gprData addi r7,sp,144 # fprData # r3 has the 'self' pointer already mr r4,r12 # methodIndex selector (it is now LATER) - addi r5,sp,328 # pointer to callers args area, beyond r3-r10 - # mapped range + addi r5,sp,360 # pointer to callers args area, beyond r3-r10 + # mapped range, Bug 516667 bl .PrepareAndDispatch nop ld r0,264(sp) addi sp,sp,248 mtlr r0 blr # .data section .toc # 0x00000038