Debian 7 安装 Emacs 24.3

Emacs 24.3出来好久了,但是在Debian 7里还是Emacs 23的版本.

以下是安装步骤(9步):

sudo aptitude install git-core libxaw7-dev libxpm-dev libpng12-dev libtiff5-dev libgif-dev libjpeg8-dev libgtk2.0-dev libncurses5-dev autoconf automake texinfo
sudo apt-get build-dep emacs
git clone git://git.savannah.gnu.org/emacs.git
cd emacs/
git checkout emacs-24.3 git checkout -b custom_branch ./autogen.sh ./configure --prefix=/opt/emacs24 make --jobs=2 sudo make install

按这个顺序安装就好了,大概半个小时到一个小时的样子。

安装好后把emacs添加到PATH里,打开~/.bashrc 文件,在最后添加:

export PATH=$PATH:/opt/emacs24/bin

保存后:

source .bashrc

这样在终端里就可以直接输入 emacs 就可以启动了。

经常按alt+F2 打开应用程序窗口,但是这里面输入emacs却不行,办法是把emacs软链接到 /usr/bin 目录里:

cd /usr/bin
ln -s /opt/emacs24/bin/emacs emacs

打完收工!


 

2010.10.03 更新:

以上通过git的方式今天用起来好慢!只好换一种方式。

一、安装编译所需包 2014.10.03 10:43~10:45

sudo apt-get install libxaw7-dev libxpm-dev libpng12-dev libtiff5-dev libgif-dev libjpeg8-dev libgtk2.0-dev libncurses5-dev autoconf automake texinfo
正在读取软件包列表... 完成
正在分析软件包的依赖关系树       
正在读取状态信息... 完成       
将会安装下列额外的软件包:
  autopoint autotools-dev debhelper gettext html2text intltool-debian
  libatk1.0-dev libcairo-script-interpreter2 libcairo2-dev libelf1
  libexpat1-dev libfontconfig1-dev libfreetype6-dev libgdk-pixbuf2.0-dev
  libgettextpo0 libglib2.0-bin libglib2.0-dev libice-dev libjbig-dev
  liblzma-dev libmail-sendmail-perl libpango1.0-dev libpcre3-dev libpcrecpp0
  libpixman-1-dev libpthread-stubs0 libpthread-stubs0-dev libsm-dev
  libsys-hostname-long-perl libtiff5 libtiffxx5 libtinfo-dev libx11-dev
  libx11-doc libxau-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev
  libxcomposite-dev libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev
  libxfixes-dev libxft-dev libxi-dev libxinerama-dev libxml2-utils libxmu-dev
  libxmu-headers libxrandr-dev libxrender-dev libxt-dev m4 pkg-config
  po-debconf x11proto-composite-dev x11proto-core-dev x11proto-damage-dev
  x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev
  x11proto-render-dev x11proto-xext-dev x11proto-xinerama-dev
  xorg-sgml-doctools xtrans-dev zlib1g-dev
建议安装的软件包:
  autoconf2.13 autoconf-archive gnu-standards autoconf-doc libtool dh-make
  gettext-doc libcairo2-doc libglib2.0-doc libgtk2.0-doc libice-doc
  liblzma-doc ncurses-doc libpango1.0-doc imagemagick libsm-doc libxaw-doc
  libxcb-doc libxext-doc libxt-doc libmail-box-perl texlive-base
  texlive-latex-base texlive-generic-recommended texinfo-doc-nonfree
下列【新】软件包将被安装:
  autoconf automake autopoint autotools-dev debhelper gettext html2text
  intltool-debian libatk1.0-dev libcairo-script-interpreter2 libcairo2-dev
  libelf1 libexpat1-dev libfontconfig1-dev libfreetype6-dev
  libgdk-pixbuf2.0-dev libgettextpo0 libgif-dev libglib2.0-bin libglib2.0-dev
  libgtk2.0-dev libice-dev libjbig-dev libjpeg8-dev liblzma-dev
  libmail-sendmail-perl libncurses5-dev libpango1.0-dev libpcre3-dev
  libpcrecpp0 libpixman-1-dev libpng12-dev libpthread-stubs0
  libpthread-stubs0-dev libsm-dev libsys-hostname-long-perl libtiff5
  libtiff5-dev libtiffxx5 libtinfo-dev libx11-dev libx11-doc libxau-dev
  libxaw7-dev libxcb-render0-dev libxcb-shm0-dev libxcb1-dev libxcomposite-dev
  libxcursor-dev libxdamage-dev libxdmcp-dev libxext-dev libxfixes-dev
  libxft-dev libxi-dev libxinerama-dev libxml2-utils libxmu-dev libxmu-headers
  libxpm-dev libxrandr-dev libxrender-dev libxt-dev m4 pkg-config po-debconf
  texinfo x11proto-composite-dev x11proto-core-dev x11proto-damage-dev
  x11proto-fixes-dev x11proto-input-dev x11proto-kb-dev x11proto-randr-dev
  x11proto-render-dev x11proto-xext-dev x11proto-xinerama-dev
  xorg-sgml-doctools xtrans-dev zlib1g-dev
