summaryrefslogtreecommitdiff
path: root/lang/julia/Makefile
blob: b1b75bd94779871c5790579b26a27ef737a70b5e (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
PORTNAME=	julia
DISTVERSION=	1.7.3
DISTVERSIONSUFFIX=	-full
CATEGORIES=	lang math
MASTER_SITES=	https://github.com/JuliaLang/julia/releases/download/v${DISTVERSION}/

MAINTAINER=	rizor.reardon@yahoo.com
COMMENT=	Implementation of Julia, a language for technical computing

LICENSE=	MIT
LICENSE_FILE=	${WRKSRC}/LICENSE.md

ONLY_FOR_ARCHS=		amd64
ONLY_FOR_ARCHS_REASON=	Has not been ported to this platform for freebsd

MY_DEPENDS=	7zz:archivers/7-zip
BUILD_DEPENDS=	patchelf:sysutils/patchelf \
		cmake:devel/cmake \
		${MY_DEPENDS}
LIB_DEPENDS=	libcurl.so:ftp/curl \
		libgit2.so:devel/libgit2 \
		libgmp.so:math/gmp \
		libmbedtls.so:security/mbedtls \
		libmpfr.so:math/mpfr \
		libpcre2-8.so:devel/pcre2 \
		libssh2.so:security/libssh2 \
		libutf8proc.so:textproc/utf8proc \
		libnghttp2.so:www/libnghttp2 \
		libunwind.so:devel/libunwind \
		libopenlibm.so:math/openlibm
RUN_DEPENDS=	${MY_DEPENDS}

USES=		gmake compiler:c++14-lang cpe fortran python perl5 \
		shebangfix blaslapack:openblas

CPE_VENDOR=	julialang

BINARY_ALIAS=	python3=${PYTHON_CMD} gfortran=gfortran${_GCC_VER}
USE_LDCONFIG=	yes
CFLAGS+=	-fpic

SHEBANG_GLOB=	*.sh

WRKSRC=		${WRKDIR}/julia-${DISTVERSION}

ALL_TARGET=	default
INSTALL_TARGET=	install
TEST_TARGET=	test

PORTDOCS=	html
PLIST_SUB=	VERSION="${PORTVERSION:R}"

CXXFLAGS+=	-std=c++14
MAKE_ARGS+=	NO_GIT=1 \
		USE_BINARYBUILDER=0 \
		prefix=${PREFIX} \
		JCXXFLAGS="${CXXFLAGS}" \
		USE_GPL_LIBS=0 \
		ARCH=x86_64 \
		USE_SYSTEM_CURL=1 \
		USE_SYSTEM_GMP=1 \
		USE_SYSTEM_OPENLIBM=1 \
		USE_SYSTEM_LAPACK=1 \
		USE_SYSTEM_LIBGIT2=1 \
		USE_SYSTEM_LIBSSH2=1 \
		USE_SYSTEM_MBEDTLS=1 \
		USE_SYSTEM_MPFR=1 \
		USE_SYSTEM_PATCHELF=1 \
		USE_SYSTEM_PCRE=1 \
		USE_SYSTEM_UTF8PROC=1 \
		USE_SYSTEM_P7ZIP=1 \
		USE_SYSTEM_BLAS=1 \
		USE_SYSTEM_NGHTTP2=1 \
		USE_SYSTEM_CSL=1 \
		USE_SYSTEM_ZLIB=1 \
		USE_SYSTEM_LIBUNWIND=1

OPTIONS_DEFINE=		DEBUG DOCS NATIVE GPL_LIBS
OPTIONS_DEFAULT=	DOCS GPL_LIBS
OPTIONS_SUB=		yes

DEBUG_MAKE_ARGS=	FORCE_ASSERTIONS=1 \
			ALL_TARGET=all \
			BUNDLE_DEBUG_LIBS=1

DOCS_VARS=		INSTALL_TARGET+=install-docs

GPL_LIBS_DESC=		Build with GPL library suitesparse
GPL_LIBS_LIB_DEPENDS=	libspqr.so:math/suitesparse-spqr \
			libumfpack.so:math/suitesparse-umfpack
GPL_LIBS_MAKE_ARGS=	USE_SYSTEM_LIBSUITESPARSE=1 \
			USE_GPL_LIBS=1

NATIVE_DESC=		Build with native CPU JIT tuning
NATIVE_MAKE_ARGS=	MARCH=native

post-patch:
	echo "override TAGGED_RELEASE_BANNER=\"FreeBSD port lang/${PORTNAME} build\"" >> ${WRKSRC}/Make.user
	# unset ARCH for auto-detection
	# Julia build script uses the name x86_86/x86, which are different from ports framework
	echo "ARCH=" >> ${WRKSRC}/Make.user
	echo "LIBBLAS=-lopenblas -L${LOCALBASE}/lib" >> ${WRKSRC}/Make.user
	echo "LIBBLASNAME=libopenblas" >> ${WRKSRC}/Make.user
	echo 'LIBLAPACK= $$(LIBBLAS)' >> ${WRKSRC}/Make.user
	echo 'LIBLAPACKNAME= $$(LIBBLASNAME)' >> ${WRKSRC}/Make.user

post-configure:
	${CC} ${CFLAGS} -lopenblas ${LDFLAGS} -o ${WRKSRC}/check_openblas \
		${FILESDIR}/check_openblas.c
	${WRKSRC}/check_openblas && ( \
		echo "USE_BLAS64=1" >> ${WRKSRC}/Make.user \
	) || ( \
		echo "USE_BLAS64=0" >> ${WRKSRC}/Make.user \
	)

post-install:
	# clean up for Pkg3.jl
.for file in .codecov.yml .travis.yml appveyor.yml bors.toml .gitignore source-extracted
	${FIND} ${STAGEDIR}${PREFIX}/share/julia/ -name ${file} -delete
.endfor
.for dir in Statistics SuiteSparse ArgTools Pkg Downloads LibCURL NetworkOptions Tar
	${RM} -fr ${STAGEDIR}${PREFIX}/share/julia/stdlib/v${PORTVERSION:R}/${dir}/.github/
.endfor

post-install-DOCS-off:
	${RM} -r ${STAGEDIR}${PREFIX}/${INSTALLDIR}/share/doc

post-install-DEBUG-off:
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/julia*
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/libjulia.so*
.for bin in libccalltest.so libllvmcalltest.so libjulia-internal.so* libblastrampoline.so libdSFMT.so libuv.so* libLLVM* sys.so
	${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/julia/${bin}
.endfor

.include <bsd.port.mk>