Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jan 2013 18:37:12 +0000 (UTC)
From:      "David E. O'Brien" <obrien@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r245171 - in head: tools/build/make_check tools/build/options usr.bin/grep
Message-ID:  <201301081837.r08IbCwq062414@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: obrien
Date: Tue Jan  8 18:37:12 2013
New Revision: 245171
URL: http://svnweb.freebsd.org/changeset/base/245171

Log:
  Following r226271, allow disabling lzma support with "WITHOUT_LZMA_SUPPORT".
  Correct r226271 which should have used WITHOUT_BZIP2_SUPPORT per r166255.
  
  Obtained from:	Juniper Networks

Added:
  head/tools/build/options/WITHOUT_LZMA_SUPPORT
     - copied, changed from r245170, head/tools/build/options/WITHOUT_BZIP2_SUPPORT
Modified:
  head/tools/build/make_check/Makefile
  head/usr.bin/grep/Makefile
  head/usr.bin/grep/file.c

Modified: head/tools/build/make_check/Makefile
==============================================================================
--- head/tools/build/make_check/Makefile	Tue Jan  8 17:42:03 2013	(r245170)
+++ head/tools/build/make_check/Makefile	Tue Jan  8 18:37:12 2013	(r245171)
@@ -24,7 +24,7 @@ SMAKE=	MAKEFLAGS= ${MAKE} -C ${.CURDIR}
 
 all:
 	@echo '1..16'
-	@${SMAKE} C_check || { cd ${.CURDIR} ; ${MAKE} failure ; }
+	@${SMAKE} C_check || { ${MAKE} -C ${.CURDIR} failure ; }
 	@echo "ok 1 - C_check # Test of -C flag existence detected no regression."
 	@echo 1:${DATA1} 2:${DATA2} 3:${DATA3} 4:${DATA4} 5:${DATA5} | \
 		diff -u ${.CURDIR}/regress.variables.out - || \

Copied and modified: head/tools/build/options/WITHOUT_LZMA_SUPPORT (from r245170, head/tools/build/options/WITHOUT_BZIP2_SUPPORT)
==============================================================================
--- head/tools/build/options/WITHOUT_BZIP2_SUPPORT	Tue Jan  8 17:42:03 2013	(r245170, copy source)
+++ head/tools/build/options/WITHOUT_LZMA_SUPPORT	Tue Jan  8 18:37:12 2013	(r245171)
@@ -1,2 +1,2 @@
 .\" $FreeBSD$
-Set to build some programs without optional bzip2 support.
+Set to build some programs without optional lzma compression support.

Modified: head/usr.bin/grep/Makefile
==============================================================================
--- head/usr.bin/grep/Makefile	Tue Jan  8 17:42:03 2013	(r245170)
+++ head/usr.bin/grep/Makefile	Tue Jan  8 18:37:12 2013	(r245171)
@@ -40,17 +40,24 @@ MLINKS= grep.1 egrep.1 \
 	grep.1 lzfgrep.1
 .endif
 
+LDADD=	-lz
+DPADD=	${LIBZ}
+
+.if !defined(WITHOUT_LZMA_SUPPORT)
+LDADD+=	-llzma
+DPADD+=	${LIBLZMA}
+
 LINKS+=	${BINDIR}/${PROG} ${BINDIR}/xzgrep \
 	${BINDIR}/${PROG} ${BINDIR}/xzegrep \
 	${BINDIR}/${PROG} ${BINDIR}/xzfgrep \
 	${BINDIR}/${PROG} ${BINDIR}/lzgrep \
 	${BINDIR}/${PROG} ${BINDIR}/lzegrep \
 	${BINDIR}/${PROG} ${BINDIR}/lzfgrep
+.else
+CFLAGS+= -DWITHOUT_LZMA
+.endif
 
-LDADD=	-lz -llzma
-DPADD=	${LIBZ} ${LIBLZMA}
-
-.if !defined(WITHOUT_BZIP2)
+.if !defined(WITHOUT_BZIP2_SUPPORT)
 LDADD+=	-lbz2
 DPADD+=	${LIBBZ2}
 

Modified: head/usr.bin/grep/file.c
==============================================================================
--- head/usr.bin/grep/file.c	Tue Jan  8 17:42:03 2013	(r245170)
+++ head/usr.bin/grep/file.c	Tue Jan  8 18:37:12 2013	(r245171)
@@ -41,7 +41,6 @@ __FBSDID("$FreeBSD$");
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <lzma.h>
 #include <stddef.h>
 #include <stdlib.h>
 #include <string.h>
@@ -50,6 +49,10 @@ __FBSDID("$FreeBSD$");
 #include <wctype.h>
 #include <zlib.h>
 
+#ifndef WITHOUT_LZMA
+#include <lzma.h>
+#endif
+
 #ifndef WITHOUT_BZIP2
 #include <bzlib.h>
 #endif
@@ -60,7 +63,9 @@ __FBSDID("$FreeBSD$");
 #define	LNBUFBUMP	80
 
 static gzFile gzbufdesc;
+#ifndef WITHOUT_LZMA
 static lzma_stream lstrm = LZMA_STREAM_INIT;
+#endif
 #ifndef WITHOUT_BZIP2
 static BZFILE* bzbufdesc;
 #endif
@@ -116,6 +121,7 @@ grep_refill(struct file *f)
 			nr = -1;
 		}
 #endif
+#ifndef WITHOUT_LZMA
 	} else if ((filebehave == FILE_XZ) || (filebehave == FILE_LZMA)) {
 		lzma_action action = LZMA_RUN;
 		uint8_t in_buf[MAXBUFSIZ];
@@ -146,6 +152,7 @@ grep_refill(struct file *f)
 			return (-1);
 		bufrem = MAXBUFSIZ - lstrm.avail_out;
 		return (0);
+#endif	/* WIHTOUT_LZMA */
 	} else
 		nr = read(f->fd, buffer, MAXBUFSIZ);
 



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