For packages only available with source codes, you can manage it with checkinstall.
The following demo use Emacs 26.3 as example. First get its source codes URL from https://www.gnu.org/software/emacs/download.html.
Note that checkinstall
must use superuser privilege (or it will failed for no privileges).
So you should always run ./configure
instead of ./configure --prefix=$HOME/.local
,
sudo checkinstall
instead of checkinstall
:
sudo apt install checkinstall
sudo apt install libgtk-3-dev libxpm-dev libgif-dev libtiff-dev gnutls-bin libgnutls28-dev
wget http://mirrors.ustc.edu.cn/gnu/emacs/emacs-26.3.tar.xz
tar xf emacs-26.3.tar.xz
cd emacs-26.3
./configure
make
dpkg -l|grep emacs # emacs is not in the list
sudo checkinstall # instead of the normal `make install`
# Name the package "Emacs 26.3"
# Modify *Alternate source location* with 'https://www.gnu.org/software/emacs/download.html'
# and *Requires* with 'libgtk-3-dev,libxpm-dev,libgif-dev,libtiff-dev,gnutls-bin,libgnutls28-dev'
During installation, "Copying files to the temporary directory..." will take a few minutes to finish. Other steps are quite fast.
The format of the Requires section of checkinstall is comma-seperated, without spaces.
After that you get file "emacs_26.3-1_amd64.deb" in the current directory.
You can install Emacs on another host with sudo gdebi emacs_26.3-1_amd64.deb
.
Remove Emacs 26.3 with dpkg -r emacs
.