Skip to content

Instantly share code, notes, and snippets.

@harrifeng
Last active April 1, 2024 13:15
Show Gist options
  • Star 26 You must be signed in to star a gist
  • Fork 9 You must be signed in to fork a gist
  • Save harrifeng/a3ebd9a2af4c65cacfd4 to your computer and use it in GitHub Desktop.
Save harrifeng/a3ebd9a2af4c65cacfd4 to your computer and use it in GitHub Desktop.
Compile emacs on redhat and centos
yum -y groupinstall "Development Tools"
yum -y install gtk+-devel gtk2-devel
yum -y install libXpm-devel
yum -y install libpng-devel
yum -y install giflib-devel
yum -y install libtiff-devel libjpeg-devel
yum -y install ncurses-devel
yum -y install gpm-devel dbus-devel dbus-glib-devel dbus-python
yum -y install GConf2-devel pkgconfig
yum -y install libXft-devel
wget https://ftp.gnu.org/pub/gnu/emacs/emacs-25.1.tar.xz
tar xvJf emacs-25.1.tar.xz
cd emacs-25.1
./configure
make
sudo make install
@cpluspluscrowe
Copy link

This is amazing, thank you

@aganzha
Copy link

aganzha commented Nov 22, 2018

This is awesome, thank you!

Perhaps someone will also need:
sudo yum install gnutls-devel

@cyberthal
Copy link

If the first wget attempt fails partway through, subsequent invocations of the script in the same directory will rename the downloaded file with a numerical suffix. The script will keep trying to unpack the first incomplete tarball.

Adding -nc to wget will prevent this problem from occurring. Adding -c will resume downloading the partial file. There is no harm in including these switches in the first invocation of wget.

https://www.gnu.org/software/wget/manual/wget.html

@pdbg
Copy link

pdbg commented Aug 8, 2019

Awesome! Thank you for sharing.

In my case i had to install gnutls-devel

sudo yum install gnutls-devel

@nalanda
Copy link

nalanda commented Aug 20, 2019

Thanks it worked wonderfully

@metaperl
Copy link

# yum install
sudo yum group install -y "Development Tools"
sudo yum install -y ncurses-devel
sudo yum install -y gtk+-devel gtk2-devel
sudo yum install -y libXpm-devel
sudo yum install -y libpng-devel
sudo yum install -y giflib-devel
sudo yum install -y libtiff-devel libjpeg-devel
sudo yum install -y ncurses-devel
sudo yum install -y gpm-devel dbus-devel dbus-glib-devel dbus-python
sudo yum install -y GConf2-devel pkgconfig
sudo yum install -y libXft-devel
sudo yum install -y gnutls-devel
sudo yum install -y texi2html texinfo

# git config
git config --global http.postBuffer  524288000
git config --global https.postBuffer 524288000
git config --global http.sslVerify false

## git clone
git clone https://github.com/emacs-mirror/emacs.git --verbose --progress


# build
cd emacs
./autogen.sh && ./configure && make && make install


@mcraveiro
Copy link

For emacs 26.3, needed ./configure --with-gif=no as well. Thanks for the script!

@ipstone
Copy link

ipstone commented Feb 26, 2020

@mcraveiro thanks for the tips, but my install on centos 7 failed at make:

./temacs --batch  --load loadup bootstrap
./temacs: error while loading shared libraries: libtinfow.so.6: cannot open shared object file: No such file or directory

ideas/suggestions?

@apmattil
Copy link

at centos8 get giflib
sudo dnf --enablerepo=PowerTools install giflib-devel

@ambiamber
Copy link

For advanced users:
create:
/etc/rpm/macros.set-build-flags
based on:
https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/20#request_diff
(don't include the deprecated macros)

yum install yum-utils rpmdevtools rpm-build
rpmdev-setuptree
cd ~/rpmbuild/SOURCES
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs-spellchecker.patch
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs-system-crypto-policies.patch
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/dotemacs.el
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs.appdata.xml
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs.desktop
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs.service
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs-terminal.desktop
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/emacs-terminal.sh
wget https://src.fedoraproject.org/rpms/emacs/raw/f6258eb59adcb47e0e93ff0c22ee571b623b1b7a/f/site-start.el
cd ~/rpmbuild/SPECS/
wget https://download.copr.fedorainfracloud.org/results/mcsontos/emacs-27/epel-7-x86_64/01832730-emacs/emacs.spec
Somehow deal with %{gpgverify} macro, you decide. Left as exercise for the reader.
Somehow deal with Source2: gpgkey-D405AA2C862C54F17EEE6BE0E8BCD7866AFCF978.gpg
sudo yum-builddep emacs.spec
rpmbuild --undefine=_disable_source_fetch -ba emacs.spec

cd ../RPMS/
find *
noarch
noarch/emacs-terminal-27.1-1.el7.noarch.rpm
noarch/emacs-filesystem-27.1-1.el7.noarch.rpm
x86_64
x86_64/emacs-27.1-1.el7.x86_64.rpm
x86_64/emacs-nox-27.1-1.el7.x86_64.rpm
x86_64/emacs-common-27.1-1.el7.x86_64.rpm
x86_64/emacs-devel-27.1-1.el7.x86_64.rpm
x86_64/emacs-debuginfo-27.1-1.el7.x86_64.rpm

sudo yum install x86_64/emacs-nox-27.1-1.el7.x86_64.rpm x86_64/emacs-common-27.1-1.el7.x86_64.rpm noarch/emacs-filesystem-27.1-1.el7.noarch.rpm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment