Ubuntu用のGNU Emacsの構築

OS管理に関連する問題は私の関心の範囲外であるため、これらの問題の1つを解決する必要が生じた場合、まず簡単なハウツーを見つけようとします。 したがって、めったに解決されないが、それでも時折発生する問題のために、チートシートを自分で書いています。 この記事はその1つです。 より大きな範囲で、「debパッケージをすばやく作成する」または「emacs.debのアセンブリを簡単に作成する」-私は判断できません。どちらにも適しています。 Ubuntu 11.10のソースコードからのGNU Emacs 24.0.92のアセンブリを以下に説明します。

場所の準備から始めます。

mkdir ~/build
cd ~/build


そして、それがない場合は、収集されたパッケージに署名するGPGキーを作成します。

gpg --gen-key
gpg -a --output ~/.gnupg/john_doe.gpg --export 'John Doe'


一連の質問が出されますが、その答えは直感的です。 キーを作成するときの微妙な点は1つだけです。後でパッケージを作成するときに使用するのと同じ名前を指定します。

.debのビルドに必要なパッケージをインストールします。

sudo apt-get install build-essential autoconf automake autotools-dev dh-make debhelper devscripts fakeroot xutils lintian pbuilder

次に、元のGNU Emacsコードを取得する必要があります。

bzr co --lightweight -v bzr://bzr.savannah.gnu.org/emacs/trunk emacs-24.0.92

ソースコードを受け取るディレクトリの名前emacs-24.0.92は、アセンブリ.debパッケージのパッケージ名: packagename-packageversion小文字を含むディレクトリの命名要件に従って選択する必要があることに注意してください。 トランクのプログラムのバージョン番号は、 http//bzr.savannah.gnu.org/lh/emacs/trunk/filesの README参照して確認README

ディレクトリをソースコードとともに、アセンブリの準備が整った状態にしましょう。 準備完了状態は、 configureスクリプトの存在です。 実行して生成:

cd emacs-24.0.92
./autogen.sh


次に、既存のディレクトリのアーカイブコピーを作成し、それと同じレベルに配置する必要があります。

tar -czvf ../emacs-24.0.92.tgz ../emacs-24.0.92/

debianizationを開始します:

dh_make -p emacs -e john.doe@gmail.com -c gpl3 -f ../emacs-24.0.92.tgz

john.doe@gmail.comをあなたの電子メールに置き換え、質問に答えます:

Type of package: single binary, indep binary, multiple binary, library, kernel module, kernel patch?

「シングルバイナリ」を選択します。

その結果、パッケージのアセンブリを制御するファイルを含むdebianディレクトリが作成されます(常に現在のディレクトリに関連するファイルとディレクトリの名前を記述します)。 少し後で編集に進みますが、今のところ、アセンブリに必要なパッケージとしてそこに登録する必要があるものを見つけます。 これを行うには、次を実行します。

dpkg-depcheck -d ./configure

システムに構築するものがない場合:

checking for library containing tputs... no
configure: error: The required function `tputs' was not found in any library.
These libraries were tried: libncurses, libterminfo, libtermcap, libcurses.
Please try installing whichever of these libraries is most appropriate
for your system, together with its header files.
For example, a libncurses-dev(el) or similar package.


必要なものをインストールするだけです:

sudo apt-get install libncurses5-dev

必要なものを検索します(正規表現を使用できます):

apt-cache search .*libncurses.*dev

長いリストの最後にあるコマンドの出力( dpkg-depcheck -d ./configure )を見てみましょう。

Packages needed:
libgtk-3-dev


これは、「Build-Depends」行のdebian/controlファイル内のリストされたパッケージに追加する必要があります。リストされたパッケージはコンマとスペースで区切ります。 このファイルの他のフィールドを見て、必要に応じて編集します。 比較するためのファイルの内容は次のとおりです。

Source: emacs
Section: editors
Priority: extra
Maintainer: John Doe <john.doe@gmail.com>
Build-Depends: debhelper (>= 8.0.0), autotools-dev, libgtk-3-dev
Standards-Version: 3.9.2
Homepage: www.gnu.org/software/emacs

Package: emacs
Architecture: any
Depends: ${shlibs:Depends}, ${misc:Depends}
Description: GNU Emacs is an extensible, customizable text editor.


debian/controlファイルの内容に関する詳細情報は、 http//www.debian.org/doc/manuals/maint-guide/dreq.ru.html#controlにあります

configureコマンドの出力に戻り、GNU Emacsのビルドに使用するものを見て、次の行を見つけます。

What operating system and machine description files should Emacs use?
`s/gnu-linux.h' and `m/amdx86-64.h'
What compiler should emacs be built with? gcc -std=gnu99 -g -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? GTK
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? yes
Does Emacs use imagemagick? yes
Does Emacs use -lgpm? yes
Does Emacs use -ldbus? yes
Does Emacs use -lgconf? no
Does Emacs use GSettings? yes
Does Emacs use -lselinux? yes
Does Emacs use -lgnutls? yes
Does Emacs use -lxml2? yes
Does Emacs use -lfreetype? yes
Does Emacs use -lm17n-flt? yes
Does Emacs use -lotf? yes
Does Emacs use -lxft? yes
Does Emacs use toolkit scroll bars? yes


