Function: project-am-extract-package-info

project-am-extract-package-info is a byte-compiled function defined in project-am.el.gz.

Signature

(project-am-extract-package-info DIR)

Documentation

Extract the package information for directory DIR.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/ede/project-am.el.gz
(defun project-am-extract-package-info (dir)
  "Extract the package information for directory DIR."
  (let ((conf-in (project-am-autoconf-file dir))
	(conf-sh (expand-file-name "configure" dir))
	(name (file-name-nondirectory
	       (directory-file-name dir)))
	(ver "1.0")
	(bugrep nil)
	(configfiles nil)
	)
    (cond
     ;; Try configure.ac or configure.in
     (conf-in
      (project-am-with-config-current conf-in
	(let ((aci (autoconf-parameters-for-macro "AC_INIT"))
	      (aia (autoconf-parameters-for-macro "AM_INIT_AUTOMAKE"))
	      (acf (autoconf-parameters-for-macro "AC_CONFIG_FILES"))
	      (aco (autoconf-parameters-for-macro "AC_OUTPUT"))
	      )
	  (cond
	   ;; AC init has more than 1 parameter
	   ((> (length aci) 1)
	    (setq name (nth 0 aci)
		  ver (nth 1 aci)
		  bugrep (nth 2 aci)))
	   ;; The init automake has more than 1 parameter
	   ((> (length aia) 1)
	    (setq name (nth 0 aia)
		  ver (nth 1 aia)
		  bugrep (nth 2 aia)))
	   )
	  ;; AC_CONFIG_FILES, or AC_OUTPUT lists everything that
	  ;; should be detected as part of this PROJECT, but not in a
	  ;; particular TARGET.
	  (let ((outfiles (cond (aco (list (car aco)))
				(t acf))))
	    (if (> (length outfiles) 1)
		(setq configfiles outfiles)
	      (setq configfiles (split-string (car outfiles) "\\s-" t)))
	    )
	  ))
      )
     ;; Else, try the script
     ((file-exists-p conf-sh)
      (project-am-with-config-current conf-sh
	(setq name (project-am-extract-shell-variable "PACKAGE_NAME")
	      ver (project-am-extract-shell-variable "PACKAGE_VERSION")
	      )
	))
     ;; Don't know what else....
     (t
      nil))
    ;; Return stuff
    (list name ver bugrep configfiles)
    ))