View | Details | Raw Unified | Return to bug 207236 | Differences between
and this patch

Collapse All | Expand All

(-)Makefile (-23 / +41 lines)
Lines 2-8 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	afl
4
PORTNAME=	afl
5
PORTVERSION=	1.96b
5
PORTVERSION=	2.00b
6
CATEGORIES=	security
6
CATEGORIES=	security
7
MASTER_SITES=	http://lcamtuf.coredump.cx/afl/releases/
7
MASTER_SITES=	http://lcamtuf.coredump.cx/afl/releases/
8
8
Lines 12-59 Link Here
12
LICENSE=	APACHE20
12
LICENSE=	APACHE20
13
LICENSE_FILE=	${WRKSRC}/docs/COPYING
13
LICENSE_FILE=	${WRKSRC}/docs/COPYING
14
14
15
USES=		compiler gmake tar:tgz
15
USES=	compiler gmake tar:tgz
16
16
17
OPTIONS_DEFINE=		DEBUG DOCS MINIMIZE_CORPUS PLOT_SUPPORT TEST_INSTRUMENTATION
17
OPTIONS_DEFINE=		DEBUG DOCS MINIMIZE_CORPUS LLVM TEST_INSTRUMENTATION
18
MINIMIZE_CORPUS_DESC=	Install afl-cmin. Adds bash dependency
18
MINIMIZE_CORPUS_DESC=	Install afl-cmin. Adds bash dependency
19
PLOT_SUPPORT_DESC=	Support progress plotting. Adds Gnuplot dependency
20
TEST_INSTRUMENTATION_DESC=	Execute tests (expected to fail in jails)
19
TEST_INSTRUMENTATION_DESC=	Execute tests (expected to fail in jails)
21
OPTIONS_DEFAULT=		DOCS MINIMIZE_CORPUS PLOT_SUPPORT
20
LLVM_DESC=	LLVM-based instrumentation (broken on 9.x)
21
OPTIONS_DEFAULT=	DOCS LLVM MINIMIZE_CORPUS
22
22
23
OPTIONS_SUB=	yes
23
OPTIONS_SUB=	yes
24
24
25
PORTSCOUT=	ignore:1
25
ONLY_FOR_ARCHS=	amd64 i386
26
27
ONLY_FOR_ARCHS=		amd64 i386
28
ONLY_FOR_ARCHS_REASON=	Uses binary instrumentation
26
ONLY_FOR_ARCHS_REASON=	Uses binary instrumentation
29
27
30
.include <bsd.port.pre.mk>
28
LLVM_BUILD_DEPENDS=	clang37:${PORTSDIR}/devel/llvm37
29
LLVM_RUN_DEPENDS=	clang37:${PORTSDIR}/devel/llvm37
30
MINIMIZE_CORPUS_RUN_DEPENDS=	${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash
31
31
32
.if (${COMPILER_TYPE} == "clang" && ${ARCH} == "i386")
32
.include <bsd.port.options.mk>
33
34
.if ${OSVERSION} < 1000013
35
# Broken on FreeBSD 9
36
PLIST_SUB+=	LLVM_SUB="@comment "
37
.else
38
PLIST_SUB+=	LLVM_SUB=""
39
.endif
40
41
.if ${ARCH} == "i386"
33
# Clang i386 emits .cfi_sections which base as(1) doesn't understand
42
# Clang i386 emits .cfi_sections which base as(1) doesn't understand
34
BUILD_DEPENDS +=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
43
BUILD_DEPENDS+=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
35
RUN_DEPENDS +=		${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
44
RUN_DEPENDS+=	${LOCALBASE}/bin/as:${PORTSDIR}/devel/binutils
36
.endif
45
.endif
37
46
38
MINIMIZE_CORPUS_RUN_DEPENDS=	${LOCALBASE}/bin/bash:${PORTSDIR}/shells/bash
47
MAKE_ARGS=	INSTALL_PROGRAM="${INSTALL_PROGRAM}" \
39
PLOT_SUPORT_RUN_DEPENDS=	gnuplot:${PORTSDIR}/math/gnuplot
48
		INSTALL_SCRIPT="${INSTALL_SCRIPT}"
40
49
41
post-patch:
50
post-patch-TEST_INSTRUMENTATION-off:
42
.if ! ${PORT_OPTIONS:MTEST_INSTRUMENTATION}
43
# afl needs shmget() which usually isn't available in jails. Disabling
51
# afl needs shmget() which usually isn't available in jails. Disabling
44
# the instrumentation tests makes sure building packages in jails works
52
# the instrumentation tests makes sure building packages in jails works
45
# by default anyway.
53
# by default anyway.
46
	${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/Makefile
54
	${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/Makefile
47
.endif
55
	${REINPLACE_CMD} -e 's@^\(all.*\) test_build@\1@' ${WRKSRC}/llvm_mode/Makefile
48
	${REINPLACE_CMD} -E -e 's@ -O3@@; s@ -g@@' \
56
49
		-e 's@install -m 755@${INSTALL_PROGRAM}@' \
57
post-patch:
50
		-e 's@ afl-(cmin|plot|whatsup) @ @g' \
58
.if ${ARCH} == "i386"
51
		${WRKSRC}/Makefile
52
.if (${COMPILER_TYPE} == "clang" && ${ARCH} == "i386")
53
	${REINPLACE_CMD} -e 's@\(  as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \
59
	${REINPLACE_CMD} -e 's@\(  as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \
54
		${WRKSRC}/afl-as.c
60
		${WRKSRC}/afl-as.c
55
.endif
61
.endif
56
62
63
.if ! ${OSVERSION} < 1000013
64
# Broken on FreeBSD 9
65
post-build-LLVM-on:
66
	@(cd ${WRKSRC}/llvm_mode; ${SETENV} \
67
		CC=clang37 \
68
		CXX=clang++37 \
69
		LLVM_CONFIG=llvm-config37 \
70
		CFLAGS="${CFLAGS}" \
71
		CXXFLAGS="${CXXFLAGS}" \
72
		${GMAKE})
73
.endif
74
57
post-install:
75
post-install:
58
	${INSTALL_DATA} ${WRKSRC}/docs/COPYING ${STAGEDIR}${DOCSDIR}/
76
	${INSTALL_DATA} ${WRKSRC}/docs/COPYING ${STAGEDIR}${DOCSDIR}/
59
77
Lines 64-67 Link Here
64
post-install-MINIMIZE_CORPUS-on:
82
post-install-MINIMIZE_CORPUS-on:
65
	${INSTALL_SCRIPT} ${WRKSRC}/afl-cmin ${STAGEDIR}${PREFIX}/bin/
83
	${INSTALL_SCRIPT} ${WRKSRC}/afl-cmin ${STAGEDIR}${PREFIX}/bin/
66
84
67
.include <bsd.port.post.mk>
85
.include <bsd.port.mk>
(-)distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (afl-1.96b.tgz) = 03beb06f8993dcb37d348e53da19ca9d064c83fcedc9d87b0b506c73c310f27c
1
SHA256 (afl-2.00b.tgz) = 3302cd8220a36e84898355dacdcacdfd9ac48c3466125ef11032e1f3a8eed277
2
SIZE (afl-1.96b.tgz) = 804864
2
SIZE (afl-2.00b.tgz) = 809523
(-)files/patch-Makefile (+28 lines)
Line 0 Link Here
1
--- Makefile.orig	2016-02-12 06:06:14 UTC
2
+++ Makefile
3
@@ -21,6 +21,8 @@ BIN_PATH    = $(PREFIX)/bin
4
 HELPER_PATH = $(PREFIX)/lib/afl
5
 DOC_PATH    = $(PREFIX)/share/doc/afl
6
 MISC_PATH   = $(PREFIX)/share/afl
7
+INSTALL_PROGRAM?=	install -s -m755
8
+INSTALL_SCRIPT?=	isntall -m755
9
 
10
 PROGS       = afl-gcc afl-as afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze
11
 SH_PROGS    = afl-plot afl-cmin afl-whatsup
12
@@ -115,11 +117,12 @@ clean:
13
 install: all
14
 	mkdir -p -m 755 $${DESTDIR}$(BIN_PATH) $${DESTDIR}$(HELPER_PATH) $${DESTDIR}$(DOC_PATH) $${DESTDIR}$(MISC_PATH)
15
 	rm -f $${DESTDIR}$(BIN_PATH)/afl-plot.sh
16
-	install -m 755 $(PROGS) $(SH_PROGS) $${DESTDIR}$(BIN_PATH)
17
-	if [ -f afl-qemu-trace ]; then install -m 755 afl-qemu-trace $${DESTDIR}$(BIN_PATH); fi
18
-	if [ -f afl-clang-fast -a -f afl-llvm-pass.so -a -f afl-llvm-rt.o ]; then set -e; install -m 755 afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; install -m 755 afl-llvm-pass.so afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
19
+	${INSTALL_PROGRAM} $(PROGS) $${DESTDIR}$(BIN_PATH)
20
+	${INSTALL_SCRIPT} $(SH_PROGS) $${DESTDIR}$(BIN_PATH)
21
+	if [ -f afl-qemu-trace ]; then ${INSTALL_PROGRAM} afl-qemu-trace $${DESTDIR}$(BIN_PATH); fi
22
+	if [ -f afl-clang-fast -a -f afl-llvm-pass.so -a -f afl-llvm-rt.o ]; then set -e; ${INSTALL_PROGRAM} afl-clang-fast $${DESTDIR}$(BIN_PATH); ln -sf afl-clang-fast $${DESTDIR}$(BIN_PATH)/afl-clang-fast++; ${INSTALL_PROGRAM} afl-llvm-pass.so $${DESTDIR}$(HELPER_PATH); install -m 755 afl-llvm-rt.o $${DESTDIR}$(HELPER_PATH); fi
23
 	set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $${DESTDIR}$(BIN_PATH)/$$i; done
24
-	install -m 755 afl-as $${DESTDIR}$(HELPER_PATH)
25
+	${INSTALL_PROGRAM} afl-as $${DESTDIR}$(HELPER_PATH)
26
 	ln -sf afl-as $${DESTDIR}$(HELPER_PATH)/as
27
 	install -m 644 docs/README docs/ChangeLog docs/*.txt $${DESTDIR}$(DOC_PATH)
28
 	cp -r testcases/ $${DESTDIR}$(MISC_PATH)
(-)files/patch-llvm__mode_afl-clang-fast.c (+15 lines)
Line 0 Link Here
1
--- llvm_mode/afl-clang-fast.c.orig	2015-09-08 22:37:25 UTC
2
+++ llvm_mode/afl-clang-fast.c
3
@@ -106,10 +106,10 @@ static void edit_params(u32 argc, char**
4
 
5
   if (!strcmp(name, "afl-clang-fast++")) {
6
     u8* alt_cxx = getenv("AFL_CXX");
7
-    cc_params[0] = alt_cxx ? alt_cxx : (u8*)"clang++";
8
+    cc_params[0] = alt_cxx ? alt_cxx : (u8*)"clang++37";
9
   } else {
10
     u8* alt_cc = getenv("AFL_CC");
11
-    cc_params[0] = alt_cc ? alt_cc : (u8*)"clang";
12
+    cc_params[0] = alt_cc ? alt_cc : (u8*)"clang37";
13
   }
14
 
15
   cc_params[cc_par_cnt++] = "-Xclang";
(-)pkg-message (+1 lines)
Line 0 Link Here
1
If you want to use afl-plot also install math/gnuplot.
(-)pkg-plist (-1 / +7 lines)
Lines 1-11 Link Here
1
bin/afl-analyze
2
bin/afl-as
1
bin/afl-clang
3
bin/afl-clang
2
bin/afl-clang++
4
bin/afl-clang++
5
%%LLVM_SUB%%%%LLVM%%bin/afl-clang-fast
6
%%LLVM_SUB%%%%LLVM%%bin/afl-clang-fast++
7
%%LLVM_SUB%%%%LLVM%%lib/afl/afl-llvm-pass.so
8
%%LLVM_SUB%%%%LLVM%%lib/afl/afl-llvm-rt.o
3
%%MINIMIZE_CORPUS%%bin/afl-cmin
9
%%MINIMIZE_CORPUS%%bin/afl-cmin
4
bin/afl-fuzz
10
bin/afl-fuzz
5
bin/afl-g++
11
bin/afl-g++
6
bin/afl-gcc
12
bin/afl-gcc
7
bin/afl-gotcpu
13
bin/afl-gotcpu
8
%%PLOT_SUPPORT%%bin/afl-plot
14
bin/afl-plot
9
bin/afl-showmap
15
bin/afl-showmap
10
bin/afl-tmin
16
bin/afl-tmin
11
bin/afl-whatsup
17
bin/afl-whatsup

Return to bug 207236