Author: ngie
Date: Mon Feb  2 08:04:38 2015
New Revision: 278062
URL: https://svnweb.freebsd.org/changeset/base/278062

Log:
  MFC r228099,r245171,r277939:
  
  r228099:
  
    - Create links to the xz and lzma versions even if BSD grep is not the
      default. Nor GNU nor liblzma in base provides such functionality so
      it may be useful.
  
  r245171:
  
    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
  
  r277939:
  
    Create MANLINKS for lzgrep, etc when MK_LZMA_SUPPORT != no
  
    Sponsored by: EMC / Isilon Storage Division

Added:
  stable/9/tools/build/options/WITHOUT_LZMA_SUPPORT
     - copied unchanged from r245171, 
head/tools/build/options/WITHOUT_LZMA_SUPPORT
Modified:
  stable/9/tools/build/make_check/Makefile
  stable/9/usr.bin/grep/Makefile
  stable/9/usr.bin/grep/file.c
Directory Properties:
  stable/9/   (props changed)
  stable/9/tools/   (props changed)
  stable/9/tools/build/   (props changed)
  stable/9/tools/build/options/   (props changed)
  stable/9/usr.bin/   (props changed)
  stable/9/usr.bin/grep/   (props changed)

Modified: stable/9/tools/build/make_check/Makefile
==============================================================================
--- stable/9/tools/build/make_check/Makefile    Mon Feb  2 08:01:10 2015        
(r278061)
+++ stable/9/tools/build/make_check/Makefile    Mon Feb  2 08:04:38 2015        
(r278062)
@@ -24,7 +24,7 @@ SMAKE=        MAKEFLAGS= ${MAKE} -C ${.CURDIR}
 
 all:
        @echo '1..17'
-       @${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: stable/9/tools/build/options/WITHOUT_LZMA_SUPPORT (from r245171, 
head/tools/build/options/WITHOUT_LZMA_SUPPORT)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ stable/9/tools/build/options/WITHOUT_LZMA_SUPPORT   Mon Feb  2 08:04:38 
2015        (r278062, copy of r245171, 
head/tools/build/options/WITHOUT_LZMA_SUPPORT)
@@ -0,0 +1,2 @@
+.\" $FreeBSD$
+Set to build some programs without optional lzma compression support.

Modified: stable/9/usr.bin/grep/Makefile
==============================================================================
--- stable/9/usr.bin/grep/Makefile      Mon Feb  2 08:01:10 2015        
(r278061)
+++ stable/9/usr.bin/grep/Makefile      Mon Feb  2 08:04:38 2015        
(r278062)
@@ -31,15 +31,16 @@ MLINKS= grep.1 egrep.1 \
        grep.1 fgrep.1 \
        grep.1 zgrep.1 \
        grep.1 zegrep.1 \
-       grep.1 zfgrep.1 \
-       grep.1 xzgrep.1 \
-       grep.1 xzegrep.1 \
-       grep.1 xzfgrep.1 \
-       grep.1 lzgrep.1 \
-       grep.1 lzegrep.1 \
-       grep.1 lzfgrep.1
+       grep.1 zfgrep.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 \
@@ -47,10 +48,17 @@ LINKS+=     ${BINDIR}/${PROG} ${BINDIR}/xzgr
        ${BINDIR}/${PROG} ${BINDIR}/lzegrep \
        ${BINDIR}/${PROG} ${BINDIR}/lzfgrep
 
-LDADD= -lz -llzma
-DPADD= ${LIBZ} ${LIBLZMA}
+MLINKS+= grep.1 xzgrep.1 \
+        grep.1 xzegrep.1 \
+        grep.1 xzfgrep.1 \
+        grep.1 lzgrep.1 \
+        grep.1 lzegrep.1 \
+        grep.1 lzfgrep.1
+.else
+CFLAGS+= -DWITHOUT_LZMA
+.endif
 
-.if !defined(WITHOUT_BZIP2)
+.if !defined(WITHOUT_BZIP2_SUPPORT)
 LDADD+=        -lbz2
 DPADD+=        ${LIBBZ2}
 

Modified: stable/9/usr.bin/grep/file.c
==============================================================================
--- stable/9/usr.bin/grep/file.c        Mon Feb  2 08:01:10 2015        
(r278061)
+++ stable/9/usr.bin/grep/file.c        Mon Feb  2 08:04:38 2015        
(r278062)
@@ -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);
 
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to