升级了 0 个软件包,新安装了 80 个软件包,要卸载 0 个软件包,有 0 个软件包未被升级。
需要下载 28.1 MB 的软件包。
解压缩后会消耗掉 91.4 MB 的额外空间。
您希望继续执行吗?[Y/n]
View Code

 Yes后开始下载安装这些包,结束时有此提示:

在处理时有错误发生:
 /var/cache/apt/archives/libfontconfig1-dev_2.9.0-7.1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

google了下,好像是下载文件不完整造成的,删除该包,重新下载安装:

sudo rm /var/cache/apt/archives/libfontconfig1-dev_2.9.0-7.1_amd64.deb
sudo apt-get install libfontconfig1-dev

二、下载emacs压缩包

从这里下载:http://mirror.bjtu.edu.cn/gnu/emacs/
文件叫 emacs-24.3.tar.gz 有50M,下载在Download目录里。
$ cd ~/Download
$ tar zxvf emacs-24.3.tar.gz # 解压后有170M。

三、编译前配置 11:13~11:14

在Download目录里新建一个目录放置编译时生成的文件,以免所有的文件都在解压后的 emacs-24.3 目录里。

$ mkdir compileemacs # 放置编译后生成的文件
$ cd compileemacs
$ ../emacs-24.3/configure --prefix=/opt/emacs
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for style of include used by make... GNU
checking dependency style of gcc... gcc3
checking whether gcc and cc understand -c and -o together... yes
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for Minix Amsterdam compiler... no
checking for ar... ar
checking for ranlib... ranlib
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking minix/config.h usability... no
checking minix/config.h presence... no
checking for minix/config.h... no
checking whether it is safe to define __EXTENSIONS__... yes
checking for special C compiler options needed for large files... no
checking for _FILE_OFFSET_BITS value needed for large files... no
checking for gcc option to accept ISO C99... -std=gnu99
checking for gcc -std=gnu99 option to accept ISO Standard C... (cached) -std=gnu99
checking whether gcc -std=gnu99 accepts -g3 -O2... yes
checking whether ln -s works... yes
checking for install-info... /usr/bin/install-info
checking for gzip... /bin/gzip
checking for paxctl... no
checking for makeinfo... /usr/bin/makeinfo
checking for -znocombreloc... yes
checking for pkg-config... /usr/bin/pkg-config
checking machine/soundcard.h usability... no
checking machine/soundcard.h presence... no
checking for machine/soundcard.h... no
checking sys/soundcard.h usability... yes
checking sys/soundcard.h presence... yes
checking for sys/soundcard.h... yes
checking soundcard.h usability... no
checking soundcard.h presence... no
checking for soundcard.h... no
checking for _oss_ioctl in -lossaudio... no
checking for alsa >= 1.0.0... no
checking for linux/version.h... yes
checking for sys/systeminfo.h... no
checking for stdio_ext.h... yes
checking for fcntl.h... yes
checking for coff.h... no
checking for pty.h... yes
checking for sys/vlimit.h... yes
checking for sys/resource.h... yes
checking for sys/utsname.h... yes
checking for pwd.h... yes
checking for utmp.h... yes
checking for dirent.h... yes
checking for util.h... no
checking for sys/socket.h... yes
checking for stdlib.h... (cached) yes
checking for unistd.h... (cached) yes
checking for sys/param.h... yes
checking for pthread.h... yes
checking for malloc/malloc.h... no
checking for maillock.h... no
checking for sys/un.h... yes
checking for execinfo.h... yes
checking for getopt.h... yes
checking for sys/time.h... yes
checking for wchar.h... yes
checking for stdint.h... (cached) yes
checking for inttypes.h... (cached) yes
checking for sys/select.h... yes
checking for sys/stat.h... (cached) yes
checking for utime.h... yes
checking if personality LINUX32 can be set... yes
checking for term.h... yes
checking whether time.h and sys/time.h may both be included... yes
checking whether sys_siglist is declared... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for speed_t... yes
checking for net/if.h... yes
checking for ifaddrs.h... yes
checking for net/if_dl.h... no
checking for struct ifreq.ifr_flags... yes
checking for struct ifreq.ifr_hwaddr... yes
checking for struct ifreq.ifr_netmask... yes
checking for struct ifreq.ifr_broadaddr... yes
checking for struct ifreq.ifr_addr... yes
checking for struct ifreq.ifr_addr.sa_len... no
checking whether we are using GNU Make... yes
checking whether gcc understands -MMD -MF... yes
checking for long file names... yes
checking for X... libraries , headers
checking whether malloc is Doug Lea style... yes
checking for getpagesize... yes
checking for working mmap... yes
checking for dnet_ntoa in -ldnet... no
checking for main in -lXbsd... no
checking for pthread_self in -lpthread... yes
checking for cma_open in -lpthreads... no
checking whether X on GNU/Linux needs -b to link... no
checking for Xkb... yes
checking for XrmSetDatabase... yes
checking for XScreenResourceString... yes
checking for XScreenNumberOfScreen... yes
checking X11 version 6... 6 or newer
checking for librsvg-2.0 >= 2.11.0... no
checking for Wand >= 6.2.8... no
checking for gtk+-3.0 >= 3.0 glib-2.0 >= 2.28... no
checking for gtk+-2.0 >= 2.10 glib-2.0 >= 2.10... yes CFLAGS='-pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12  ' LIBS='-lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0  '
checking for gtk_main... yes
checking whether GTK_TYPE_FILE_SELECTION is declared... yes
checking for gtk_file_selection_new... yes
checking for gtk_widget_get_window... yes
checking for gtk_widget_set_has_window... yes
checking for gtk_dialog_get_action_area... yes
checking for gtk_widget_get_sensitive... yes
checking for gtk_widget_get_mapped... yes
checking for gtk_adjustment_get_page_size... yes
checking for gtk_orientable_set_orientation... yes
checking for gtk_window_set_has_resize_grip... no
checking for dbus-1 >= 1.0... no
checking for gio-2.0 >= 2.26... yes CFLAGS='-pthread -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  ' LIBS='-lgio-2.0 -lgobject-2.0 -lglib-2.0  '
checking for gconf-2.0 >= 2.13... no
checking for gobject-2.0 >= 2.0... yes CFLAGS='-I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include  ' LIBS='-lgobject-2.0 -lglib-2.0  '
checking for g_type_init... yes
checking for lgetfilecon in -lselinux... no
checking for gnutls >= 2.6.6... no
checking for gnutls_certificate_set_verify_function... no
checking for fontconfig >= 2.2.0... yes CFLAGS=' ' LIBS='-lfontconfig  '
checking for xft >= 0.13.0... yes CFLAGS='-I/usr/include/freetype2  ' LIBS='-lXft  '
checking for XRenderQueryExtension in -lXrender... yes
checking X11/Xft/Xft.h usability... yes
checking X11/Xft/Xft.h presence... yes
checking for X11/Xft/Xft.h... yes
checking for XftFontOpen in -lXft... yes
checking for freetype2... yes CFLAGS='-I/usr/include/freetype2  ' LIBS='-lfreetype  '
checking for libotf... no
checking X11/xpm.h usability... yes
checking X11/xpm.h presence... yes
checking for X11/xpm.h... yes
checking for XpmReadFileToPixmap in -lXpm... yes
checking for XpmReturnAllocPixels preprocessor define... yes
checking jerror.h usability... yes
checking jerror.h presence... yes
checking for jerror.h... yes
checking for jpeg_destroy_compress in -ljpeg... yes
checking png.h usability... yes
checking png.h presence... yes
checking for png.h... yes
checking for png_get_channels in -lpng... yes
checking whether png_longjmp is declared... no
checking tiffio.h usability... yes
checking tiffio.h presence... yes
checking for tiffio.h... yes
checking for TIFFGetVersion in -ltiff... yes
checking gif_lib.h usability... yes
checking gif_lib.h presence... yes
checking for gif_lib.h... yes
checking for EGifPutExtensionLast in -lgif... yes
checking gpm.h usability... no
checking gpm.h presence... no
checking for gpm.h... no
checking X11/SM/SMlib.h usability... yes
checking X11/SM/SMlib.h presence... yes
checking for X11/SM/SMlib.h... yes
checking for SmcOpenConnection in -lSM... yes
checking for libxml-2.0 > 2.6.17... no
checking whether netdb declares h_errno... yes
checking for sqrt in -lm... yes
checking for maillock in -lmail... no
checking for maillock in -llockfile... no
checking for liblockfile.so... no
checking for gethostname... yes
checking for closedir... yes
checking for getrusage... yes
checking for get_current_dir_name... yes
checking for lrand48... yes
checking for setsid... yes
checking for fpathconf... yes
checking for select... yes
checking for euidaccess... yes
checking for getpagesize... (cached) yes
checking for setlocale... yes
checking for utimes... yes
checking for getrlimit... yes
checking for setrlimit... yes
checking for setpgid... yes
checking for getcwd... yes
checking for shutdown... yes
checking for getaddrinfo... yes
checking for __fpending... yes
checking for strsignal... yes
checking for setitimer... yes
checking for sendto... yes
checking for recvfrom... yes
checking for getsockname... yes
checking for getpeername... yes
checking for getifaddrs... yes
checking for freeifaddrs... yes
checking for gai_strerror... yes
checking for mkstemp... yes
checking for getline... yes
checking for getdelim... yes
checking for fsync... yes
checking for sync... yes
checking for difftime... yes
checking for posix_memalign... yes
checking for getpwent... yes
checking for endpwent... yes
checking for getgrent... yes
checking for endgrent... yes
checking for touchlock... no
checking for cfmakeraw... yes
checking for cfsetspeed... yes
checking for copysign... yes
checking for __executable_start... yes
checking for getwd... yes
checking for random... yes
checking for rint... yes
checking for __builtin_unwind_init... yes
checking for _LARGEFILE_SOURCE value needed for large files... no
checking whether getpgrp requires zero arguments... yes
checking for grantpt... yes
checking for getpt... yes
checking for posix_openpt... yes
checking for library containing tputs... -ltinfo
checking for tzset... yes
checking for readlinkat... yes
checking for gettimeofday... yes
checking for nanotime... no
checking for lstat... yes
checking for alarm... yes
checking for pselect... yes
checking for pthread_sigmask... yes
checking for readlink... yes
checking for strtoimax... yes
checking for strtoumax... yes
checking for symlink... yes
checking for localtime_r... yes
checking for futimes... yes
checking for futimesat... yes
checking for futimens... yes
checking for utimensat... yes
checking for lutimes... yes
checking whether localtime caches TZ... no
checking for socket... yes
checking netinet/in.h usability... yes
checking netinet/in.h presence... yes
checking for netinet/in.h... yes
checking arpa/inet.h usability... yes
checking arpa/inet.h presence... yes
checking for arpa/inet.h... yes
checking whether system supports dynamic ptys... yes
checking for pid_t... yes
checking vfork.h usability... no
checking vfork.h presence... no
checking for vfork.h... no
checking for fork... yes
checking for vfork... yes
checking for working fork... yes
checking for working vfork... (cached) yes
checking for snprintf... yes
checking for nl_langinfo and CODESET... yes
checking for mbstate_t... yes
checking for C restricted array declarations... yes
checking for signals via characters... yes
checking whether we are using the GNU C library... yes
checking for style of pending output formalism... new
checking for _setjmp... yes
checking for usable FIONREAD... yes
checking for usable SIGIO... yes
checking for working alloca.h... yes
checking for alloca... yes
checking whether byte ordering is bigendian... no
checking for inline... inline
checking whether strtold conforms to C99... yes
checking if environ is properly declared... yes
checking for st_dm_mode in struct stat... no
checking whether strmode is declared... no
checking whether the preprocessor supports include_next... yes
checking whether system header files limit the line length... no
checking for getopt.h... (cached) yes
checking for getopt_long_only... yes
checking whether getopt is POSIX compatible... yes
checking for working GNU getopt function... no
checking whether getenv is declared... yes
checking for C/C++ restrict keyword... __restrict
checking for struct timeval... yes
checking for wide-enough struct timeval.tv_sec member... yes
checking for unsigned long long int... yes
checking for long long int... yes
checking whether stdint.h conforms to C99... yes
checking whether lstat correctly handles trailing slash... yes
checking whether <sys/select.h> is self-contained... yes
checking for sigset_t... yes
checking for stdbool.h that conforms to C99... yes
checking for _Bool... yes
checking for wchar_t... yes
checking whether struct tm is in sys/time.h or time.h... time.h
checking for struct tm.tm_zone... yes
checking for struct tm.tm_gmtoff... yes
checking whether strtoimax is declared... yes
checking whether strtoumax is declared... yes
checking whether stat file-mode macros are broken... no
checking for mode_t... yes
checking for struct timespec in <time.h>... yes
checking whether the utimes function works... yes
checking for struct utimbuf... yes
checking for alloca as a compiler built-in... yes
checking for library containing clock_gettime... -lrt
checking for clock_gettime... yes
checking for clock_settime... yes
checking whether dup2 works... yes
checking for library containing backtrace_symbols_fd... none required
checking for getloadavg... yes
checking sys/loadavg.h usability... no
checking sys/loadavg.h presence... no
checking for sys/loadavg.h... no
checking whether getloadavg is declared... yes
checking whether gettimeofday clobbers localtime buffer... no
checking for gettimeofday with POSIX signature... almost
checking for working mktime... yes
checking whether signature of pselect conforms to POSIX... yes
checking whether pselect detects invalid fds... yes
checking whether pthread_sigmask works without -lpthread... yes
checking whether pthread_sigmask returns error numbers... yes
checking whether pthread_sigmask unblocks signals correctly... guessing yes
checking whether readlink signature is correct... yes
checking whether readlink handles trailing slash correctly... yes
checking for volatile sig_atomic_t... yes
checking for sighandler_t... yes
checking for socklen_t... yes
checking for ssize_t... yes
checking for struct stat.st_atim.tv_nsec... yes
checking whether struct stat.st_atim is of type struct timespec... yes
checking for struct stat.st_birthtimespec.tv_nsec... no
checking for struct stat.st_birthtimensec... no
checking for struct stat.st_birthtim.tv_nsec... no
checking for working stdalign.h... no
checking for va_copy... yes
checking whether NULL can be used in arbitrary expressions... yes
checking whether strtoimax works... yes
checking whether symlink handles trailing slash correctly... yes
checking whether <sys/select.h> is self-contained... (cached) yes
checking for nlink_t... yes
checking whether localtime_r is declared... yes
checking whether localtime_r is compatible with its POSIX signature... yes
checking for library containing timer_settime... -lrt
checking for timer_settime... yes

