Bug 201683 - [PATCH] [mips] graphics/cairo: fails to build on mips
Summary: [PATCH] [mips] graphics/cairo: fails to build on mips
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-gnome mailing list
URL:
Keywords: patch
Depends on:
Blocks: 201681
  Show dependency treegraph
 
Reported: 2015-07-19 01:29 UTC by Carlos J Puga Medina
Modified: 2015-11-09 15:16 UTC (History)
4 users (show)

See Also:
bugzilla: maintainer-feedback? (gnome)


Attachments
cairo-fix-mips.diff (3.28 KB, patch)
2015-07-19 01:29 UTC, Carlos J Puga Medina
no flags Details | Diff
poudriere log (75.72 KB, text/x-log)
2015-07-19 02:36 UTC, Carlos J Puga Medina
no flags Details
cairo failed build log (63.70 KB, text/x-log)
2015-08-01 16:40 UTC, Carlos J Puga Medina
no flags Details
cairo with atomic operations enabled log (149.13 KB, text/x-log)
2015-08-02 03:31 UTC, Carlos J Puga Medina
no flags Details
cairo-fix-mips.diff (6.34 KB, patch)
2015-08-08 20:23 UTC, Carlos J Puga Medina
cjpm: maintainer-approval+
Details | Diff
cairo-fix-mips.diff (4.25 KB, patch)
2015-08-09 23:35 UTC, Carlos J Puga Medina
cjpm: maintainer-approval+
Details | Diff
cairo with atomic operations enabled log (165.41 KB, text/x-log)
2015-08-10 00:07 UTC, Carlos J Puga Medina
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Carlos J Puga Medina 2015-07-19 01:29:11 UTC
Created attachment 158959 [details]
cairo-fix-mips.diff

The following patch disables atomic support on mips and makes portlint checks happy.

# portlint -ac
WARN: Consider to set DEVELOPER=yes in /etc/make.conf
0 fatal errors and 1 warning found.
Comment 1 Carlos J Puga Medina 2015-07-19 02:36:05 UTC
Created attachment 158963 [details]
poudriere log
Comment 2 Carlos J Puga Medina 2015-08-01 16:40:45 UTC
Created attachment 159441 [details]
cairo failed build log

