Stage cad/jspice3 and unbreak on FreeBSD 10+

It would have been easy just to set this to "USE_GCC=any" to fix it,
but the code had plenty of undefined returns when a type was expected.
Using clang exposed those problems.  Hopefully I defined the missing
return values correctly.
This commit is contained in:
John Marino 2014-08-18 08:32:20 +00:00
parent 25b3f428f2
commit 643f83a81d
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=365270
11 changed files with 232 additions and 14 deletions

View File

@ -3,10 +3,9 @@
PORTNAME= jspice3
PORTVERSION= 2.5.011109
PORTREVISION= 0
PORTREVISION= 1
CATEGORIES= cad
MASTER_SITES= http://www.wrcad.com/ftp/pub/ \
ftp://ftp.srware.com/pub/
MASTER_SITES= http://www.wrcad.com/ftp/pub/
DISTNAME= ${PORTNAME}-2.5-011109
MAINTAINER= ports@FreeBSD.org
@ -18,7 +17,6 @@ OPTIONS_DEFINE= X11 EXAMPLES
OPTIONS_DEFAULT= X11
WRKSRC= ${WRKDIR}/${PORTNAME}-2.5
NO_STAGE= yes
.include <bsd.port.options.mk>
.if ${PORT_OPTIONS:MX11}
@ -26,27 +24,41 @@ USE_XORG= x11 xaw xt
.endif
pre-configure:
@${REINPLACE_CMD} -e 's+/usr/local+${PREFIX}+g ; \
s+-O -g+${CFLAGS}+g;' \
@${REINPLACE_CMD} -e 's+/usr/local+${PREFIX}+g;s+-O -g+${CFLAGS}+g;' \
${WRKSRC}/conf/unixconf/mkheader.0
.if ${PORT_OPTIONS:MX11}
@${REINPLACE_CMD} -e 's+#%%WITH_X%%++g' \
@${REINPLACE_CMD} -e 's+#%%WITH_X%%++g' \
${WRKSRC}/conf/unixconf/mkheader.0
.else
@${ECHO} "#undef HAVE_X11" >> ${WRKSRC}/src/include/spice.h
.endif
do-build:
@(cd ${WRKSRC};${SETENV} ${MAKE_ENV} ${SH} build)
(cd ${WRKSRC};${SETENV} ${MAKE_ENV} ${SH} build)
do-install:
@(cd ${WRKSRC}/src/bin;${SETENV} ${MAKE_ENV} ${MAKE} install)
post-install:
${MKDIR} ${STAGEDIR}${PREFIX}/lib/jspice3/helpdir \
${STAGEDIR}${PREFIX}/lib/jspice3/sced \
${STAGEDIR}${PREFIX}/lib/jspice3/scripts
(cd ${WRKSRC}/src/bin && ${INSTALL_PROGRAM} jspice3 nutmeg help \
multidec proc2mod spiced xeditor ${STAGEDIR}${PREFIX}/bin)
${INSTALL_DATA} ${WRKSRC}/lib/mfbcap ${WRKSRC}/lib/news \
${STAGEDIR}${PREFIX}/lib/jspice3
${INSTALL_DATA} ${WRKSRC}/lib/helpdir/* \
${STAGEDIR}${PREFIX}/lib/jspice3/helpdir
${INSTALL_DATA} ${WRKSRC}//lib/sced/* \
${STAGEDIR}${PREFIX}/lib/jspice3/sced
${INSTALL_DATA} ${WRKSRC}/lib/scripts/* \
${STAGEDIR}${PREFIX}/lib/jspice3/scripts
.if ${PORT_OPTIONS:MEXAMPLES}
${MV} ${PREFIX}/lib/jspice3/examples ${EXAMPLESDIR}
.else
${RM} -R ${PREFIX}/lib/jspice3/examples
${MKDIR} ${STAGEDIR}${PREFIX}/share/examples/jspice3/cryocmos \
${STAGEDIR}${PREFIX}/share/examples/jspice3/josephson
${INSTALL_DATA} ${WRKSRC}/examples/*.* \
${STAGEDIR}${PREFIX}/share/examples/jspice3
${INSTALL_DATA} ${WRKSRC}/examples/cryocmos/* \
${STAGEDIR}${PREFIX}/share/examples/jspice3/cryocmos
${INSTALL_DATA} ${WRKSRC}/examples/josephson/* \
${STAGEDIR}${PREFIX}/share/examples/jspice3/josephson
.endif
.include <bsd.port.mk>

View File

@ -0,0 +1,15 @@
--- conf/util/configure.orig 2002-01-15 19:21:25.000000000 +0000
+++ conf/util/configure
@@ -805,11 +805,7 @@ else
fi
-if test "$GCC" = yes; then
- DEPEND_PROG="gcc -MM"
-else
- DEPEND_PROG="cc -M"
-fi
+DEPEND_PROG="cc -MM"
if test -x /usr/ucb/install; then
INSTALL="/usr/ucb/install"

View File

@ -0,0 +1,11 @@
--- src/bin/help.c.intermediate 2014-08-18 06:30:22.000000000 +0000
+++ src/bin/help.c
@@ -53,7 +53,7 @@ XErrorEvent *errorev;
XGetErrorText(display, errorev->error_code, ErrorMessage, 1024);
printf(ErrorMessage);
- return;
+ return (NULL);
}

View File

@ -0,0 +1,27 @@
--- src/bin/spiced.c.orig 2001-05-01 21:56:08.000000000 +0000
+++ src/bin/spiced.c
@@ -16,12 +16,11 @@ Author: 1985 Wayne A. Christopher, U. C.
#include "spice.h"
#include <stdio.h>
-#ifdef HAVE_STRINGS_H
-#include <strings.h>
-#else
#include <string.h>
-#endif
#include <errno.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <ctype.h>
#include <sys/types.h>
#ifdef HAVE_SOCKET
@@ -293,7 +292,7 @@ sigchild()
(void) fclose(fp);
} else
nrunning--;
- return;
+ return 0;
}
#else /* not HAVE_SOCKET */