一部のライブラリ(「no」が立っている)のサポートが必要な場合は、必要な-devパッケージをシステムに配布してください。 INSTALLファイルにはconfigureスクリプトのオプションが記述されており、GNU Emacsビルドをさまざまな方法で設定するために使用できます。 configure試用とdpkg-depcheck -d ./configure --without-pngを実行していることに注意してください。たとえば、コンパイルされたGNU Emacsで作成された.debパッケージには影響しません。 .debパッケージのアセンブリ中に必要なパラメーターをconfigureスクリプトに渡すには、次の行をdebian/rules追加します。

override_dh_auto_configure:
dh_auto_configure -- --without-png


2行目はタブ文字で始まる必要があることに注意してください(ここではパーサーがすべてを飲み込んでおり、インデントは表示されていません)。

そして今、 debian/内容に関するいくつかの言葉。 アセンブリにはdebian/{control, rules, copyright, changelog}dh_makeです。これらはすべてdh_makeを実行して生成されます。 原則として、あなたは他に何も編集することはできませんが、 debian/copyrightファイルを整理することを提案する人々の作品に敬意を表します。 以下に例を示します。

Format: dep.debian.net/deps/dep5
Upstream-Name: emacs
Source: savannah.gnu.org/bzr/?group=emacs
Maintainer: John Doe <john.doe@gmail.com>

Files: *
Copyright: Copyright (C) 2007 Free Software Foundation, Inc. <fsf.org>
License: GPL-3.0+

Files: debian/*
Copyright: 2011 John Doe <john.doe@gmail.com>
License: GPL-3.0+

License: GPL-3.0+
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
.
This package is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
.
You should have received a copy of the GNU General Public License
along with this program. If not, see <www.gnu.org/licenses>.
.
On Debian systems, the complete text of the GNU General
Public License version 3 can be found in "/usr/share/common-licenses/GPL-3".


これで、すべてを組み立てる準備ができました。 1つの問題が残っています-「チェックを行う」。 Makefile 、チェックターゲットがあり、.debビルドシステムによって起動されるようにビルドされます。 そして、準備されたリリースではなくトランクをマージしたため、テストに合格しない可能性があります。 少なくとも今は持っています。 テストをスキップするには、環境変数DEB_BUILD_OPTIONS="nocheck"設定する必要があります。 したがって、ビルドを開始します。

DEB_BUILD_OPTIONS="nocheck" dpkg-buildpackage -rfakeroot

テストをスキップしない場合、コマンドは次のようになります。

dpkg-buildpackage -rfakeroot

デフォルトでは、Gtk Emacsビルドはgtk3 gtk3をサポートしており、configureはGtk3XftGtk3フォント)をサポートする目に優しいGUIを構成するために必要ではありません。 すべてを正しく行った場合、パッケージは、PGPキーを生成するときに尋ねられた秘密のフレーズを尋ねることで完了します。 その後、現在のディレクトリの1レベル上に、システムにインストール可能な、組み立てられた.debパッケージが表示されます。

dpkg -i ../emacs_24.0.92-1_amd64.deb

それだけです

情報源:
www.debian.org/doc/manuals/maint-guide/index.ru.html
www.webupd8.org/2010/01/how-to-create-deb-package-ubuntu-debian.html

Source: https://habr.com/ru/post/J134951/


All Articles