Commit | Line | Data |
---|---|---|
e0f712ba AC |
1 | #!/bin/sh |
2 | ||
3 | #### osx-install: create the file ~/.MacOSX/environment.plist with | |
4 | #### appropriate paths for Emacs to access lisp and bin directories. | |
5 | #### On Mac OS X, this file contains values for environment variables | |
6 | #### seen by Aqua application launched in the Finder. This script | |
7 | #### must be run at the top level of a Mac OS X binary distribution. | |
8 | ||
9 | # Copyright (C) 2002 Free Software Foundation, Inc. | |
10 | # | |
11 | # This file is part of GNU Emacs. | |
12 | # | |
13 | # GNU Emacs is free software; you can redistribute it and/or modify | |
14 | # it under the terms of the GNU General Public License as published by | |
15 | # the Free Software Foundation; either version 2, or (at your option) | |
16 | # any later version. | |
17 | # | |
18 | # GNU Emacs is distributed in the hope that it will be useful, | |
19 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 | # GNU General Public License for more details. | |
22 | # | |
23 | # You should have received a copy of the GNU General Public License | |
24 | # along with GNU Emacs; see the file COPYING. If not, write to the | |
25 | # Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
26 | # Boston, MA 02111-1307, USA. | |
27 | ||
28 | progname="$0" | |
29 | ||
30 | ### Exit if a command fails. | |
31 | #set -e | |
32 | ||
33 | ### Print out each line we read, for debugging's sake. | |
34 | set -v | |
35 | ||
36 | LANGUAGE=C | |
37 | LC_ALL=C | |
38 | LC_MESSAGES= | |
39 | LANG= | |
40 | export LANGUAGE LC_ALL LC_MESSAGES LANG | |
41 | ||
42 | ## Don't restrict access to any files. | |
43 | umask 0 | |
44 | ||
45 | ### Make sure we're running in the right place. | |
46 | if [ ! -d Emacs.app -o ! -d libexec -o ! -d share ]; then | |
47 | echo "${progname} must be run in the top directory of the Emacs" >&2 | |
48 | echo "binary distribution tree for Mac OS. cd to that directory" >&2 | |
49 | echo "and try again." >&2 | |
50 | exit 1 | |
51 | fi | |
52 | ||
53 | versionfile=`ls share/emacs/21.*/lisp/version.el` | |
54 | ||
55 | ### Find out which version of Emacs this is. | |
56 | shortversion=`grep 'defconst[ ]*emacs-version' ${versionfile} \ | |
57 | | sed -e 's/^.*"\([0-9][0-9]*\.[0-9][0-9]*\).*$/\1/'` | |
58 | version=`grep 'defconst[ ]*emacs-version' ${versionfile} \ | |
59 | | sed -e 's/^[^"]*"\([^"]*\)".*$/\1/'` | |
60 | if [ ! "${version}" ]; then | |
61 | echo "${progname}: can't find current Emacs version in \`./lisp/version.el'" >&2 | |
62 | exit 1 | |
63 | fi | |
64 | ||
65 | echo Version numbers are $version and $shortversion | |
66 | ||
67 | homedir=`ls -d ~` | |
68 | initfile="${homedir}/.MacOSX/environment.plist" | |
69 | ||
70 | if [ -f ${initfile} ]; then | |
71 | mv ${initfile} ${initfile}.old | |
72 | fi | |
73 | ||
74 | if [ -d ${homedir}/.MacOSX ]; then | |
75 | mkdir ${homedir}/.MacOSX | |
76 | fi | |
77 | ||
78 | execpath=`ls -d libexec/emacs/21.*/powerpc-apple-*/` | |
79 | ||
80 | echo '<?xml version="1.0" encoding="UTF-8"?>' > ${initfile} | |
81 | echo '<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">' >> ${initfile} | |
82 | echo '<plist version="0.9">' >> ${initfile} | |
83 | echo '<dict>' >> ${initfile} | |
84 | echo ' <key>EMACSLOADPATH</key>' >> ${initfile} | |
85 | echo " <string>`pwd`/share/emacs/${version}/lisp/</string>" >> ${initfile} | |
86 | echo ' <key>EMACSPATH</key>' >> ${initfile} | |
87 | echo " <string>`pwd`/${execpath}:`pwd`/bin/</string>" >> ${initfile} | |
88 | echo ' <key>EMACSDATA</key>' >> ${initfile} | |
89 | echo " <string>`pwd`/share/emacs/${version}/etc/</string>" >> ${initfile} | |
90 | echo ' <key>EMACSDOC</key>' >> ${initfile} | |
91 | echo " <string>`pwd`/share/emacs/${version}/etc/</string>" >> ${initfile} | |
92 | echo ' <key>INFOPATH</key>' >> ${initfile} | |
93 | echo " <string>`pwd`/info/</string>" >> ${initfile} | |
94 | echo '</dict>' >> ${initfile} | |
95 | echo '</plist>' >> ${initfile} | |
96 | ||
97 | ### osx-install ends here |