Closed Bug 290518 Opened 19 years ago Closed 19 years ago

make cairo build on windows/msvc

Categories

(Core Graveyard :: GFX, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: bryner, Assigned: bryner)

References

Details

Attachments

(1 file, 3 obsolete files)

 
Attached patch patch (obsolete) — Splinter Review
This lets us use our existing build system to compile cairo and libpixman,
which I think is the quickest way to get things working.  One non-obvious thing
here is that I needed to add a definition for AC_SRC_ALPHA, otherwise it
doesn't compile with VC6.  I think that patch should be submitted upstream as
well.  Same for the M_PI addition.  I had to #ifdef out all of the debug code
inside cairo itself, because it references functions I can't find defined
anywhere (it's probably just as well, since a lot of developers do debug builds
and probably aren't really interested in debugging cairo).
Attachment #180837 - Flags: review?(vladimir)
Attachment #180837 - Flags: superreview?(tor)
Comment on attachment 180837 [details] [diff] [review]
patch

Looks good to me; I'll get a build going on win32 with it and with my own
latest canvas changes at some point tonight.
Attachment #180837 - Flags: review?(vladimir) → review+
Comment on attachment 180837 [details] [diff] [review]
patch

>+ifeq ($(MOZ_GFX_TOOLKIT),windows)
>+CSRCS	+= 	cairo_win32_font.c \
>+		cairo_win32_surface.c
>+EXPORTS += cairo-win32.h
>+endif
>+
>+ifeq ($(MOZ_GFX_TOOLKIT),cocoa)
>+CSRCS	+= 	cairo_quartz_surface.c \
>+		cairo_atsui_font.c
>+endif

export cairo-quartz.h

>+ifdef BUILD_CAIRO_PDF
>+CSRCS	+= cairo_pdf_surface.c \
>+	cairo_png_surface.c \
>+	cairo_ps_surface.c
>+endif

export cairo-pdf.h (nit whitespace)

>+ifdef BUILD_CAIRO_X11
>+CSRCS	+=	cairo_xcb_surface.c \
>+		cairo_xlib_surface.c \
>+		cairo_ft_font.c
>+endif

export cairo-xlib.h

>+ifdef BUILD_CAIRO_GL
>+CSRCS	+= 	cairo_glitz_surface.c
>+endif

export cairo-glitz.h

>+
>+LOCAL_INCLUDES	= -I$(srcdir)
>+
>+FORCE_STATIC_LIB = 1
>+# This library is used by other shared libs in a static build
>+FORCE_USE_PIC = 1

Something for another bug, but we're currently going to end up including two
copies of the cairo/pixman libraries shipping with binaries (once linked to
the cairo svg component, once linked to gklayout).

>+# If stdint.h is not present on the system, we export it from this directory.
>+ifndef HAVE_STDINT_H
>+EXPORTS		+= stdint.h
> 
>-ps-am:
>+export::
>+	cp -p $(srcdir)/mozstdint.h stdint.h
>+endif

Do we really want to be exporting stdint.h?  Reusing a standard name like
that just seems to be begging for trouble/confusion down the line.
Attachment #180837 - Flags: superreview?(tor) → superreview-
+#define int8_t   PRInt8

hm... why not use a typedef?
(In reply to comment #3)
> Do we really want to be exporting stdint.h?  Reusing a standard name like
> that just seems to be begging for trouble/confusion down the line.
> 

I don't see a way around exporting it; cairo.h includes pixman.h which needs
stdint.h.  We're explicitly only doing this for platforms without a stdint.h.

(In reply to comment #4)
> +#define int8_t   PRInt8
> 
> hm... why not use a typedef?

It looks like system versions of stdint.h generally do use typedefs, so I'll
change it to avoid future idiosyncrasies regarding typedef usage.
Attached patch revised patch (obsolete) — Splinter Review
Changes from the last patch:

gfx/cairo/libpixman/src/mozstdint.h:
  - Changed #defines to typedefs
gfx/cairo/cairo/src/Makefile.in:
  - Added exports for non-win32 platforms
  - Made quartz surface build for either mac or cocoa widget
  - Moved export rule so that the default make target is still "all"
gfx/cairo/.cvsignore, gfx/cairo/cairo/src/.cvsignore,
gfx/cairo/libpixman/src/.cvsignore: added
Attachment #180837 - Attachment is obsolete: true
Attachment #180917 - Flags: superreview?(tor)
(In reply to comment #5)
> (In reply to comment #3)
> > Do we really want to be exporting stdint.h?  Reusing a standard name like
> > that just seems to be begging for trouble/confusion down the line.
> 
> I don't see a way around exporting it; cairo.h includes pixman.h which needs
> stdint.h.  We're explicitly only doing this for platforms without a stdint.h.

Actually pixman.h, cairo-wideint.h, and cairoint.h all select between
int_types.h, inttypes.h, and stdint.h based on various prepocessor defines.
We already modify these sections in the moz tree copy (see cairo/stdint.diff),
so could/should change them again for what you're trying to do.
Attachment #180917 - Attachment is obsolete: true
Attachment #181005 - Flags: superreview?(tor)
(In reply to comment #8)
> Created an attachment (id=181005) [edit]
> hook in mozstdint.h without calling it stdint.h

With this patch, linux fails to build with errors that look its failing to try
using the native 64bit type support (bug 287035):

/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c: In function
`_cairo_hull_vertex_compare':
/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:96: error:
conversion to non-scalar type requested
/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:97: error:
conversion to non-scalar type requested
/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:98: error:
conversion to non-scalar type requested
/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:99: error:
conversion to non-scalar type requested
/home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:100: error:
invalid operands to binary <
Same errors on OS-X.
We need to define HAVE_UINT64_T, I guess.  May as well do it unconditionally
since we have this type available everywhere.

(In reply to comment #9)
> (In reply to comment #8)
> > Created an attachment (id=181005) [edit] [edit]
> > hook in mozstdint.h without calling it stdint.h
> 
> With this patch, linux fails to build with errors that look its failing to try
> using the native 64bit type support (bug 287035):
> 
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c: In function
> `_cairo_hull_vertex_compare':
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:96: error:
> conversion to non-scalar type requested
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:97: error:
> conversion to non-scalar type requested
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:98: error:
> conversion to non-scalar type requested
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:99: error:
> conversion to non-scalar type requested
> /home/tor/src/moz-build/mozilla/gfx/cairo/cairo/src/cairo_hull.c:100: error:
> invalid operands to binary <
> 
Instead of these sections:

#if defined (__SVR4) && defined (__sun)
# include <sys/int_types.h>
#else
# if defined (__OpenBSD__) || defined (_AIX)
#  include <inttypes.h>
# else 
#  if defined (HAVE_STDINT_H)
#   include <stdint.h>
#  else
#   include <mozstdint.h>
#  endif
# endif
#endif

Maybe we should do something closer to what CVS cairo uses (with the appropriate
configure.in changes)?

#if   HAVE_STDINT_H
# include <stdint.h>
#elif HAVE_INTTYPES_H
# include <inttypes.h>
#elif HAVE_SYS_INT_TYPES_H
# include <sys/int_types.h>
#else
# include "mozstdint.h"
#endif
Attached patch one more trySplinter Review
I tested that this builds on Windows and Mac.
Attachment #181005 - Attachment is obsolete: true
Attachment #181092 - Flags: superreview?(tor)
(In reply to comment #13)
> Created an attachment (id=181092) [edit]
> one more try
> 
> I tested that this builds on Windows and Mac.

It builds on Linux / gtk2 as well.
Comment on attachment 181092 [details] [diff] [review]
one more try

SVG enabled build fails.  You need this change:

RCS file: /cvsroot/mozilla/layout/svg/renderer/src/cairo/Makefile.in,v
retrieving revision 1.12
diff -u -8 -p -r1.12 Makefile.in
--- Makefile.in 5 Apr 2005 12:36:02 -0000	1.12
+++ Makefile.in 19 Apr 2005 16:19:33 -0000
@@ -64,16 +64,18 @@ REQUIRES = \
	dom	\
	content \
	necko	\
	util \
	uconv \
	windowwatcher \
	locale \
	layout \
+	cairo \
+	libpixman \
	$(NULL)

Also BUILD_CAIRO_X11 doesn't seem to be getting set on linux, so cairo-xlib.h
wasn't exported (causing nsSVGCairoCanvas.cpp to fail to compile even with the
above patch).
Attachment #181092 - Flags: superreview?(tor) → superreview-
I fixed those and checked in the patch.  I don't really feel like wasting more
time iterating on this bug when any bustage should be readily apparent on tinderbox.
Status: NEW → RESOLVED
Closed: 19 years ago
Resolution: --- → FIXED
Attachment #180917 - Flags: superreview?(tor)
Attachment #181005 - Flags: superreview?(tor)
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: