all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
blob e5f4972902fc9686957080e65506c2acc7e14ab1 3170 bytes (raw)
name: build-aux/make-info-dir 	 # note: path name is non-authoritative(*)

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
 
#!/bin/sh

### make-info-dir - create info/dir, for systems without install-info

## Copyright (C) 2013-2024 Free Software Foundation, Inc.

## Author: Glenn Morris <rgm@gnu.org>
## Maintainer: emacs-devel@gnu.org

## This file is part of GNU Emacs.

## GNU Emacs is free software: you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
## the Free Software Foundation, either version 3 of the License, or
## (at your option) any later version.

## GNU Emacs is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.

## You should have received a copy of the GNU General Public License
## along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.

### Commentary:

## Generate info/dir, for systems without install-info.
## Expects to be called from top-level Emacs source directory.

## It only handles the case where info/dir is missing from the
## installation directory.  It does not handle info/dir being present
## but missing some entries.

## Header contains non-printing characters, so this is more
## reliable than using awk.
cat <"${1?}" || exit
shift

exec "${AWK-awk}" '
  function detexinfo() {
    gsub(/@value{emacsname}/, "Emacs")
    gsub(/@[^{]*\{/, "")
    gsub(/}/, "")
  }
  BEGIN {
    ntopics = 0
    topic[ntopics++] = "Texinfo documentation system"
    topic[ntopics++] = "Emacs"
    topic[ntopics++] = "Emacs lisp"
    topic[ntopics++] = "Emacs editing modes"
    topic[ntopics++] = "Emacs network features"
    topic[ntopics++] = "Emacs misc features"
    topic[ntopics++] = "Emacs lisp libraries"
    topic[ntopics] = "Unknown category"
    texinfo = 0
  }

  /^@dircategory / {
    texinfo = 1
    sub(/^@dircategory /, "")
    detexinfo()
    for (dircat = 0; dircat < ntopics && topic[dircat] != $0; dircat++)
      continue;
  }
  /^@direntry/, /^@end direntry/ {
    # FIXME do not ignore w32 if OS is w32.
    if ($0 !~ /^@/ && $0 !~ /w32/) {
      detexinfo()
      data[dircat] = data[dircat] $0 "\n"
    }
  }

  ## Org stuff. TODO we assume the order of the texinfo items.
  {
    ## TODO Check FILENAME suffix instead?
    ## TODO Is this portable awk?
    if (FNR == 1) texinfo = 0

    ## If applied to the generated org.texi file, this picks up the examples.
    ## Thanks for making life more difficult...
    if (texinfo) next

    if (tolower($0) ~ /^#\+texinfo_dir_category/) {
      sub(/^#[^:]*: /, "")
      for (dircat = 0; dircat < ntopics && topic[dircat] != $0; dircat++)
        continue;
    }
    if (tolower($0) ~ /^#\+texinfo_dir_title/) {
      sub(/^#[^:]*: /, "")
      ## Note this does not fill any long descriptions.
      data[dircat] = data[dircat] sprintf("* %-30s", ($0 ". "))
    }
    if (tolower($0) ~ /^#\+texinfo_dir_desc/) {
      sub(/^#[^:]*: /, "")
      data[dircat] = data[dircat] $0 ".\n"
    }
  }

  END {
    for (dircat = 0; dircat <= ntopics; dircat++)
      if (data[dircat])
        printf "\n%s\n%s", topic[dircat], data[dircat]
  }
' "${@?}"

debug log:

solving e5f4972902f ...
found e5f4972902f in https://git.savannah.gnu.org/cgit/emacs.git

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.