1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-23 00:43:28 +00:00

Remove dependency on bash2 and support GNU C __attribute__ syntax.

PR:		1416
Submitted by:	Andrew L. Moore <alm@slewsys.org>
This commit is contained in:
Steve Price 1998-07-26 23:56:30 +00:00
parent 46f2115274
commit aea0dc1683
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=12139
3 changed files with 212 additions and 3 deletions

View File

@ -3,7 +3,7 @@
# Date created: 28 Sept 1995
# Whom: dchapes@zeus.leitch.com
#
# $Id: Makefile,v 1.3 1996/11/18 10:35:12 asami Exp $
# $Id: Makefile,v 1.4 1998/06/25 22:26:24 asami Exp $
#
DISTNAME= cflow-2.0
@ -13,8 +13,6 @@ MASTER_SITE_SUBDIR= devel/lang/c
MAINTAINER= dchapes@zeus.leitch.com
RUN_DEPENDS= bash:${PORTSDIR}/shells/bash2
USE_GMAKE= yes
.include <bsd.port.mk>

198
devel/cflow/files/patch-ac Normal file
View File

@ -0,0 +1,198 @@
--- cflow.sh.orig Sun Feb 19 12:59:18 1995
+++ cflow.sh Wed Jun 3 16:03:01 1998
@@ -1,41 +1,38 @@
-#! @CFLOW_SHELL@
+#!/bin/sh -
# cflow - print a function call hierarchy
# This script is contributed to the public domain by Andrew Moore
# of Talke Studio.
-# exit on errors..
+: ${F2C:=f2c}
+: ${LEX:=flex}
+: ${YACC:="bison -y"}
+: ${CC:=gcc}
+: ${CPP:="$CC -E"}
+: ${PRCC:=/usr/local/bin/prcc}
+: ${PRCG:=/usr/local/bin/prcg}
+: ${RM:=/bin/rm}
-# this values can be overriden by devining them in the
-# enviornment
-F2C=${F2C:=f2c}
-LEX=${LEX:=flex}
-YACC={YACC:="bison -y"}
-CC=${CC:=gcc}
-CPP=${CPP:="$CC -E"}
-PRCC=${PRCC:=@PRCC@}
-PRCG=${PRCG:=@PRCG@}
TMPFILE=/tmp/cflow.$$
-function prcc {
+prcc () {
if [ $verbose ]; then
echo $PRCC $* >/dev/tty
fi
-
- command $PRCC $*
+ $PRCC $*
}
-function prcg {
+prcg () {
if [ $verbose ]; then
echo $PRCG $* >/dev/tty
fi
- command $PRCG $*
+ $PRCG $*
}
-function echo {
- builtin echo -e "$*"
+echo () {
+ printf "$*\n"
}
@@ -50,8 +47,7 @@
progname=$0
-function usage
-{
+usage () {
echo $progname [-AaginPXVvxh] [-d n] [-w n] [-r name] [cpp-opts] files
echo "\t-a\tprint a seperate cal graph for each function"
echo "\t-A\teliminate ansi keywords"
@@ -86,8 +82,7 @@
exclude_directory="$exclude_directory".$$
fi
-function do_mkdir
-{
+do_mkdir () {
for i in $*
do
mkdir -p $i
@@ -98,27 +93,24 @@
done
}
-function remove_exclude_files
-{
+remove_exclude_files () {
if [ -d $exclude_directory ]; then
- rm -rf $exclude_directory
+ $RM -rf $exclude_directory
fi
}
-function remove_tmp_file
-{
+remove_tmp_file () {
if [ "$save_temps" ] ; then
echo temp file in $TMPFILE
else
- rm $TMPFILE
+ $RM $TMPFILE
fi
}
-# call this once when we get are include files
+# call this once when we get our include files
# called only if we want to exclude files
-function exclude
-{
+exclude () {
if [ "$exclude_files" ]; then
do_mkdir $exclude_directory
fi
@@ -136,12 +128,9 @@
done
}
-#builtin -d echo # use gnu echo
# echo command line is $* >& 2
while getopts aghsAPD:I:X:nU:d:ir:Vvw:x c; do
-# echo option is $c
-# echo OPTARG = $OPTARG
case $c in
D)
CPP="$CPP -D$OPTARG"
@@ -202,44 +191,48 @@
esac
done
+shift $(expr $OPTIND - 1)
+
+if [ $# -eq 0 ]; then
+ usage
+fi
+
if [ "$exclude_files" ]; then
exclude
CPP="$CPP -I$exclude_directory"
fi
-
-
-
-let count=$OPTIND-1
-shift $count
-unset count
-
-if [ $# -eq 0 ]; then
- usage
+cat >${TMPFILE}.c <<\EOF
+#ifdef __GNUC__
+ yes;
+#endif
+EOF
+if ${CPP} ${TMPFILE}.c | egrep yes >/dev/null 2>&1; then
+ CPP="${CPP} -D__attribute__(x)="
fi
+$RM -f ${TMPFILE}.c
-for c in $*
-do
+for c in $*; do
case $c in
*.c|*.cc|*.C)
cname=$c
;;
*.f)
- cname=`basename $c .f`.c
+ cname=$(basename $c .f).c
cat $c | $F2C >$cname
;;
*.F)
- cname=`basename $c .F`.C
+ cname=$(basename $c .F).C
cat $c | $F2C >$cname
;;
*.l)
- cname=`basename $c .l`.c
+ cname=$(basename $c .l).c
$LEX $c
sed '/# line/d' lex.yy.c >$cname
;;
*.y)
- cname=`basename $c .y`.c
+ cname=$(basename $c .y).c
$YACC $c
sed '/# line/d' y.tab.c >$cname
;;
@@ -267,6 +260,7 @@
$CPP $cname >>$TMPFILE
done
+
if [ "$no_prcg" ]; then
PRCG=cat

View File

@ -0,0 +1,13 @@
--- cflow.1.orig Wed Jun 3 16:23:13 1998
+++ cflow.1 Wed Jun 3 16:23:32 1998
@@ -157,10 +157,3 @@
.I static
qualifier is ignored. Only the first definition of a function or
variable is recognized.
-.P
-It appears a definition like
-.ft CW
-.ti
-main() { foo();
-.ft
-causes problems.