summaryrefslogtreecommitdiffstats
path: root/science/gamess/Makefile
blob: 29e23fece25848d005d22d097271b43b87845be1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
# Created by: NAKATA Maho <maho@FreeBSD.org>
# $FreeBSD$

PORTNAME=	gamess
PORTVERSION=	${SNAPDATE}
PORTREVISION=	1
CATEGORIES=	science
MASTER_SITES=	#http://www.msg.ameslab.gov/GAMESS/License_Agreement.html
DISTNAME=	gamess-current
DIST_SUBDIR=	${PORTNAME}/${PORTVERSION}

MAINTAINER=	maho@FreeBSD.org
COMMENT=	Freely obtainable ab-initio molecular orbital calculation program

USES=		fortran gmake
WRKSRC=		${WRKDIR}/gamess
SNAPDATE=	20130501.1

RESTRICTED=	No Redistribution

.if !exists(${DISTDIR}/${DISTFILES})
IGNORE=you must manually get the source distribution from master site. http://www.msg.ameslab.gov/GAMESS/download.html. Please select "Source code distribution", and check on "running on Intel compatible PC running Linux". You must have license, and freely obtainable
.endif

MANUAL_PACKAGE_BUILD=You must manually get the source distribution from master site. http://www.msg.ameslab.gov/GAMESS/download.html. Please select "Source code distribution", and check on "running on Intel compatible PC running Linux". You must have license, and freely obtainable.

NO_STAGE=	yes
.include <bsd.port.pre.mk>

.if exists(${LOCALBASE}/lib/libgoto2.so)
WITH_BLAS?=	gotoblas
.elif exists(${LOCALBASE}/lib/libatlas.so)
WITH_BLAS?=	atlas
.else
WITH_BLAS?=	reference
.endif

. if ${WITH_BLAS} == reference
LIB_DEPENDS+=	libblas.so:${PORTSDIR}/math/blas
LIB_DEPENDS+=	liblapack.so:${PORTSDIR}/math/lapack
BLAS=		-lblas
LAPACK=		-llapack
.elif ${WITH_BLAS} == gotoblas
LIB_DEPENDS+=	libgoto2.so:${PORTSDIR}/math/gotoblas
BLAS=		-lgoto2p
LAPACK=		-lgoto2p
.elif ${WITH_BLAS} == atlas
LIB_DEPENDS+=	libatlas.so:${PORTSDIR}/math/atlas
BLAS=		-lptf77blas
LAPACK=		-lalapack -lptcblas
.endif

.if defined(WITH_OPTIMIZED_FLAGS)
.if ${ARCH} == "amd64"
CFLAGS+=	-pipe -O3 -ffast-math -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -funit-at-a-time
FFLAGS+=	-pipe -O3 -ffast-math -funroll-all-loops -fpeel-loops -ftracer -funswitch-loops -funit-at-a-time
.elif ${ARCH} == "i386"
CFLAGS+=	-pipe -O3 -ffast-math -finline-functions -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -malign-double -mcpu=i686 -march=i686 -mfancy-math-387
FFLAGS+=	-pipe -O3 -ffast-math -finline-functions -fomit-frame-pointer -funroll-loops -fexpensive-optimizations -malign-double -mcpu=i686 -march=i686 -mfancy-math-387
.endif
.endif

#WITH_IFC=	yes #currently building with ifc is broken
.if defined(WITH_IFC)
FC=	${LOCALBASE}/intel_fc_80/bin/ifort
F77=	${LOCALBASE}/intel_fc_80/bin/ifort
CC=	${LOCALBASE}/intel_cc_80/bin/icc
FFLAGS=	-axP -xW -ipo -O3 -Vaxlib
CFLAGS=	-axP -xW -ipo -O3 -Vaxlib
LIBSVM=	-lsvml
LIBG2C=	-lg2c
.else
LIBG2C=
LIBSVM=
.endif

.if defined(WITH_IFC)
FORTRAN=	ifort
.else
FORTRAN=	gfortran
.endif

pre-build:
	${CP} ${FILESDIR}/install.info ${WRKSRC}
	${CP} ${FILESDIR}/Makefile.top ${WRKSRC}/Makefile
	@${REINPLACE_CMD} -e 's+%%PREFIX%%+${PREFIX}+g' ${WRKSRC}/gms-files.csh
.if ${ARCH} == "amd64"
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd64+g' ${WRKSRC}/comp
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd64+g' ${WRKSRC}/compall
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd64+g' ${WRKSRC}/ddi/compddi
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd64+g' ${WRKSRC}/lked
	@${REINPLACE_CMD} -e 's+%%GMS_TARGET%%+freebsd64+g' ${WRKSRC}/install.info
.elif ${ARCH} == "i386"
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd32+g' ${WRKSRC}/comp
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd32+g' ${WRKSRC}/compall
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd32+g' ${WRKSRC}/ddi/compddi
	@${REINPLACE_CMD} -e 's+%%ARCH%%+freebsd32+g' ${WRKSRC}/lked
	@${REINPLACE_CMD} -e 's+%%GMS_TARGET%%+freebsd32+g' ${WRKSRC}/install.info
