SCM Repository
Annotation of /XEmacs/packages/package-compile.el
Parent Directory
|
Revision Log
Revision 1.9 - (view) (download)
| 1 : | steve | 1.1 | ;;; package-compile.el --- Bytecompiler wrapper for building packages from source |
| 2 : | |||
| 3 : | ;; Copyright (C) 1998 by Free Software Foundation, Inc. | ||
| 4 : | |||
| 5 : | ;; Author: SL Baur <steve@altair.xemacs.org> | ||
| 6 : | ;; Keywords: internal, lisp | ||
| 7 : | |||
| 8 : | ;; This file is part of XEmacs. | ||
| 9 : | |||
| 10 : | ;; XEmacs is free software; you can redistribute it and/or modify it | ||
| 11 : | ;; under the terms of the GNU General Public License as published by | ||
| 12 : | ;; the Free Software Foundation; either version 2, or (at your option) | ||
| 13 : | ;; any later version. | ||
| 14 : | |||
| 15 : | ;; XEmacs is distributed in the hope that it will be useful, but | ||
| 16 : | ;; WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 17 : | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 18 : | ;; General Public License for more details. | ||
| 19 : | |||
| 20 : | ;; You should have received a copy of the GNU General Public License | ||
| 21 : | ;; along with XEmacs; see the file COPYING. If not, write to the Free | ||
| 22 : | ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA | ||
| 23 : | ;; 02111-1307, USA. | ||
| 24 : | |||
| 25 : | ;;; Synched up with: Not in FSF | ||
| 26 : | |||
| 27 : | ;;; Commentary: | ||
| 28 : | |||
| 29 : | ;; This is meant to be called -batch and handles setting up the loadpath | ||
| 30 : | ;; and minimizing what autoloads are imported. | ||
| 31 : | |||
| 32 : | ;; This package cannot be used with an XEmacs binary that was built with | ||
| 33 : | ;; backwards compatible lisp directories. | ||
| 34 : | |||
| 35 : | ;;; Code: | ||
| 36 : | |||
| 37 : | ;; (setq stack-trace-on-error t) | ||
| 38 : | |||
| 39 : | (when (interactive-p) | ||
| 40 : | (error "package-compile may only be used with -batch")) | ||
| 41 : | |||
| 42 : | steveb | 1.4 | ;;; Step 1, set the load-path and load the core autoloads. |
| 43 : | steve | 1.1 | |
| 44 : | steveb | 1.4 | (let* ((roots (paths-find-emacs-roots invocation-directory |
| 45 : | invocation-name)) | ||
| 46 : | (lisp-directory (paths-find-lisp-directory roots))) | ||
| 47 : | steveb | 1.6 | (setq load-path (paths-find-recursive-load-path (list lisp-directory) |
| 48 : | paths-load-path-depth))) | ||
| 49 : | steve | 1.1 | |
| 50 : | (load (expand-file-name "auto-autoloads" (car load-path))) | ||
| 51 : | |||
| 52 : | ;;; Step 2, collect the dependencies into load-path and load the autoloads. | ||
| 53 : | (require 'bytecomp) | ||
| 54 : | |||
| 55 : | (defconst package-directory-map | ||
| 56 : | '( | ||
| 57 : | ;; libs/* | ||
| 58 : | ("Sun" . "libs") | ||
| 59 : | ("apel" . "libs") | ||
| 60 : | steveb | 1.2 | ("dired" . "libs") |
| 61 : | steve | 1.1 | ("edebug" . "libs") |
| 62 : | ("efs" . "libs") | ||
| 63 : | steveb | 1.5 | ("fsf-compat" . "libs") |
| 64 : | steve | 1.1 | ("mail-lib" . "libs") |
| 65 : | ("tooltalk" . "libs") | ||
| 66 : | ("xemacs-base" . "libs") | ||
| 67 : | ("xemacs-devel" . "libs") | ||
| 68 : | ;; mule/* | ||
| 69 : | ("mule-base" . "mule") | ||
| 70 : | ("egg-its" . "mule") | ||
| 71 : | ("leim" . "mule") | ||
| 72 : | ("locale" . "mule") | ||
| 73 : | ("skk" . "mule") | ||
| 74 : | ;; prog/* | ||
| 75 : | ("ada" . "prog") | ||
| 76 : | ("c-support" . "prog") | ||
| 77 : | ("cc-mode" . "prog") | ||
| 78 : | ("debug" . "prog") | ||
| 79 : | ("ediff" . "prog") | ||
| 80 : | ("emerge" . "prog") | ||
| 81 : | ("pcl-cvs" . "prog") | ||
| 82 : | ("prog-modes" . "prog") | ||
| 83 : | ("scheme" . "prog") | ||
| 84 : | ("sh-script" . "prog") | ||
| 85 : | ("vc" . "prog") | ||
| 86 : | ("vc-cc" . "prog") | ||
| 87 : | ("vhdl" . "prog") | ||
| 88 : | ;; comm/* | ||
| 89 : | steveb | 1.7 | ("bbdb" . "comm") |
| 90 : | steve | 1.1 | ("footnote" . "comm") |
| 91 : | ("gnats" . "comm") | ||
| 92 : | ("gnus" . "comm") | ||
| 93 : | steveb | 1.9 | ("irchat" . "comm") |
| 94 : | steve | 1.1 | ("mailcrypt" . "comm") |
| 95 : | steveb | 1.7 | ("mew" . "comm") |
| 96 : | steve | 1.1 | ("mh-e" . "comm") |
| 97 : | ("net-utils" . "comm") | ||
| 98 : | ("ph" . "comm") | ||
| 99 : | steveb | 1.8 | ("pgnus" . "comm") |
| 100 : | steve | 1.1 | ("rmail" . "comm") |
| 101 : | ("supercite" . "comm") | ||
| 102 : | ("tm" . "comm") | ||
| 103 : | ("vm" . "comm") | ||
| 104 : | ("w3" . "comm") | ||
| 105 : | steveb | 1.8 | ("zenirc" . "comm") |
| 106 : | steve | 1.1 | ;; games/* |
| 107 : | ("cookie" . "games") | ||
| 108 : | ("games" . "games") | ||
| 109 : | ("mine" . "games") | ||
| 110 : | ("misc-games" . "games") | ||
| 111 : | ;; oa/* | ||
| 112 : | ("calendar" . "oa") | ||
| 113 : | ("edit-utils" . "oa") | ||
| 114 : | ("forms" . "oa") | ||
| 115 : | ("frame-icon" . "oa") | ||
| 116 : | ("hm--html-menus" . "oa") | ||
| 117 : | ("ispell" . "oa") | ||
| 118 : | ("pc" . "oa") | ||
| 119 : | ("psgml" . "oa") | ||
| 120 : | ("sgml" . "oa") | ||
| 121 : | ("slider" . "oa") | ||
| 122 : | ("speedbar" . "oa") | ||
| 123 : | ("strokes" . "oa") | ||
| 124 : | ("text-modes" . "oa") | ||
| 125 : | ("time" . "oa") | ||
| 126 : | ;; os/* | ||
| 127 : | ("eterm" . "os") | ||
| 128 : | ("igrep" . "os") | ||
| 129 : | ("ilisp" . "os") | ||
| 130 : | ("os-utils" . "os") | ||
| 131 : | ("view-process" . "os") | ||
| 132 : | ;; wp/* | ||
| 133 : | ("auctex" . "wp") | ||
| 134 : | ("crisp" . "wp") | ||
| 135 : | ("edt" . "wp") | ||
| 136 : | ("texinfo" . "wp") | ||
| 137 : | ("textools" . "wp") | ||
| 138 : | ("tpu" . "wp") | ||
| 139 : | ("viper" . "wp"))) | ||
| 140 : | |||
| 141 : | (defun package-name-to-directory (package) | ||
| 142 : | "Map `package' to a source directory." | ||
| 143 : | (let ((dir (expand-file-name | ||
| 144 : | package | ||
| 145 : | (expand-file-name (cdr (assoc package | ||
| 146 : | package-directory-map)) | ||
| 147 : | "../..")))) | ||
| 148 : | (cond ((equal package "gnus") | ||
| 149 : | (expand-file-name "gnus/lisp" (file-name-as-directory dir))) | ||
| 150 : | steveb | 1.8 | ((equal package "pgnus") |
| 151 : | (expand-file-name "gnus/lisp" (file-name-as-directory dir))) | ||
| 152 : | steveb | 1.7 | ((or (equal package "w3") (equal package "bbdb")) |
| 153 : | steve | 1.1 | (expand-file-name "lisp" (file-name-as-directory dir))) |
| 154 : | steveb | 1.7 | ((equal package "mew") |
| 155 : | (expand-file-name "mew" (file-name-as-directory dir))) | ||
| 156 : | steveb | 1.8 | ((equal package "zenirc") |
| 157 : | (expand-file-name "src" (file-name-as-directory dir))) | ||
| 158 : | steve | 1.1 | (t dir)))) |
| 159 : | |||
| 160 : | (defvar depends nil) | ||
| 161 : | (defvar command-line-args-left) | ||
| 162 : | |||
| 163 : | (while (and command-line-args-left | ||
| 164 : | (not (equal "--" (car command-line-args-left)))) | ||
| 165 : | (push (car command-line-args-left) depends) | ||
| 166 : | (pop command-line-args-left)) | ||
| 167 : | |||
| 168 : | (when command-line-args-left | ||
| 169 : | (pop command-line-args-left)) | ||
| 170 : | |||
| 171 : | ;; Setup load-path and load necessary auto-autoloads | ||
| 172 : | (while depends | ||
| 173 : | (let ((dir (package-name-to-directory (car depends)))) | ||
| 174 : | steveb | 1.3 | (when (null dir) |
| 175 : | (error "%s is not in `package-directory-map'. See: package-compile.el" | ||
| 176 : | dir)) | ||
| 177 : | steve | 1.1 | (push dir load-path) |
| 178 : | (load (expand-file-name "auto-autoloads" dir)) | ||
| 179 : | (pop depends))) | ||
| 180 : | |||
| 181 : | ;; Lastly, add the current directory | ||
| 182 : | (push default-directory load-path) | ||
| 183 : | |||
| 184 : | ;;; Step 3, perform the requested bytecompilation | ||
| 185 : | |||
| 186 : | ;; (prin1 "Load path = ") | ||
| 187 : | ;; (prin1 load-path) | ||
| 188 : | ;; (terpri) | ||
| 189 : | |||
| 190 : | (batch-byte-compile) | ||
| 191 : | |||
| 192 : | (provide 'package-compile) | ||
| 193 : | |||
| 194 : | ;;; package-compile.el ends here |
| root@alioth.debian.org | ViewVC Help |
| Powered by ViewVC 1.0.0 |

