[Mesa-dev] [PATCH] automake: make the build less chatty

Eric Anholt eric at anholt.net
Fri Dec 9 00:38:05 UTC 2016


Matt Turner <mattst88 at gmail.com> writes:

> On Thu, Dec 8, 2016 at 6:55 AM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
>
>> former uses relative paths, while the latter absolute ones.
>> Skimming through - nothing obvious comes up on convincing autoconf to
>> generate/use the absolute ones.
>
>
> So the patch makes what amount to a cosmetic change in the best case.
> But... we know that it's not actually cosmetic because the information
> lost was useful for at least one person's Emacs macro (which sounds
> like something I want, tbh).

If you're using emacs and aren't using this, I highly recommend it.
Here's some bits of my .emacs, originally from
https://emacswiki.org/emacs/CompileCommand.

;;mode-compile
(global-set-key (kbd "C-c c") 'std-compile)
(global-set-key (kbd "C-c <up>") 'previous-error)
(global-set-key (kbd "C-c <down>") 'next-error)

(defun compile-pkg (&optional command startdir)
  "Compile a package, moving up to the parent directory
  containing configure.ac, if it exists. Start in startdir if defined,
  else start in the current directory."
  (interactive)

  (let ((dirname)
	(dir-buffer nil))
    (setq startdir (expand-file-name (if startdir startdir ".")))
    (setq command  (if command command compile-command))

    (setq dirname (upward-find-file "configure.ac" startdir))
    (setq dirname (if dirname dirname (upward-find-file "Cargo.toml" startdir)))
    (setq dirname (if dirname dirname (upward-find-file "cmake" startdir)))
    (setq dirname (if dirname dirname (upward-find-file "Makefile" startdir)))
    (setq dirname (if dirname dirname (expand-file-name ".")))
    ; We've now worked out where to start. Now we need to worry about
    ; calling compile in the right directory
    (save-excursion
      (setq dir-buffer (find-file-noselect dirname))
      (set-buffer dir-buffer)
      (compile command)
      (kill-buffer dir-buffer))))

(defun upward-find-file (filename &optional startdir)
  "Move up directories until we find a certain filename. If we
  manage to find it, return the containing directory. Else if we
  get to the toplevel directory and still can't find it, return
  nil. Start at startdir or . if startdir not given"

  (let ((dirname (expand-file-name
		  (if startdir startdir ".")))
	(found nil) ; found is set as a flag to leave loop if we find it
	(top nil))  ; top is set when we get
		    ; to / so that we only check it once

    ; While we've neither been at the top last time nor have we found
    ; the file.
    (while (not (or found top))
      ; If we're at / set top flag.
      (if (string= (expand-file-name dirname) "/")
	  (setq top t))
      
      ; Check for the file
      (if (file-exists-p (expand-file-name filename dirname))
	  (setq found t)
	; If not, move up a directory
	(setq dirname (expand-file-name ".." dirname))))
    ; return statement
    (if found dirname nil)))

(defun std-compile ()
  "Like 'compile', but uses compile-pkg"
  (interactive)
  (compile-pkg compile-command))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20161208/72307c70/attachment.sig>


More information about the mesa-dev mailing list