View File

@ -0,0 +1,11 @@
--- src/lib/ckt/cktdelt.c.orig 1997-03-21 22:04:30.000000000 +0000
+++ src/lib/ckt/cktdelt.c
@@ -20,7 +20,7 @@ GENERIC *task;
{
JOB *job, *next;
- if (task == NULL) return;
+ if (task == NULL) return (OK);
for (job = ((TSKtask*)task)->jobs; job; job = next) {
next = job->JOBnextJob;

View File

@ -0,0 +1,45 @@
--- src/lib/fte/options.c.orig 2009-01-11 20:27:11.000000000 +0000
+++ src/lib/fte/options.c
@@ -66,7 +66,7 @@ def_fn(_iv_cpdebug)
def_fn(_iv_history)
{
- if (!flag) return;
+ if (!flag) return (US_OK);
if (v->va_type == VT_NUM)
cp_maxhistlength = v->va_num;
else if (v->va_type == VT_REAL)
@@ -930,27 +930,27 @@ struct variable **v1, **v2;
v = va_copy(plot_cur->pl_env);
else
v = NULL;
- if (tv = cp_enqvar(kw_plots)) {
+ if ((tv = cp_enqvar(kw_plots))) {
tv->va_next = v;
v = tv;
}
- if (tv = cp_enqvar(kw_curplot)) {
+ if ((tv = cp_enqvar(kw_curplot))) {
tv->va_next = v;
v = tv;
}
- if (tv = cp_enqvar(kw_curplottitle)) {
+ if ((tv = cp_enqvar(kw_curplottitle))) {
tv->va_next = v;
v = tv;
}
- if (tv = cp_enqvar(kw_curplotname)) {
+ if ((tv = cp_enqvar(kw_curplotname))) {
tv->va_next = v;
v = tv;
}
- if (tv = cp_enqvar(kw_curplotdate)) {
+ if ((tv = cp_enqvar(kw_curplotdate))) {
tv->va_next = v;
v = tv;
}
- if (tv = cp_enqvar(kw_display)) {
+ if ((tv = cp_enqvar(kw_display))) {
tv->va_next = v;
v = tv;
}

View File

@ -0,0 +1,11 @@
--- src/lib/inp/ifeval.c.orig 1997-03-21 22:04:12.000000000 +0000
+++ src/lib/inp/ifeval.c
@@ -37,7 +37,7 @@ double step, finaltime;
int i;
if (!tree)
- return;
+ return (OK);
for (i = 0; i < tree->numVars; i++)
init_node(pt->derivs[i],step,finaltime);
init_node(pt->tree,step,finaltime);

View File

@ -0,0 +1,29 @@
--- src/lib/mfb/mfbgnc.c.orig 2001-05-01 19:45:26.000000000 +0000
+++ src/lib/mfb/mfbgnc.c
@@ -120,7 +120,7 @@ char *PM;
cp = PM;
dp = result;
if (cp == NULL) {
- return;
+ return (NULL);
}
while (c = *cp++) {
if(c == '$') {
@@ -300,7 +300,7 @@ char *PM;
y1 = reg;
}
else
- return;
+ return (NULL);
hiy = (y1 >> 7) & 037;
extra = x1 & 03 | ((y1 & 03) << 2);
loy = (y1 >> 2) & 037;
@@ -427,7 +427,7 @@ char *PM;
continue;
default:
- return;
+ return (NULL);
}
}
*dp='\0';

View File

@ -0,0 +1,26 @@
--- src/lib/plot/postsc.c.orig 1997-03-21 22:03:37.000000000 +0000
+++ src/lib/plot/postsc.c
@@ -343,12 +343,12 @@ int linestyleid;
get it when PS_Text restores a -1 linestyle */
if (linestyleid == -1) {
currentgraph->linestyle = -1;
- return;
+ return (0);
}
if (linestyleid < 0) {
internalerror("bad linestyleid");
- return;
+ return (0);
}
if (linestyleid > dispdev->numlinestyles)
@@ -407,7 +407,7 @@ int x, y, Xform;
if (Xform == (char)0) {
PS_Text(text,x,y);
- return;
+ return (0);
}
s = tbuf;

View File

@ -0,0 +1,20 @@
--- src/lib/sced/labeltxt.c.orig 1997-03-21 22:04:16.000000000 +0000
+++ src/lib/sced/labeltxt.c
@@ -175,7 +175,7 @@ int x, y, degrees, scale;
if (!strcmp(dispdev->name,"wp")) {
/* use plain text for now */
DevText(text,x,y);
- return;
+ return (0);
}
/* Hack! If degrees is >= 90, an angle is assumed.
@@ -185,7 +185,7 @@ int x, y, degrees, scale;
if (!strcmp(dispdev->name,"postscript")) {
PS_ScaledText(text,x,y,degrees);
- return;
+ return (0);
}
if (degrees & 1) {

View File

@ -0,0 +1,11 @@
--- src/lib/sced/scedintr.c.orig 2001-05-01 20:54:05.000000000 +0000
+++ src/lib/sced/scedintr.c
@@ -1009,7 +1009,7 @@ char *string;
strcat(TypeOut,string);
else
strcat(TypeOut,"\n");
- if (strchr(TypeOut,'\n') == NULL) return;
+ if (strchr(TypeOut,'\n') == NULL) return (False);
if (MoreLine(TypeOut))
EnableMore(False);
*TypeOut = '\0';