Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 1 Dec 2019 10:53:41 +0000 (UTC)
From:      Tobias Kortkamp <tobik@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r518765 - in head/security/afl++: . files
Message-ID:  <201912011053.xB1ArfjT073784@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: tobik
Date: Sun Dec  1 10:53:40 2019
New Revision: 518765
URL: https://svnweb.freebsd.org/changeset/ports/518765

Log:
  security/afl++: Simplify
  
  - Hook up GCC plugin build in files/Makefile.extra
  - Simplify install and strip
  - Hook up extended tests

Modified:
  head/security/afl++/Makefile
  head/security/afl++/files/Makefile.extra

Modified: head/security/afl++/Makefile
==============================================================================
--- head/security/afl++/Makefile	Sun Dec  1 09:40:32 2019	(r518764)
+++ head/security/afl++/Makefile	Sun Dec  1 10:53:40 2019	(r518765)
@@ -22,7 +22,9 @@ USE_GITHUB=	yes
 GH_ACCOUNT=	vanhauser-thc
 GH_PROJECT=	AFLplusplus
 
+MAKE_ARGS=	STRIP_CMD="${STRIP_CMD}"
 ALL_TARGET=	all libdislocator
+INSTALL_TARGET=	install-strip
 TEST_TARGET=	test_build
 
 CONFLICTS_INSTALL=	afl
@@ -38,6 +40,10 @@ LLVM_DESC=	LLVM-based instrumentation
 
 GCC_BUILD_DEPENDS=	gcc${GCC_DEFAULT}:lang/gcc${GCC_DEFAULT}
 GCC_RUN_DEPENDS=	gcc${GCC_DEFAULT}:lang/gcc${GCC_DEFAULT}
+GCC_MAKE_ARGS=		GCC=gcc${GCC_DEFAULT} \
+			GXX=g++${GCC_DEFAULT}
+GCC_ALL_TARGET=		gcc_plugin
+GCC_TEST_TARGET=	test_gcc_plugin
 
 LLVM_BUILD_DEPENDS=	clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
 LLVM_RUN_DEPENDS=	clang${LLVM_DEFAULT}:devel/llvm${LLVM_DEFAULT}
@@ -68,12 +74,15 @@ post-patch:
 # jails works by default.  afl needs shmget() which usually isn't
 # available in jails.
 	@${REINPLACE_CMD} 's@^\(all.*\) test_build@\1@' \
-		${WRKSRC}/Makefile ${WRKSRC}/llvm_mode/Makefile
+		${WRKSRC}/Makefile \
+		${WRKSRC}/gcc_plugin/Makefile \
+		${WRKSRC}/llvm_mode/Makefile
 .if ${ARCH} == "i386"
 	@${REINPLACE_CMD} 's@\(  as_params\[0\] = afl_as ? afl_as : \)\(.*\)@\1(u8*)"${LOCALBASE}/bin/as";@' \
 		${WRKSRC}/src/afl-as.c
 .endif
-	@${CAT} ${FILESDIR}/Makefile.extra >> ${WRKSRC}/Makefile
+	@${REINPLACE_CMD} '/export AFL_CC/d' ${WRKSRC}/test/test.sh
+	@${ECHO_CMD} "include ${FILESDIR}/Makefile.extra" >> ${WRKSRC}/Makefile
 
 post-patch-GCC-on:
 	@${REINPLACE_CMD} \
@@ -87,47 +96,22 @@ post-patch-LLVM-on:
 		-e 's|"clang\+\+"|"clang\+\+${LLVM_DEFAULT}"|g' \
 		${WRKSRC}/llvm_mode/afl-clang-fast.c
 
-post-build-GCC-on:
-	@${DO_MAKE_BUILD} -C ${WRKSRC}/gcc_plugin CC=gcc${GCC_DEFAULT} \
-		CXX=g++${GCC_DEFAULT}
-
 post-install:
