版本坑的问题在前边的回帖都提到了。Homebrew 大家都有去看。
楼主的问题不是选哪个版本,而是自行编译的时候为何检测不到 imagemagick@6,这点从 Homebrew 看不出来。
如果楼主用 Homebrew/Linuxbrew 就不需要开此贴了。
版本坑的问题在前边的回帖都提到了。Homebrew 大家都有去看。
楼主的问题不是选哪个版本,而是自行编译的时候为何检测不到 imagemagick@6,这点从 Homebrew 看不出来。
如果楼主用 Homebrew/Linuxbrew 就不需要开此贴了。
有 Linuxbrew 那就用,为啥非要守着老旧的 wget->config->make->make install
循环呢。纠结为何检测不到 imagemagick@6,还是尽快能使用 emacs 更重要吧?那就安装 Linuxbrew,有空再慢慢研究人家用了什么黑魔法吧。
我刚搜索了一下,AUR 上有编译好的 emacs 27 呀。。。所以楼主纯粹想尝试自己编译一下 emacs?
正在 manjaro 下下载 emacs 27,一会看看支持图片显示不。。。
AUR 上的 emacs 27 支持图片显示,所以楼主别纠结了。真想知道人家是咋编译的话,可以找下 PKGBUILD 看一下,初步了解是文本形态的,和 Homebrew 下的 formula 很相似。我就不再继续折腾了。
补图一张,可怜我 USB2.0 的 U 盘。心疼一秒~
我记得 Linuxbrew 还要重新自举一套工具链,还把 Homebrew 的一整套缺点都继承了(慢,只管杀不管埋,不支持 slot,编译定制选项少),在 Linux 有 portage, nix, pkgsrc 这些成熟的跨平台包管理器的情况下,不觉得需要考虑 Linuxbrew。
@Angelaneia 有运行过 pkg-config --update
吗
出售脚本一枚 ,开箱即食
Note:
#!/bin/bash
emacs_src="http://mirrors.ustc.edu.cn/gentoo/distfiles/emacs-25.3.tar.xz"
imagemagick_src="http://mirrors.ustc.edu.cn/gentoo/distfiles/ImageMagick-6.9.9-23.tar.xz"
root_dir="$(mktemp -d)"
cd "$root_dir" || exit -1
fetch
test_file="$root_dir"/test.el
cat > "$test_file" << EOF
(message "%s" "==========================Check emacs support imagemagick==============================")
(message "%s" (image-type-available-p (quote imagemagick)))
EOF
imagemagick_dir="/placeholder"
emacs_dir="/placeholder"
imagemagick_mirror_dir="$HOME"/.config/ImageMagick6 # see note --> 1
export CFLAGS="-O2 -Wno-error -mtune=intel -march=native -pipe -fomit-frame-pointer " # see note --> 2
export CXXFLAGS="${CFLAGS} -fpermissive "
fetch_src(){
curl -s "$1" | xz -d | tar xfv -
}
fetch(){
cd "$root_dir" || exit -1
fetch_src "$emacs_src"
fetch_src "$imagemagick_src"
imagemagick_dir="$(find "${root_dir}" -maxdepth 1 -type d -name 'ImageMagick*')"
emacs_dir="$(find "${root_dir}" -maxdepth 1 -type d -name 'emacs*')"
}
test_emacs(){
cd "$emacs_dir" || exit -1
./src/emacs -Q --script "$test_file"
}
get_env(){
PKG_CONFIG_PATH="${imagemagick_mirror_dir}"/lib/pkgconfig pkg-config MagickWand --"$1"
}
configure_emacs(){
cd "${imagemagick_mirror_dir}/bin/" || exit -1
IMAGEMAGICK_CFLAGS=$(get_env cflags)
IMAGEMAGICK_LIBS=$(get_env libs)
export IMAGEMAGICK_LIBS
export IMAGEMAGICK_CFLAGS
cd "$emacs_dir" || exit -1
./configure \ # see note --> 3
--prefix=/usr \
--build=x86_64-pc-linux-gnu \
--host=x86_64-pc-linux-gnu \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--datadir=/usr/share \
--sysconfdir=/etc \
--localstatedir=/var/lib \
--disable-dependency-tracking \
--disable-silent-rules \
--docdir=/usr/share/doc/emacs-25.3-r2 \
--htmldir=/usr/share/doc/emacs-25.3-r2/html \
--libdir=/usr/lib64 \
--program-suffix=-emacs-25 \
--infodir=/usr/share/info/emacs-25 \
--localstatedir=/var \
--enable-locallisppath=/etc/emacs:/usr/share/emacs/site-lisp \
--with-gameuser=:gamestat \
--without-compress-install \
--with-file-notification=inotify \
--enable-acl \
--with-dbus \
--without-modules \
--with-gpm \
--without-hesiod \
--without-kerberos \
--without-kerberos5 \
--with-xml2 \
--without-selinux \
--with-gnutls \
--with-wide-int \
--with-zlib \
--with-sound=alsa \
--with-x \
--without-ns \
--with-gconf \
--with-gsettings \
--with-toolkit-scroll-bars \
--with-gif \
--with-jpeg \
--with-png \
--with-rsvg \
--with-tiff \
--with-xpm \
--with-imagemagick \
--with-xft \
--without-cairo \
--with-libotf \
--with-m17n-flt \
--with-x-toolkit=gtk3 \
--without-xwidgets
make -j9
echo "Change me: sudo make install" # see note --> 4
}
install_imagemagick(){
cd "$imagemagick_dir" || exit -1
[ -f ./autogen.sh ] && ./autogen.sh
./configure --prefix="$imagemagick_mirror_dir" \ # see note --> 5
--oldincludedir="${imagemagick_mirror_dir}/include" \
--build=x86_64-pc-linux-gnu \
--host=x86_64-pc-linux-gnu \
--disable-dependency-tracking \
--disable-silent-rules \
--disable-static \
--enable-shared \
--disable-hdri \
--disable-opencl \
--with-threads \
--with-modules \
--with-quantum-depth=16 \
--with-magick-plus-plus \
--without-perl \
--with-bzlib \
--with-x \
--with-zlib \
--without-autotrace \
--without-dps \
--without-djvu \
--without-fftw \
--without-fpx \
--without-fontconfig \
--with-freetype \
--without-gslib \
--without-gvc \
--without-jbig \
--with-jpeg \
--without-openjp2 \
--with-lcms \
--without-lqr \
--without-lzma \
--without-openexr \
--with-pango \
--with-png \
--with-rsvg \
--with-tiff \
--without-webp \
--without-windows-font-dir \
--without-wmf \
--with-xml \
--enable-openmp \
--with-gcc-arch=no-automagic
make -j9
make install
echo "${imagemagick_mirror_dir}/lib" | sudo tee -a /etc/ld.so.conf.d/999-imagemagick-6.conf # see note --> 6
sudo ldconfig # see note --> 7
}
fetch
install_imagemagick
configure_emacs
test_emacs
想安利Gentoo了怎么办
举报BUG:bash脚本中的HERE-DOC体中的 ’ 会使下面所有的内容成为字符串,于是不得不使用quote
@Athenacle 很厉害了!可以看下 formula 和 PKGBUILD 的打包规范, 发到 Linuxbrew 和 AUR 上,减少类似楼主这样的问题帖子,帮助大家节省几百至几千小时的折腾时间!
@LdBeth 我还没有用过 Linuxbrew,不过个人猜测它应该只需要 gcc 和 ruby。你说的 Homebrew 的缺点我没有体会到,“编译选项少”——理论上可以做到和 config 一样多的选项。至于 Gentoo 我没用过不便评论。不过,目前并没有看到吸引我去尝试的点。
Homebrew 好处之一在于把那些可能遇到的坑都替你踩咯,譬如 楼上我提到的,还有 @Athenacle 那一坨脚本,可能节省你数小时至数天的折腾时间。
看看相应的开发用的包有没有安装, debian 上叫 libmagickwand-dev