[Midnightbsd-cvs] mports: lang/f2c: Added f2c-20060810

ctriv at midnightbsd.org ctriv at midnightbsd.org
Fri Dec 19 21:54:16 EST 2008


Log Message:
-----------
Added f2c-20060810

Added Files:
-----------
    mports/lang/f2c:
        Makefile (r1.1)
        distinfo (r1.1)
        pkg-descr (r1.1)
        pkg-plist (r1.1)
    mports/lang/f2c/files:
        patch-better-security (r1.1)
        patch-f2c.h (r1.1)
        patch-libf2c_MAIN.c (r1.1)
        patch-libf2c_Makefile (r1.1)
        patch-src_Makefile (r1.1)

-------------- next part --------------
--- /dev/null
+++ lang/f2c/pkg-descr
@@ -0,0 +1,6 @@
+f2c and its run-time library, libf2c.a, are a port of the
+Fortran-to-C converter available from ftp.netlib.org.  This
+software was originally developed by AT&T, Lucent Technologies,
+and Bellcore.
+
+WWW: http://www.netlib.org/
--- /dev/null
+++ lang/f2c/pkg-plist
@@ -0,0 +1,6 @@
+bin/f2c
+%%FC%%bin/%%FCNAME%%
+include/f2c.h
+lib/libf2c.a
+lib/libf2c.so
+lib/libf2c.so.2
--- /dev/null
+++ lang/f2c/Makefile
@@ -0,0 +1,78 @@
+#
+# $MidnightBSD: mports/lang/f2c/Makefile,v 1.1 2008/12/20 02:54:13 ctriv Exp $
+#
+
+PORTNAME=	f2c
+PORTVERSION=	20060810
+CATEGORIES=	lang
+MASTER_SITES=	${MASTER_SITE_LOCAL}
+MASTER_SITE_SUBDIR=	maho/f2c
+DISTNAME=	${PORTNAME}
+EXTRACT_SUFX=	.tar
+DIST_SUBDIR=	${PORTNAME}-${PORTVERSION}
+
+MAINTAINER=	ports at MidnightBSD.org
+COMMENT=	Fortran-to-C converter and its run-time libraries
+LICENSE=	other
+
+EXTRACT_DEPENDS=${UNZIP_CMD}:${PORTSDIR}/archivers/unzip
+
+GUNZIP_CMD=	minigzip -d
+USE_GMAKE=	yes
+USE_LDCONFIG=	yes
+
+# Set FCNAME to the name of the Fortran 77 / F2C wrapper.
+FCNAME?=	fc
+PLIST_SUB=	FCNAME=${FCNAME}
+.if defined(WITH_FC)
+PLIST_SUB+=	FC=""
+.else
+PLIST_SUB+=	FC="@comment "
+.endif
+
+MAN1=		f2c.1
+
+PORTDOCS=	00lastchange README README_libf2c changes f2c.pdf permission
+
+.include <bsd.port.pre.mk>
+
+post-extract:
+	cd ${WRKSRC} && ${FIND} . -name "*.gz" | ${XARGS} ${GUNZIP_CMD}
+	cd ${WRKSRC} && ${UNZIP_CMD} libf2c.zip
+	${CP} -p ${WRKSRC}/libf2c/README ${WRKSRC}/README_libf2c
+
+pre-patch:
+	${CP} -p ${WRKSRC}/libf2c/makefile.u ${WRKSRC}/libf2c/Makefile
+	${CP} -p ${WRKSRC}/src/makefile.u ${WRKSRC}/src/Makefile
+
+pre-configure:
+	${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|' ${WRKSRC}/fc
+
+do-build:
+	@${ECHO_MSG} "===> Building f2c..."
+	@(cd ${WRKSRC}/src;	\
+	${SETENV} ${MAKE_ENV} ${GMAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET})
+	@${ECHO_MSG} "===> Building libf2c..."
+	@(cd ${WRKSRC}/libf2c;	\
+	${SETENV} ${MAKE_ENV} ${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} ${ALL_TARGET} libf2c.so)
+	${MV} ${WRKSRC}/libf2c/libf2c.so ${WRKSRC}/libf2c/libf2c.so.2
+
+do-install:
+	${INSTALL_PROGRAM} ${WRKSRC}/src/f2c ${PREFIX}/bin
+.if defined(WITH_FC)
+	${INSTALL_SCRIPT} ${WRKSRC}/fc ${PREFIX}/bin/${FCNAME}
+.endif
+	${INSTALL_DATA} ${WRKSRC}/src/f2c.h ${PREFIX}/include
+	${INSTALL_MAN} ${WRKSRC}/src/f2c.1 ${MAN1PREFIX}/man/man1
+	${INSTALL_DATA} ${WRKSRC}/libf2c/libf2c.a ${PREFIX}/lib
+	${INSTALL_DATA} ${WRKSRC}/libf2c/libf2c.so.2 ${PREFIX}/lib
+	${LN} -sf libf2c.so.2 ${PREFIX}/lib/libf2c.so
+
+post-install:
+.if !defined(NOPORTDOCS)
+	${MKDIR} ${DOCSDIR}
+	${INSTALL_DATA} ${PORTDOCS:S|^|${WRKSRC}/|} ${DOCSDIR}
+	@${ECHO_MSG} "===> Documentation installed in ${DOCSDIR}."
+.endif
+
+.include <bsd.port.post.mk>
--- /dev/null
+++ lang/f2c/distinfo
@@ -0,0 +1,3 @@
+MD5 (f2c-20060810/f2c.tar) = 6315ad30ff5538e9c80271fc7bbf9774
+SHA256 (f2c-20060810/f2c.tar) = 0ce78544ddfcdac24b3ffc4cf8696f3b1b49390198e2d85fec3ce3a78545a948
+SIZE (f2c-20060810/f2c.tar) = 1201152
--- /dev/null
+++ lang/f2c/files/patch-better-security
@@ -0,0 +1,76 @@
+diff -ruN f2c.orig/files/patch-libf2c+lwrite.c f2c/files/patch-libf2c+lwrite.c
+--- f2c.orig/files/patch-libf2c+lwrite.c	1969-12-31 19:00:00.000000000 -0500
++++ f2c/files/patch-libf2c+lwrite.c	2008-07-29 14:05:35.000000000 -0500
+@@ -0,0 +1,24 @@
++--- libf2c/lwrite.c.orig	2008-07-29 13:57:49.000000000 -0500
+++++ libf2c/lwrite.c	2008-07-29 14:02:33.000000000 -0500
++@@ -107,10 +107,10 @@
++ 		absn = -absn;
++ 	fmt = LLOW <= absn && absn < LHIGH ? LFFMT : LEFMT;
++ #ifdef USE_STRLEN
++-	sprintf(buf, fmt, n);
+++	snprintf(buf, sizeof(buf), fmt, n);
++ 	return strlen(buf);
++ #else
++-	return sprintf(buf, fmt, n);
+++	return snprintf(buf, sizeof(buf), fmt, n);
++ #endif
++ 
++ #else
++@@ -134,7 +134,7 @@
++ 		*b = 0;
++ 		goto f__ret;
++ 		}
++-	sprintf(b, LGFMT, n);
+++	snprintf(b, sizeof(b), LGFMT, n);
++ 	switch(*b) {
++ #ifndef WANT_LEAD_0
++ 		case '0':
+diff -ruN f2c.orig/files/patch-libf2c+open.c f2c/files/patch-libf2c+open.c
+--- f2c.orig/files/patch-libf2c+open.c	1969-12-31 19:00:00.000000000 -0500
++++ f2c/files/patch-libf2c+open.c	2008-07-29 14:08:51.000000000 -0500
+@@ -0,0 +1,29 @@
++--- libf2c/open.c.orig	2008-07-29 13:58:04.000000000 -0500
+++++ libf2c/open.c	2008-07-29 14:08:30.000000000 -0500
++@@ -12,7 +12,7 @@
++ #ifdef KR_headers
++ extern char *malloc();
++ #ifdef NON_ANSI_STDIO
++-extern char *mktemp();
+++extern int mkstemp();
++ #endif
++ extern integer f_clos();
++ #else
++@@ -187,7 +187,7 @@
++ 			opnerr(a->oerr,107,"open")
++ 		}
++ 	else
++-		sprintf(buf, "fort.%ld", (long)a->ounit);
+++		snprintf(buf, sizeof(buf), "fort.%ld", (long)a->ounit);
++ 	b->uscrtch = 0;
++ 	b->uend=0;
++ 	b->uwrt = 0;
++@@ -211,7 +211,7 @@
++ 		b->uscrtch=1;
++ #ifdef NON_ANSI_STDIO
++ 		(void) strcpy(buf,"tmp.FXXXXXX");
++-		(void) mktemp(buf);
+++		(void) mkstemp(buf);
++ 		goto replace;
++ #else
++ 		if (!(b->ufd = tmpfile()))
+diff -ruN f2c.orig/files/patch-libf2c+rawio.h f2c/files/patch-libf2c+rawio.h
+--- f2c.orig/files/patch-libf2c+rawio.h	1969-12-31 19:00:00.000000000 -0500
++++ f2c/files/patch-libf2c+rawio.h	2008-07-29 14:09:17.000000000 -0500
+@@ -0,0 +1,11 @@
++--- libf2c/rawio.h.orig	2008-07-29 14:07:02.000000000 -0500
+++++ libf2c/rawio.h	2008-07-29 14:08:08.000000000 -0500
++@@ -26,7 +26,7 @@
++ #endif
++ #endif /*KR_HEADERS*/
++ 
++-extern char *mktemp(char*);
+++extern int mkstemp(char*);
++ 
++ #ifdef __cplusplus
++ 	}
--- /dev/null
+++ lang/f2c/files/patch-libf2c_Makefile
@@ -0,0 +1,50 @@
+--- libf2c/Makefile.orig	Fri Jun  6 15:09:42 2003
++++ libf2c/Makefile	Sun Jul 30 11:48:17 2006
+@@ -13,9 +13,9 @@
+ # to the CFLAGS = line below.
+ 
+ .SUFFIXES: .c .o
+-CC = cc
++#CC = cc
+ SHELL = /bin/sh
+-CFLAGS = -O
++CFLAGS += -fPIC
+ 
+ # compile, then strip unnecessary symbols
+ .c.o:
+@@ -29,7 +29,7 @@
+ 
+ MISC =	f77vers.o i77vers.o main.o s_rnge.o abort_.o exit_.o getarg_.o iargc_.o\
+ 	getenv_.o signal_.o s_stop.o s_paus.o system_.o cabs.o\
+-	derf_.o derfc_.o erf_.o erfc_.o sig_die.o uninit.o
++	derf_.o derfc_.o erf_.o erfc_.o sig_die.o uninit.o MAIN.o
+ POW =	pow_ci.o pow_dd.o pow_di.o pow_hh.o pow_ii.o pow_ri.o pow_zi.o pow_zz.o
+ CX =	c_abs.o c_cos.o c_div.o c_exp.o c_log.o c_sin.o c_sqrt.o
+ DCX =	z_abs.o z_cos.o z_div.o z_exp.o z_log.o z_sin.o z_sqrt.o
+@@ -82,7 +82,7 @@
+ ## of "cc -shared".
+ 
+ libf2c.so: $(OFILES)
+-	cc -shared -o libf2c.so $(OFILES)
++	$(CC) -shared -o libf2c.so $(OFILES)
+ 
+ ### If your system lacks ranlib, you don't need it; see README.
+ 
+@@ -110,12 +110,15 @@
+ # If your system lacks onexit() and you are not using an
+ # ANSI C compiler, then you should uncomment the following
+ # two lines (for compiling main.o):
+-#main.o: main.c
+-#	$(CC) -c -DNO_ONEXIT -DSkip_f2c_Undefs main.c
++main.o: main.c
++	$(CC) -c $(CFLAGS) -DNO_ONEXIT -DSkip_f2c_Undefs main.c
+ # On at least some Sun systems, it is more appropriate to
+ # uncomment the following two lines:
+ #main.o: main.c
+ #	$(CC) -c -Donexit=on_exit -DSkip_f2c_Undefs main.c
++
++MAIN.o: MAIN.c
++	$(CC) -c $(CFLAGS) -DSkip_f2c_Undefs MAIN.c
+ 
+ install: libf2c.a
+ 	cp libf2c.a $(LIBDIR)
--- /dev/null
+++ lang/f2c/files/patch-f2c.h
@@ -0,0 +1,171 @@
+taken from /usr/src/gnu/lib/libg2c/g2c.h of FreeBSD 6.2-RELEASE
+
+--- src/xsum0.out	Mon Jan 15 16:39:12 2007
++++ src/xsum0.out	Mon Jan 15 16:39:45 2007
+@@ -10,7 +10,7 @@
+ expr.c	6bfe005	72276
+ f2c.1	b0441b2	7532
+ f2c.1t	bf1f87	7574
+-f2c.h	e770b7d8	4688
++f2c.h	119ccae4	5589
+ format.c	bc32336	59652
+ format.h	b396862	458
+ formatdata.c	11a95834	28870
+
+--- libf2c/f2c.h0.orig	Tue Sep  7 13:46:24 1999
++++ libf2c/f2c.h0	Mon Jan 15 16:39:12 2007
+@@ -1,4 +1,13 @@
+-/* f2c.h  --  Standard Fortran to C header file */
++/* g2c.h  --  g77 version of f2c (Standard Fortran to C header file) */
++
++/* This file is generated by the g77 libg2c configuration process from a
++   file named g2c.hin.  This process sets up the appropriate types,
++   defines the appropriate macros, and so on.  The resulting g2c.h file
++   is used to build g77's copy of libf2c, named libg2c, and also can
++   be used when compiling C code produced by f2c to link the resulting
++   object file(s) with those produced by the same version of g77 that
++   produced this file, allowing inter-operability of f2c-compiled and
++   g77-compiled code.  */
+ 
+ /**  barf  [ba:rf]  2.  "He suggested using FORTRAN, and everybody barfed."
+ 
+@@ -7,24 +16,24 @@
+ #ifndef F2C_INCLUDE
+ #define F2C_INCLUDE
+ 
+-typedef long int integer;
+-typedef unsigned long int uinteger;
++/* F2C_INTEGER will normally be `int' but would be `long' on 16-bit systems */
++/* we assume short, float are OK */
++typedef int /* long int */ integer;
++typedef unsigned long int /* long */ uinteger;
+ typedef char *address;
+ typedef short int shortint;
+ typedef float real;
+ typedef double doublereal;
+ typedef struct { real r, i; } complex;
+ typedef struct { doublereal r, i; } doublecomplex;
+-typedef long int logical;
++typedef int /* long int */ logical;
+ typedef short int shortlogical;
+ typedef char logical1;
+ typedef char integer1;
+-#ifdef INTEGER_STAR_8	/* Adjust for integer*8. */
+-typedef long long longint;		/* system-dependent */
+-typedef unsigned long long ulongint;	/* system-dependent */
++typedef long long int /* long long */ longint;		/* system-dependent */
++typedef unsigned long long int /* long long */ ulongint;	/* system-dependent */
+ #define qbit_clear(a,b)	((a) & ~((ulongint)1 << (b)))
+ #define qbit_set(a,b)	((a) |  ((ulongint)1 << (b)))
+-#endif
+ 
+ #define TRUE_ (1)
+ #define FALSE_ (0)
+@@ -37,14 +46,15 @@
+ /* I/O stuff */
+ 
+ #ifdef f2c_i2
++#error "f2c_i2 will not work with g77!!!!"
+ /* for -i2 */
+ typedef short flag;
+ typedef short ftnlen;
+ typedef short ftnint;
+ #else
+-typedef long int flag;
+-typedef long int ftnlen;
+-typedef long int ftnint;
++typedef int /* long int */ flag;
++typedef int /* long int */ ftnlen;
++typedef int /* long int */ ftnint;
+ #endif
+ 
+ /*external read, write*/
+@@ -201,6 +211,9 @@
+ /* undef any lower-case symbols that your C compiler predefines, e.g.: */
+ 
+ #ifndef Skip_f2c_Undefs
++/* (No such symbols should be defined in a strict ANSI C compiler.
++   We can avoid trouble with f2c-translated code by using
++   gcc -ansi [-traditional].) */
+ #undef cray
+ #undef gcos
+ #undef mc68010
+
+--- src/f2c.h.orig	Mon Jan 15 16:39:12 2007
++++ src/f2c.h	Mon Jan 15 16:39:12 2007
+@@ -1,4 +1,13 @@
+-/* f2c.h  --  Standard Fortran to C header file */
++/* g2c.h  --  g77 version of f2c (Standard Fortran to C header file) */
++
++/* This file is generated by the g77 libg2c configuration process from a
++   file named g2c.hin.  This process sets up the appropriate types,
++   defines the appropriate macros, and so on.  The resulting g2c.h file
++   is used to build g77's copy of libf2c, named libg2c, and also can
++   be used when compiling C code produced by f2c to link the resulting
++   object file(s) with those produced by the same version of g77 that
++   produced this file, allowing inter-operability of f2c-compiled and
++   g77-compiled code.  */
+ 
+ /**  barf  [ba:rf]  2.  "He suggested using FORTRAN, and everybody barfed."
+ 
+@@ -7,24 +16,24 @@
+ #ifndef F2C_INCLUDE
+ #define F2C_INCLUDE
+ 
+-typedef long int integer;
+-typedef unsigned long int uinteger;
++/* F2C_INTEGER will normally be `int' but would be `long' on 16-bit systems */
++/* we assume short, float are OK */
++typedef int /* long int */ integer;
++typedef unsigned long int /* long */ uinteger;
+ typedef char *address;
+ typedef short int shortint;
+ typedef float real;
+ typedef double doublereal;
+ typedef struct { real r, i; } complex;
+ typedef struct { doublereal r, i; } doublecomplex;
+-typedef long int logical;
++typedef int /* long int */ logical;
+ typedef short int shortlogical;
+ typedef char logical1;
+ typedef char integer1;
+-#ifdef INTEGER_STAR_8	/* Adjust for integer*8. */
+-typedef long long longint;		/* system-dependent */
+-typedef unsigned long long ulongint;	/* system-dependent */
++typedef long long int /* long long */ longint;		/* system-dependent */
++typedef unsigned long long int /* long long */ ulongint;	/* system-dependent */
+ #define qbit_clear(a,b)	((a) & ~((ulongint)1 << (b)))
+ #define qbit_set(a,b)	((a) |  ((ulongint)1 << (b)))
+-#endif
+ 
+ #define TRUE_ (1)
+ #define FALSE_ (0)
+@@ -37,14 +46,15 @@
+ /* I/O stuff */
+ 
+ #ifdef f2c_i2
++#error "f2c_i2 will not work with g77!!!!"
+ /* for -i2 */
+ typedef short flag;
+ typedef short ftnlen;
+ typedef short ftnint;
+ #else
+-typedef long int flag;
+-typedef long int ftnlen;
+-typedef long int ftnint;
++typedef int /* long int */ flag;
++typedef int /* long int */ ftnlen;
++typedef int /* long int */ ftnint;
+ #endif
+ 
+ /*external read, write*/
+@@ -201,6 +211,9 @@
+ /* undef any lower-case symbols that your C compiler predefines, e.g.: */
+ 
+ #ifndef Skip_f2c_Undefs
++/* (No such symbols should be defined in a strict ANSI C compiler.
++   We can avoid trouble with f2c-translated code by using
++   gcc -ansi [-traditional].) */
+ #undef cray
+ #undef gcos
+ #undef mc68010
--- /dev/null
+++ lang/f2c/files/patch-libf2c_MAIN.c
@@ -0,0 +1,21 @@
+--- libf2c/MAIN.c.orig	Sun Jul 30 15:06:49 2006
++++ libf2c/MAIN.c	Sun Jul 30 15:12:02 2006
+@@ -0,0 +1,18 @@
++/* $FreeBSD: ports/lang/f2c/files/patch-libf2c_MAIN.c,v 1.1 2006/08/10 07:37:32 thierry Exp $
++   Add a pseudo entry point for cases where the main FOTRAN program is missing
++   e.g. ports/cad/tochnog.
++
++   Credit: adapted from Sergio Gelato <gelato (at) sissa.it> on Usenet.
++*/
++
++#include <stdio.h>
++#include <stdlib.h>
++#include <sys/cdefs.h>
++
++__weak_reference(missing_MAIN__,MAIN__);
++
++void missing_MAIN__ (void)
++{
++    fprintf(stderr, "The Fortran main program is missing.\n");
++    abort();
++}
--- /dev/null
+++ lang/f2c/files/patch-src_Makefile
@@ -0,0 +1,13 @@
+--- ./src/Makefile.orig	Sat Mar  5 02:24:21 2005
++++ ./src/Makefile	Thu Jul 27 22:50:42 2006
+@@ -1,8 +1,8 @@
+ #	Makefile for f2c, a Fortran 77 to C converter
+ 
+ .SUFFIXES: .c .o
+-CC = cc
+-CFLAGS = -O
++#CC = cc
++#CFLAGS = -O
+ SHELL = /bin/sh
+ YACC = yacc
+ YFLAGS =


More information about the Midnightbsd-cvs mailing list