なんとなく,macOS 上で homebrew の imagemagick と emacs をリンクしてみようと思って emacs のビルドを.
% brew install imagemagick
してから Emacs の configure & make を動かして見たけどそのままではダメなのね.imagemagick6 から 7 になって色々と imagemagick 側に変更が入ってるみたい.
ということで,ちょこっと 10分くらいで emacs 側のソース修正.configure.ac の修正だけではダメで,src 以下のファイルも直さないといけないみたい.
*** emacs/configure.ac 2017-01-15 21:02:27.000000000 +0900
--- emacs-20170122/configure.ac 2017-01-22 23:07:46.000000000 +0900
***************
*** 2462,2468 ****
if test "${with_imagemagick}" != "no"; then
## 6.3.5 is the earliest version known to work; see Bug#17339.
## 6.8.2 makes Emacs crash; see Bug#13867.
! IMAGEMAGICK_MODULE="Wand >= 6.3.5 Wand != 6.8.2"
EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE])
AC_SUBST(IMAGEMAGICK_CFLAGS)
AC_SUBST(IMAGEMAGICK_LIBS)
--- 2462,2468 ----
if test "${with_imagemagick}" != "no"; then
## 6.3.5 is the earliest version known to work; see Bug#17339.
## 6.8.2 makes Emacs crash; see Bug#13867.
! IMAGEMAGICK_MODULE="MagickWand >= 6.3.5 MagickWand != 6.8.2"
EMACS_CHECK_MODULES([IMAGEMAGICK], [$IMAGEMAGICK_MODULE])
AC_SUBST(IMAGEMAGICK_CFLAGS)
AC_SUBST(IMAGEMAGICK_LIBS)
*** emacs/src/image.c 2017-01-15 21:01:53.000000000 +0900
--- emacs-20170122/src/image.c 2017-01-22 23:29:13.000000000 +0900
***************
*** 8244,8257 ****
/* The GIF library also defines DrawRectangle, but its never used in Emacs.
Therefore rename the function so it doesn't collide with ImageMagick. */
#define DrawRectangle DrawRectangleGif
! #include <wand/MagickWand.h>
/* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason.
Emacs seems to work fine with the hidden version, so unhide it. */
! #include <magick/version.h>
#if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665
extern WandExport void PixelGetMagickColor (const PixelWand *,
! MagickPixelPacket *);
#endif
/* Log ImageMagick error message.
--- 8244,8257 ----
/* The GIF library also defines DrawRectangle, but its never used in Emacs.
Therefore rename the function so it doesn't collide with ImageMagick. */
#define DrawRectangle DrawRectangleGif
! #include <MagickWand/MagickWand.h>
/* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason.
Emacs seems to work fine with the hidden version, so unhide it. */
! #include <MagickCore/version.h>
#if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665
extern WandExport void PixelGetMagickColor (const PixelWand *,
! PixelInfo *);
#endif
/* Log ImageMagick error message.
***************
*** 8406,8412 ****
PixelWand **source, **dest;
size_t source_width, source_height;
ssize_t source_left, source_top;
! MagickPixelPacket pixel;
DisposeType dispose;
ptrdiff_t lines = 0;
--- 8406,8412 ----
PixelWand **source, **dest;
size_t source_width, source_height;
ssize_t source_left, source_top;
! PixelInfo pixel;
DisposeType dispose;
ptrdiff_t lines = 0;
***************
*** 8471,8477 ****
if (dispose == BackgroundDispose || PixelGetAlpha (source[x]))
{
PixelGetMagickColor (source[x], &pixel);
! PixelSetMagickColor (dest[x + source_left], &pixel);
}
}
PixelSyncIterator (dest_iterator);
--- 8471,8477 ----
if (dispose == BackgroundDispose || PixelGetAlpha (source[x]))
{
PixelGetMagickColor (source[x], &pixel);
! PixelSetPixelColor (dest[x + source_left], &pixel);
}
}
PixelSyncIterator (dest_iterator);
***************
*** 8516,8522 ****
MagickWand *image_wand;
PixelIterator *iterator;
PixelWand **pixels, *bg_wand = NULL;
! MagickPixelPacket pixel;
Lisp_Object image;
Lisp_Object value;
Lisp_Object crop;
--- 8516,8522 ----
MagickWand *image_wand;
PixelIterator *iterator;
PixelWand **pixels, *bg_wand = NULL;
! PixelInfo pixel;
Lisp_Object image;
Lisp_Object value;
Lisp_Object crop;
で,autogen.sh してから configure & make でビルドできました.
でも brew 側の imagemagick がアップデートされたら emacs も動作しなくなる可能性があるかな.この状況だと.まぁ,いっか.
あと,gnutls とリンクする際のブログにも書きましたが,imagemagick とのリンクにも pkgconfig が使われているので brew で pkgconfig を入れておく必要はあります.
あ,一応,手元でビルドしているのは emacs のバージョンは git の origin/master です.
また,念のために書いておきますが,上記パッチは適当にコンパイル通るように修正しただけなので本当にこれで修正がよいかは確認していないです.使われる方は各自の責任で使ってください.私自身は何の責任も負いません.はい.