Configured for `x86_64-unknown-linux-gnu'.

  Where should the build process find the source code?    /home/z/Download/emacs-24.3
  What compiler should emacs be built with?               gcc -std=gnu99 -g3 -O2
  Should Emacs use the GNU version of malloc?             yes
      (Using Doug Lea's new malloc from the GNU C Library.)
  Should Emacs use a relocating allocator for buffers?    no
  Should Emacs use mmap(2) for buffer allocation?         no
  What window system should Emacs use?                    x11
  What toolkit should Emacs use?                          GTK2
  Where do we find X Windows header files?                Standard dirs
  Where do we find X Windows libraries?                   Standard dirs
  Does Emacs use -lXaw3d?                                 no
  Does Emacs use -lXpm?                                   yes
  Does Emacs use -ljpeg?                                  yes
  Does Emacs use -ltiff?                                  yes
  Does Emacs use a gif library?                           yes -lgif
  Does Emacs use -lpng?                                   yes
  Does Emacs use -lrsvg-2?                                no
  Does Emacs use imagemagick?                             no
  Does Emacs use -lgpm?                                   no
  Does Emacs use -ldbus?                                  no
  Does Emacs use -lgconf?                                 no
  Does Emacs use GSettings?                               yes
  Does Emacs use -lselinux?                               no
  Does Emacs use -lgnutls?                                no
  Does Emacs use -lxml2?                                  no
  Does Emacs use -lfreetype?                              yes
  Does Emacs use -lm17n-flt?                              no
  Does Emacs use -lotf?                                   no
  Does Emacs use -lxft?                                   yes
  Does Emacs use toolkit scroll bars?                     yes


configure: creating ./config.status
config.status: creating Makefile
config.status: creating lib/Makefile
config.status: creating lib-src/Makefile
config.status: creating oldXMenu/Makefile
config.status: creating doc/emacs/Makefile
config.status: creating doc/misc/Makefile
config.status: creating doc/lispintro/Makefile
config.status: creating doc/lispref/Makefile
config.status: creating src/Makefile
config.status: creating lwlib/Makefile
config.status: creating lisp/Makefile
config.status: creating leim/Makefile
config.status: creating nextstep/Makefile
config.status: creating admin/unidata/Makefile
config.status: creating src/config.h
config.status: executing depfiles commands
config.status: executing mkdirs commands
config.status: executing epaths commands
creating src/epaths.h
config.status: executing gdbinit commands
creating src/.gdbinit
View Code

四、编译 11:21~11:29

$ make

五、安装  11:47~11:48

sudo make install

安装成功后添加到环境变量中:

export PATH=$PATH:/opt/emacs24/bin

软链接到 /usr/bin 目录里:

cd /usr/bin
ln -s /opt/emacs24/bin/emacs emacs
ls -l emacs 
lrwxrwxrwx 1 root root 22 10月  3 11:54 emacs -> /opt/emacs24/bin/emacs

--End--

 

posted @ 2014-06-18 20:24  ibg  阅读(1273)  评论(0编辑  收藏  举报