第11章. Info文件

新版本的texinfo包含了一个叫install-info的工具.如果你的port安装了任何info文件,请阅读这一章,虽然很长,但内容很重要,如果你能按照来做,工作会是相当漂亮的.

首先要知道:

    % install-info --help
    install-info [OPTION]... [INFO-FILE [DIR-FILE]]
      Install INFO-FILE in the Info directory file DIR-FILE.
    
    Options:
    --delete          Delete existing entries in INFO-FILE;
                        don't insert any new entries.
     :
    --entry=TEXT      Insert TEXT as an Info directory entry.
     :
    --section=SEC     Put this file's entries in section SEC of the directory. :

注意: 这个程序并不实际安装info文件.只是插入或删除目录文件的实体.

这里有7个步骤使你的port使用install-info.使用editors/emacs 为例.

  1. 察看texinfo的源文件,在没有@dircategory和@direntry的文件添加,补丁如下.
        --- ./man/vip.texi.org  Fri Jun 16 15:31:11 1995
        +++ ./man/vip.texi      Tue May 20 01:28:33 1997
        @@ -2,6 +2,10 @@
        
         @setfilename ../info/vip
         @settitle VIP
        +@dircategory The Emacs editor and associated tools
        +@direntry
        +* VIP: (vip).          A VI-emulation for Emacs.
        +@end direntry
        
         @iftex
         @finalout
         :
    

    注意: 每个文件只能包含一个info实体,因为install-info --delete有个bug.如果你在@direntry定义了多个实体,只能删除第一个.

  2. 会到port目录,make clean;make.确定所有的info文件从原码中重新编译.因为texinfo源文件比info文件新,所以当你输入make时,会重新编译.但很多makefile文件没有包含一个正确的info依赖,所以你需要修改主Makefile.in文件,使他可以进入man子目录重新编译info文件.
        --- ./Makefile.in.org   Mon Aug 19 21:12:19 1996
        +++ ./Makefile.in       Tue Apr 15 00:15:28 1997
        @@ -184,7 +184,7 @@
         # Subdirectories to make recursively.  `lisp' is not included
         # because the compiled lisp files are part of the distribution
         # and you cannot remake them without installing Emacs first.
        -SUBDIR = lib-src src
        +SUBDIR = lib-src src man
        
         # The makefiles of the directories in $SUBDIR.
         SUBDIR_MAKEFILES = lib-src/Makefile man/Makefile src/Makefile oldXMenu/Makefile
         lwlib/Makefile
        --- ./man/Makefile.in.org       Thu Jun 27 15:27:19 1996
        +++ ./man/Makefile.in   Tue Apr 15 00:29:52 1997
        @@ -66,6 +66,7 @@
         ${srcdir}/gnu1.texi \
         ${srcdir}/glossary.texi
        
        +all: info
         info: $(INFO_TARGETS)
        
         dvi: $(DVI_TARGETS)
    

    因为man子目录中的目标是info.而主Makefile调用的是all,所以第二段是必要的.

  3. 如果在Makefile.in中存在一个安装dir文件的地方,请删除他.你的port不需要这么做.同样删除于此有关的信息.
        --- ./Makefile.in.org   Mon Aug 19 21:12:19 1996
        +++ ./Makefile.in       Mon Apr 14 23:38:07 1997
        @@ -368,14 +368,8 @@
                if [ `(cd ${srcdir}/info && /bin/pwd)` != `(cd ${infodir} && /bin/pwd)` ]; \
                then \
                  (cd ${infodir};  \
        -          if [ -f dir ]; then \
        -            if [ ! -f dir.old ]; then mv -f dir dir.old; \
        -            else mv -f dir dir.bak; fi; \
        -          fi; \
                   cd ${srcdir}/info ; \
        -          (cd $${thisdir}; ${INSTALL_DATA} ${srcdir}/info/dir ${infodir}/dir);
        \
        -          (cd $${thisdir}; chmod a+r ${infodir}/dir); \
                   for f in ccmode* cl* dired-x* ediff* emacs* forms* gnus* info* message* mh-e* sc* vip*; do \
                     (cd $${thisdir}; \
                      ${INSTALL_DATA} ${srcdir}/info/$$f ${infodir}/$$f; \
                      chmod a+r ${infodir}/$$f); \
    
  4. (这一步仅仅在你修改一个存在的port时需要)察看以下pkg-plist文件,删除任何要patch up info/dir的信息.可能在pkg-install文件和其他文件中也存在,你需要搜索以下.
        Index: pkg-plist
        ===================================================================
        RCS file: /usr/cvs/ports/editors/emacs/pkg-plist,v
        retrieving revision 1.15
        diff -u -r1.15 pkg-plist
        --- pkg-plist       1997/03/04 08:04:00     1.15
        +++ pkg-plist       1997/04/15 06:32:12
        @@ -15,9 +15,6 @@
         man/man1/emacs.1.gz
         man/man1/etags.1.gz
         man/man1/ctags.1.gz
        -@unexec cp %D/info/dir %D/info/dir.bak
        -info/dir
        -@unexec cp %D/info/dir.bak %D/info/dir
         info/cl
         info/cl-1
         info/cl-2
    
  5. 在Makefile中添加一个post-install行为调用install-info和要安装的info文件.你没有不要创建目录文件.install-info会自动创建.
        Index: Makefile
        ===================================================================
        RCS file: /usr/cvs/ports/editors/emacs/Makefile,v
        retrieving revision 1.26
        diff -u -r1.26 Makefile
        --- Makefile    1996/11/19 13:14:40     1.26
        +++ Makefile    1997/05/20 10:25:09     1.28
        @@ -20,5 +20,8 @@
         post-install:
         .for file in emacs-19.34 emacsclient etags ctags b2m
                strip ${PREFIX}/bin/${file}
         .endfor
        +.for info in emacs vip viper forms gnus mh-e cl sc dired-x ediff ccmode
        +       install-info ${PREFIX}/info/${info} ${PREFIX}/info/dir
        +.endfor
        
         .include <bsd.port.mk>
    
  6. 修改pkg-plist文件,适当的加入@exec和@unexec.
        Index: pkg-plist
        ===================================================================
        RCS file: /usr/cvs/ports/editors/emacs/pkg-plist,v
        retrieving revision 1.15
        diff -u -r1.15 pkg-plist
        --- pkg-plist       1997/03/04 08:04:00     1.15
        +++ pkg-plist       1997/05/20 10:25:12     1.17
        @@ -16,7 +14,14 @@
         man/man1/etags.1.gz
         man/man1/ctags.1.gz
        +@unexec install-info --delete %D/info/emacs %D/info/dir
         :
        +@unexec install-info --delete %D/info/ccmode %D/info/dir
         info/cl
         info/cl-1
        @@ -87,6 +94,18 @@
         info/viper-3
         info/viper-4
        +@exec install-info %D/info/emacs %D/info/dir
         :
        +@exec install-info %D/info/ccmode %D/info/dir
         libexec/emacs/19.34/i386--freebsd/cvtmail
         libexec/emacs/19.34/i386--freebsd/digest-doc
    

    注意: @unexec install-info --delete应该在info文件之前出现.@exec install-info命令应该在info文件之后,这个@exec会创建需要的目录.

  7. 测试 注意每一步是否达到目的.