从源代码安装特定的 Evince 分支

从源代码安装特定的 Evince 分支

我想安装 Evince 的一个特定分支,名为持续突出显示。我尝试了下面列出的几个命令,但无法安装它。

  • 我尝试使用以下命令:

    git clone https://gitlab.gnome.org/VirtuousCrane/evince.git
    cd evince
    sudo make && sudo make install
    

    终端给我回馈了:

    make *** no targets specified and no makefile found. stop
    
  • 我也尝试过./autogen.sh,结果是:

    bash: ./autogen.sh: No such file or directory
    
  • 该命令./configure给出的结果是:

    bash: ./configure: No such file or directory
    
  • 该命令sh ./autogen.sh给出的结果是:

    sh: 0: cannot open ./autogen.sh: No such file
    

我如何安装 Evince 的特定分支?

答案1

Evince 使用 Meson 构建系统。

首先,使用以下方式安装

sudo apt install meson

然后,cd进入源目录并运行命令,

meson builddir --prefix=/usr/local
sudo ninja -C builddir install

要卸载,请运行

sudo ninja -C builddir uninstall

注意:在编译之前,您需要安装 evince 的所有构建依赖项。为此,请打开软件和源,然后启用Source Code。运行sudo apt update,并sudo apt-get build-dep evince安装所有构建依赖项。

答案2

这是我编译 evince 的方法(欢迎评论,我是 Debian 打包方面的新手)。它成功地在 ubuntu 22 上安装了我定制的 evince。

保存以下脚本为build_deb.sh

#!/bin/bash
set -ex

if [ "$#" -ne 1 ]; then
    echo "Wrong number of parameters.
Usage: $(basename $0) build_dir"
    exit 1
fi

MESON_BUILD_ROOT=$(readlink -f $1)
PACKAGE_VERSION=42.6.2
PKG_DIR="$MESON_BUILD_ROOT"/deb
mkdir -p $PKG_DIR/DEBIAN/
cat > $PKG_DIR/DEBIAN/control <<- 'END_OF_TEXT'
Package: evince
Version: 42.6.2
Architecture: amd64
Maintainer: Mystique Packager
Description: Customized Evince PDF viewer
Depends: gsettings-desktop-schemas, shared-mime-info, dconf-gsettings-backend | gsettings-backend, libatk1.0-0, libc6, libcairo-gobject2, libcairo2, libgdk-pixbuf-2.0-0, libglib2.0-0, libgnome-desktop-3-19, libgtk-3-0, libhandy-1-0, libnautilus-extension1a, libpango-1.0-0, libpangocairo-1.0-0, libsecret-1-0
Provides: evince, evince-common, libevdocument3-4, libevview3-3
Conflicts: evince
Homepage: https://your-custom-project-homepage.org
END_OF_TEXT

cd "$MESON_BUILD_ROOT"
DESTDIR=$PKG_DIR ninja install
fakeroot dpkg-deb --build $PKG_DIR/ evince-custom_$PACKAGE_VERSION.deb

然后:

sudo vim /etc/apt/sources.list # remove the comment in front of the src apt repo
sudo apt update
sudo apt install ninja-build meson -y
sudo apt-get build-dep evince

apt source evince # download source, and then modify them as you want
cd the_source_repo 
meson builddir --prefix=/usr

chmod +x build_deb.sh
./build_deb.sh builddir
sudo apt remove --purge libevdocument3-4 evince evince-common
sudo dpkg -i builddir/evince-custom_42.6.2.deb

如果你想避免在你的系统上保留开发臃肿:

# to do before everything
dpkg --get-selections | grep -v deinstall > packages_before.txt
# to do after everything
dpkg --get-selections | grep -v deinstall > packages_after.txt
diff packages_before.txt packages_after.txt  | grep '>' | awk '{print $2}' > diff.txt

cat diff.txt | xargs sudo apt remove -y

相关内容