Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 3 Nov 2008 23:20:20 +0100
From:      Ed Schouten <ed@80386.nl>
To:        gnome@FreeBSD.org
Cc:        rink@FreeBSD.org
Subject:   nspr and firefox3 on powerpc
Message-ID:  <20081103222020.GU1165@hoeg.nl>

next in thread | raw e-mail | index | archive | help

--6pjpgtPchv3bUQQn
Content-Type: multipart/mixed; boundary="APvmIexg9DiduZOF"
Content-Disposition: inline


--APvmIexg9DiduZOF
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Hello all,

I saw both the nspr and firefox3 ports were maintained by the GNOME
folks, so I'd better send these patches to you, to ask if I can commit
them to CVS.

Last week I installed FreeBSD -CURRENT on my PowerBook G4 12". So far a
lot of things start to work, but I noticed I wasn't able to compile my
favourite browser on it. I've attached two patches, one for nspr and one
for firefox3 to make them compile properly.

nspr:

The patch for nspr is quite obvious. _freebsd.cfg now returns an #error,
because the platform is unsupported. Add the proper size definitions.
I've copied these from _linux.cfg. Turns out the _openbsd.cfg and
_netbsd.cfg definitions are quite probably a little broken, because they
define PR_BYTES_PER_INT64 to 4. These bits should be correct, though.

firefox3:

