Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Sep 2013 13:27:18 +0200
From:      Rafael Ostertag <rafi@guengel.ch>
To:        gnome@FreeBSD.org
Subject:   [PATCH] www/webkit-gtk2: enable build on sparc64
Message-ID:  <20130910132718.632b415adcdf36e08d15ac68@guengel.ch>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.

--Multipart=_Tue__10_Sep_2013_13_27_18_+0200_H+AESAWyiIqD1ssS
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit

Hi guys

Apparently, building webkit-gtk2 on sparc64 fails mainly due to missing
atomicIncrement()/atomicDecrement() for sparc64 (see
Source/JavaScriptCore/wtf/Atomics.h). 

The attached patch provides atomicIncrement()/atomicDecrement() for
sparc64 and sets `--disable-optimizations' and
`--disable-introspection' in the ports Makefile in order to build
webkit sucessfully. `--disable-optimizations' is used in order to
prevent the build from dying due to invalid assembly code generated by
gcc (on FB9.1 at least). `--disable-introspection' is used because
generating introspection segfaulted on sparc.

The patch has been created according to the FreeBSD Porter's Handbook,
so you should have no difficulties in applying it.

Patch Summary
=============

New Files
---------
files/patch-Source-JavaScriptCore-wtf-Atomics.h

Updated Files
-------------
Makefile


cheers
rafi
-- 
+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

  Rafael Ostertag
  Niederwilerstrasse 2
  CH-8546 Kefikon
  Switzerland

  Phone:  +41 56 534 1649
  Mail:   rafi@guengel.ch
  Web:    www.guengel.ch
  ICQ#:   225700135

+-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+

--Multipart=_Tue__10_Sep_2013_13_27_18_+0200_H+AESAWyiIqD1ssS
Content-Type: text/x-diff;
 name="webkit-gtk2.patch"
Content-Disposition: attachment;
 filename="webkit-gtk2.patch"
Content-Transfer-Encoding: 7bit

Index: Makefile
===================================================================
--- Makefile	(revision 326841)
+++ Makefile	(working copy)
@@ -41,8 +41,7 @@
 LDFLAGS+=	-L${LOCALBASE}/lib
 CONFIGURE_ARGS=	--with-gtk=2.0 \
 		--enable-svg-fonts \
-		--disable-geolocation \
-		--enable-introspection
+		--disable-geolocation
 MAKEFILE=	GNUmakefile
 
 BROWSER_PLUGINS_DIR?=	${LOCALBASE}/lib/browser_plugins/symlinks/webkit-gtk2
@@ -73,6 +72,13 @@
 CFLAGS+=	-mminimal-toc
 .endif
 
+.if ${ARCH} == sparc64
+CONFIGURE_ARGS+=--disable-introspection \
+		--disable-optimizations
+.else
+CONFIGURE_ARGS+=--enable-introspection
+.endif
+
 .if ${PERL_LEVEL} >= 501400
 BUILD_DEPENDS+=	p5-Switch>0:${PORTSDIR}/lang/p5-Switch
 .endif
Index: files/patch-Source-JavaScriptCore-wtf-Atomics.h
===================================================================
--- files/patch-Source-JavaScriptCore-wtf-Atomics.h	(revision 0)
+++ files/patch-Source-JavaScriptCore-wtf-Atomics.h	(working copy)
@@ -0,0 +1,41 @@
+--- Source/JavaScriptCore/wtf/Atomics.h.orig	2013-09-08 11:23:27.000000000 +0200
++++ Source/JavaScriptCore/wtf/Atomics.h	2013-09-08 11:26:12.000000000 +0200
+@@ -116,6 +116,38 @@
+ inline int atomicIncrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, 1) + 1; }
+ inline int atomicDecrement(int volatile* addend) { return __gnu_cxx::__exchange_and_add(addend, -1) - 1; }
+ 
++#elif COMPILER(GCC) && CPU(SPARC64)
++#define WTF_USE_LOCKFREE_THREADSAFEREFCOUNTED 1
++
++inline int atomicIncrement(int volatile* addend) { 
++ int register sav, sum;
++
++ AGAIN:
++  sav=*addend;
++  sum=sav+1;
++  __asm("cas %2, %1, %0" : "+r" (sum) : "r" (sav), "m" (*addend) );
++  // Now sum will hold the value of (*addend). If it has been modified
++  // before `cas' it ain't the same as sav, so we have to try
++  // again. If it is the same value as sav, then we just had
++  // atomically increased the value.
++  if (sav != sum) goto AGAIN;
++  return sum+1;
++}
++
++inline int atomicDecrement(int volatile* addend) { 
++ int register sav, sum;
++
++ AGAIN:
++  sav=*addend;
++  sum=sav-1;
++  __asm("cas %2, %1, %0" : "+r" (sum) : "r" (sav), "m" (*addend) );
++  // Now sum will hold the value of (*addend). If it has been modified
++  // before `cas' it ain't the same as sav, so we have to try
++  // again. If it is the same value as sav, then we just had
++  // atomically increased the value.
++  if (sav != sum) goto AGAIN;
++  return sum-1;
++}
+ #endif
+ 
+ inline bool weakCompareAndSwap(unsigned* location, unsigned expected, unsigned newValue)

Property changes on: files/patch-Source-JavaScriptCore-wtf-Atomics.h
___________________________________________________________________
Added: fbsd:nokeywords
## -0,0 +1 ##
+yes
\ No newline at end of property
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property

--Multipart=_Tue__10_Sep_2013_13_27_18_+0200_H+AESAWyiIqD1ssS--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20130910132718.632b415adcdf36e08d15ac68>