aboutsummaryrefslogtreecommitdiffstats
path: root/devel/valgrind-snapshot/Makefile
blob: 8f346c859a81b211212ecb424df352f78167d4cd (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
# Ports collection makefile for:    valgrind
# Date created:             April 19 2004
# Whom:                 Simon Barner <barner@gmx.de>
#
# $FreeBSD$
#

PORTNAME=   valgrind
PORTVERSION=    352
PORTREVISION=   3
CATEGORIES= devel
MASTER_SITES=   http://www.rabson.org/
PKGNAMESUFFIX=  -snapshot
DISTNAME=   ${PORTNAME}-current-${PORTVERSION}

MAINTAINER= barner@FreeBSD.org
COMMENT=    A (memory) debugging and profiling tool

CONFLICTS=  valgrind-[0-9]*
LATEST_LINK=    valgrind-snapshot

ONLY_FOR_ARCHS= i386

USE_GMAKE=  yes
USE_GNOME=  pkgconfig
USE_PERL5_BUILD=yes
USE_REINPLACE=  yes
GNU_CONFIGURE=  yes
CONFIGURE_TARGET=--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}

WRKSRC=     ${WRKDIR}/${DISTNAME}

.include <bsd.port.pre.mk>

.if ${OSVERSION} >= 500000 
PLIST_SUB+= RELENG_4="@comment "
PLIST_SUB+= RELENG_5=""
.else
PLIST_SUB+= RELENG_4=""
PLIST_SUB+= RELENG_5="@comment "
.endif

.if ${PERL_LEVEL} < 500601
IGNORE=     "can\'t be built. Your Perl version is too old. Please use lang/perl5.8 port to upgrade your Perl"
.endif

PROCFS!=    /sbin/mount | ${GREP} '^procfs' | ${AWK} '{print $1}'

pre-everything::

.if ${PROCFS}
    @${ECHO_CMD} ""
    @${ECHO_CMD} "Check if procfs is running: YES"
.else
    @${ECHO_CMD} "-----------------------------------------------------------"
    @${ECHO_CMD} ""
    @${ECHO_CMD} "Valgrind needs a running procfs, which is not"
    @${ECHO_CMD} "activated on your system. Please read the procfs\(5\)"
    @${ECHO_CMD} "manpage and add the following line to /etc/fstab:"
    @${ECHO_CMD} ""
    @${ECHO_CMD} "proc /proc procfs rw 0 0"
    @${ECHO_CMD} ""
    @${ECHO_CMD} "-----------------------------------------------------------"
.endif

pre-patch:
.ifdef(NOPORTDOCS)
    ${FIND} ${WRKSRC} -name "Makefile.in" -exec \
        ${REINPLACE_CMD} -e "s/docs//g" {} \;
.endif

post-install:
    @${INSTALL_DATA} ${WRKSRC}/coregrind/vg_unistd.h \
        ${PREFIX}/include/valgrind

# Check if kernel is built with USER_LDT option (FreeBSD 4 only)
.if ${OSVERSION} < 500000
    @${PREFIX}/bin/valgrind --tool=memcheck true 2> ${WRKDIR}/ldt.test
    @${GREP} i386_set_ldt ${WRKDIR}/ldt.test >/dev/null &&\
    ${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! && \
    ${ECHO_CMD} Please rebuild your kernel with ``options USER_LDT''! && \
    ${ECHO_CMD} Otherwise, valgrind will not be able to perform pointer analysis! && \
    ${ECHO_CMD} !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! || true
.endif

# Generate suppression files
    @yes | ${PREFIX}/bin/valgrind --tool=memcheck --gen-suppressions=yes true \
        | ${SED} -e 's,.*{$$,{,'  \
        | ${GREP} -v '^=' \
        > ${WRKDIR}/freebsd-default.supp || \
        ${RM} ${WRKDIR}/freebsd-default.supp

.if exists(${WRKDIR}/freebsd-default.supp)
    @${INSTALL_DATA} ${WRKDIR}/freebsd-default.supp \
        ${PREFIX}/lib/valgrind
PLIST_SUB+= VALGRIND_SUPPFILE=""
    @${ECHO} ""
    @${ECHO} ""
    @${CAT} ${PKGMESSAGE} | ${SED} -e 's,%%PREFIX%%,${PREFIX},g'
    @${ECHO} ""
.else
PLIST_SUB+= VALGRIND_SUPPFILE="@comment "
.endif

.include <bsd.port.post.mk>