summaryrefslogtreecommitdiffstats
path: root/science/afni/Makefile
blob: fe4cfa4427e58cb0ff9ae3ba23cd925c9ca234d5 (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
# Created by: Jason W. Bacon <bacon4000@gmail.com>
# $FreeBSD$

############################################################################
# http://www.neuro.mcw.edu/Ports has the latest source distribution from
#  which this port is built.  It will be updated as time permits.
#
# afni.nimh.nih.gov is the ultimate source for AFNI, and will always
# contain the latest source release.  If this port is not up to date,
# you can download the latest sources and build manually.

PORTNAME=	afni
PORTVERSION=	2015.11.13
PORTREVISION=	3
CATEGORIES=	science biology graphics
MASTER_SITES=	http://www.acadix.biz/Ports/distfiles/

MAINTAINER=	bacon4000@gmail.com
COMMENT=	Advanced Functional Neuro Imaging

LICENSE=	GPLv2

BUILD_DEPENDS=	gm4:devel/m4 \
		R:math/R
LIB_DEPENDS=	libexpat.so:textproc/expat2 \
		libf2c.so:lang/f2c \
		libgsl.so:math/gsl \
		libnetcdff.so:science/netcdf-fortran \
		libxml2.so:textproc/libxml2 \
		libXm.so:x11-toolkits/open-motif
RUN_DEPENDS=	endian:sysutils/endian \
		mpeg_encode:multimedia/mpeg_encode \
		ppmtogif:graphics/netpbm \
		qhull:math/qhull5 \
		R:math/R

CONFLICTS=	im-[0-9]* \
		nifticlib-[0-9]* \
		open-usp-tukubai-[0-9]*

USES=		gettext gmake iconv jpeg:run motif perl5 python shebangfix tar:xz
SHEBANG_FILES=	suma_change_spec \
		3dPAR2AFNI.pl \
		python_scripts/*.py \
		pkundu/meica.py \
		pkundu/meica.libs/*.py \
		pkundu/meica.libs/mdp/test/run_tests.py
USE_GNOME=	glib20

.include <bsd.port.options.mk>

BROKEN_sparc64=	Does not compile: "undefined reference to '_mcount'"

USE_GL=		gl glu glw
USE_XORG=	x11 xext xi xmu xp xt
MAKE_ENV=	CC="${CC}" R_SHARE_DIR=${LOCALBASE}/lib/R/share
MAKE_JOBS_UNSAFE=yes

ALL_TARGET=	vastness suma

###########################################################################
# Install parameters

SUB_FILES=	pkg-message afni.cshrc afni.profile

INSTALL_WRKSRC=	${WRKSRC}/BSD
PRESTAGE=	${WRKSRC}/prestage

X11R6_FILES=	coxplot/Makefile \
		coxplot/Makefile.f2c \
		3DEdge/src/Makefile \
		SUMA/SUMA_Makefile \
		edt_blur.c \
		suma_datasets.c \
		SUMA/SUMA_Load_Surface_Object.c \
		SUMA/SUMA_MiscFunc.c \
		SUMA/SUMA_ParseCommands.c \
		SUMA/GLUT/libglut/glut_event.c \
		SUMA/SUMA_Surface_IO.c

post-extract:
.for f in ${X11R6_FILES}
	@${REINPLACE_CMD} \
		-e 's|/usr/X11R6|$${LOCALBASE}|g' ${WRKSRC}/${f}
.endfor
	@${REINPLACE_CMD} \
		-E 's|AFNI_[0-9_]+|${PORTVERSION}|g' ${WRKSRC}/AFNI_label.h
	@${REINPLACE_CMD} \
		-e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/afni.1
	@${CP} ${FILESDIR}/Makefile ${WRKSRC}
	@${RM} ${WRKSRC}/3DEdge/src/Makefile.orig

# shebangfix misses /bin/python on 10.1
post-patch:
	${REINPLACE_CMD} -e "s|-lglib|-lglib-2.0|g" \
		${WRKSRC}/SUMA/SUMA_Makefile
	${REINPLACE_CMD} -e "s|/bin/python|${PYTHON_CMD}|g" \
		${WRKSRC}/python_scripts/lib_fat_Rfactor.py
	${REINPLACE_CMD} \
		-e 's|os\.path\.dirname(sys\.argv\[0\])|"${PREFIX}/libexec"|g' \
		${WRKSRC}/pkundu/meica.py
	${REINPLACE_CMD} \
		-e 's|g_info|afni_g_info|g' \
		${WRKSRC}/rickr/Dimon.c \
		${WRKSRC}/rickr/Dimon1.c \
		${WRKSRC}/afni_history_rickr.c \
		${WRKSRC}/mri_dicom_stuff.c \
		${WRKSRC}/mri_process_siemens.c \
		${WRKSRC}/mri_read_dicom.c \
		${WRKSRC}/to3d.c \
		${WRKSRC}/mri_dicom_stuff.h

post-build:
	${MKDIR} ${PRESTAGE}/bin \
		${PRESTAGE}/scripts \
		${PRESTAGE}/lib \
		${PRESTAGE}/include \
		${PRESTAGE}/trash \
		${PRESTAGE}/doc \
		${PRESTAGE}/share
	${MV}	${INSTALL_WRKSRC}/libf2c.a \
		${PRESTAGE}/trash
	${MV}	${INSTALL_WRKSRC}/*.a \
		${INSTALL_WRKSRC}/*.so \
		${PRESTAGE}/lib
	${MV}	${INSTALL_WRKSRC}/funstuff \
		${INSTALL_WRKSRC}/AFNI.*rc \
		${INSTALL_WRKSRC}/afnigui* \
		${PRESTAGE}/share
	${MV}	${INSTALL_WRKSRC}/*.h \
		${PRESTAGE}/include
	${MV}	${INSTALL_WRKSRC}/README* \
		${PRESTAGE}/doc
	for binary in `${FILE} ${INSTALL_WRKSRC}/* | fgrep 'ELF' | ${AWK} -F ':' ' { print $$1 }'` ; do \
		${MV} $${binary} ${PRESTAGE}/bin ; \
	done
	${MV}	${INSTALL_WRKSRC}/* \
		${PRESTAGE}/scripts
	${MV}	${PRESTAGE}/scripts/meica.libs ${PRESTAGE}

do-install:
	${MKDIR} ${STAGEDIR}${DATADIR} \
		${STAGEDIR}${PREFIX}/lib/afni \
		${STAGEDIR}${PREFIX}/include/afni
	for f in ${PRESTAGE}/lib/*; do \
		${STRIP_CMD} $${f}; \
	done
	${INSTALL_DATA} ${PRESTAGE}/lib/* ${STAGEDIR}${PREFIX}/lib/afni
	${INSTALL_DATA} ${PRESTAGE}/include/* ${STAGEDIR}${PREFIX}/include/afni
	cd ${PRESTAGE}/share && ${COPYTREE_SHARE} . ${STAGEDIR}${DATADIR}
	${INSTALL_PROGRAM} ${PRESTAGE}/bin/* ${STAGEDIR}${PREFIX}/bin
	${INSTALL_SCRIPT} ${PRESTAGE}/scripts/* ${STAGEDIR}${PREFIX}/bin
	cd ${PRESTAGE} && ${COPYTREE_BIN} meica.libs \
		${STAGEDIR}${PREFIX}/libexec
	${INSTALL_DATA} ${WRKSRC}/Atlases/* ${STAGEDIR}${DATADIR}
	${INSTALL_MAN} ${WRKSRC}/afni.1 ${STAGEDIR}${MAN1PREFIX}/man/man1
	${MKDIR} ${STAGEDIR}${DOCSDIR} ${STAGEDIR}${PREFIX}/etc/mri
	${INSTALL_DATA} ${PRESTAGE}/doc/* ${STAGEDIR}${DOCSDIR}
	${INSTALL_SCRIPT} ${WRKDIR}/afni.cshrc ${WRKDIR}/afni.profile \
		${STAGEDIR}${PREFIX}/etc/mri

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