-.for script in afl-cmin afl-plot afl-whatsup
-	${INSTALL_SCRIPT} ${WRKSRC}/${script} ${STAGEDIR}${PREFIX}/bin
-.endfor
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/afl-as
-.for prog in afl-analyze afl-fuzz afl-gcc afl-gotcpu afl-showmap afl-tmin
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${prog}
-.endfor
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/*.so
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}/libdislocator
 	${INSTALL_MAN} ${WRKSRC}/libdislocator/README.md \
 		${STAGEDIR}${DOCSDIR}/libdislocator
 
 post-install-GCC-on:
-	${INSTALL_PROGRAM} ${WRKSRC}/afl-g++-fast \
-		${WRKSRC}/afl-gcc-fast \
-		${STAGEDIR}${PREFIX}/bin
-	${INSTALL_MAN} ${WRKSRC}/afl-g++-fast.8 \
-		${WRKSRC}/afl-gcc-fast.8 \
-		${STAGEDIR}${PREFIX}/man/man8
-	${INSTALL_LIB} ${WRKSRC}/afl-gcc-pass.so \
-		${STAGEDIR}${PREFIX}/lib/afl
-	${INSTALL_DATA} ${WRKSRC}/afl-gcc-rt.o \
-		${STAGEDIR}${PREFIX}/lib/afl
 	@${MKDIR} ${STAGEDIR}${DOCSDIR}/gcc_plugin
 	${INSTALL_MAN} ${WRKSRC}/gcc_plugin/README.* \
 		${STAGEDIR}${DOCSDIR}/gcc_plugin
 
 post-install-LLVM-on:
-	@${STRIP_CMD} ${STAGEDIR}${PREFIX}/lib/afl/*.so \
-		${STAGEDIR}${PREFIX}/bin/afl-clang-fast
 	${MKDIR} ${STAGEDIR}${DOCSDIR}/llvm_mode
 	${INSTALL_MAN} ${WRKSRC}/llvm_mode/README.* \
 		${STAGEDIR}${DOCSDIR}/llvm_mode
 
-post-test-GCC-on:
-	@${DO_MAKE_BUILD} -C ${WRKSRC}/gcc_plugin CC=gcc${GCC_DEFAULT} \
-		CXX=g++${GCC_DEFAULT} test_build
+post-test:
+	@cd ${WRKSRC}/test && ./test.sh
 
 .include <bsd.port.mk>

Modified: head/security/afl++/files/Makefile.extra
==============================================================================
--- head/security/afl++/files/Makefile.extra	Sun Dec  1 09:40:32 2019	(r518764)
+++ head/security/afl++/files/Makefile.extra	Sun Dec  1 10:53:40 2019	(r518765)
@@ -1,5 +1,11 @@
-.PHONY: libdislocator llvm_mode test_llvm_mode
+.PHONY: gcc_plugin install-strip libdislocator llvm_mode test_gcc_plugin test_llvm_mode
 
+install-strip: install
+	@cd ${DESTDIR}${BIN_PATH} && ${STRIP_CMD} ${PROGS}
+	@-${STRIP_CMD} ${DESTDIR}${BIN_PATH}/afl-clang-fast
+	@-${STRIP_CMD} ${DESTDIR}${BIN_PATH}/afl-gcc-fast
+	@cd ${DESTDIR}${HELPER_PATH} && ${STRIP_CMD} afl-as *.so
+
 libdislocator:
 	$(MAKE) -C libdislocator CFLAGS="-I../include ${CFLAGS}"
 	
@@ -8,3 +14,9 @@ llvm_mode:
 
 test_llvm_mode:
 	$(MAKE) -C llvm_mode test_build
+
+gcc_plugin:
+	$(MAKE) -C gcc_plugin CC="${GCC}" CXX="${GXX}"
+
+test_gcc_plugin:
+	$(MAKE) -C gcc_plugin CC="${GCC}" CXX="${GXX}" test_build



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201912011053.xB1ArfjT073784>