Subject: pkg/32273: pkgsrc/misc/screen SPARC/Solaris 10 Sun Studio 11 Compile Error
To: None <pkg-manager@netbsd.org, gnats-admin@netbsd.org,>
From: None <jakerosoft@gmail.com>
List: pkgsrc-bugs
Date: 12/10/2005 01:10:00
>Number:         32273
>Category:       pkg
>Synopsis:       pkgsrc/misc/screen SPARC/Solaris 10 Sun Studio 11 Compile Error
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Dec 10 01:10:00 +0000 2005
>Originator:     Jake Kupersmith
>Release:        Solaris 10 - NetBSD pkgsrc
>Organization:
>Environment:
SunOS 5.10 Generic sun4u sparc SUNW,Sun-Blade-100

>Description:
misc.c in screen is missing a few #if's to support Sun Solaris and the Sun Studio 11 compiler.  I have included a patch that fixed the problem for me.

/usr/pkgsrc/misc/screen# cat /etc/mk.conf 
.ifdef BSD_PKG_MK       # begin pkgsrc settings

# default settings

PKG_DBDIR=/var/db/pkg
LOCALBASE=/usr/pkg
VARBASE=/var
FETCH_CMD=/usr/pkg/bin/ftp
PAX=/usr/pkg/bin/pax
SED=/usr/pkg/bin/nbsed

# compiler settings

PKGSRC_COMPILER=sunpro
CC=     cc
CXX=    CC
CPP=    /usr/ccs/lib/cpp
# 32-bit builds..
CUSTOM_OPTS= -xtarget=ultra2 -xarch=v8plusa
# 64-bit builds...
#ABI=   64
#SPARC_TARGET_ARCH= sparcv9
#CUSTOM_OPTS= -xtarget=ultra2 -xarch=v9a
#
CFLAGS+= ${CUSTOM_OPTS}
CXXFLAGS+= ${CUSTOM_OPTS}
LDFLAGS+= ${CUSTOM_OPTS}

# misc settings

SMART_MESSAGES=yes

# package settings

UPDATE_TARGET= package
PKG_CONFIG_PATH= /usr/pkg/lib/pkgconfig/
PACKAGES?= ${_PKGSRCDIR}/packages/${MACHINE_ARCH}

# package specific settings

KDE3_NSPLUGINS=         YES
PKG_OPTIONS.freetype2=  truetype
PKG_OPTIONS.perl=       threads
PKG_OPTIONS.net-snmp=   ssl
PKG_OPTIONS.openssh=    pam
PKG_OPTIONS.wget=       ssl

.endif                  # end pkgsrc settings
>How-To-Repeat:
/usr/pkgsrc/misc/screen# cvs update -dP
? README.html
cvs update: Updating .
cvs update: Updating files
cvs update: Updating patches
cvs update: Updating pkg

/usr/pkgsrc/misc/screen# bmake 
...
configure: WARNING: If you wanted to set the --build type, don't use --host.
    If a cross compiler is detected then cross compile mode will be used.
this is screen version 4.0.2
checking for sparc-sun-solaris2-gcc... cc
checking for C compiler default output... a.out
checking whether the C compiler works... yes
checking whether we are cross compiling... no
checking for suffix of executables... 
checking for suffix of object files... o
checking whether we are using the GNU C compiler... no
...
cc -c -I. -I.    -O -xtarget=ultra2 -xarch=v8plusa misc.c
"misc.c", line 619: prototype mismatch: 2 args passed, 3 expected
cc: acomp failed for misc.c
*** Error code 2
>Fix:
# /usr/include/stdlib.h
    183 #if defined(__EXTENSIONS__) || \
    184     (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX)) || \
    185     defined(_XPG6)
    186 extern int posix_openpt(int);
    187 extern int setenv(const char *, const char *, int);
    188 extern int unsetenv(const char *);
    189 #endif
/usr/pkgsrc/misc/screen# cat patches/patch-aq 
--- misc.c.orig Fri Dec  9 09:36:20 2005
+++ misc.c      Fri Dec  9 09:40:23 2005
@@ -613,7 +613,9 @@
    */
 # endif /* NEEDSETENV */
 #else /* USESETENV */
-# if defined(linux) || defined(__convex__) || (BSD >= 199103)
+# if defined(linux) || defined(__convex__) || (BSD >= 199103) \
+  || defined(__EXTENSIONS__) || defined(_XPG6) \
+  || (!defined(_STRICT_STDC) && !defined(__XOPEN_OR_POSIX))
   setenv(var, value, 1);
 # else
   setenv(var, value);