Subject: enhancement to bsd.man.mk
To: None <netbsd-bugs@sun-lamp.cs.berkeley.edu>
From: Luke Mewburn <lm@rmit.edu.au>
List: netbsd-bugs
Date: 03/27/1994 23:53:15
A few days ago I sent in some enhancements to makewhatis.{sh,sed}
to add support for gzipped files (and cgd added compressed files
support.)

Marc Boschma (marcb@werj.com.au) provided me with the following
enhancements to <bsd.man.mk> to allow autocompression of manual
pages as they get installed. I cleaned up the stuff a bit, and
made it more generic (rather than just being hardcoded to gzip.)

To kick-in compression using gzip, just define  MAN_COMPRESS
in your environment.

If you want to use an alternative compression scheme,
set MAN_COMPRESS to the command to use, and MAN_COMPRESS_SUFFIX
to the suffix that $MAN_COMPRESS generates.

Note that in its current form, it won't remove old versions of
compressed manuals if you only use the compression for a short
while - you'll have to remove them by hand, or enhance the
dependancies.


So, here's the patch (joint effort between myself & Marc.)

PS: could someone update my email address in the doc/CHANGES
from whatever it is (probably zak@rmit.edu.au or s902113@minyos...
to lm@rmit.edu.au. Thanks.)


--
*** src/share/mk/bsd.man.mk	Thu Feb 10 22:12:21 1994
--- share/mk/bsd.man.mk	Sun Mar 20 17:08:26 1994
***************
*** 18,77 ****
--- 18,109 ----
  
  MINSTALL=	install ${COPY} -o ${MANOWN} -g ${MANGRP} -m ${MANMODE}
  
+ .if defined(MAN_COMPRESS) && empty(MAN_COMPRESS)
+ MAN_COMPRESS=		gzip -v9f
+ MAN_COMPRESS_SUFFIX=	.gz
+ .endif
+ 
  maninstall:
  .if defined(MAN1) && !empty(MAN1)
  MANALL+=${MAN1}
  maninstall: man1install
  man1install:
  	${MINSTALL} ${MAN1} ${DESTDIR}${MANDIR}1${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}1${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN1} )
+ .endif
  .endif
  .if defined(MAN2) && !empty(MAN2)
  MANALL+=${MAN2}
  maninstall: man2install
  man2install:
  	${MINSTALL} ${MAN2} ${DESTDIR}${MANDIR}2${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}2${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN2} )
+ .endif
  .endif
  .if defined(MAN3) && !empty(MAN3)
  MANALL+=${MAN3}
  maninstall: man3install
  man3install:
  	${MINSTALL} ${MAN3} ${DESTDIR}${MANDIR}3${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}3${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN3} )
+ .endif
  .endif
  .if defined(MAN3F) && !empty(MAN3F)
  MANALL+=${MAN3F}
  maninstall: man3finstall
  man3finstall:
  	${MINSTALL} ${MAN3F} ${DESTDIR}${MANDIR}3f${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}3f${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN3F} )
+ .endif
  .endif
  .if defined(MAN4) && !empty(MAN4)
  MANALL+=${MAN4}
  maninstall: man4install
  man4install:
  	${MINSTALL} ${MAN4} ${DESTDIR}${MANDIR}4${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}4${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN4} )
+ .endif
  .endif
  .if defined(MAN5) && !empty(MAN5)
  MANALL+=${MAN5}
  maninstall: man5install
  man5install:
  	${MINSTALL} ${MAN5} ${DESTDIR}${MANDIR}5${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}5${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN5} )
+ .endif
  .endif
  .if defined(MAN6) && !empty(MAN6)
  MANALL+=${MAN6}
  maninstall: man6install
  man6install:
  	${MINSTALL} ${MAN6} ${DESTDIR}${MANDIR}6${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}6${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN6} )
+ .endif
  .endif
  .if defined(MAN7) && !empty(MAN7)
  MANALL+=${MAN7}
  maninstall: man7install
  man7install:
  	${MINSTALL} ${MAN7} ${DESTDIR}${MANDIR}7${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}7${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN7} )
+ .endif
  .endif
  .if defined(MAN8) && !empty(MAN8)
  MANALL+=${MAN8}
  maninstall: man8install
  man8install:
  	${MINSTALL} ${MAN8} ${DESTDIR}${MANDIR}8${MANSUBDIR}
+ .if defined(MAN_COMPRESS)
+ 	(cd ${DESTDIR}${MANDIR}8${MANSUBDIR} ; ${MAN_COMPRESS} ${MAN8} )
+ .endif
  .endif
  .if defined(MLINKS) && !empty(MLINKS)
  maninstall: manlinkinstall
***************
*** 87,94 ****
  		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
  		t=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
  		echo $$t -\> $$l; \
! 		rm -f $$t; \
! 		ln $$l $$t; \
  	done; true
  .endif
  
--- 119,126 ----
  		dir=${DESTDIR}${MANDIR}`expr $$name : '.*\.\(.*\)'`; \
  		t=$${dir}${MANSUBDIR}/`expr $$name : '\(.*\)\..*'`.0; \
  		echo $$t -\> $$l; \
! 		rm -f $$t $$t${MAN_COMPRESS_SUFFIX}; \
! 		ln $$l${MAN_COMPRESS_SUFFIX} $$t${MAN_COMPRESS_SUFFIX}; \
  	done; true
  .endif
  

------------------------------------------------------------------------------