.endif
	@${REINPLACE_CMD} -e 's+%%GMS_PATH%%+${WRKSRC}+g ; \
			     s+%%GMS_BUILD_DIR%%+${WRKSRC}+g ; \
				s+%%GMS_FORTRAN%%+${FORTRAN}+g ; \
				s+%%FC%%+${FC}+g ; \
				s+%%GMS_GFORTRAN_VERNO%%+${GCC_DEFAULT_VERSION}+g ; \
				s+%%GMS_DDI_COMM%%+sockets+g ; \
				s+%%GMS_MATHLIB%%+none+g ; \
				s+%%GMS_MATHLIB_PATH%%+${LOCALBASE}/lib+g' ${WRKSRC}/install.info
	${REINPLACE_CMD} -e 's+%%FC%%+${FC}+g ; \
			      s+%%LDFLAGS%%+${LDFLAGS}+g ; \
			      s+%%LOCALBASE%%+${LOCALBASE}+g ; \
			      s+%%LIBSVM%%+${LIBSVM}+g ; \
			      s+%%LIBG2C%%+${LIBG2C}+g ; \
			      s+%%BLAS%%+${BLAS}+g ; \
			      s+%%PTHREAD_LIBS%%+${PTHREAD_LIBS}+g' \
			 ${WRKSRC}/lked
	${REINPLACE_CMD} -e 's+%%FC%%+${FC}+g ; \
			      s+%%FFLAGS%%+${FFLAGS}+g' \
			 ${WRKSRC}/comp
	${REINPLACE_CMD} -e 's+%%CC%%+${CC}+g' \
			 ${WRKSRC}/compall
	${REINPLACE_CMD} -e 's+%%PREFIX%%+${PREFIX}+g' \
			 ${WRKSRC}/rungms
	${REINPLACE_CMD} -e  's+%%FC%%+${FC}+g ; \
		   	      s+%%GMS_FORTRAN%%+${FORTRAN}+g ; \
			      s+%%PTHREAD_CFLAGS%%+${PTHREAD_CFLAGS}+g ; \
			      s+%%PTHREAD_LIBS%%+${PTHREAD_LIBS}+g ; \
			      s+%%UNDERSCORES%%+${UNDERSCORES}+g ; \
			      s+%%CC%%+${CC}+g' \
			 ${WRKSRC}/ddi/compddi

	${CP} ${FILESDIR}/Makefile.tools ${WRKSRC}/tools/Makefile
	${REINPLACE_CMD} -e 's+%%FC%%+${FC}+g ; \
			      s+%%FFLAGS%%+${FFLAGS}+g' \
		${WRKSRC}/tools/Makefile

do-build:
	(cd ${WRKSRC}; ${MAKE_CMD})

do-install:
	${MKDIR} ${PREFIX}/bin/gms
	${MKDIR} ${PREFIX}/share/gamess
	${MKDIR} ${PREFIX}/share/gamess/mcpdata
	${MKDIR} ${PREFIX}/share/doc/gamess
	${MKDIR} ${PREFIX}/share/examples/gamess
	${INSTALL_SCRIPT}  ${WRKDIR}/gamess/rungms		${PREFIX}/bin/gamess
	${CHMOD} 555 ${PREFIX}/bin/gamess
	${INSTALL_SCRIPT} ${WRKDIR}/gamess/gms-files.csh          ${PREFIX}/bin/gms
	${INSTALL_PROGRAM} ${WRKDIR}/gamess/gamess.00.x          ${PREFIX}/bin/gms
	${INSTALL_PROGRAM} ${WRKDIR}/gamess/ddi/ddikick.x            ${PREFIX}/bin/gms
	${INSTALL_DATA}    ${WRKDIR}/gamess/*.DOC                ${PREFIX}/share/doc/gamess/
	${INSTALL_DATA}    ${WRKDIR}/gamess/tests/standard/*.inp          ${PREFIX}/share/examples/gamess/
	${MKDIR} ${PREFIX}/share/gamess/auxdata
	${MKDIR} ${PREFIX}/share/gamess/auxdata/BASES
	${MKDIR} ${PREFIX}/share/gamess/auxdata/EFP
	${MKDIR} ${PREFIX}/share/gamess/auxdata/MCP
	${MKDIR} ${PREFIX}/share/gamess/auxdata/QUANPOL
	${INSTALL_DATA}    ${WRKDIR}/gamess/auxdata/ericfmt.dat	${PREFIX}/share/gamess/auxdata/
	${INSTALL_DATA}    ${WRKDIR}/gamess/auxdata/BASES/*	${PREFIX}/share/gamess/auxdata/BASES
	${INSTALL_DATA}    ${WRKDIR}/gamess/auxdata/EFP/*	${PREFIX}/share/gamess/auxdata/EFP
	${INSTALL_DATA}    ${WRKDIR}/gamess/auxdata/MCP/*	${PREFIX}/share/gamess/auxdata/MCP
	${INSTALL_DATA}    ${WRKDIR}/gamess/auxdata/QUANPOL/*	${PREFIX}/share/gamess/auxdata/QUANPOL
	${INSTALL_DATA}    ${WRKDIR}/gamess/ddi/readme.ddi       ${PREFIX}/share/doc/gamess/

.include <bsd.port.post.mk>
OpenPOWER on IntegriCloud