7e0a2eab0cd614107058ef7c63031d6824009054
[chise/xemacs-chise.git.1] / lib-src / update-custom.sh
1 #!/bin/sh
2 ### update-custom.sh --- update Customize group dependencies
3
4 # Author: Hrvoje Niksic, based on update-autoloads.el by
5 #   Jamie Zawinski, Ben Wing, Martin Buchholz, and Steve Baur
6 # Maintainer: Hrvoje Niksic
7 # Keywords: internal
8
9 # This file is part of XEmacs.
10
11 # XEmacs is free software; you can redistribute it and/or modify it
12 # under the terms of the GNU General Public License as published by
13 # the Free Software Foundation; either version 2, or (at your option)
14 # any later version.
15
16 # XEmacs is distributed in the hope that it will be useful, but
17 # WITHOUT ANY WARRANTY; without even the implied warranty of
18 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
19 # General Public License for more details.
20
21 # You should have received a copy of the GNU General Public License
22 # along with XEmacs; see the file COPYING.  If not, write to
23 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
24 # Boston, MA 02111-1307, USA.
25
26 ### Commentary:
27
28 # This is much simpler than update-autoloads.el.  All we need to do is
29 # compute a list of directories we want to use, and feed it to
30 # Custom-make-dependencies.  End of story.
31
32 ### Code:
33
34 set -eu
35
36 # get to the right directory
37 test ! -d ./lisp -a -d ../lisp && cd ..
38 if test ! -d ./lisp ; then
39         echo $0: neither ./lisp/ nor ../lisp/ exist
40         exit 1
41 fi
42
43 test -z "$EMACS" && EMACS="./src/xemacs"
44 echo " (using $EMACS)"
45
46 export EMACS
47
48 REAL=`cd \`dirname $EMACS\` ; pwd | sed 's|^/tmp_mnt||'`/`basename $EMACS`
49
50 echo "Rebuilding custom-loads with $REAL..."
51
52 if [ "`uname -r | sed 's/\(.\).*/\1/'`" -gt 4 ]; then
53   echon()
54   {    
55     /bin/echo $* '\c'
56   }
57 else
58   echon()
59   {
60     echo -n $*
61   }
62 fi
63
64 # Compute patterns to ignore when searching for files
65 # These directories don't have customizations, or are partially broken.
66 # If some of the packages listed here are customized, don't forget to
67 #  remove the directory!
68 ignore_dirs="cl egg eos its language locale sunpro term \
69 tooltalk iso electric \
70 hm--html-menus gnats pcl-cvs vm"
71
72 # Only use Mule XEmacs to build Mule-specific autoloads & custom-loads.
73 echon "Checking for Mule support..."
74 lisp_prog='(princ (featurep (quote mule)))'
75 mule_p="`$EMACS -batch -q -no-site-file -eval \"$lisp_prog\"`"
76 if test "$mule_p" = nil ; then
77         echo No
78         ignore_dirs="$ignore_dirs mule leim skk"
79 else
80         echo Yes
81 fi
82
83 echon "Checking directories..."
84 dirs=lisp/
85 for dir in lisp/*; do
86         if test -d $dir \
87                 -a $dir != lisp/CVS \
88                 -a $dir != lisp/SCCS; then
89                 for ignore in $ignore_dirs; do
90                         if test $dir = lisp/$ignore; then
91                                 continue 2
92                         fi
93                 done
94                 rm -f "$dir/custom-load.elc"
95                 dirs="$dirs $dir"
96         fi
97 done
98 echo done
99
100 $EMACS -batch -q -no-site-file -l cus-dep -f Custom-make-dependencies $dirs