Subject: pkg/36031: lang/spidermonkey's config.mk overrides pkgsrc-provided -On with -O
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <blair.sadewitz@gmail.com>
List: pkgsrc-bugs
Date: 03/18/2007 20:15:01
>Number:         36031
>Category:       pkg
>Synopsis:       lang/spidermonkey's config.mk overrides pkgsrc-provided -On with -O
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 18 20:15:00 +0000 2007
>Originator:     Blair Sadewitz
>Release:        amd64 4.99.15
>Organization:
>Environment:
NetBSD dexamyl 4.99.15 NetBSD 4.99.15 (DEXAMYL) #2: Sun Mar 18 18:05:21 UTC 2007

>Description:
${WRKSRC}/js/src/config.mk adds -O due to 

OPTIMIZER= -O

Generally, using -O2 is a better idea. I've built this on amd64 with -O2, and the only issue is a few instances of type-punning breaking strict aliasing rules.  This could be fixed, but for now using -fno-strict-aliasing doesn't hurt.

Unless there's a reason for using -O for every supported pkgsrc platform and compiler, this should be fixed.
>How-To-Repeat:
Build spidermonkey.
>Fix:

If this patch comes out malformed due to my browser, note that the only 
change is removing -O from OPTIMIZER in ${WRKSRC}/js/src/config.mk.

Don't forget to add CFLAGS+=-fno-strict-aliasing to the package Makefile.

--- patches/patch-aa    2006-08-09 03:03:21.000000000 -0400
+++ work.dexamyl/.newpatches/patch-aa   2007-03-18 16:07:42.000000000 -0400
@@ -1,8 +1,8 @@
 $NetBSD: patch-aa,v 1.3 2006/08/08 09:50:33 tron Exp $
 
---- config.mk.orig     2003-11-15 00:10:55.000000000 +0000
-+++ config.mk  2006-08-08 10:35:24.000000000 +0100
-@@ -96,10 +96,26 @@
+--- config.mk.orig     2003-11-14 19:10:55.000000000 -0500
++++ config.mk
+@@ -96,10 +96,26 @@ else
  ifeq ($(OS_ARCH),Darwin)
  OS_CONFIG      := Darwin
  else
@@ -29,7 +29,16 @@
 
  ASFLAGS         =
  DEFINES         =
-@@ -126,7 +142,11 @@
+@@ -113,7 +129,7 @@ CP = cp
+ endif
+
+ ifdef BUILD_OPT
+-OPTIMIZER  = -O
++OPTIMIZER  =
+ DEFINES    += -UDEBUG -DNDEBUG -UDEBUG_$(shell whoami)
+ OBJDIR_TAG = _OPT
+ else
+@@ -126,7 +142,11 @@ DEFINES    += -DDEBUG -DDEBUG_$(shell wh
  OBJDIR_TAG = _DBG
  endif