This patch is a little more complex. The changes to the port Makefile:
it turns out the `cc -dumpspecs | grep -m 1 pthread' trick doesn't work
on powerpc, because the flag it tries to obtain is stored on the second
line it returns. Make the pattern a little more accurate to make it work
properly. GECKO_PTHREAD_LIBS is now -lpthread instead of a lot of random
garbage.

The fixes to the other file look a little strange, but that's mainly
because diff(1) makes a mess out of it. The only thing it does, is make
FreeBSD/powerpc use some of the Linux/powerpc xptcall bits that we need
instead of bailing out because we're running an unknown architecture.
We already do similar things for FreeBSD/{alpha,sparc64} and looking at
the xptcall code it is a pretty sane decision to do this.

Any comments?

--=20
 Ed Schouten <ed@80386.nl>
 WWW: http://80386.nl/

--APvmIexg9DiduZOF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="nspr.diff"
Content-Transfer-Encoding: quoted-printable

--- devel/nspr/files/patch-.._pr_include_md__freebsd.cfg
+++ devel/nspr/files/patch-.._pr_include_md__freebsd.cfg
@@ -0,0 +1,54 @@
+--- ../pr/include/md/_freebsd.cfg
++++ ../pr/include/md/_freebsd.cfg
+@@ -283,6 +283,51 @@
+ #define PR_ALIGN_OF_POINTER 8
+ #define PR_ALIGN_OF_WORD    8
+=20
++#elif defined(__powerpc__)
++
++#undef  IS_LITTLE_ENDIAN
++#define IS_BIG_ENDIAN    1
++
++#define PR_BYTES_PER_BYTE   1
++#define PR_BYTES_PER_SHORT  2
++#define PR_BYTES_PER_INT    4
++#define PR_BYTES_PER_INT64  8
++#define PR_BYTES_PER_LONG   4
++#define PR_BYTES_PER_FLOAT  4
++#define PR_BYTES_PER_DOUBLE 8
++#define PR_BYTES_PER_WORD   4
++#define PR_BYTES_PER_DWORD  8
++
++#define PR_BITS_PER_BYTE    8
++#define PR_BITS_PER_SHORT   16
++#define PR_BITS_PER_INT     32
++#define PR_BITS_PER_INT64   64
++#define PR_BITS_PER_LONG    32
++#define PR_BITS_PER_FLOAT   32
++#define PR_BITS_PER_DOUBLE  64
++#define PR_BITS_PER_WORD    32
++
++#define PR_BITS_PER_BYTE_LOG2   3
++#define PR_BITS_PER_SHORT_LOG2  4
++#define PR_BITS_PER_INT_LOG2    5
++#define PR_BITS_PER_INT64_LOG2  6
++#define PR_BITS_PER_LONG_LOG2   5
++#define PR_BITS_PER_FLOAT_LOG2  5
++#define PR_BITS_PER_DOUBLE_LOG2 6
++#define PR_BITS_PER_WORD_LOG2   5
++
++#define PR_ALIGN_OF_SHORT   2
++#define PR_ALIGN_OF_INT     4
++#define PR_ALIGN_OF_LONG    4
++#define PR_ALIGN_OF_INT64   8
++#define PR_ALIGN_OF_FLOAT   4
++#define PR_ALIGN_OF_DOUBLE  8
++#define PR_ALIGN_OF_POINTER 4
++#define PR_ALIGN_OF_WORD    4
++
++#define PR_BYTES_PER_WORD_LOG2   2
++#define PR_BYTES_PER_DWORD_LOG2  3
++
+ #else
+=20
+ #error "Unknown CPU architecture"
--- devel/nspr/files/patch-.._pr_include_md__freebsd.h
+++ devel/nspr/files/patch-.._pr_include_md__freebsd.h
@@ -1,6 +1,15 @@
---- ../pr/include/md/_freebsd.h.orig	Mon Nov 22 16:24:53 2004
-+++ ../pr/include/md/_freebsd.h	Sun Jul 23 13:15:29 2006
-@@ -106,6 +106,16 @@
+--- ../pr/include/md/_freebsd.h
++++ ../pr/include/md/_freebsd.h
+@@ -57,6 +57,8 @@
+ #define _PR_SI_ARCHITECTURE "ia64"
+ #elif defined(__amd64__)
+ #define _PR_SI_ARCHITECTURE "amd64"
++#elif defined(__powerpc__)
++#define _PR_SI_ARCHITECTURE "powerpc"
+ #else
+ #error "Unknown CPU architecture"
+ #endif
+@@ -106,6 +108,16 @@
  #define _PR_IPV6_V6ONLY_PROBE
  #endif
 =20

--APvmIexg9DiduZOF
Content-Type: text/x-diff; charset=us-ascii
Content-Disposition: attachment; filename="firefox3.diff"
Content-Transfer-Encoding: quoted-printable

--- www/firefox3/Makefile
+++ www/firefox3/Makefile
@@ -57,7 +57,7 @@
=20
 .include <bsd.port.pre.mk>
=20
-GECKO_PTHREAD_LIBS!=3D${CC} -dumpspecs | ${GREP} -m 1 pthread | ${SED} -e =
's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
+GECKO_PTHREAD_LIBS!=3D${CC} -dumpspecs | ${GREP} -m 1 '%{\!pg: %{pthread:'=
 | ${SED} -e 's|^.*%{\!pg: %{pthread:|| ; s|}.*$$||' || ${TRUE}
=20
 .if ${HAVE_GNOME:Mlibgnomeui}!=3D""
 USE_GNOME+=3D	libgnomeui
--- www/firefox3/files/patch-xpcom_reflect_xptcall_src_md_unix_Makefile.in
+++ www/firefox3/files/patch-xpcom_reflect_xptcall_src_md_unix_Makefile.in
@@ -1,16 +1,16 @@
 --- xpcom/reflect/xptcall/src/md/unix/Makefile.in.orig	Thu Aug 14 21:00:23=
 2003
 +++ xpcom/reflect/xptcall/src/md/unix/Makefile.in	Sun Feb  1 15:06:40 2004
-@@ -49,6 +49,9 @@
- ifeq (86,$(findstring 86,$(OS_TEST)))
- CPPSRCS		:=3D xptcinvoke_unixish_x86.cpp xptcstubs_unixish_x86.cpp
+@@ -70,6 +70,9 @@
+ ifeq (Darwin,$(OS_ARCH))
+ DEFINES		+=3D -DKEEP_STACK_16_BYTE_ALIGNED
  endif
 +ifeq (x86_64,$(OS_TEST))
 +CPPSRCS		:=3D xptcinvoke_x86_64_linux.cpp xptcstubs_x86_64_linux.cpp
 +endif
  endif
+ endif
  #
- # New code for Linux, et. al., with gcc
-@@ -60,7 +63,7 @@
+@@ -87,7 +90,7 @@
  endif
  endif
  # IA64 Linux
@@ -19,7 +19,7 @@
  ifneq (,$(findstring ia64,$(OS_TEST)))
  CPPSRCS		:=3D xptcinvoke_ipf64.cpp xptcstubs_ipf64.cpp
  ASFILES		:=3D xptcstubs_asm_ipf64.s xptcinvoke_asm_ipf64.s
-@@ -106,9 +109,15 @@
+@@ -150,9 +153,15 @@
  ASFILES		:=3D xptcinvoke_asm_osf1_alpha.s xptcstubs_asm_osf1_alpha.s
  endif
  #
@@ -36,12 +36,19 @@
  CPPSRCS		:=3D xptcinvoke_linux_alpha.cpp xptcstubs_linux_alpha.cpp
  endif
  #
-@@ -294,6 +303,15 @@
- ifeq ($(OS_ARCH)$(OS_TEST),NetBSDsparc)
- CPPSRCS		:=3D xptcinvoke_sparc_netbsd.cpp xptcstubs_sparc_netbsd.cpp
+@@ -311,7 +320,7 @@
+ #
+ # Linux/PPC
+ #
+-ifeq ($(OS_ARCH)$(OS_TEST),Linuxpowerpc)
++ifneq (,$(filter Linuxpowerpc FreeBSDpowerpc,$(OS_ARCH)$(OS_TEST)))
+ CPPSRCS		:=3D xptcinvoke_ppc_linux.cpp xptcstubs_ppc_linux.cpp
+ ASFILES		:=3D xptcinvoke_asm_ppc_linux.s xptcstubs_asm_ppc_linux.s
+ AS		:=3D $(CC) -c -x assembler-with-cpp
+@@ -389,6 +398,15 @@
  ASFILES		:=3D xptcinvoke_asm_sparc_netbsd.s xptcstubs_asm_sparc_netbsd.s
-+endif
-+#
+ endif
+ #
 +# FreeBSD/SPARC64
 +#
 +ifeq ($(OS_ARCH),FreeBSD)
@@ -49,6 +56,8 @@
 +CPPSRCS		:=3D xptcinvoke_sparc64_freebsd.cpp xptcstubs_sparc64_freebsd.cpp
 +ASFILES		:=3D xptcinvoke_asm_sparc64_freebsd.s xptcstubs_asm_sparcv9_sola=
ris.s
 +endif
- endif
++endif
++#
+ # OpenBSD/SPARC
  #
- # Solaris/SPARC
+ ifeq ($(OS_ARCH)$(OS_TEST),OpenBSDsparc)

--APvmIexg9DiduZOF--

--6pjpgtPchv3bUQQn
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (FreeBSD)

iEYEARECAAYFAkkPeSQACgkQ52SDGA2eCwWLugCfb+GJXdzE+K21wbfcTGKb+Ga7
kdoAnArpn+LJxpRj0BPU07oGwBHhcYtJ
=wb+L
-----END PGP SIGNATURE-----

--6pjpgtPchv3bUQQn--



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