aboutsummaryrefslogtreecommitdiffstats
path: root/devel/frama-c/Makefile
blob: 6bdb9c5528acb77b32a47bf140fd3438aa8e44e4 (plain) (blame)
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
# New ports collection makefile for:    frama-c
# Date created:         25 May 2011
# Whom:                 b.f. <bf@FreeBSD.org>
#
# $FreeBSD$
#

PORTNAME=       frama-c
DISTVERSIONPREFIX=  Nitrogen-
DISTVERSION=        20111001
CATEGORIES=     devel
MASTER_SITES=       http://frama-c.com/download/ LOCAL/bf

MAINTAINER= bf@FreeBSD.org
COMMENT=    Extensible platform for source-code analysis of C

LICENSE=    LGPL21

BUILD_DEPENDS=  ${LOCALBASE}/lib/ocaml/ocamlgraph/graph.a:${PORTSDIR}/math/ocaml-ocamlgraph
RUN_DEPENDS=    ${LOCALBASE}/lib/ocaml/ocamlgraph/graph.a:${PORTSDIR}/math/ocaml-ocamlgraph

GNU_CONFIGURE=  yes
MAKE_ENV+=  FRAMAC_LIBDIR="${PREFIX}/lib/frama-c"
MAN1=       frama-c.1 frama-c-gui.1
OPTIONS=    ALTERGO "Build wp plugin components that use Alt-Ergo" on \
        COQ "Build wp plugin components that use Coq" off \
        GUI "Build GUI" on \
        PLUGINS "Build bundled plugins" on
USE_GMAKE=  yes
USE_OCAML=  yes

.include <bsd.port.options.mk>

.if defined(WITH_ALTERGO)
.if !defined(WITH_PLUGINS)
IGNORE =    requires WITH_PLUGINS for WITH_ALTERGO
.endif
BUILD_DEPENDS +=    alt-ergo:${PORTSDIR}/math/alt-ergo
RUN_DEPENDS+=       alt-ergo:${PORTSDIR}/math/alt-ergo
.else
CONFIGURE_ENV +=    HAS_ALTERGO=no
.endif

.if defined(WITH_COQ)
.if !defined(WITH_PLUGINS)
IGNORE =    requires WITH_PLUGINS for WITH_COQ
.endif
BUILD_DEPENDS +=    coqc:${PORTSDIR}/math/coq
RUN_DEPENDS+=       coqc:${PORTSDIR}/math/coq
.else
CONFIGURE_ENV +=    HAS_COQ=no
.endif

.if defined(WITH_GUI)
.if !defined(WITH_PLUGINS)
IGNORE =    requires WITH_PLUGINS for WITH_GUI
.endif
BUILD_DEPENDS +=    lablgtk2:${PORTSDIR}/x11-toolkits/ocaml-lablgtk2
RUN_DEPENDS+=       lablgtk2:${PORTSDIR}/x11-toolkits/ocaml-lablgtk2
CONFIGURE_ARGS+=    --enable-gui
PLIST_SUB+=     GUI=""
.else
CONFIGURE_ARGS+=    --disable-gui
PLIST_SUB+=     GUI="@comment "
.endif

.if defined(WITH_PLUGINS)
BUILD_DEPENDS +=    dot:${PORTSDIR}/graphics/graphviz \
            ltl2ba:${PORTSDIR}/math/ltl2ba
RUN_DEPENDS+=       dot:${PORTSDIR}/graphics/graphviz \
            ltl2ba:${PORTSDIR}/math/ltl2ba
PLIST_SUB+=     PLUGINS=""
.else
CONFIGURE_ARGS+=    --with-no-plugin
PLIST_SUB+=     PLUGINS="@comment "
.endif

