aboutsummaryrefslogtreecommitdiffstats
path: root/devel/cil/Makefile
blob: f98873e5fe44a799730a2f8490a270eec0243917 (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
# Created by: Alexander Leidinger <netchild@FreeBSD.org>
# $FreeBSD$

PORTNAME=   cil
PORTVERSION=    1.7.3
PORTREVISION=   2
CATEGORIES= devel lang
MASTER_SITES=   SF/${PORTNAME}/${PORTNAME}

MAINTAINER= ports@FreeBSD.org
COMMENT=    Infrastructure for C Program Analysis and Transformation

LICENSE=    BSD3CLAUSE
LICENSE_FILE=   ${WRKSRC}/LICENSE

CONFLICTS=  ccured-[0-9]*

ONLY_FOR_ARCHS= i386 amd64
USES=       gmake perl5
USE_OCAML=  yes
USE_OCAML_FINDLIB=  yes
OCAML_PKGDIRS=
GNU_CONFIGURE=  yes
MAKE_JOBS_UNSAFE=yes

PORTDOCS=   *
PLIST_FILES=    ${BINFILES:S,^,bin/,} \
        %%SITE_PERL%%/CilConfig.pm \
        ${LIBFILES:S,^,%%SITE_PERL%%/CIL/,} \
        ${LIBBINS:S,^,%%SITE_PERL%%/CIL/,} \
        ${LIBAFILES:S,^,%%SITE_PERL%%/CIL/,}
BINFILES=   cilly cilly.native
LIBAFILES=  App/Cilly.pm
LIBFILES=   App/Cilly/KeptFile.pm \
        App/Cilly/OutputFile.pm \
        App/Cilly/TempFile.pm
LIBBINS=    patcher

OPTIONS_DEFINE= DOCS

post-patch:
    @${REINPLACE_CMD} -e \
        '35 s|make|gmake|g' ${WRKSRC}/myocamlbuild.ml
    @${REINPLACE_CMD} -e \
        's|@CILHOME@/lib|${PREFIX}/${SITE_PERL_REL}/CIL|g ; \
        s|\@CILHOME\@|${PREFIX}|g' \
        ${WRKSRC}/lib/App/Cilly/CilConfig.pm.in
    @${REINPLACE_CMD} -e \
        '/^#!/s|/.*|${PERL}|' ${WRKSRC}/lib/patcher
    @${REINPLACE_CMD} -e \
        '/^#!/s|/.*|${PERL}| ; \
         s|$$::cilhome|${PREFIX}|g ; \
         s|obj/$$::archos|libexec/cil|g ; \
         s|^use Cilly;|use CIL::Cilly|' ${WRKSRC}/bin/cilly
    @${REINPLACE_CMD} -e \
        's|^use KeptFile;|use CIL::KeptFile;| ; \
         s|^use OutputFile;|use CIL::OutputFile;| ; \
         s|^use TempFile;|use CIL::TempFile;|' \
            ${WRKSRC}/lib/App/Cilly.pm.in
    @${REINPLACE_CMD} -e \
        's|^use OutputFile;|use CIL::OutputFile;|' \
        ${WRKSRC}/lib/App/Cilly/KeptFile.pm
    @${REINPLACE_CMD} -e \
        's|^use OutputFile;|use CIL::OutputFile;|' \
        ${WRKSRC}/lib/App/Cilly/TempFile.pm
    @${REINPLACE_CMD} '/MACHDEPCC/ s|gcc|${CC}|' ${WRKSRC}/Makefile.in

pre-install:
    @${STRIP_CMD} ${WRKSRC}/bin/cilly.native

do-install:
    (cd ${WRKSRC}/bin && ${INSTALL_SCRIPT} ${BINFILES} \
        ${STAGEDIR}${PREFIX}/bin)
    @${MKDIR} ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/CIL/App/Cilly
    ${INSTALL_DATA} ${WRKSRC}/lib/App/Cilly/CilConfig.pm \
        ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}
    (cd ${WRKSRC}/lib && ${INSTALL_DATA} ${LIBFILES} \
        ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/CIL/App/Cilly)
    (cd ${WRKSRC}/lib && ${INSTALL_DATA} ${LIBAFILES} \
        ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/CIL/App)
    (cd ${WRKSRC}/lib && ${INSTALL_DATA} ${LIBBINS} \
        ${STAGEDIR}${PREFIX}/${SITE_PERL_REL}/CIL)
# Remove orphan dir created by bsd.ocaml.mk
    -@${RMDIR} -p ${STAGEDIR}${OCAMLFIND_DESTDIR}

do-install-DOCS-on:
    @${MKDIR} ${STAGEDIR}${DOCSDIR}
    @${RM} -rf ${WRKSRC}/doc/cilcode.tmp
    (cd ${WRKSRC}/doc && ${COPYTREE_SHARE} . ${STAGEDIR}${DOCSDIR})

.include <bsd.port.mk>