Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 297215 Details for
Bug 434126
gnome-web-photo failed massrebuild attempt for GCC 4.3
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Working patch
xulrunner2.patch (text/plain), 48.24 KB, created by
Marco Pesenti Gritti
on 2008-03-07 16:51:55 UTC
(
hide
)
Description:
Working patch
Filename:
MIME Type:
Creator:
Marco Pesenti Gritti
Created:
2008-03-07 16:51:55 UTC
Size:
48.24 KB
patch
obsolete
>Index: src/Prefs.cpp >=================================================================== >--- src/Prefs.cpp (revision 105) >+++ src/Prefs.cpp (working copy) >@@ -26,9 +26,9 @@ > #include <nsCOMPtr.h> > #include <nsIPrefService.h> > #include <nsIServiceManager.h> >-#include <nsIServiceManager.h> >+#include <nsServiceManagerUtils.h> > #include <nsILocalFile.h> >-#include <nsString.h> >+#include <nsStringGlue.h> > > #include <pango/pango.h> > #include <gconf/gconf-client.h> >Index: src/Writer.h >=================================================================== >--- src/Writer.h (revision 105) >+++ src/Writer.h (working copy) >@@ -21,7 +21,8 @@ > #ifndef WRITER_H > #define WRITER_H > >-#include <nsString.h> >+#include <nsStringGlue.h> >+#include <gfxImageSurface.h> > #include <gtkmozembed.h> > #include <gdk-pixbuf/gdk-pixdata.h> > #include <png.h> >@@ -31,8 +32,6 @@ > #include <jerror.h> > #endif > >-class nsIDrawingSurface; >- > class Writer > { > public: >@@ -41,9 +40,9 @@ > > PRBool Write (); > >- virtual PRBool Prepare(nsIDrawingSurface *) = 0; >+ virtual PRBool Prepare(gfxImageSurface *) = 0; > virtual PRBool Finish() = 0; >- virtual void WriteSurface(nsIDrawingSurface*, PRUint32, PRUint32, PRUint8*, PRInt32, PRInt32, PRInt32) = 0; >+ virtual void WriteSurface(gfxImageSurface*, PRUint32, PRUint32) = 0; > > protected: > GtkMozEmbed *mEmbed; >@@ -64,10 +63,10 @@ > PNGWriter (GtkMozEmbed*, const char *); > virtual ~PNGWriter(); > >- virtual PRBool Prepare(nsIDrawingSurface *); >+ virtual PRBool Prepare(gfxImageSurface *); > virtual PRBool Finish(); > >- virtual void WriteSurface(nsIDrawingSurface*, PRUint32, PRUint32, PRUint8*, PRInt32, PRInt32, PRInt32); >+ virtual void WriteSurface(gfxImageSurface*, PRUint32, PRUint32); > > static void WarnCallback(png_structp, png_const_charp); > static void ErrorCallback(png_structp, png_const_charp); >@@ -86,10 +85,10 @@ > PPMWriter (GtkMozEmbed*, const char *); > virtual ~PPMWriter(); > >- virtual PRBool Prepare(nsIDrawingSurface *); >+ virtual PRBool Prepare(gfxImageSurface *); > virtual PRBool Finish(); > >- virtual void WriteSurface(nsIDrawingSurface*, PRUint32, PRUint32, PRUint8*, PRInt32, PRInt32, PRInt32); >+ virtual void WriteSurface(gfxImageSurface*, PRUint32, PRUint32); > > private: > FILE *mFile; >@@ -102,9 +101,9 @@ > ThumbnailWriter(GtkMozEmbed*, const char*, PRUint32); > virtual ~ThumbnailWriter(); > >- virtual PRBool Prepare(nsIDrawingSurface *); >+ virtual PRBool Prepare(gfxImageSurface *); > virtual PRBool Finish(); >- virtual void WriteSurface(nsIDrawingSurface*, PRUint32, PRUint32, PRUint8*, PRInt32, PRInt32, PRInt32); >+ virtual void WriteSurface(gfxImageSurface*, PRUint32, PRUint32); > > private: > GdkPixdata *mData; >@@ -119,10 +118,10 @@ > JPEGWriter (GtkMozEmbed*, const char *, PRUint16); > virtual ~JPEGWriter(); > >- virtual PRBool Prepare(nsIDrawingSurface *); >+ virtual PRBool Prepare(gfxImageSurface *); > virtual PRBool Finish(); > >- virtual void WriteSurface(nsIDrawingSurface*, PRUint32, PRUint32, PRUint8*, PRInt32, PRInt32, PRInt32); >+ virtual void WriteSurface(gfxImageSurface*, PRUint32, PRUint32); > > private: > PRUint16 mQuality; >Index: src/Printer.cpp >=================================================================== >--- src/Printer.cpp (revision 105) >+++ src/Printer.cpp (working copy) >@@ -27,6 +27,7 @@ > #include <nsIPrintSettings.h> > #include <nsIPrintSettingsService.h> > #include <nsIServiceManager.h> >+#include <nsServiceManagerUtils.h> > #include <nsIInterfaceRequestorUtils.h> > #include <nsNativeCharsetUtils.h> > #include <gtkmozembed_internal.h> >@@ -44,10 +45,10 @@ > , mPrintBG(aPrintBG) > { > if (aFilename[0] == '/') { >- NS_CopyNativeToUnicode (nsDependentCString(aFilename), mFilename); >+ NS_CStringToUTF16 (nsCString (aFilename), NS_CSTRING_ENCODING_UTF8, mFilename); > } else { > char *path = g_build_filename (g_get_current_dir(), aFilename, NULL); >- NS_CopyNativeToUnicode (nsDependentCString(path), mFilename); >+ NS_CStringToUTF16 (nsCString (path), NS_CSTRING_ENCODING_UTF8, mFilename); > g_free(path); > } > } >@@ -100,7 +101,6 @@ > { > aSettings->SetPrinterName (NS_LITERAL_STRING("PostScript/default").get()); > aSettings->SetPrintRange (nsIPrintSettings::kRangeAllPages); >- aSettings->SetPaperSize (nsIPrintSettings::kPaperSizeDefined); > aSettings->SetPaperSizeUnit (nsIPrintSettings::kPaperSizeMillimeters); > aSettings->SetPaperWidth (210.0); > aSettings->SetPaperHeight (297.0); >Index: src/main.cpp >=================================================================== >--- src/main.cpp (revision 105) >+++ src/main.cpp (working copy) >@@ -25,6 +25,7 @@ > #include <glib/gi18n.h> > #include <gtk/gtk.h> > #include <gtkmozembed.h> >+#include <gtkmozembed_glue.cpp> > #include <nsCOMPtr.h> > #include <nsIServiceManager.h> > #include <nsIStyleSheetService.h> >@@ -336,6 +337,48 @@ > static nsresult > gecko_startup (void) > { >+ nsresult rv; >+ >+ static const GREVersionRange greVersion = { >+ "1.9a", PR_TRUE, >+ "1.9.*", PR_TRUE >+ }; >+ char xpcomLocation[4096]; >+ rv = GRE_GetGREPathWithProperties(&greVersion, 1, nsnull, 0, xpcomLocation, 4096); >+ if (NS_FAILED (rv)) >+ { >+ g_warning ("Could not get gre path!\n"); >+ return FALSE; >+ } >+ >+ // Startup the XPCOM Glue that links us up with XPCOM. >+ rv = XPCOMGlueStartup(xpcomLocation); >+ if (NS_FAILED (rv)) >+ { >+ g_warning ("Could not determine locale!\n"); >+ return FALSE; >+ } >+ >+ rv = GTKEmbedGlueStartup(); >+ if (NS_FAILED (rv)) >+ { >+ g_warning ("Could not startup glue!\n"); >+ return FALSE; >+ } >+ >+ rv = GTKEmbedGlueStartupInternal(); >+ if (NS_FAILED (rv)) >+ { >+ g_warning ("Could not startup internal glue!\n"); >+ return FALSE; >+ } >+ >+ char *lastSlash = strrchr(xpcomLocation, '/'); >+ if (lastSlash) >+ *lastSlash = '\0'; >+ >+ gtk_moz_embed_set_path(xpcomLocation); >+ > /* BUG ALERT! If we don't have a profile, Gecko will crash on https sites and > * when trying to open the password manager. The prefs will be set up so that > * no cookies or passwords etc. will be persisted. >@@ -345,12 +388,6 @@ > gtk_moz_embed_set_profile_path (profile, "gnome-web-photo"); > g_free (profile); > >-#ifdef HAVE_GECKO_1_9 >- gtk_moz_embed_set_path (GECKO_HOME); >-#else >- gtk_moz_embed_set_comp_path (GECKO_HOME); >-#endif >- > /* Fire up the beast! */ > gtk_moz_embed_push_startup (); > >@@ -362,8 +399,6 @@ > return NS_ERROR_FAILURE; > } > >- nsresult rv = NS_OK; >- > if (mode != MODE_PRINT) { > /* This prevents us from printing all pages, so only do it for photo/thumbnail */ > nsCOMPtr<nsIStyleSheetService> sheetService (do_GetService ("@mozilla.org/content/style-sheet-service;1", &rv)); >@@ -585,7 +620,6 @@ > } > > /* Arg checking complete, now let's get started! */ >- > /* Initialised gecko */ > nsresult rv = gecko_startup (); > if (NS_FAILED (rv)) { >Index: src/Components.cpp >=================================================================== >--- src/Components.cpp (revision 105) >+++ src/Components.cpp (working copy) >@@ -137,80 +137,15 @@ > return NS_OK; > } > >-#ifdef HAVE_PSM >- >-#include <nsIBadCertListener.h> >- >-#define NSSDIALOGS_CLASSNAME "Dummy NSS Dialogs" >-#define NSSDIALOGS_CID { 0x128e643e, 0x8b28, 0x4eea, { 0x8d, 0xe7, 0x22, 0x4f, 0x5a, 0xa0, 0x56, 0x54 } } >- >-class NSSDialogs : public nsIBadCertListener >-{ >- public: >- NS_DECL_ISUPPORTS >- NS_DECL_NSIBADCERTLISTENER >- >- NSSDialogs () { } >- ~NSSDialogs () { } >-}; >- >-NS_IMPL_THREADSAFE_ISUPPORTS1 (NSSDialogs, nsIBadCertListener) >- >-/* boolean confirmUnknownIssuer (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert, out short certAddType); */ >-NS_IMETHODIMP >-NSSDialogs::ConfirmUnknownIssuer(nsIInterfaceRequestor *socketInfo, >- nsIX509Cert *cert, >- PRInt16 *certAddType, >- PRBool *_retval) >-{ >- LOG ("ConfirmUnknownIssuer\n"); >- *certAddType = nsIBadCertListener::ADD_TRUSTED_FOR_SESSION; >- *_retval = PR_TRUE; >- return NS_OK; >-} >- >-/* boolean confirmMismatchDomain (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */ >-NS_IMETHODIMP >-NSSDialogs::ConfirmMismatchDomain(nsIInterfaceRequestor *socketInfo, >- const nsACString & targetURL, >- nsIX509Cert *cert, >- PRBool *_retval) >-{ >- LOG ("ConfirmMismatchDomain\n"); >- *_retval = PR_TRUE; >- return NS_OK; >-} >- >-/* boolean confirmCertExpired (in nsIInterfaceRequestor socketInfo, in nsIX509Cert cert); */ >-NS_IMETHODIMP >-NSSDialogs::ConfirmCertExpired(nsIInterfaceRequestor *socketInfo, >- nsIX509Cert *cert, >- PRBool *_retval) >-{ >- LOG ("ConfirmCertExpired\n"); >- *_retval = PR_TRUE; >- return NS_OK; >-} >- >-/* void notifyCrlNextupdate (in nsIInterfaceRequestor socketInfo, in AUTF8String targetURL, in nsIX509Cert cert); */ >-NS_IMETHODIMP >-NSSDialogs::NotifyCrlNextupdate(nsIInterfaceRequestor *socketInfo, >- const nsACString & targetURL, >- nsIX509Cert *cert) >-{ >- LOG ("NotifyCrlNextupdate\n"); >- return NS_OK; >-} >- >-#endif /* HAVE_PSM */ >- > /* -------------------------------------------------------------------------- */ > > NS_GENERIC_FACTORY_CONSTRUCTOR(Prompter) > >+#ifndef HAVE_GECKO_1_9 > #ifdef HAVE_PSM > NS_GENERIC_FACTORY_CONSTRUCTOR(NSSDialogs) > #endif >+#endif /* HAVE_GECKO_1_9 */ > > static const nsModuleComponentInfo sAppComps[] = > { >@@ -220,14 +155,6 @@ > NS_PROMPTSERVICE_CONTRACTID, > PrompterConstructor > }, >-#ifdef HAVE_PSM >- { >- NSSDIALOGS_CLASSNAME, >- NSSDIALOGS_CID, >- NS_BADCERTLISTENER_CONTRACTID, >- NSSDialogsConstructor >- }, >-#endif /* HAVE_PSM */ > }; > > PRBool >Index: src/Makefile.am >=================================================================== >--- src/Makefile.am (revision 105) >+++ src/Makefile.am (working copy) >@@ -36,29 +36,32 @@ > main.cpp > > gnome_web_photo_CPPFLAGS = \ >+ $(DEPENDENCY_CFLAGS) \ > $(addprefix -I$(GECKO_INCLUDE_ROOT)/,$(gecko_include_subdirs)) \ > -DSHARE_DIR=\"$(pkgdatadir)\" \ > -DLOCALEDIR=\"$(datadir)/locale\" \ > -DGECKO_HOME=\"$(GECKO_HOME)\" \ > -DGECKO_PREFIX=\"$(GECKO_PREFIX)\" \ >+ -DXPCOM_GLUE_USE_NSPR \ >+ -DXPCOM_GLUE \ > $(AM_CPPFLAGS) > > gnome_web_photo_CXXFLAGS = \ > $(DEPENDENCY_CFLAGS) \ >- $(GECKO_CFLAGS) \ >+ $(LIBXUL_INCLUDES) \ >+ $(LIBXUL_CXXFLAGS) \ > $(AM_CXXFLAGS) > > gnome_web_photo_LDFLAGS = \ >- -R$(GECKO_HOME) \ >+ -R$(LIBXUL_LIBDIR) \ > $(AM_LDFLAGS) > > gnome_web_photo_LDADD = \ > $(DEPENDENCY_LIBS) \ > $(JPEG_LIBS) \ >- $(GECKO_LIBS) \ >- $(GECKO_EXTRA_LIBS) >+ $(LIBXUL_LIBS) \ >+ -lxpcomglue > >- > install-exec-hook: gnome-web-photo > cd $(DESTDIR)$(bindir) && \ > rm -f gnome-web-thumbnail gnome-web-print && \ >Index: src/Printer.h >=================================================================== >--- src/Printer.h (revision 105) >+++ src/Printer.h (working copy) >@@ -27,7 +27,7 @@ > #include <nsIWebBrowserPrint.h> > #include <nsIWebProgressListener.h> > #include <nsIPrintProgressParams.h> >-#include <nsString.h> >+#include <nsStringGlue.h> > #include <gtkmozembed.h> > > class nsIPrintSettings; >Index: src/Listener.h >=================================================================== >--- src/Listener.h (revision 105) >+++ src/Listener.h (working copy) >@@ -23,7 +23,7 @@ > > #include <nsCOMPtr.h> > #include <nsIDOMLoadListener.h> >-#include <nsString.h> >+#include <nsStringGlue.h> > #include <gtkmozembed.h> > > class Listener : public nsIDOMLoadListener >Index: src/Writer.cpp >=================================================================== >--- src/Writer.cpp (revision 105) >+++ src/Writer.cpp (working copy) >@@ -37,13 +37,13 @@ > #include <nsIDocShell.h> > #include <nsIDocumentViewer.h> > #include <nsIMarkupDocumentViewer.h> >+#include <nsIInterfaceRequestorUtils.h> > #include <nsIPresShell.h> >-#include <nsPresContext.h> >-#include <nsIView.h> >+#include <nsIDeviceContext.h> > #include <nsIViewManager.h> > #include <nsIScrollableView.h> >-#include <nsIRenderingContext.h> >-#include <nsIDrawingSurface.h> >+#include <gfxContext.h> >+#include <gfxPlatform.h> > #include <nsRect.h> > #include <gtkmozembed_internal.h> > #include <gdk-pixbuf/gdk-pixbuf.h> >@@ -78,43 +78,24 @@ > { > NS_ENSURE_STATE (mEmbed); > >- PRBool retval = PR_FALSE; >- > nsresult rv; > nsCOMPtr<nsIWebBrowser> browser; > gtk_moz_embed_get_nsIWebBrowser (mEmbed, getter_AddRefs (browser)); >- NS_ENSURE_TRUE (browser, retval); >+ NS_ENSURE_TRUE (browser, PR_FALSE); > > nsCOMPtr<nsIDOMWindow> domWin; > rv = browser->GetContentDOMWindow (getter_AddRefs (domWin)); >- NS_ENSURE_SUCCESS (rv, retval); >+ NS_ENSURE_SUCCESS (rv, PR_FALSE); > > nsCOMPtr<nsIDOMDocument> domDoc; > rv = domWin->GetDocument (getter_AddRefs (domDoc)); >- NS_ENSURE_SUCCESS (rv, retval); >+ NS_ENSURE_SUCCESS (rv, PR_FALSE); > > nsCOMPtr<nsIDocument> doc (do_QueryInterface (domDoc, &rv)); >- NS_ENSURE_SUCCESS (rv, retval); >+ NS_ENSURE_SUCCESS (rv, PR_FALSE); > >- nsCOMPtr<nsISupports> docShellAsISupports (doc->GetContainer ()); >- nsCOMPtr<nsIDocShell> docShell (do_QueryInterface (docShellAsISupports, &rv)); >- NS_ENSURE_SUCCESS (rv, retval); >- >- nsCOMPtr<nsIPresShell> presShell; >- rv = docShell->GetPresShell (getter_AddRefs (presShell)); >- NS_ENSURE_SUCCESS (rv, retval); >- >- nsCOMPtr<nsPresContext> presContext; >- rv = docShell->GetPresContext (getter_AddRefs (presContext)); >- NS_ENSURE_SUCCESS (rv, retval); >- >- rv = NS_ERROR_NULL_POINTER; >- nsIViewManager *viewManager = presShell->GetViewManager (); >- NS_ENSURE_TRUE (viewManager, retval); >- > /* Get document information */ > CopyUTF16toUTF8 (doc->GetDocumentTitle(), mTitle); >- mTitle.CompressWhitespace(PR_TRUE, PR_TRUE); > > nsIURI *uri = doc->GetDocumentURI(); > if (uri) { >@@ -123,6 +104,20 @@ > > doc->FlushPendingNotifications (Flush_Display); > >+ nsCOMPtr<nsIDocShell> docShell (do_GetInterface (browser, &rv)); >+ NS_ENSURE_SUCCESS (rv, rv); >+ >+ nsCOMPtr<nsIPresShell> presShell; >+ rv = docShell->GetPresShell (getter_AddRefs (presShell)); >+ NS_ENSURE_SUCCESS (rv, PR_FALSE); >+ >+ nsIViewManager *viewManager = presShell->GetViewManager (); >+ NS_ENSURE_TRUE (viewManager, PR_FALSE); >+ >+ nsIDeviceContext *dc; >+ viewManager->GetDeviceContext (dc); >+ NS_ENSURE_TRUE (dc, PR_FALSE); >+ > nsIScrollableView* scrollableView = nsnull; > viewManager->GetRootScrollableView (&scrollableView); > nsIView* view; >@@ -132,16 +127,12 @@ > viewManager->GetRootView(view); > } > >- /* Get conversion factors */ >- float p2t = presContext->PixelsToTwips(); >- float t2p = presContext->TwipsToPixels(); >+ nsRect r = view->GetBounds() - view->GetPosition(); > > /* Limit the bitmap size */ >- nscoord twipLimitW = NSIntPixelsToTwips(mWidth, p2t); >- nscoord twipLimitH = NSIntPixelsToTwips(mHeight, p2t); >+ nscoord twipLimitW = NSIntPixelsToAppUnits(mWidth, dc->AppUnitsPerDevPixel ()); >+ nscoord twipLimitH = NSIntPixelsToAppUnits(mHeight, dc->AppUnitsPerDevPixel ()); > >- nsRect r = view->GetBounds() - view->GetPosition(); >- > if (r.height > twipLimitH) { > r.height = twipLimitH; > } >@@ -149,89 +140,37 @@ > r.width = twipLimitW; > } > >- /* sanity check */ >- if (r.IsEmpty()) { >- LOG ("Rect is empty!\n"); >- return PR_FALSE; >- } >+ mWidth = NSAppUnitsToIntPixels(r.width, dc->AppUnitsPerDevPixel ()); >+ mHeight = NSAppUnitsToIntPixels(r.height, dc->AppUnitsPerDevPixel ()); > >- mWidth = NSTwipsToIntPixels(r.width, t2p); >- mHeight = NSTwipsToIntPixels(r.height, t2p); >+ nsRefPtr<gfxImageSurface> imgSurface = >+ new gfxImageSurface(gfxIntSize(mWidth, mHeight), >+ gfxImageSurface::ImageFormatRGB24); >+ NS_ENSURE_TRUE(imgSurface, PR_FALSE); > >- PRUint32 stripe = (2 << 20) / mWidth; >- nscoord twipStripe = NSIntPixelsToTwips(stripe, p2t); >+ nsRefPtr<gfxContext> imgContext = new gfxContext(imgSurface); > >- nsRect cutout(r); >- cutout.SizeTo(r.width, PR_MIN(r.height, twipStripe)); >+ nsRefPtr<gfxASurface> surface = >+ gfxPlatform::GetPlatform()-> >+ CreateOffscreenSurface(gfxIntSize(mWidth, mHeight), >+ gfxASurface::ImageFormatRGB24); >+ NS_ENSURE_TRUE(surface, PR_FALSE); > >- PRUint32 roundCount = 0; >- const char* status = ""; >+ nsRefPtr<gfxContext> context = new gfxContext(surface); >+ NS_ENSURE_TRUE(context, PR_FALSE); > >- if (r.IsEmpty()) { >- status = "EMPTY"; >- } else { >- PRBool failed = PR_FALSE; >- while (!cutout.IsEmpty() && !mHadError && !failed) { >- ++roundCount; >+ rv = presShell->RenderDocument(r, PR_FALSE, PR_TRUE, >+ NS_RGB(255, 255, 0), context); >+ NS_ENSURE_SUCCESS(rv, PR_FALSE); > >- PRUint32 width = NSTwipsToIntPixels(cutout.width, t2p); >- PRUint32 height = NSTwipsToIntPixels(cutout.height, t2p); >+ imgContext->DrawSurface(surface, gfxSize(mWidth, mHeight)); > >- nsCOMPtr<nsIRenderingContext> context; >- rv = viewManager->RenderOffscreen (view, cutout, >- PR_FALSE, PR_TRUE, NS_RGB(255, 255, 255), >- getter_AddRefs(context)); >- if (NS_FAILED(rv)) { >- failed = PR_TRUE; >- status = "FAILEDRENDER"; >- } else { >- nsIDrawingSurface* surface; >- context->GetDrawingSurface(&surface); >- if (!surface) { >- failed = PR_TRUE; >- status = "NOSURFACE"; >- } else { >- PRUint32 w, h; >- surface->GetDimensions(&w,&h); >- /* these are computed from ScaleRoundOut(t2p) on cutout.Bounds(), and >- * may be one pixel too wide and/or hight >- */ >- >- if (width > w || height > h) { >- failed = PR_TRUE; >- status = "SIZEMISMATCH"; >- } else if (!Prepare(surface)) { >- failed = PR_TRUE; >- status = "PNGPREPAREFAILED"; >- } else { >- PRUint8* data; >- PRInt32 rowLen, rowSpan; >- rv = surface->Lock(0, 0, w, h, (void**)&data, &rowSpan, &rowLen, >- NS_LOCK_SURFACE_READ_ONLY); >- if (NS_FAILED(rv)) { >- failed = PR_TRUE; >- status = "FAILEDLOCK"; >- } else { >- LOG ("."); >- WriteSurface(surface, width, height, data, rowLen, rowSpan, rowLen/w); >- surface->Unlock(); >- } >- } >- } >- context->DestroyDrawingSurface(surface); >- } >- cutout.MoveBy(0, twipStripe); >- cutout.IntersectRect(r, cutout); >- } >- >- retval = Finish(); >- status = retval ? "OK" : status[0] != '\0' ? status : "FAILED"; >- LOG ("\n"); >+ if (Prepare(imgSurface)) { >+ WriteSurface(imgSurface, mWidth, mHeight); >+ return Finish(); > } > >- LOG ("%d round(s) of height %d, result: %s\n", roundCount, stripe, status); >- >- return retval; >+ return PR_FALSE; > } > > /* PNG Writer */ >@@ -267,7 +206,7 @@ > }; > > PRBool >-PNGWriter::Prepare(nsIDrawingSurface *aSurface) >+PNGWriter::Prepare(gfxImageSurface *aSurface) > { > if (mInitialised) return PR_TRUE; > >@@ -357,10 +296,6 @@ > // PNG_RESOLUTION_METER); > // 1000 * 72 / 25.4 = 2834 > >- nsPixelFormat format; >- aSurface->GetPixelFormat(&format); >- /* FIXME: assert that subsequent surfaces have same format? */ >- > /* FIXME: do I need 8, or the format.m[R|G|B]Count here? */ > png_set_IHDR (mPNG, mInfo, mWidth, mHeight, 8 /* bits per sample */ /* FIXME? */, > PNG_COLOR_TYPE_RGB /* FIXME: alpha? */, PNG_INTERLACE_NONE, >@@ -368,10 +303,10 @@ > if (mHadError) return PR_FALSE; > > png_color_8 sig_bit; >- sig_bit.red = format.mRedCount; >- sig_bit.green = format.mGreenCount; >- sig_bit.blue = format.mBlueCount; >- sig_bit.alpha = format.mAlphaCount; >+ sig_bit.red = 8; >+ sig_bit.green = 8; >+ sig_bit.blue = 8; >+ sig_bit.alpha = 0; > png_set_sBIT (mPNG, mInfo, &sig_bit); > if (mHadError) return PR_FALSE; > >@@ -390,43 +325,28 @@ > } > > void >-PNGWriter::WriteSurface(nsIDrawingSurface *aSurface, >+PNGWriter::WriteSurface(gfxImageSurface *aSurface, > PRUint32 aWidth, >- PRUint32 aHeight, >- PRUint8 *aData, >- PRInt32 aRowLen, >- PRInt32 aRowSpan, >- PRInt32 aPixelSpan) >+ PRUint32 aHeight) > { >- nsPixelFormat format; >- aSurface->GetPixelFormat(&format); >+ long cairoStride = aSurface->Stride(); >+ unsigned char* cairoData = aSurface->Data(); > >- PRUint8* buf = (PRUint8*) mRow; >- for (PRUint32 i = 0; i < aHeight; ++i) >- { >- PRUint8* src = aData + i*aRowSpan; >+ for (PRUint32 row = 0; row < aHeight; ++row) { >+ PRUint8* dest = mRow; >+ for (PRUint32 col = 0; col < aWidth; ++col) { >+ PRUint32* cairoPixel = reinterpret_cast<PRUint32*> >+ ((cairoData + row * cairoStride + 4 * col)); > >- PRUint8* dest = buf; >- for (PRUint32 j = 0; j < aWidth; ++j) >- { >- /* v is the pixel value */ >-#ifdef WORDS_BIGENDIAN >- PRUint32 v = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; >- v >>= (32 - 8*aPixelSpan); >-//maybe like this: PRUint32 v = *((PRUint32*) src) >> (32 - 8*bytesPerPix); >-#else >- PRUint32 v = *((PRUint32*) src); >-#endif >- dest[0] = ((v & format.mRedMask) >> format.mRedShift) << (8 - format.mRedCount); >- dest[1] = ((v & format.mGreenMask) >> format.mGreenShift) << (8 - format.mGreenCount); >- dest[2] = ((v & format.mBlueMask) >> format.mBlueShift) << (8 - format.mBlueCount); >- src += aPixelSpan; >- dest += 3; >- } >- >- png_write_row (mPNG, mRow); >- if (mHadError) break; >+ dest[0] = (*cairoPixel >> 16) & 0xFF; >+ dest[1] = (*cairoPixel >> 8) & 0xFF; >+ dest[2] = (*cairoPixel >> 0) & 0xFF; >+ dest += 3; > } >+ >+ png_write_row (mPNG, mRow); >+ if (mHadError) break; >+ } > } > > PRBool >@@ -484,7 +404,7 @@ > }; > > PRBool >-PPMWriter::Prepare(nsIDrawingSurface *aSurface) >+PPMWriter::Prepare(gfxImageSurface *aSurface) > { > if (mInitialised) return PR_TRUE; > >@@ -502,45 +422,30 @@ > } > > void >-PPMWriter::WriteSurface(nsIDrawingSurface *aSurface, >+PPMWriter::WriteSurface(gfxImageSurface *aSurface, > PRUint32 aWidth, >- PRUint32 aHeight, >- PRUint8 *aData, >- PRInt32 aRowLen, >- PRInt32 aRowSpan, >- PRInt32 aPixelSpan) >+ PRUint32 aHeight) > { >- nsPixelFormat format; >- aSurface->GetPixelFormat(&format); >+ long cairoStride = aSurface->Stride(); >+ unsigned char* cairoData = aSurface->Data(); > >- PRUint8* buf = (PRUint8*) mRow; >- for (PRUint32 i = 0; i < aHeight; ++i) >- { >- PRUint8* src = aData + i*aRowSpan; >+ for (PRUint32 row = 0; row < aHeight; ++row) { >+ PRUint8* dest = mRow; >+ for (PRUint32 col = 0; col < aWidth; ++col) { >+ PRUint32* cairoPixel = reinterpret_cast<PRUint32*> >+ ((cairoData + row * cairoStride + 4 * col)); > >- PRUint8* dest = mRow; >- for (PRUint32 j = 0; j < aWidth; ++j) >- { >- /* v is the pixel value */ >-#ifdef WORDS_BIGENDIAN >- PRUint32 v = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; >- v >>= (32 - 8*aPixelSpan); >-//maybe like this: PRUint32 v = *((PRUint32*) src) >> (32 - 8*bytesPerPix); >-#else >- PRUint32 v = *((PRUint32*) src); >-#endif >- dest[0] = ((v & format.mRedMask) >> format.mRedShift) << (8 - format.mRedCount); >- dest[1] = ((v & format.mGreenMask) >> format.mGreenShift) << (8 - format.mGreenCount); >- dest[2] = ((v & format.mBlueMask) >> format.mBlueShift) << (8 - format.mBlueCount); >- src += aPixelSpan; >- dest += 3; >- } >+ dest[0] = (*cairoPixel >> 16) & 0xFF; >+ dest[1] = (*cairoPixel >> 8) & 0xFF; >+ dest[2] = (*cairoPixel >> 0) & 0xFF; >+ dest += 3; >+ } > >- if (fwrite(mRow, 3, mWidth, mFile) != mWidth) { >- mHadError = PR_TRUE; >- break; >- } >+ if (fwrite(mRow, 3, mWidth, mFile) != mWidth) { >+ mHadError = PR_TRUE; >+ break; > } >+ } > } > > PRBool >@@ -573,7 +478,7 @@ > } > > PRBool >-ThumbnailWriter::Prepare(nsIDrawingSurface *aSurface) >+ThumbnailWriter::Prepare(gfxImageSurface *aSurface) > { > if (!mInitialised) { > void *buf = malloc (sizeof (GdkPixdata) + 3 * THUMBNAIL_WIDTH * THUMBNAIL_HEIGHT); >@@ -596,38 +501,25 @@ > } > > void >-ThumbnailWriter::WriteSurface(nsIDrawingSurface *aSurface, >+ThumbnailWriter::WriteSurface(gfxImageSurface *aSurface, > PRUint32 aWidth, >- PRUint32 aHeight, >- PRUint8 *aData, >- PRInt32 aRowLen, >- PRInt32 aRowSpan, >- PRInt32 aPixelSpan) >+ PRUint32 aHeight) > { >- nsPixelFormat format; >- aSurface->GetPixelFormat(&format); >+ long cairoStride = aSurface->Stride(); >+ unsigned char* cairoData = aSurface->Data(); > >- for (PRUint32 i = 0; i < aHeight; ++i) >- { >- PRUint8* src = aData + i*aRowSpan; >- for (PRUint32 j = 0; j < aWidth; ++j) >- { >- /* v is the pixel value */ >-#ifdef WORDS_BIGENDIAN >- PRUint32 v = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; >- v >>= (32 - 8*aPixelSpan); >-#else >- PRUint32 v = *((PRUint32*) src); >-#endif >- mDest[0] = ((v & format.mRedMask) >> format.mRedShift) << (8 - format.mRedCount); >- mDest[1] = ((v & format.mGreenMask) >> format.mGreenShift) << (8 - format.mGreenCount); >- mDest[2] = ((v & format.mBlueMask) >> format.mBlueShift) << (8 - format.mBlueCount); >- src += aPixelSpan; >- mDest += 3; >- } >+ for (PRUint32 row = 0; row < aHeight; ++row) { >+ for (PRUint32 col = 0; col < aWidth; ++col) { >+ PRUint32* cairoPixel = reinterpret_cast<PRUint32*> >+ ((cairoData + row * cairoStride + 4 * col)); > >- if (mHadError) break; >+ mDest[0] = (*cairoPixel >> 16) & 0xFF; >+ mDest[1] = (*cairoPixel >> 8) & 0xFF; >+ mDest[2] = (*cairoPixel >> 0) & 0xFF; >+ mDest += 3; > } >+ if (mHadError) break; >+ } > } > > PRBool >@@ -690,7 +582,7 @@ > }; > > PRBool >-JPEGWriter::Prepare(nsIDrawingSurface *aSurface) >+JPEGWriter::Prepare(gfxImageSurface *aSurface) > { > if (mInitialised) return PR_TRUE; > >@@ -733,44 +625,29 @@ > } > > void >-JPEGWriter::WriteSurface(nsIDrawingSurface *aSurface, >+JPEGWriter::WriteSurface(gfxImageSurface *aSurface, > PRUint32 aWidth, >- PRUint32 aHeight, >- PRUint8 *aData, >- PRInt32 aRowLen, >- PRInt32 aRowSpan, >- PRInt32 aPixelSpan) >+ PRUint32 aHeight) > { >- nsPixelFormat format; >- aSurface->GetPixelFormat(&format); >+ long cairoStride = aSurface->Stride(); >+ unsigned char* cairoData = aSurface->Data(); > >- PRUint8* buf = (PRUint8*) mRow; >- for (PRUint32 i = 0; i < aHeight; ++i) >- { >- PRUint8* src = aData + i*aRowSpan; >+ for (PRUint32 row = 0; row < aHeight; ++row) { >+ PRUint8* dest = mRow; >+ for (PRUint32 col = 0; col < aWidth; ++col) { >+ PRUint32* cairoPixel = reinterpret_cast<PRUint32*> >+ ((cairoData + row * cairoStride + 4 * col)); > >- PRUint8* dest = buf; >- for (PRUint32 j = 0; j < aWidth; ++j) >- { >- /* v is the pixel value */ >-#ifdef WORDS_BIGENDIAN >- PRUint32 v = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; >- v >>= (32 - 8*aPixelSpan); >-//maybe like this: PRUint32 v = *((PRUint32*) src) >> (32 - 8*bytesPerPix); >-#else >- PRUint32 v = *((PRUint32*) src); >-#endif >- dest[0] = ((v & format.mRedMask) >> format.mRedShift) << (8 - format.mRedCount); >- dest[1] = ((v & format.mGreenMask) >> format.mGreenShift) << (8 - format.mGreenCount); >- dest[2] = ((v & format.mBlueMask) >> format.mBlueShift) << (8 - format.mBlueCount); >- src += aPixelSpan; >- dest += 3; >- } >- >- JSAMPROW rows[1] = { (JSAMPLE*) mRow }; >- (void) jpeg_write_scanlines (&mJPEG, rows, 1); >- if (mHadError) break; >+ dest[0] = (*cairoPixel >> 16) & 0xFF; >+ dest[1] = (*cairoPixel >> 8) & 0xFF; >+ dest[2] = (*cairoPixel >> 0) & 0xFF; >+ dest += 3; > } >+ >+ JSAMPROW rows[1] = { (JSAMPLE*) mRow }; >+ (void) jpeg_write_scanlines (&mJPEG, rows, 1); >+ if (mHadError) break; >+ } > } > > PRBool >Index: configure.ac >=================================================================== >--- configure.ac (revision 105) >+++ configure.ac (working copy) >@@ -1,5 +1,5 @@ > # Copyright © 2000-2004 Marco Pesenti Gritti >-# Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch >+# Copyright © 2003, 2004, 2005 Christian Persch > # > # This program is free software; you can redistribute it and/or modify it > # under the terms of the GNU General Public License as published by the >@@ -130,59 +130,13 @@ > > AM_GCONF_SOURCE_2 > >+# ********* >+# Xulrunner >+# ********* > >-# ******* >-# Mozilla >-# ******* >+LIBXUL_INIT >+LIBXUL_DEFINES > >-GECKO_INIT([GECKO]) >-GECKO_DEFINES >- >-AC_SUBST([GECKO]) >-AC_SUBST([GECKO_FLAVOUR]) >-AC_SUBST([GECKO_INCLUDE_ROOT]) >-AC_SUBST([GECKO_HOME]) >-AC_SUBST([GECKO_PREFIX]) >- >-case "$GECKO" in >-seamonkey) min_version=1.0 ;; >-*firefox) min_version=1.4 ;; >-xulrunner) min_version=1.8 ;; >-esac >- >-PKG_CHECK_MODULES([GECKO], [${gecko_cv_gecko}-xpcom >= $min_version ${gecko_cv_extra_pkg_dependencies}]) >-AC_SUBST([GECKO_CFLAGS]) >-AC_SUBST([GECKO_LIBS]) >- >-# In xulrunner, gkgfx is in libxul; for all others we need to >-# explicitly link against it >- >-if test "$GECKO" != "xulrunner"; then >- GECKO_EXTRA_LIBS="$GECKO_EXTRA_LIBS -lgkgfx" >-fi >- >-AC_SUBST([GECKO_EXTRA_LIBS]) >- >-# Check for PSM headers >- >-AC_MSG_CHECKING([for mozilla security compoment]) >-GECKO_COMPILE_IFELSE([pipnss], >- [AC_LANG_PROGRAM( >- [[#include <nsIX509Cert.h>]], >- [[nsIX509Cert *c; >- c->GetIssuer (nsnull);]] >- )], >- [AC_DEFINE([HAVE_PSM], [1],[Define if you have the mozilla NSS headers installed]) have_psm=yes], >- [have_psm=no]) >-AC_MSG_RESULT([$have_psm]) >- >-AM_CONDITIONAL([HAVE_PSM],[test "x$have_psm" = "xyes"]) >- >-# Needed since 1.8b2 >-# Define this down here so it doesn't affect the API checks above >- >-AC_DEFINE([MOZILLA_INTERNAL_API],[1],[Define for access to internal mozilla API]) >- > # ****************** > # Portability checks > # ****************** >--- /dev/null 2008-03-07 10:07:23.927002592 +0100 >+++ m4/libxul.m4 2008-03-07 17:34:47.000000000 +0100 >@@ -0,0 +1,566 @@ >+# Copyright © 2000-2004 Marco Pesenti Gritti >+# Copyright © 2003, 2004, 2005, 2006, 2007 Christian Persch >+# >+# This program is free software; you can redistribute it and/or modify it >+# under the terms of the GNU General Public License as published by the >+# Free Software Foundation; either version 2 of the License, or (at your >+# option) any later version. >+# >+# This program is distributed in the hope that it will be useful, but >+# WITHOUT ANY WARRANTY; without even the implied warranty of >+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+# General Public License for more details. >+# >+# You should have received a copy of the GNU General Public License along >+# with this program; if not, write to the Free Software Foundation, Inc., >+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >+ >+# LIBXUL_INIT([embedding],[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) >+# >+# Checks for libxul, and aborts if it's not found >+# >+# Checks for -fshort-wchar compiler variable, and adds it to >+# AM_CXXFLAGS if found >+# >+# Checks whether RTTI is enabled, and adds -fno-rtti to >+# AM_CXXFLAGS otherwise >+# >+# Checks whether the gecko build is a debug build, and adds >+# debug flags to AM_CXXFLAGS if it is. >+ >+AC_DEFUN([LIBXUL_INIT], >+[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl >+ >+if test -z "$1"; then >+ libxul_cv_libxul_pkg="libxul" >+elif test "$1" = "embedding"; then >+ libxul_cv_libxul_pkg="libxul-embedding" >+else >+ AC_MSG_ERROR([[Unsupported value passed to LIBXUL_INIT]]) >+fi >+ >+PKG_CHECK_EXISTS([$libxul_cv_libxul_pkg],[libxul_cv_have_libxul=yes],[libxul_cv_have_libxul=no]) >+if test "$libxul_cv_have_libxul" != "yes"; then >+ # Debian/Ubuntu xulrunner-1.9-dev has versioned pc files, try again >+ libxul_cv_libxul_pkg="${libxul_cv_libxul_pkg}-1.9" >+ PKG_CHECK_EXISTS([$libxul_cv_libxul_pkg],[libxul_cv_have_libxul=yes],[libxul_cv_have_libxul=no]) >+fi >+if test "$libxul_cv_have_libxul" != "yes"; then >+ # Still nothing? Error out >+ AC_MSG_ERROR([libxul not found]) >+fi >+ >+libxul_cv_version="$($PKG_CONFIG --modversion $libxul_cv_libxul_pkg)" >+libxul_cv_prefix="$($PKG_CONFIG --variable=prefix $libxul_cv_libxul_pkg)" >+libxul_cv_include_root="$($PKG_CONFIG --variable=includedir $libxul_cv_libxul_pkg)" >+libxul_cv_sdkdir="$($PKG_CONFIG --variable=sdkdir $libxul_cv_libxul_pkg)" >+ >+# FIXMEchpe: this isn't right. The pc file seems buggy, but until >+# I can figure this out, do it like this: >+libxul_cv_libdir="$(readlink $($PKG_CONFIG --variable=sdkdir $libxul_cv_libxul_pkg)/bin)" >+ >+libxul_cv_includes="$($PKG_CONFIG --cflags-only-I libxul-unstable libxul)" >+ >+AC_DEFINE([HAVE_LIBXUL],[1],[Define for libxul]) >+ >+LIBXUL_VERSION="$libxul_cv_version" >+LIBXUL_PREFIX="$libxul_cv_prefix" >+LIBXUL_INCLUDE_ROOT="$libxul_cv_include_root" >+LIBXUL_INCLUDES="$libxul_cv_includes" >+LIBXUL_LIBDIR="$libxul_cv_libdir" >+ >+LIBXUL_CXXCPPFLAGS= >+LIBXUL_CXXFLAGS= >+LIBXUL_LDFLAGS= >+ >+# Can't use the value from the .pc file, since it seems buggy >+# Until I can figure it out, do this instead >+LIBXUL_LIBS="-L${libxul_cv_sdkdir}/lib -lxpcomglue_s -L${libxul_cv_sdkdir}/bin -lxul -lxpcom" >+ >+# *********************** >+# Check for -fshort-wchar >+# *********************** >+ >+# NOTE: This is really gcc-only >+# Do this test using CXX only since some versions of gcc >+# 2.95-2.97 have a signed wchar_t in c++ only and some versions >+# only have short-wchar support for c++. >+ >+AC_LANG_PUSH([C++]) >+ >+_SAVE_CXXFLAGS=$CXXFLAGS >+CXXFLAGS="$CXXFLAGS $LIBXUL_CXXFLAGS -fshort-wchar" >+ >+AC_CACHE_CHECK([for compiler -fshort-wchar option], >+ libxul_cv_have_usable_wchar_option, >+ [AC_RUN_IFELSE([AC_LANG_SOURCE( >+ [[#include <stddef.h> >+ int main () { >+ return (sizeof(wchar_t) != 2) || (wchar_t)-1 < (wchar_t) 0 ; >+ } ]])], >+ [libxul_cv_have_usable_wchar_option="yes"], >+ [libxul_cv_have_usable_wchar_option="no"], >+ [libxul_cv_have_usable_wchar_option="maybe (cross-compiling)"])]) >+ >+CXXFLAGS="$_SAVE_CXXFLAGS" >+ >+AC_LANG_POP([C++]) >+ >+if test "$libxul_cv_have_usable_wchar_option" = "yes"; then >+ LIBXUL_CXXFLAGS="$LIBXUL_CXXFLAGS -fshort-wchar" >+fi >+ >+# ************** >+# Check for RTTI >+# ************** >+ >+AC_MSG_CHECKING([whether to enable C++ RTTI]) >+AC_ARG_ENABLE([cpp-rtti], >+ AS_HELP_STRING([--enable-cpp-rtti],[Enable C++ RTTI]), >+ [],[enable_cpp_rtti=no]) >+AC_MSG_RESULT([$enable_cpp_rtti]) >+ >+if test "$enable_cpp_rtti" = "no"; then >+ LIBXUL_CXXFLAGS="-fno-rtti $LIBXUL_CXXFLAGS" >+fi >+ >+# ************* >+# Various tests >+# ************* >+ >+# FIXMEchpe: remove this test, it shouldn't be needed anymore thanks to static glue libs >+ >+AC_LANG_PUSH([C++]) >+ >+_SAVE_CPPFLAGS="$CPPFLAGS" >+CPPFLAGS="$CPPFLAGS $LIBXUL_CXXCPPFLAGS $LIBXUL_INCLUDES" >+ >+AC_MSG_CHECKING([[whether we have a libxul debug build]]) >+AC_COMPILE_IFELSE( >+ [AC_LANG_SOURCE([[#include <xpcom-config.h> >+ #if !defined(MOZ_REFLOW_PERF) || !defined(MOZ_REFLOW_PERF_DSP) >+ #error No >+ #endif]] >+ )], >+ [libxul_cv_have_debug=yes], >+ [libxul_cv_have_debug=no]) >+AC_MSG_RESULT([$libxul_cv_have_debug]) >+ >+CPPFLAGS="$_SAVE_CPPFLAGS" >+ >+AC_LANG_POP([C++]) >+ >+if test "$libxul_cv_have_debug" = "yes"; then >+ LIBXUL_CXXCPPFLAGS="$LIBXUL_CXXCPPFLAGS -DDEBUG -D_DEBUG" >+ >+ AC_DEFINE([HAVE_LIBXUL_DEBUG],[1],[Define if libxul is a debug build]) >+fi >+ >+# ************************************* >+# Check for C++ symbol visibility stuff >+# ************************************* >+ >+# Check for .hidden assembler directive and visibility attribute. >+# Copied from mozilla's configure.in, which in turn was >+# borrowed from glibc's configure.in >+ >+# Only do this for g++ >+ >+if test "$GXX" = "yes"; then >+ AC_CACHE_CHECK(for visibility(hidden) attribute, >+ libxul_cv_visibility_hidden, >+ [cat > conftest.c <<EOF >+ int foo __attribute__ ((visibility ("hidden"))) = 1; >+EOF >+ libxul_cv_visibility_hidden=no >+ if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then >+ if egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then >+ libxul_cv_visibility_hidden=yes >+ fi >+ fi >+ rm -f conftest.[cs] >+ ]) >+ if test "$libxul_cv_visibility_hidden" = "yes"; then >+ AC_DEFINE([HAVE_VISIBILITY_HIDDEN_ATTRIBUTE],[1],[Define if the compiler supports the "hidden" visibility attribute]) >+ >+ AC_CACHE_CHECK(for visibility(default) attribute, >+ libxul_cv_visibility_default, >+ [cat > conftest.c <<EOF >+ int foo __attribute__ ((visibility ("default"))) = 1; >+EOF >+ libxul_cv_visibility_default=no >+ if ${CC-cc} -fvisibility=hidden -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then >+ if ! egrep '\.(hidden|private_extern).*foo' conftest.s >/dev/null; then >+ libxul_cv_visibility_default=yes >+ fi >+ fi >+ rm -f conftest.[cs] >+ ]) >+ if test "$libxul_cv_visibility_default" = "yes"; then >+ AC_DEFINE([HAVE_VISIBILITY_ATTRIBUTE],[1],[Define if the compiler supports the "default" visibility attribute]) >+ >+ AC_CACHE_CHECK(for visibility pragma support, >+ libxul_cv_visibility_pragma, >+ [cat > conftest.c <<EOF >+#pragma GCC visibility push(hidden) >+ int foo_hidden = 1; >+#pragma GCC visibility push(default) >+ int foo_default = 1; >+EOF >+ libxul_cv_visibility_pragma=no >+ if ${CC-cc} -Werror -S conftest.c -o conftest.s >/dev/null 2>&1; then >+ if egrep '\.(hidden|private_extern).*foo_hidden' conftest.s >/dev/null; then >+ if ! egrep '\.(hidden|private_extern).*foo_default' conftest.s > /dev/null; then >+ libxul_cv_visibility_pragma=yes >+ fi >+ fi >+ fi >+ rm -f conftest.[cs] >+ ]) >+ if test "$libxul_cv_visibility_pragma" = "yes"; then >+ AC_CACHE_CHECK(For gcc visibility bug with class-level attributes (GCC bug 26905), >+ libxul_cv_have_visibility_class_bug, >+ [cat > conftest.c <<EOF >+#pragma GCC visibility push(hidden) >+struct __attribute__ ((visibility ("default"))) TestStruct { >+ static void Init(); >+}; >+__attribute__ ((visibility ("default"))) void TestFunc() { >+ TestStruct::Init(); >+} >+EOF >+ libxul_cv_have_visibility_class_bug=no >+ if ! ${CXX-g++} ${CXXFLAGS} ${DSO_PIC_CFLAGS} ${DSO_LDOPTS} -S -o conftest.S conftest.c > /dev/null 2>&1 ; then >+ libxul_cv_have_visibility_class_bug=yes >+ else >+ if test `egrep -c '@PLT|\\$stub' conftest.S` = 0; then >+ libxul_cv_have_visibility_class_bug=yes >+ fi >+ fi >+ rm -rf conftest.{c,S} >+ ]) >+ >+ AC_CACHE_CHECK(For x86_64 gcc visibility bug with builtins (GCC bug 20297), >+ libxul_cv_have_visibility_builtin_bug, >+ [cat > conftest.c <<EOF >+#pragma GCC visibility push(hidden) >+#pragma GCC visibility push(default) >+#include <string.h> >+#pragma GCC visibility pop >+ >+__attribute__ ((visibility ("default"))) void Func() { >+ char c[[100]]; >+ memset(c, 0, sizeof(c)); >+} >+EOF >+ libxul_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 >+ libxul_cv_have_visibility_builtin_bug=yes >+ else >+ if test `grep -c "@PLT" conftest.S` = 0; then >+ libxul_cv_visibility_builtin_bug=yes >+ fi >+ fi >+ rm -f conftest.{c,S} >+ ]) >+ if test "$libxul_cv_have_visibility_builtin_bug" = "no" -a \ >+ "$libxul_cv_have_visibility_class_bug" = "no"; then >+ VISIBILITY_FLAGS='-I$(DIST)/include/system_wrappers -include $(topsrcdir)/config/gcc_hidden.h' >+ WRAP_SYSTEM_INCLUDES=1 >+ else >+ VISIBILITY_FLAGS='-fvisibility=hidden' >+ fi # have visibility pragma bug >+ fi # have visibility pragma >+ fi # have visibility(default) attribute >+ fi # have visibility(hidden) attribute >+ >+ LIBXUL_CXXFLAGS="$LIBXUL_CXXFLAGS $VISIBILITY_FLAGS" >+fi # g++ >+ >+# ********* >+# Finish up >+# ********* >+ >+AC_SUBST([LIBXUL_VERSION]) >+AC_SUBST([LIBXUL_PREFIX]) >+AC_SUBST([LIBXUL_INCLUDE_ROOT]) >+AC_SUBST([LIBXUL_INCLUDES]) >+AC_SUBST([LIBXUL_LIBDIR]) >+AC_SUBST([LIBXUL_CXXCPPFLAGS]) >+AC_SUBST([LIBXUL_CXXFLAGS]) >+AC_SUBST([LIBXUL_LDFLAGS]) >+AC_SUBST([LIBXUL_LIBS]) >+ >+]) >+ >+# LIBXUL_DEFINES >+# >+# Automake defines for libxul. Not included in LIBXUL_INIT so that >+# LIBXUL_INIT may be called conditionally. If you use LIBXUL_INIT, >+# you _must_ call LIBXUL_DEFINES, unconditionally. >+ >+AC_DEFUN([LIBXUL_DEFINES], >+[ >+ >+AM_CONDITIONAL([HAVE_LIBXUL],[test "$libxul_cv_have_libxul" = "yes"]) >+AM_CONDITIONAL([HAVE_LIBXUL_DEBUG],[test "$libxul_cv_have_debug" = "yes"]) >+ >+]) >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# _LIBXUL_DISPATCH(MACRO, INCLUDEDIRS, ...) >+ >+m4_define([_LIBXUL_DISPATCH], >+[ >+ >+AC_LANG_PUSH([C++]) >+ >+_SAVE_CPPFLAGS="$CPPFLAGS" >+_SAVE_CXXFLAGS="$CXXFLAGS" >+_SAVE_LDFLAGS="$LDFLAGS" >+_SAVE_LIBS="$LIBS" >+CPPFLAGS="$CPPFLAGS $LIBXUL_CXXCPPFLAGS $LIBXUL_INCLUDES" >+CXXFLAGS="$CXXFLAGS $LIBXUL_CXXFLAGS $($PKG_CONFIG --cflags-only-other libxul)" >+LDFLAGS="$LDFLAGS $LIBXUL_LDFLAGS -Wl,--rpath=$LIBXUL_LIBDIR" >+LIBS="$LIBS $($PKG_CONFIG --libs libxul)" >+ >+# FIXMEchpe: remove this, since the header layout is now flat (only stable and unstable) >+ >+_LIBXUL_DISPATCH_INCLUDEDIRS="$2" >+ >+_LIBXUL_DISPATCH_INCLUDEDIRS="$_LIBXUL_DISPATCH_INCLUDEDIRS dom necko pref" >+ >+# Now add them to CPPFLAGS >+for i in $_LIBXUL_DISPATCH_INCLUDEDIRS; do >+ CPPFLAGS="$CPPFLAGS -I$LIBXUL_INCLUDE_ROOT/$i" >+done >+ >+m4_indir([$1],m4_shiftn(2,$@)) >+ >+CPPFLAGS="$_SAVE_CPPFLAGS" >+CXXFLAGS="$_SAVE_CXXFLAGS" >+LDFLAGS="$_SAVE_LDFLAGS" >+LIBS="$_SAVE_LIBS" >+ >+AC_LANG_POP([C++]) >+ >+])# _LIBXUL_DISPATCH >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# LIBXUL_CHECK_HEADERS(INCLUDEDIRS, HEADERS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [INCLUDES]) >+ >+AC_DEFUN([LIBXUL_CHECK_HEADERS],[_LIBXUL_DISPATCH([AC_CHECK_HEADERS],$@)]) >+ >+# LIBXUL_COMPILE_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) >+ >+AC_DEFUN([LIBXUL_COMPILE_IFELSE],[_LIBXUL_DISPATCH([AC_COMPILE_IFELSE],$@)]) >+ >+# LIBXUL_RUN_IFELSE(INCLUDEDIRS, PROGRAM, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) >+ >+AC_DEFUN([LIBXUL_RUN_IFELSE],[_LIBXUL_DISPATCH([AC_RUN_IFELSE],$@)]) >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# LIBXUL_XPCOM_PROGRAM([PROLOGUE], [BODY]) >+# >+# Produce a template C++ program which starts XPCOM up and shuts it down after >+# the BODY part has run. In BODY, the the following variables are predeclared: >+# >+# nsresult rv >+# int status = 1 (EXIT_FAILURE) >+# >+# The program's exit status will be |status|; set it to 0 (or EXIT_SUCCESS) >+# to indicate success and to a value between 1 (EXIT_FAILURE) and 120 to >+# indicate failure. >+# >+# To jump out of the BODY and exit the test program, you can use |break|. >+ >+AC_DEFUN([LIBXUL_XPCOM_PROGRAM], >+[AC_LANG_PROGRAM([[ >+#include <xpcom-config.h> >+#include <stdlib.h> >+#include <stdio.h> >+#include <nsXPCOM.h> >+#include <nsCOMPtr.h> >+#include <nsILocalFile.h> >+#include <nsIServiceManager.h> >+#include <nsStringGlue.h> >+]] >+[$1], >+[[ >+// redirect unwanted mozilla debug output to the bit bucket >+freopen ("/dev/null", "w", stdout); >+ >+nsresult rv; >+nsCOMPtr<nsILocalFile> directory; >+rv = NS_NewNativeLocalFile (NS_LITERAL_CSTRING("$_LIBXUL_HOME"), PR_FALSE, >+ getter_AddRefs (directory)); >+if (NS_FAILED (rv) || !directory) { >+ exit (126); >+} >+ >+rv = NS_InitXPCOM2 (nsnull, directory, nsnull); >+if (NS_FAILED (rv)) { >+ exit (125); >+} >+ >+int status = EXIT_FAILURE; >+ >+// now put in the BODY, scoped with do...while(0) to ensure we don't hold a >+// COMptr after XPCOM shutdown and so we can jump out with a simple |break|. >+do { >+]] >+m4_shiftn(1,$@) >+[[ >+} while (0); >+ >+NS_ShutdownXPCOM (nsnull); >+exit (status); >+]]) >+]) # LIBXUL_XPCOM_PROGRAM >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# LIBXUL_XPCOM_PROGRAM_CHECK([ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [ACTION-IF-CROSS-COMPILING]) >+# >+# Checks whether we can build and run any XPCOM test programs at all >+ >+AC_DEFUN([LIBXUL_XPCOM_PROGRAM_CHECK], >+[AC_REQUIRE([LIBXUL_INIT])dnl >+ >+AC_CACHE_CHECK([whether we can compile and run XPCOM programs], >+[libxul_cv_xpcom_program_check], >+[ >+libxul_cv_xpcom_program_check=no >+ >+LIBXUL_RUN_IFELSE([], >+ [LIBXUL_XPCOM_PROGRAM([],[[status = EXIT_SUCCESS;]])], >+ [libxul_cv_xpcom_program_check=yes], >+ [libxul_cv_xpcom_program_check=no], >+ [libxul_cv_xpcom_program_check=maybe]) >+]) >+ >+if test "$libxul_cv_xpcom_program_check" = "yes"; then >+ ifelse([$2],,[:],[$2]) >+else >+ ifelse([$3],,[AC_MSG_FAILURE([Cannot compile and run XPCOM programs])], >+ [$3]) >+fi >+ >+]) # LIBXUL_XPCOM_PROGRAM_CHECK >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# LIBXUL_CHECK_CONTRACTID(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) >+# >+# Checks wheter CONTRACTID is a registered contract ID >+ >+AC_DEFUN([LIBXUL_CHECK_CONTRACTID], >+[AC_REQUIRE([LIBXUL_INIT])dnl >+ >+AS_VAR_PUSHDEF([libxul_cv_have_CID],[libxul_cv_have_$1]) >+ >+AC_CACHE_CHECK([for the $1 XPCOM component], >+libxul_cv_have_CID, >+[ >+AS_VAR_SET(libxul_cv_have_CID,[no]) >+ >+LIBXUL_RUN_IFELSE([], >+[LIBXUL_XPCOM_PROGRAM([[ >+#include <nsIComponentRegistrar.h> >+]],[[ >+status = 99; >+nsCOMPtr<nsIComponentRegistrar> registrar; >+rv = NS_GetComponentRegistrar (getter_AddRefs (registrar)); >+if (NS_FAILED (rv)) break; >+ >+status = 98; >+PRBool isRegistered = PR_FALSE; >+rv = registrar->IsContractIDRegistered ("$1", &isRegistered); >+if (NS_FAILED (rv)) break; >+ >+status = isRegistered ? EXIT_SUCCESS : 97; >+]]) >+], >+[AS_VAR_SET(libxul_cv_have_CID,[yes])], >+[AS_VAR_SET(libxul_cv_have_CID,[no])], >+[AS_VAR_SET(libxul_cv_have_CID,[maybe])]) >+ >+]) >+ >+if test AS_VAR_GET(libxul_cv_have_CID) = "yes"; then >+ ifelse([$2],,[:],[$2]) >+else >+ ifelse([$3],,[AC_MSG_ERROR([dnl >+Contract ID "$1" is not registered, but $PACKAGE_NAME depends on it.])], >+ [$3]) >+fi >+ >+AS_VAR_POPDEF([libxul_cv_have_CID]) >+ >+]) # LIBXUL_CHECK_CONTRACTID >+ >+# LIBXUL_CHECK_CONTRACTIDS(CONTRACTID, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) >+# >+# Checks wheter CONTRACTIDs are registered contract IDs. >+# If ACTION-IF-NOT-FOUND is given, it is executed when one of the contract IDs >+# is not found and the missing contract ID is in the |as_contractid| variable. >+ >+AC_DEFUN([LIBXUL_CHECK_CONTRACTIDS], >+[AC_REQUIRE([LIBXUL_INIT])dnl >+ >+result=yes >+as_contractid= >+for as_contractid in $1 >+do >+ LIBXUL_CHECK_CONTRACTID([$as_contractid],[],[result=no; break;]) >+done >+ >+if test "$result" = "yes"; then >+ ifelse([$2],,[:],[$2]) >+else >+ ifelse([$3],,[AC_MSG_ERROR([dnl >+Contract ID "$as_contractid" is not registered, but $PACKAGE_NAME depends on it.])], >+ [$3]) >+fi >+ >+]) # LIBXUL_CHECK_CONTRACTIDS >+ >+# *************************************************************************** >+# *************************************************************************** >+# *************************************************************************** >+ >+# LIBXUL_XPIDL([ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND]) >+# >+# Checks for xpidl program and include directory >+# >+# Variables set: >+# XPIDL: the xpidl program >+# XPIDL_IDLDIR: the xpidl include directory >+ >+AC_DEFUN([LIBXUL_XPIDL], >+[AC_REQUIRE([LIBXUL_INIT])dnl >+ >+_C_PATH_PROG([XPIDL],[xpidl],[no],[$LIBXUL_LIBDIR:$PATH]) >+ >+XPIDL_IDLDIR="$($PKG_CONFIG --variable=idldir libxul)" >+ >+if test "$XPIDL" != "no" -a -n "$XPIDL_IDLDIR" -a -f "$XPIDL_IDLDIR/nsISupports.idl"; then >+ ifelse([$1],,[:],[$1]) >+else >+ ifelse([$2],,[AC_MSG_FAILURE([XPIDL program or include directory not found])],[$2]) >+fi >+ >+])
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 434126
:
297137
|
297215
|
297224