post-patch:
    @${MKDIR} ${WRKSRC}/tests/report \
        ${WRKSRC}/tests/wp \
        ${WRKSRC}/tests/wp_plugin \
        ${WRKSRC}/tests/wp_acsl \
        ${WRKSRC}/tests/wp_store \
        ${WRKSRC}/tests/wp_hoare \
        ${WRKSRC}/tests/wp_runtime \
        ${WRKSRC}/tests/wp_bts \
        ${WRKSRC}/tests/wp_engine
    @${REINPLACE_CMD} -e 's|@make |@${GMAKE} |' \
            ${WRKSRC}/src/aorai/Makefile.in
    @${REINPLACE_CMD} \
        -e 's|$$(CP)|${INSTALL_DATA}|' \
        -e 's|add_prefix|addprefix|' \
            ${WRKSRC}/share/Makefile.plugin
    @${REINPLACE_CMD} \
        -e '\|$$(CP) $$(TARGETS|s|$$(CP)|${INSTALL_DATA}|' \
        -e '\|$$(CP) frama-c|s|$$(CP)|${INSTALL_SCRIPT}|' \
            ${WRKSRC}/share/Makefile.dynamic
    @${REINPLACE_CMD} -e '\|^# Installation|,\|^# File headers|{ \
        \|$$(CP).*bin|s|$$(CP)|${INSTALL_SCRIPT}|; \
        \|$$(CP) -R doc/manuals $$(FRAMAC_DATADIR)| \
        s||${MKDIR} $$(FRAMAC_DATADIR)/manuals ; \
        ${INSTALL_DATA} doc/manuals/* $$(FRAMAC_DATADIR)/manuals|; \
        \|$$(CP).*man|s|$$(CP)\( -R\)*|${INSTALL_MAN}|; \
        \|$$(CP).*share|s|$$(CP)\( -R\)*|${INSTALL_DATA}|; \
        s|$$(CP)|${INSTALL_DATA}|; }' \
            ${WRKSRC}/Makefile
    @${REINPLACE_CMD} -e 's|HAS_ALTERGO=$$||' \
        -e '\|case $$ALTERGO_VERSION in|{N; s|0\.92\.2|0.94*|;}' \
        -e 's|HAS_COQ=$$||' \
        -e '\|case $$OCAMLGRAPH_VERSION in|{N; s|1\.8|&*|;}' \
            ${WRKSRC}/configure

.if defined(WITH_GUI)
pre-configure:
    @(if [ ! -e ${LOCALBASE}/lib/ocaml/lablgtk2/gtkSourceView2.cmi -o \
    ! -e ${LOCALBASE}/lib/ocaml/lablgtk2/gnomeCanvas.cmi ] ; then \
    ${ECHO_MSG} "==> The WITH_GUI option for ${PKGNAME} requires" ; \
    ${ECHO_MSG} "==> x11-toolkits/ocaml-lablgtk2 to be built" ; \
    ${ECHO_MSG} "==> WITH_GNOMECANVAS and WITH_GTKSOURCEVIEW2" ; \
    exit 1; fi)
    @(if [ ! -e ${LOCALBASE}/lib/ocaml/ocamlgraph/dgraph.cmi ] ; then \
    ${ECHO_MSG} "==> The WITH_GUI option for ${PKGNAME} requires" ; \
    ${ECHO_MSG} "==> math/ocaml-ocamlgraph to be built WITH_GUI" ; \
    exit 1; fi)

.endif

post-install:
    @${TOUCH} ${PREFIX}/lib/frama-c/plugins/.keep_me \
    ${PREFIX}/lib/frama-c/plugins/gui/.keep_me

.if defined(MAINTAINER_MODE)
check regression-test test: build
    @(cd ${WRKSRC}; ${SETENV} ${MAKE_ENV} \
    FRAMAC_LIB=${WRKSRC}/lib/fc \
    FRAMAC_PLUGIN=${WRKSRC}/lib/plugins \
    FRAMAC_SHARE=${WRKSRC}/share \
    ${GMAKE} ${_MAKE_JOBS} ${MAKE_ARGS} tests)

.endif

.include <bsd.port.mk>