graphics/cairo fails to build with atomic operations enabled.
Comment 3 Carlos J Puga Medina 2015-08-01 21:15:54 UTC
(In reply to Carlos J Puga Medina from comment #2)

It seems that cairo looks first for:

return __sync_fetch_and_add
__sync_val_compare_and_swap

and defines it as cairo_cv_atomic_primitives="Intel".

If the configure compile fails cairo is looking for libatomic_ops support.
Comment 4 Carlos J Puga Medina 2015-08-02 03:30:36 UTC
This patch allows to build cairo port with atomic operations enabled:

--- Makefile.orig	2015-08-02 05:25:43.503429000 +0200
+++ Makefile	2015-08-02 05:28:26.946450000 +0200
@@ -4,7 +4,7 @@
 
 PORTNAME=	cairo
 PORTVERSION=	1.12.18
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	2
 CATEGORIES=	graphics
 MASTER_SITES=	http://cairographics.org/releases/
@@ -16,6 +16,7 @@
 
 .if !defined(REFERENCE_PORT)
 
+BUILD_DEPENDS=	${LOCALBASE}/include/atomic_ops.h:${PORTSDIR}/devel/libatomic_ops
 LIB_DEPENDS=	libfreetype.so:${PORTSDIR}/print/freetype2 \
 		libpng.so:${PORTSDIR}/graphics/png \
 		libfontconfig.so:${PORTSDIR}/x11-fonts/fontconfig
@@ -26,6 +27,10 @@
 CONFIGURE_ARGS=	--with-html-dir=${DOCSDIR} \
 		--disable-directfb \
 		--enable-tee
+CPPFLAGS+=	-I${LOCALBASE}/include
+LDFLAGS+=	-L${LOCALBASE}/lib
+CONFIGURE_ENV=	CPPFLAGS="${CPPFLAGS} LDFLAGS="${LDFLAGS} \
+		cairo_cv_atomic_primitives="libatomic-ops"
 USES+=		cpe libtool pathfix pkgconfig
 CPE_VENDOR=	cairographics
 USE_XORG=	pixman
Comment 5 Carlos J Puga Medina 2015-08-02 03:31:37 UTC
Created attachment 159451 [details]
cairo with atomic operations enabled log
Comment 6 Carlos J Puga Medina 2015-08-02 03:37:19 UTC
Comment on attachment 158959 [details]
cairo-fix-mips.diff

>diff -urN graphics/cairo.old/Makefile graphics/cairo/Makefile
>--- graphics/cairo.old/Makefile	2015-07-19 03:20:21.000000000 +0200
>+++ graphics/cairo/Makefile	2015-07-19 03:22:06.000000000 +0200
>@@ -4,7 +4,7 @@
> 
> PORTNAME=	cairo
> PORTVERSION=	1.12.18
>-PORTREVISION=	1
>+PORTREVISION=	2
> PORTEPOCH=	2
> CATEGORIES=	graphics
> MASTER_SITES=	http://cairographics.org/releases/
>@@ -12,11 +12,14 @@
> MAINTAINER=	gnome@FreeBSD.org
> COMMENT=	Vector graphics library with cross-device output support
> 
>+LICENSE=	LGPL21 MPL
>+LICENSE_COMB=	multi
>+
> USES=		tar:xz
> 
> .if !defined(REFERENCE_PORT)
> 
>-LIB_DEPENDS=	libfreetype.so:${PORTSDIR}/print/freetype2 \
>+LIB_DEPENDS+=	libfreetype.so:${PORTSDIR}/print/freetype2 \
> 		libpng.so:${PORTSDIR}/graphics/png \
> 		libfontconfig.so:${PORTSDIR}/x11-fonts/fontconfig
> 
>@@ -41,7 +44,7 @@
> 		--disable-egl \
> 		--enable-tee
> 
>-OPTIONS_DEFINE=	OPENGL XCB GLIB X11 
>+OPTIONS_DEFINE=	OPENGL XCB GLIB X11
> OPTIONS_DEFAULT=XCB GLIB X11
> XCB_DESC=	Enable XCB (X C-language Binding) Support
> GLIB_DESC=	Enable GObject Functions Feature
>@@ -61,6 +64,10 @@
> 
> .include <bsd.port.options.mk>
> 
>+.if ${ARCH} == "mips"
>+CONFIGURE_ARGS+=	--disable-atomic
>+.endif
>+
> post-patch:
> 	@${REINPLACE_CMD} -e '/test/s/==/=/g' \
> 		-e '/LIBS/s/-lrt//'  -e '/LIBS/s|-ldld||' \
>@@ -77,7 +84,6 @@
> 	@${REINPLACE_CMD} 's|@CAIRO_CFLAGS@|-I$$(top_srcdir)/src/glew &|' \
> 		${WRKSRC}/src/Makefile.in
> .endif
>+.endif
> 
> .include <bsd.port.mk>
>-
>-.endif
>diff -urN graphics/cairo.old/files/patch-src_cairo-xlib-display.c graphics/cairo/files/patch-src_cairo-xlib-display.c
>--- graphics/cairo.old/files/patch-src_cairo-xlib-display.c	2015-07-19 03:20:21.000000000 +0200
>+++ graphics/cairo/files/patch-src_cairo-xlib-display.c	2015-07-18 21:45:05.000000000 +0200
>@@ -1,6 +1,6 @@
>---- src/cairo-xlib-display.c.orig	2010-11-21 14:41:31.000000000 -0500
>-+++ src/cairo-xlib-display.c	2010-11-21 14:42:12.000000000 -0500
>-@@ -353,11 +353,7 @@ _cairo_xlib_device_create (Display *dpy)
>+--- src/cairo-xlib-display.c.orig	2014-11-06 21:35:30 UTC
>++++ src/cairo-xlib-display.c
>+@@ -263,11 +263,7 @@ _cairo_xlib_device_create (Display *dpy)
>      /* Prior to Render 0.10, there is no protocol support for gradients and
>       * we call function stubs instead, which would silently consume the drawing.
>       */
>diff -urN graphics/cairo.old/files/patch-util_cairo-sphinx_sphinx.c graphics/cairo/files/patch-util_cairo-sphinx_sphinx.c
>--- graphics/cairo.old/files/patch-util_cairo-sphinx_sphinx.c	2015-07-19 03:20:21.000000000 +0200
>+++ graphics/cairo/files/patch-util_cairo-sphinx_sphinx.c	2015-07-18 21:45:05.000000000 +0200
>@@ -1,5 +1,5 @@
>---- util/cairo-sphinx/sphinx.c.orig	2014-10-06 15:22:24.000000000 -0400
>-+++ util/cairo-sphinx/sphinx.c	2014-10-06 15:23:04.000000000 -0400
>+--- util/cairo-sphinx/sphinx.c.orig	2014-11-06 21:35:30 UTC
>++++ util/cairo-sphinx/sphinx.c
> @@ -1325,7 +1325,7 @@ client_shm (const char *shm_path)
>  
>      base = mmap (NULL, DATA_SIZE,
>diff -urN graphics/cairo.old/pkg-descr graphics/cairo/pkg-descr
>--- graphics/cairo.old/pkg-descr	2015-07-19 03:20:21.000000000 +0200
>+++ graphics/cairo/pkg-descr	2015-07-18 21:47:24.000000000 +0200
>@@ -10,4 +10,4 @@
> and filling Bezier cubic splines, transforming and compositing translucent
> images, and antialiased text rendering.
> 
>-WWW:	http://www.cairographics.org
>+WWW: http://www.cairographics.org
Comment 7 Carlos J Puga Medina 2015-08-08 20:23:59 UTC
Created attachment 159673 [details]
cairo-fix-mips.diff
Comment 8 Carlos J Puga Medina 2015-08-08 20:28:21 UTC
The last patch is better in this case.

Testing@work via poudriere
Comment 9 Carlos J Puga Medina 2015-08-09 23:35:12 UTC
Created attachment 159713 [details]
cairo-fix-mips.diff
Comment 10 Carlos J Puga Medina 2015-08-10 00:07:12 UTC
Created attachment 159714 [details]
cairo with atomic operations enabled log
Comment 11 Carlos J Puga Medina 2015-11-09 10:01:17 UTC
Please, can someone commit this patch?
Comment 12 commit-hook freebsd_committer 2015-11-09 14:59:48 UTC
A commit references this bug:

Author: sbruno
Date: Mon Nov  9 14:59:37 UTC 2015
New revision: 401102
URL: https://svnweb.freebsd.org/changeset/ports/401102

Log:
  Update port Makefile to support mips build of cairo.

  Add License Information

  PR:		201683
  Submitted by:	Carlos J Puga Medina <cpm@fbsd.es>

Changes:
  head/graphics/cairo/Makefile
  head/graphics/cairo/files/patch-src_cairo-gl.h
  head/graphics/cairo/files/patch-src_cairo-xlib-display.c
  head/graphics/cairo/files/patch-util_cairo-sphinx_sphinx.c
  head/graphics/cairo/pkg-descr
Comment 13 Sean Bruno freebsd_committer 2015-11-09 15:16:05 UTC
Done and done.

A little follow up from antoine was required to unbreak index on 9.

https://svnweb.freebsd.org/ports?view=revision&revision=401103