unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Autodetect imagemagick on macOS + Homebrew
@ 2018-01-10 21:37 Alan Third
  2018-01-15 19:42 ` Charles A. Roelli
  2018-01-28 18:35 ` Philipp Stephani
  0 siblings, 2 replies; 5+ messages in thread
From: Alan Third @ 2018-01-10 21:37 UTC (permalink / raw)
  To: Emacs-Devel devel

[-- Attachment #1: Type: text/plain, Size: 210 bytes --]

When imagemagick 6 is installed on macOS using Homebrew it can be a
bit of a faff to get Emacs built with it. The attached patch
automatically adds it to PKG_CONFIG_PATH if Homebrew is detected.
-- 
Alan Third

[-- Attachment #2: 0001-Allow-configure-to-find-Homebrew-installed-imagemagi.patch --]
[-- Type: text/plain, Size: 1672 bytes --]

From d5d4fdf1478acb87dc046ec367e4f8ad1e095e76 Mon Sep 17 00:00:00 2001
From: Alan Third <alan@idiocy.org>
Date: Tue, 9 Jan 2018 23:47:56 +0000
Subject: [PATCH] Allow configure to find Homebrew installed imagemagick

* configure.ac: Add the imagemagick pkgconfig dir to pkg-config's
search path.
---
 configure.ac | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index c574d7dd0d..32ade3e95c 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1269,10 +1269,10 @@ AC_DEFUN
 
 # Makeinfo on macOS is ancient, check whether there is a more recent
 # version installed by Homebrew.
-AC_CHECK_PROG(HAVE_BREW, [brew], [yes])
-if test -n "$HAVE_BREW"; then
+AC_CHECK_PROGS(BREW, [brew])
+if test -n "$BREW"; then
   AC_PATH_PROG([MAKEINFO], [makeinfo], [],
-    [`brew --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
+    [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
 fi
 
 ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
@@ -2529,6 +2529,12 @@ AC_DEFUN
 HAVE_IMAGEMAGICK=no
 if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then
   if test "${with_imagemagick}" != "no"; then
+    if test -n "$BREW"; then
+      # Homebrew doesn't link ImageMagick 6 by default, so make sure
+      # pkgconfig can find it.
+      export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig"
+    fi
+
     ## 6.3.5 is the earliest version known to work; see Bug#17339.
     ## 6.8.2 makes Emacs crash; see Bug#13867.
     ## 7 and later have not been ported to; See Bug#25967.
-- 
2.14.3


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: Autodetect imagemagick on macOS + Homebrew
  2018-01-10 21:37 Autodetect imagemagick on macOS + Homebrew Alan Third
@ 2018-01-15 19:42 ` Charles A. Roelli
  2018-01-15 23:09   ` Alan Third
  2018-01-28 18:35 ` Philipp Stephani
  1 sibling, 1 reply; 5+ messages in thread
From: Charles A. Roelli @ 2018-01-15 19:42 UTC (permalink / raw)
  To: Alan Third; +Cc: emacs-devel

> Date: Wed, 10 Jan 2018 21:37:50 +0000
> From: Alan Third <alan@idiocy.org>
> 
> When imagemagick 6 is installed on macOS using Homebrew it can be a
> bit of a faff to get Emacs built with it. The attached patch
> automatically adds it to PKG_CONFIG_PATH if Homebrew is detected.
> -- 
> Alan Third
> 
> >From d5d4fdf1478acb87dc046ec367e4f8ad1e095e76 Mon Sep 17 00:00:00 2001
> From: Alan Third <alan@idiocy.org>
> Date: Tue, 9 Jan 2018 23:47:56 +0000
> Subject: [PATCH] Allow configure to find Homebrew installed imagemagick
> 
> * configure.ac: Add the imagemagick pkgconfig dir to pkg-config's
> search path.
> ---
>  configure.ac | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index c574d7dd0d..32ade3e95c 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -1269,10 +1269,10 @@ AC_DEFUN
>  
>  # Makeinfo on macOS is ancient, check whether there is a more recent
>  # version installed by Homebrew.
> -AC_CHECK_PROG(HAVE_BREW, [brew], [yes])
> -if test -n "$HAVE_BREW"; then
> +AC_CHECK_PROGS(BREW, [brew])
> +if test -n "$BREW"; then
>    AC_PATH_PROG([MAKEINFO], [makeinfo], [],
> -    [`brew --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
> +    [`$BREW --prefix texinfo 2>/dev/null`/bin$PATH_SEPARATOR$PATH])
>  fi
>  
>  ## Require makeinfo >= 4.13 (last of the 4.x series) to build the manuals.
> @@ -2529,6 +2529,12 @@ AC_DEFUN
>  HAVE_IMAGEMAGICK=no
>  if test "${HAVE_X11}" = "yes" || test "${HAVE_NS}" = "yes" || test "${HAVE_W32}" = "yes"; then
>    if test "${with_imagemagick}" != "no"; then
> +    if test -n "$BREW"; then
> +      # Homebrew doesn't link ImageMagick 6 by default, so make sure
> +      # pkgconfig can find it.
> +      export PKG_CONFIG_PATH="$PKG_CONFIG_PATH$PATH_SEPARATOR`$BREW --prefix imagemagick@6 2>/dev/null`/lib/pkgconfig"
> +    fi
> +
>      ## 6.3.5 is the earliest version known to work; see Bug#17339.
>      ## 6.8.2 makes Emacs crash; see Bug#13867.
>      ## 7 and later have not been ported to; See Bug#25967.
> -- 
> 2.14.3

Thanks for looking into this.  When I tried "brew" last time, I
remember running into a similar problem in this area.

That said, isn't this a problem that should be fixed in the package
manager?  Why does "brew" not place ImageMagick's pkg-config file
where they are usually stored?



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Autodetect imagemagick on macOS + Homebrew
  2018-01-15 19:42 ` Charles A. Roelli
@ 2018-01-15 23:09   ` Alan Third
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Third @ 2018-01-15 23:09 UTC (permalink / raw)
  To: Charles A. Roelli; +Cc: emacs-devel

On Mon, Jan 15, 2018 at 08:42:41PM +0100, Charles A. Roelli wrote:
> > Date: Wed, 10 Jan 2018 21:37:50 +0000
> > From: Alan Third <alan@idiocy.org>
> > 
> > When imagemagick 6 is installed on macOS using Homebrew it can be a
> > bit of a faff to get Emacs built with it. The attached patch
> > automatically adds it to PKG_CONFIG_PATH if Homebrew is detected.
> 
> Thanks for looking into this.  When I tried "brew" last time, I
> remember running into a similar problem in this area.
> 
> That said, isn't this a problem that should be fixed in the package
> manager?  Why does "brew" not place ImageMagick's pkg-config file
> where they are usually stored?

I’m not sure. I believe it’s because other applications use
imagemagick 7, and they don’t want to cause issues by putting both on
PATH or something. OTOH I don’t think that matters too much with
pkg-config because it can detect versions, but I don’t really know.

There’s a similar issue with makeinfo, which is why we’re detecting
homebrew already.
-- 
Alan Third



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Autodetect imagemagick on macOS + Homebrew
  2018-01-10 21:37 Autodetect imagemagick on macOS + Homebrew Alan Third
  2018-01-15 19:42 ` Charles A. Roelli
@ 2018-01-28 18:35 ` Philipp Stephani
  2018-01-28 23:50   ` Alan Third
  1 sibling, 1 reply; 5+ messages in thread
From: Philipp Stephani @ 2018-01-28 18:35 UTC (permalink / raw)
  To: Alan Third; +Cc: Emacs-Devel devel

[-- Attachment #1: Type: text/plain, Size: 680 bytes --]

Alan Third <alan@idiocy.org> schrieb am Mi., 10. Jan. 2018 um 22:38 Uhr:

> When imagemagick 6 is installed on macOS using Homebrew it can be a
> bit of a faff to get Emacs built with it. The attached patch
> automatically adds it to PKG_CONFIG_PATH if Homebrew is detected.
>
>
I'm wondering whether these concatenations work if the packages aren't
installed. `brew --prefix texinfo 2>/dev/null`/bin results in /bin if
texinfo isn't installed, but this might be a bit too implicit and brittle -
how certain are we that brew will print the empty string here forever?
Maybe it would be better to check the return value of brew and append the
path segments only if it has suceeded.

[-- Attachment #2: Type: text/html, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Autodetect imagemagick on macOS + Homebrew
  2018-01-28 18:35 ` Philipp Stephani
@ 2018-01-28 23:50   ` Alan Third
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Third @ 2018-01-28 23:50 UTC (permalink / raw)
  To: Philipp Stephani; +Cc: Emacs-Devel devel

On Sun, Jan 28, 2018 at 06:35:41PM +0000, Philipp Stephani wrote:
> Alan Third <alan@idiocy.org> schrieb am Mi., 10. Jan. 2018 um 22:38 Uhr:
> 
> > When imagemagick 6 is installed on macOS using Homebrew it can be a
> > bit of a faff to get Emacs built with it. The attached patch
> > automatically adds it to PKG_CONFIG_PATH if Homebrew is detected.
> >
> >
> I'm wondering whether these concatenations work if the packages aren't
> installed. `brew --prefix texinfo 2>/dev/null`/bin results in /bin if
> texinfo isn't installed,

It doesn’t, actually. I’ve never installed tomcat on this laptop:

    breton:/Users/alan>brew --prefix tomcat
    /usr/local/Cellar/tomcat/8.5.27

Although it does return blank if the package doesn’t exist at all. (It
sends an error message to stderr.)

> Maybe it would be better to check the return value of brew and
> append the path segments only if it has suceeded.

Yes, it might be a good idea.
-- 
Alan Third



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-01-28 23:50 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 21:37 Autodetect imagemagick on macOS + Homebrew Alan Third
2018-01-15 19:42 ` Charles A. Roelli
2018-01-15 23:09   ` Alan Third
2018-01-28 18:35 ` Philipp Stephani
2018-01-28 23:50   ` Alan Third

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).