summaryrefslogtreecommitdiff
path: root/cad/mex-wcalc/Makefile
blob: fc96f37a1d93db8331e35cdccb4d82d20d6da23e (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
# $NetBSD: Makefile,v 1.5 2006/02/05 23:08:22 joerg Exp $
#

.include "../../cad/wcalc/Makefile.common"
PKGNAME=	mex-${DISTNAME}
PKGREVISION=	1

COMMENT=	Matlab Based Transmission Line Analysis/Synthesis Calculator

# Only enable the matlab frontend
CONFIGURE_ARGS+=	--disable-cgi
CONFIGURE_ARGS+=	--disable-gtk1
CONFIGURE_ARGS+=	--disable-gtk2
CONFIGURE_ARGS+=	--disable-htdocs
CONFIGURE_ARGS+=	--disable-libwcalc
CONFIGURE_ARGS+=	--disable-stdio
CONFIGURE_ARGS+=	--with-matlab
CONFIGURE_ARGS+=	--without-octave
CONFIGURE_ARGS+=	--without-scilab

post-patch:
	${MV} ${WRKSRC}/mex-wcalc/mexopts.sh.in \
		${WRKSRC}/mex-wcalc/mexopts.sh.in.orig
	${SED} 's;\.\./libwcalc;${BUILDLINK_DIR}/lib;g' \
		${WRKSRC}/mex-wcalc/mexopts.sh.in.orig \
		> ${WRKSRC}/mex-wcalc/mexopts.sh.in

# This depends on an installation of Matlab which pkgsrc does
# not have.  We should find a sane way to deal with this.  It is
# not clear if linux/solaris matlab users care to use pkgsrc
# to manage its installation or if it will always be installed
# outside of pkgsrc.

# In addition, mex-wcalc will not currently build correctly
# if you are using a non-native matlab (i.e. linux or solaris
# matlab on NetBSD).
#
# To get mex-wcalc to work under emulation you need to set up
# a cross-tool chain, build a libwcalc targeted to the same
# system as the matlab installation, and modify the mexopts.sh
# file in ${WRKSRC}/mex-wcalc to use this cross tool chain.
# Basically what it comes down to is you need to compile shared
# modules for the same os as the matlab binary.
#
ONLY_FOR_PLATFORM=	Linux-*-i386 SunOS-*-sparc*

.include "../../mk/bsd.prefs.mk"

DEF_MATLAB_ARCH=	unknown
DEF_MATLAB_MEX=	mex
DEF_MEX_SUFX=	unknown
.if ${OPSYS} == "Linux"
. if (${MACHINE_ARCH} == "i386")
DEF_MATLAB_ARCH=	glnx86
DEF_MEX_SUFX=	mexglx
. endif
.elif ${OPSYS} == "SunOS"
. if (${MACHINE_ARCH} == "sparc")
DEF_MATLAB_ARCH=	sol2
DEF_MEX_SUFX=	mexsol
. endif
.endif
MATLAB_ARCH?=	${DEF_MATLAB_ARCH}
MEX_SUFX?=	${DEF_MEX_SUFX}

MATLAB_MEX?=		${DEF_MATLAB_MEX}

PLIST_SUBST+=		MEX_SUFX=${MEX_SUFX:Q}

.if !empty(PHASES_AFTER_EXTRACT:M${PKG_PHASE})
MATLAB_DIR!=		${MATLAB_MEX} -v 2>/dev/null | ${AWK} '/[ \t]MATLAB[ \t]/ {print $$NF}'

BUILDLINK_PASSTHRU_DIRS+=	${MATLAB_DIR}/extern/include
BUILDLINK_PASSTHRU_DIRS+=	${MATLAB_DIR}/simulink/include
BUILDLINK_PASSTHRU_DIRS+=	${MATLAB_DIR}/bin/${MATLAB_ARCH}
.endif

.include "../../cad/libwcalc/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"