2009年11月30日月曜日

maximaをいじる

手元で数式処理できるツールが欲しいなぁ、と、だいぶ前からMaximaに目をつけていた。

気分転換がてら、ちょこちょこいじってみようと思う。

参考書は、

はじめてのMaxima

にする。

ごりごり読むのではなくて、あくまでのんびり遊びながらつまみ食いする予定。

debian-emacs-policyのポイント

ざっとポイントをまとめた。
これ以上理解するには、perlを多少勉強せねばならない。
うーん。どうしたものか。


* debian-emacs-policyのポイント
- debian-emacs-policyでは、debian systemにてemacs
関連のpackagesを作成/管理するためのpolicyが規程
されている。
- 簡明にまとまっている文書なので、メモ化する必要は
ないのだが、確実な理解のためにあえてメモを作成す
る。
- policyの所在
- emacsen-common:
/usr/share/doc/emacsen-common/debian-emacs-policy.gz
- またはWeb。debian.org。

** policyにおける用語
- <emacs>

emacs
xemacs21
emacs21
emacs22

- <flavor>

xemacs21
emacs21
emacs22

- すなわち、<emacs> - 'emacs'。

** policyが求めるload-path
- load-path
- debian emacs policyでは、最低、次の場所が次の
順(優先度が高い順)にload-pathに含まれることを求めている。
これはどのemacsenにおいても、である。

/etc/<flavor>
/etc/emacs
/usr/local/share/emacs/<upstream>/site-lisp
/usr/local/share/emacs/site-lisp
/usr/share/emacs/<flavor>/site-lisp
/usr/share/emacs/site-lisp

- ここで、<upstream>は、'22.2'などのupstream
version number。

** emacsen-common package
- emacsen-commonパッケージは、debian emacs policy
に従ったemacs packagesの管理のためのfacilityを提
供している。
- 提供物一覧

~ $ apt-file list emacsen-common
emacsen-common: /etc/emacs/site-start.d/00debian-vars.el
emacsen-common: /etc/emacs/site-start.el
emacsen-common: /usr/lib/emacsen-common/emacs-install
emacsen-common: /usr/lib/emacsen-common/emacs-package-install
emacsen-common: /usr/lib/emacsen-common/emacs-package-remove
emacsen-common: /usr/lib/emacsen-common/emacs-remove
emacsen-common: /usr/lib/emacsen-common/generate-install-list
emacsen-common: /usr/lib/emacsen-common/packages/install/emacsen-common
emacsen-common: /usr/lib/emacsen-common/packages/remove/emacsen-common
emacsen-common: /usr/share/doc/emacsen-common/changelog.gz
emacsen-common: /usr/share/doc/emacsen-common/copyright
emacsen-common: /usr/share/doc/emacsen-common/debian-emacs-policy.gz
emacsen-common: /usr/share/emacs/site-lisp/debian-startup.el
~ $

- /etc/emacs/site-start.el
- これはpackageに含まれてはいるが、local admin
が中身を管理するもの。

*** 提供物の概要
**** /usr/lib/emacsen-common/emacs-install
- perl script。
- コメント。

# Call emacsen-common/packages/install/* install-flavor other-flavor ...
# for every installed emacs add-on package.

**** /usr/lib/emacsen-common/emacs-remove
- emacs-installの別名。

**** /usr/lib/emacsen-common/emacs-package-install
- perl script。
- コメント。

# Was this called because we're installing/removing a new emacs
# flavor? This should probably be handled with getopt and a command
# line opt, but it's freeze time, and I'm tired...

**** /usr/lib/emacsen-common/emacs-package-remove
- emacs-package-installの別名。

**** /usr/lib/emacsen-common/generate-install-list
- perl script。
- ライブラリ。
- コメント。

# depends on: dpkg, tsort, perl

# This script should be handed a list of add-on packages on stdin, and
# it will sort them according to their dependencies. It will also add
# in other add-on packages that aren't mentioned, but are needed.

# Test code
# my @input_packages = <STDIN>;
# my @result = generate_add_on_install_list(@input_packages);
# print " " . join("\n ", @result);

**** /usr/lib/emacsen-common/packages/install/emacsen-common
- shell script。
- 使い方。
- /usr/lib/emacsen-common/packages/remove/emacsen-common <flavor>
- emacsen-commonパッケージが提供しているelファイ
ルについて、flavor用バイトコンパイルを実施する。
**** /usr/lib/emacsen-common/packages/remove/emacsen-common
- shell script。
- 使い方。
- /usr/lib/emacsen-common/packages/remove/emacsen-common <flavor>
- emacsen-commonパッケージが提供しているelファイ
ルのflavor用バイトコンパイルを削除する。

** emacsen main packages
- 'emacs22'とか'xemacs21'とか、emacsen本体を提供
するパッケージのこと。
*** 必須作法
**** メンテナスクリプト
- postinst
- postinstに記述するもの。
- "/usr/lib/emacsen-common/emacs-install <flavor>"
- この記述によってemacs-installは次のものを実
行する。
- "/usr/lib/emacsen-common/packages/install/<pkg> <flavor> <others>"
- prerm
- prermに記述するもの。
- "/usr/lib/emacsen-common/emacs-remove <flavor>"
- この記述によってemacs-removeは次のものを実
行する。
- "/usr/lib/emacsen-common/packages/remove/<pkg> <flavor> <others>"
**** バイナリシムリンク
- /usr/bin/<package-name>から
/usr/bin/<emacs-binary>へのsymbolic linkが必須。
- というのはadd-on packagesがinstall/removeすると
き、/usr/bin/$ARGV[0]を使ってバイトコンパイルな
どをするから。
**** 依存関係 "Provides: emacsen"
- emacsen main packageは、debian packageとして
controlファイルにおいて、"Provides:"に
"emacsen"と記述する。
- 例:emacs22

Provides: editor, emacsen, info-browser, mail-reader, news-reader

** add-on packages
*** 基本作法
- 必須な作法は少い。
- 何故かというと、もしadd-onしようとしている機能に
ついて、バイトコンパイルが不要であったり、インストー
ル時の調整(emacs毎)も不要であったりするならば、
単にそのadd-on packageは、しかるべき場所にしか
るべきファイルを置くだけで目的をはたせるからだ。
- ここでは必須なものを含めて基本的なものを書く。
**** 設置場所
- add-on packagesが設置できる場所はつぎのとおり。
/etc/<emacs>/site-start.d
/usr/share/<emacs>/site-lisp/<package-name>
- これは必須作法である。
**** load-path
- add-on packagesはload-pathをいじってはいけない。
- これは必須作法である。
**** 依存関係
- 'emacsen-common'をdependsするべきではない。その
かわりに、'emacsen'をdependsするか、対応している
flavorsをdependsする。
**** 初期化ファイルの中身
- site-start.dなどにおく初期化ファイルでは、load
ではなくautoloadを使うべし。

*** 応用作法
- 「バイトコンパイルが必要」など、flavorに依存した
install/remove処理が必要なものの作法。

**** メンテナスクリプト
- まず、次のファイルをパッケージにて提供すべし。

/usr/lib/emacsen-common/packages/install/<pkg>
/usr/lib/emacsen-common/packages/remove/<pkg>

- サンプル
- 仮想的なfooというパッケージに対するもの。
- flavor毎にバイトコンパイルをするもの。
- install

#!/bin/sh
# /usr/lib/emacsen-common/packages/install/foo
# [ This particular script hasn't been tested, so be careful. ]
set -e

FLAVOR=$1
echo install/foo: Handling install of emacsen flavor ${FLAVOR}

byte_compile_options="-batch -f batch-byte-compile"
el_files="some-file.el some-other-file.el etc.el"
el_dir=/usr/share/emacs/site-lisp/foo/
elc_dir=/usr/share/${FLAVOR}/site-lisp/foo/

if [ ${FLAVOR} != emacs ]
then
echo install/foo: byte-compiling for ${FLAVOR}

[ -d ${elc_dir} ] || mkdir ${elc_dir}

# Copy the temp .el files
(cd ${el_dir} && cp ${el_files} ${elc_dir})

# Byte compile them
(cd ${elc_dir} \
&& ${FLAVOR} ${byte_compile_options} ${el_files} 2> /dev/null)

# remove the redundant .el files
# presumes that any .el files in the <flavor> dir are trash.
rm ${elc_dir}/*.el
fi
exit 0;

- remove

#!/bin/sh
# /usr/lib/emacsen-common/packages/remove/foo
# [ This particular script hasn't been tested either, so be careful. ]
set -e

FLAVOR=$1
elc_dir=/usr/share/${FLAVOR}/site-lisp/foo

echo remove/foo: Handling removal of emacsen flavor ${FLAVOR}

if [ ${FLAVOR} != emacs ]
then
echo emacsen-common: purging byte-compiled files for ${FLAVOR}
rm -f ${elc_dir}/*.elc
[ -d ${elc_dir} -a `ls -la ${elc_dir}|wc -l` -gt 3 ] && rmdir ${elc_dir}
fi
exit 0;

- その上で、メンテナスクリプトは次のようにすべき。
- postinst
- /usr/lib/emacsen-common/emacs-package-install <pkg>
- prerm
- /usr/lib/emacsen-common/emacs-package-remove <pkg>


こつこつ。

2009年11月29日日曜日

Ubuntu/GNU Emacs22の起動プロセスにおけるload-pathの構築と利用

ソースを探ったり、いろいろビルドしたりして、結構わかった。
完全とまではいきませんが、現状では十分。

load-pathに限らず、Emacsの起動プロセスをいろいろ調べた。結果として、Emacsの仕組みについて多少詳しくなったのも嬉しい。


* Ubuntu/GNU Emacs22の起動プロセスにおけるload-pathの構築と利用
** src/epaths.in
- epaths.hの素。
- この中のPATH_LOADSEARCHがload-pathの素。
- GNU配布状態:
#define PATH_LOADSEARCH "/usr/local/lib/emacs/lisp"

** src/epaths.h
- makeによって、epaths.inを素に生成される。
- GNU配布状態: [./configure, makeの結果]
#define PATH_LOADSEARCH "/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/local/share/emacs/22.2/lisp:/usr/local/share/emacs/22.2/leim"
- Ubuntu: [debuildの結果]
#define PATH_LOADSEARCH "/etc/emacs22:/etc/emacs:/usr/local/share/emacs/22.2/site-lisp:/usr/local/share/emacs/site-lisp:/usr/share/emacs/22.2/site-lisp:/usr/share/emacs/site-lisp:/usr/share/emacs/22.2/leim:/usr/share/emacs/22.2/lisp:/usr/share/emacs/22.2/leim"

** src/emacs.c
- main
- init_lread関数[lread.c]の実行
- normal = PATH_LOADSEARCH;
- Vload_path = decode_env_path ("EMACSLOADPATH", normal);
- dcode_env_pathはパス達のリストを返す。
- Vtop_level変数の構成
- 起動時に評価するlispを格納。
- 値の形式は(load . (hoge))。すなわちhogeをロー
ドする。
- hogeは、
- emacsオプションで'-l'指定があればそのelファ
イル。
- そうでなければ、'loadup.el'。
- GNU:
(load "loadup.el")
- Frecursive_edit関数の実行
- editor command loop に入る。
- recursive_edit_1 [keyboard.c]
- command_loop [keyboard.c]
- internal_catch (Qtop_level, top_level_1, Qnil)
- top_level_1 [keyboad.c]
- internal_condition_case (top_level_2, Qerror, cmd_error) [eval.c]
- top_level_2 [keyboard.c]
- Feval (Vtop_level) [eval.c]
- ここにいたり、先にVtop_level
で設定した(load "loadup.el")が
評価される。

** lisp/loadup.el
- このelispに入った時点では、emacs.cのVload_path
がload-pathの値である。

*** load-path変数の調整
- bootstrappingするときだけ、load-pathを次のように
加工する。通常はこの加工はしない。

(let ((dir (car load-path)))
;; We'll probably overflow the pure space.
(setq purify-flag nil)
(setq load-path (list dir
(expand-file-name "emacs-lisp" dir)
(expand-file-name "language" dir)
(expand-file-name "international" dir)
(expand-file-name "textmodes" dir))))

*** (load "startup") [lisp/startup.el]
- (defcustom site-run-file "site-start" ...)
- (defconst debian-emacs-flavor 'emacs22 ...)
[*debian patch*]
- (setq top-level '(normal-top-level))
- normal-top-level関数を定義
- この関数の中で次の処理が定義されている。
- load-pathの拡張
- load-pathに含まれるパスを順次処理する。
- 処理は、そのパスに、subdirs.elや
leim-list.elがあれば、それらをloadするとい
うもの。
- subdirs.elの中身の典型は、次の2つ。
- normal-top-level-add-subdirs-\
to-load-path を引数無しで呼ぶ。これは
カレントディレクトリ配下のサブディレク
トリを全てload-pathに追加する。
- normal-top-level-add-subdirs-\
to-load-path を引数有で呼ぶ。これはカ
レントディレクトリ配下のサブディレクト
リについて、引数で指定されたものを
load-pathに追加する。
- leim-list.elの中身の典型は、次のよう。
- register-input-method関数の実行を列記。
- loadやautoloadをここに記述することも
ある。
- command-line関数を実行する。
- emacs-starup-hookを呼ぶ。
- term-startup-hookを呼ぶ。
- command-line関数を定義
- この関数の中で次の処理が定義されている。
- (load site-run-file t t)
- (load "debian-startup" t t nil) [*debian patch*]
- "debian-startup.el"の中身は関数群定義のみ。
- 定義される関数の一覧。
- debian-pkg-add-load-path-item
- debian-unique-strings
- debian-run-directories
- debian-startup
- (debian-startup debian-emacs-flavor)の実行 [*debian patch*]
- (let ((common-dir "/etc/emacs/site-start.d")
(flavor-dir (concat "/etc/" (symbol-name flavor) "/site-start.d")))
(debian-run-directories flavor-dir common-dir))))
- (debian-run-directories flavor-dir common-dir)
- flavor-dirやcommon-dirに入っているすべての
ディレクトリについて、NNfilename.elや
NNfilename.elcの形のファイル名のものを探索
収集し、アルファベティカルにソートして、重
複を削除したリストを作成する。このリス
トをbase-namesと呼ぶ。
- load-pathに、flavor-dirとcommon-dirを追
加する。
- base-namesの中身(file)をひとつずつloadす
る。
- 前項のloadをした結果として、load-pathが
さらに拡張されているかもしれない。そこで、
load-pathをflavor-dirとcommon-dirを追加
しただけの状態に戻す。
- (load site-run-file t t nil) [*debian patch*]

- user-init-file-1の調整
- user-init-file-1は、いわゆる'~/.emacs'となる。
- (load user-init-file-1 t t)
- otherfileの調整
- いわゆる'~/.emacs.d'の中の'init'というファイ
ル。
- (load otherfile t t)
- (load "default" t t)
- inihibit-default-initがnilのときは読み込まな
い。

*** (load "site-load" t)
- 'site-load.el'がload-pathのどこかに存在すれば
それをloadする。

- これはtemacsからemacsをdumpするときに含めたい
elispを指定するために存在している。計算機の速度
が向上しているため最近は使わない。
- そもそもの目的はdumpに含めることなのだが、起動時
に読み込ませるelispの設置場所としても使えると言
えば使える。
- ホストのelisp共通設定は、ここではなく
て'default.el'に書くべきである。そちらはユーザ
によって読み込みの制御ができるから。

*** (load "site-init" t)
- 'site-init.el'がload-pathのどこかに存在すれば
それをloadする。

- これもsite-loadと同種の目的のもの。タイミングが
違う。site-initに書いたものはdumped imageにdoc
stringsが読み込まれる。こちらに書いたものは
dumped imageには読み込まれない。
- そもそもの目的はdumpに含めることなのだが、起動時
に読み込ませるelispの設置場所としても使えると言
えば使える。
- ホストのelisp共通設定は、ここではなく
て'default.el'に書くべきである。そちらはユーザ
によって読み込みの制御ができるから。

- site-init.el [*debian patch*]
- flavor-specificなinfo dirの追加処理が記述され
ている。

*** (eval top-level)
- (eval top-level)
- normal-top-level関数[startup.el]の実行


こつこつ。

2009年11月26日木曜日

【入門DP】4.1 パッケージ作成のための基礎知識

教本で知識を確認しつつ、その知識をつかって、emacs22のパッケージをいじってみる。その様子を掲載する。


** 4 パッケージの作成と配布
*** 4.1 パッケージ作成のための基礎知識
- Ubuntu Interpidのemacs22をサンプルとしよう。

**** apt-cache showsrc emacs22
- これによって、ダウンロード前に情報をみれる。

$ apt-cache showsrc emacs22
Package: emacs22
Binary: emacs22-common, emacs22-bin-common, emacs22, emacs22-gtk, emacs22-nox, emacs22-el, emacs
Version: 22.2-0ubuntu2
Priority: optional
Section: editors
Maintainer: Ubuntu Core Developers
Original-Maintainer: Michael W. Olson (GNU address)
Build-Depends: libncurses5-dev, texinfo, liblockfile-dev, libgif-dev, libtiff-dev, xaw3dg-dev, libpng12-dev, libjpeg62-dev, libgtk2.0-dev, dpkg-dev (>> 1.10.0), quilt (>= 0.42), lsb-release, debhelper (>= 5.0.0), libxaw7-dev, libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64]
Architecture: any
Standards-Version: 3.7.2
Format: 1.0
Directory: pool/main/e/emacs22
Files:
04ef020a8f1f98965a6b1f881800414b 1461 emacs22_22.2-0ubuntu2.dsc
d6ee586b8752351334ebf072904c4d51 38694318 emacs22_22.2.orig.tar.gz
2d264719b7d1aea7e446e73c5e68c654 26934 emacs22_22.2-0ubuntu2.diff.gz
Vcs-Bzr: http://code.launchpad.net/%7Eubuntu-elisp/emacs/ubuntu/
Checksums-Sha1:
7a371332cb8400d44e8eb31f19e432bbc93523a0 38694318 emacs22_22.2.orig.tar.gz
b6e448aa81a7bf5a04a754f3b7ed39e4923079ef 26934 emacs22_22.2-0ubuntu2.diff.gz
Checksums-Sha256:
216839e1fb38ca4f2ed0a07689fb47ee80d90845f34e0a56fe781d6aa462e367 38694318 emacs22_22.2.orig.tar.gz
5dcfd2a13f68972124174271d5c7f532954500f107c972df94364ef560f2b1a6 26934 emacs22_22.2-0ubuntu2.diff.gz

$

**** ソースのダウンロード
- '-d'をつけなければ、自動的にorig.tar.gzと
diff.gzが展開される。ここではあえて展開させない。

$ apt-get -d source emacs22
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
NOTICE: 'emacs22' packaging is maintained in the 'Bzr' version control system at:
http://code.launchpad.net/%7Eubuntu-elisp/emacs/ubuntu/
Please use:
bzr get http://code.launchpad.net/%7Eubuntu-elisp/emacs/ubuntu/
to retrieve the latest (possible unreleased) updates to the package.
38.7MB のソースアーカイブを取得する必要があります。
取得:1 http://jp.archive.ubuntu.com intrepid/main emacs22 22.2-0ubuntu2 (dsc) [1461B]
取得:2 http://jp.archive.ubuntu.com intrepid/main emacs22 22.2-0ubuntu2 (tar) [38.7MB]
取得:3 http://jp.archive.ubuntu.com intrepid/main emacs22 22.2-0ubuntu2 (diff) [26.9kB]
38.7MB を 7s で取得しました (5385kB/s)
ダウンロードオンリーモードでパッケージのダウンロードが完了しました
$ ls
emacs22_22.2-0ubuntu2.diff.gz emacs22_22.2-0ubuntu2.dsc emacs22_22.2.orig.tar.gz
$

- dscファイルの確認。

$ cat emacs22_22.2-0ubuntu2.dsc
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.0
Source: emacs22
Binary: emacs22-common, emacs22-bin-common, emacs22, emacs22-gtk, emacs22-nox, emacs22-el, emacs
Architecture: any
Version: 22.2-0ubuntu2
Maintainer: Ubuntu Core Developers
Standards-Version: 3.7.2
Vcs-Bzr: http://code.launchpad.net/%7Eubuntu-elisp/emacs/ubuntu/
Build-Depends: libncurses5-dev, texinfo, liblockfile-dev, libgif-dev, libtiff-dev, xaw3dg-dev, libpng12-dev, libjpeg62-dev, libgtk2.0-dev, dpkg-dev (>> 1.10.0), quilt (>= 0.42), lsb-release, debhelper (>= 5.0.0), libxaw7-dev, libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64]
Checksums-Sha1:
7a371332cb8400d44e8eb31f19e432bbc93523a0 38694318 emacs22_22.2.orig.tar.gz
b6e448aa81a7bf5a04a754f3b7ed39e4923079ef 26934 emacs22_22.2-0ubuntu2.diff.gz
Checksums-Sha256:
216839e1fb38ca4f2ed0a07689fb47ee80d90845f34e0a56fe781d6aa462e367 38694318 emacs22_22.2.orig.tar.gz
5dcfd2a13f68972124174271d5c7f532954500f107c972df94364ef560f2b1a6 26934 emacs22_22.2-0ubuntu2.diff.gz
Files:
d6ee586b8752351334ebf072904c4d51 38694318 emacs22_22.2.orig.tar.gz
2d264719b7d1aea7e446e73c5e68c654 26934 emacs22_22.2-0ubuntu2.diff.gz
Original-Maintainer: Michael W. Olson (GNU address)

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFIv/MoW0JvuRdL8BoRAt5eAJ9vlp/tLgrk4OKHKlqexuK5E2SKcQCdHPuB
5DPs97j8ZSQHIjDU74XphAM=
=MKWY
-----END PGP SIGNATURE-----
$

**** orig.tar.gzの中身を確認
- emacs-22.2として展開される。これはGNU配布版その
ままなのだろう。

$ tar zxf emacs22_22.2.orig.tar.gz
$ ls
emacs-22.2 emacs22_22.2-0ubuntu2.diff.gz emacs22_22.2-0ubuntu2.dsc emacs22_22.2.orig.tar.gz
$ cd emacs-22.2
$ ls
AUTHORS INSTALL configure lib-src mac nt vpath.sed
BUGS Makefile.in configure.in lisp make-dist oldXMenu
CONTRIBUTE README etc lispintro man site-lisp
COPYING config.bat info lispref mkinstalldirs src
ChangeLog config.guess install-sh lwlib move-if-change update-subdirs
FTP config.sub leim m4 msdos vms
$

**** diffファイルの中身を確認
- すべて新規ファイルの作成である。
- すべて、debian/配下のファイルである。

--- emacs22-22.2.orig/debian/emacs-bin-common.overrides.linda
+++ emacs22-22.2/debian/emacs-bin-common.overrides.linda
@@ -0,0 +1,2 @@
+Tag: no-manual-for-binary
+Data: (e|c)(tags|macsclient).emacs22
--- emacs22-22.2.orig/debian/emacsclient.desktop
+++ emacs22-22.2/debian/emacsclient.desktop
@@ -0,0 +1,13 @@
+[Desktop Entry]
+Version=1.0
[snip]

**** dpkg-sourceで展開
- ソースパッケージの展開にはdpkg-sourceを使う。
- これまでの作業で展開したものなどは念のため削除
しておく。

$ ls
emacs22_22.2-0ubuntu2.diff.gz emacs22_22.2-0ubuntu2.dsc emacs22_22.2.orig.tar.gz
$ dpkg-source -x emacs22_22.2-0ubuntu2.dsc
gpg: 2008年09月04日 23時39分36秒 JSTにDSA鍵ID 174BF01Aで施された署名
gpg: 署名を検査できません: 公開鍵が見つかりません
dpkg-source: extracting emacs22 in emacs22-22.2
dpkg-source: info: unpacking emacs22_22.2.orig.tar.gz
dpkg-source: info: applying emacs22_22.2-0ubuntu2.diff.gz
$ ls
emacs22-22.2 emacs22_22.2-0ubuntu2.dsc
emacs22_22.2-0ubuntu2.diff.gz emacs22_22.2.orig.tar.gz
$ cd emacs22-22.2/
$ ls
AUTHORS INSTALL configure leim m4 msdos vms
BUGS Makefile.in configure.in lib-src mac nt vpath.sed
CONTRIBUTE README debian lisp make-dist oldXMenu
COPYING config.bat etc lispintro man site-lisp
ChangeLog config.guess info lispref mkinstalldirs src
FTP config.sub install-sh lwlib move-if-change update-subdirs
$

- 確かに、debian/が増えているだけである。
- orig.tar.gzを展開したときはemacs-22.2だったが、
dpkg-sourceした後は、emacs22-22.2になっている。
これは、orig.tar.gzのファイル名はdebianポリシー
にあわせるが、中身は上流のままというのがポリシー
なのだろう。それを展開時に修正しているのが、

dpkg-source: extracting emacs22 in emacs22-22.2

なのだろう。

$ tar -tvf emacs22_22.2.orig.tar.gz
drwxrwxrwx cyd/cyd 0 2008-03-26 22:55 emacs-22.2/
-rw-r--r-- cyd/cyd 92389 2008-03-26 13:55 emacs-22.2/AUTHORS
-rw-r--r-- cyd/cyd 210 2007-04-15 10:34 emacs-22.2/FTP
[snip]

**** debian/の中身
***** debian/control
- このソースツリーから生成するすべてのパッケージ
のメタデータが記載されている。

Source: emacs22
Section: editors
Priority: optional
Maintainer: Ubuntu Core Developers
XSBC-Original-Maintainer: Michael W. Olson (GNU address)
Build-Depends: libncurses5-dev, texinfo, liblockfile-dev, libgif-dev, libtiff-dev, xaw3dg-dev, libpng12-dev, libjpeg62-dev, libgtk2.0-dev, dpkg-dev (>> 1.10.0), quilt (>= 0.42), lsb-release, debhelper (>= 5.0.0), libxaw7-dev, libasound2-dev [!hurd-i386 !kfreebsd-i386 !kfreebsd-amd64]
Standards-Version: 3.7.2
XS-Vcs-Bzr: http://code.launchpad.net/%7Eubuntu-elisp/emacs/ubuntu/

Package: emacs22-common
Section: editors
Priority: optional
Architecture: all
Depends: emacsen-common (>= 1.4.10), dpkg (>= 1.9.0)
Suggests: emacs22-el
Conflicts: emacs22-el (<< ${source:Version}), w3-el, dictionaries-common (<< 0.60.0), emacs22-common-non-dfsg
Replaces: emacs22-common-non-dfsg
Description: The GNU Emacs editor's common infrastructure
GNU Emacs is the extensible self-documenting text editor.
This package contains the infrastructure common between emacs22,
emacs22-gtk, and emacs22-nox.

Package: emacs22-bin-common
Section: editors
Priority: optional
Architecture: any
Depends: emacs22-common (= ${source:Version}), ${shlibs:Depends}
Description: The GNU Emacs editor's shared, architecture dependent files
GNU Emacs is the extensible self-documenting text editor.
This package contains the architecture dependent infrastructure
that's shared by emacs22, emacs22-gtk, and emacs22-nox.
[snip]

***** debian/rules
- パッケージの構築を実施するプログラム。
- rulesファイルの一行目は

#!/usr/bin/make -f

でなければならない。
- またインターフェイスとして次のターゲットは必須
である。

build [必須]
binary [必須]
binary-arch [必須]
binary-indep [必須]
clean
build-arch
build-indep
get-orig-source

- 中身を多少追ってみる。本格的に追うのはdebhelper
の節にて。

- binaryターゲットは?

binary: binary-indep binary-arch

- この前提条件達は?

binary-indep: build install
dh_testdir -i
dh_testroot -i
dh_installchangelogs -i
dh_installdocs -i
dh_link -i
dh_strip -i
dh_compress -XREADME.Debian -i
dh_fixperms -i
dh_installdeb -i
# don't install maintainer scripts in the metapackage
rm -vf debian/emacs/DEBIAN/{post,pre}{inst,rm}
dh_shlibdeps -i
dh_gencontrol -i
dh_md5sums -i
dh_builddeb -i

binary-arch: build install
dh_testdir -a
dh_testroot -a
dh_installinfo -a
dh_installman -a
dh_installchangelogs -a
dh_installdocs -a
dh_installexamples -a
dh_installmenu -a
dh_desktop -a
dh_link -a
dh_strip -a
dh_compress -a
dh_fixperms -a -X${movemail_bin}
dh_installdeb -a
dh_shlibdeps -a
dh_gencontrol -a
dh_md5sums -a
dh_builddeb -a

- buildターゲットは?

build: patch build-stamp

- patchターゲットは?

これはrulesには存在しない。おそらく、

include /usr/share/quilt/quilt.make

こちらの中にあるのでは。

- build-stampターゲットは?

build-stamp: bootstrap emacs emacs-gtk emacs-nox
dh_testdir
touch $@

- bootstrapターゲットは?

bootstrap: bootstrap-stamp
bootstrap-stamp:
dh_testdir

# Emacs must be bootstrapped at least once in order to
# generate .elc files
CFLAGS="${CFLAGS}" ./configure ${emacs_confflags}
${build_cmd} bootstrap
${build_cmd} distclean

touch $@

- ここでAutotoolsのbootstrapをやってるのだな。
- emacsターゲットは?

emacs: bootstrap emacs-stamp
emacs-stamp:
dh_testdir

$(call emacs_build,${emacs_confflags},x-emacs)
${build_cmd} distclean

touch $@

- emacs_buildマクロとは?

define emacs_build
# Build emacs
CFLAGS="${CFLAGS}" ./configure ${1}
${build_cmd}
# Check for pure space overflow
${check_pure_space}
# save binary from deletion
mv src/emacs src/${2}
endef

- ここで./configureをやる。

- build_cmdマクロとは?

define build_cmd
${MAKE} CFLAGS="${CFLAGS}" LDFLAGS="${LDFLAGS}"
endef

- お、ここでmakeを呼ぶのか。

- パッチあてて、./configureとmakeの流れがどう記述
さているかは理解できた。


**** ビルド環境確認
- 環境はそろっているようだ。

$ sudo apt-get -s build-dep emacs22
パッケージリストを読み込んでいます... 完了
依存関係ツリーを作成しています
状態情報を読み取っています... 完了
アップグレード: 0 個、新規インストール: 0 個、削除: 0 個、保留: 0 個。
$

スタックをかなり積んだ成果が出ている。rulesの中身など、いろいろよく分かる。

こつこつ。

GNUからDebianへ

調べてみたところ、GNU Autoconf/Automake/Libtoolは、第11章以降について、サンプルの現代化がなされていないようだ。自分で現代化していく、というのも勉強になりそうだが、Autotoolsの知識を得ることはスタックの途中にすぎないので、ちょっと重い。

そこで、この本は第10章(US第11章)でいったん区切りとする。先々、今度は主たる目的としてAutotoolsを攻めてみたい。

さて、スタックがひとつ巻き戻った。

次は、Debian Systemのパッケージ構造の基礎を再確認しよう。

教本は、

[入門] Debian パッケージ

にする。昔一度読んだことがあるので、パッケージ構造に関わる部分だけ復習する。

こつこつ。

【autotools】10(US 11) GNU Libtoolとconfigure.inおよびMakefile.am

Autotoolsの新刊がもうすぐ発売される。

AUTOTOOLS

GNU Autoconf/Automake/Libtoolは、少々古いので、それを補えるかもしれない。楽しみです。


** 10(US 11) GNU Libtoolとconfigure.inおよびMakefile.am
- この章は、Automake&Autoconfと一緒にlibtoolを使
う方法の説明。
- 一通り読み、ソースを追い、サンプルを試してみた。
- しかし、何かを「わかった」という実感はない。
- こういう内容は結局実戦で使うときに、理解が発生
するのだろう。
- 今は、触れておくことによってその準備をしている
と考えておく。
- なお、サンプルは、私の環境では、なぜか
Segmentation fault。。。

convenience-2.0 $ ./convenience
cos (0) => 1
Segmentation fault
convenience-2.0 $


こつこつ。

2009年11月25日水曜日

【autotools】9(US 10) GNU Libtool入門 (2)


** 9(US 10) GNU Libtool入門
- Libtoolを単に利用するだけではなく、中身も探って
みよう、シェルプロンプトからLibtoolを使ってみよ
う、というお話。
- ここで、ざっと読んでみるが困難を感じる。
- GNU Libtool Infoをちらっと見てみる。やはり困難
を感じる。
- Linkers & Loadersで勉強。完了。
- GNU Libtool Infoもざっとやる。問題なし。
- そしてこの章に戻ってきた。
- 内容はわかるが、libtoolの利用例が古いlibtoolの
もので、そのままでは動かない。。。
- 最新のlibtoolでの操作に置き換えてみる。

- 訳書P93
- ltconfigによるホスト用libtoolの生成方法が記載
されている。しかし、現状のlibtoolではltconfig
は廃止されており、configureにてホスト用
libtoolを生成するようである。
- Ubuntuでは、Ubuntu用のlibtoolが生成済みで配布
されており、この作業にはソースパッケージが必
要である。
- ここでは割愛する。
- 訳書P97
- ここはlibtoolのI/Fが変更になっているところ。
- 現在は次のとおり。

9-US10 $ libtool --mode=compile gcc -c hello.c
libtool: compile: gcc -c hello.c -fPIC -DPIC -o .libs/hello.o
libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1
9-US10 $ ls
hello.c hello.lo hello.o
9-US10 $ libtool --mode=link gcc -rpath /usr/local/lib -o libhello.la hello.lo
libtool: link: gcc -shared .libs/hello.o -Wl,-soname -Wl,libhello.so.0 -o .libs/libhello.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libhello.so.0" && ln -s "libhello.so.0.0.0" "libhello.so.0")
libtool: link: (cd ".libs" && rm -f "libhello.so" && ln -s "libhello.so.0.0.0" "libhello.so")
libtool: link: ar cru .libs/libhello.a hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la" "libhello.la" )
9-US10 $ ls
hello.c hello.lo hello.o libhello.la
9-US10 $

- 次の部分は、本文にコンパイルとあるのでmodeを
compileにしているが、rpathスイッチがあるとい
うことはリンクすべきではないか。

9-US10 $ libtool --mode=compile c89 -rpath /usr/local/lib -c hello.c
libtool: compile: unable to infer tagged configuration
libtool: compile: specify a tag with `--tag'
9-US10 $

- 訳書P98

9-US10 $ libtool --mode=link gcc -static -o libhello.la hello.lo
libtool: link: ar cru .libs/libhello.a hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la" "libhello.la" )
9-US10 $ ls
hello.c hello.lo hello.o libhello.la
9-US10 $

- 訳書P100

9-US10 $ libtool --mode=link gcc -o libtrim.la trim.lo
libtool: link: ar cru .libs/libtrim.a .libs/trim.o
libtool: link: ranlib .libs/libtrim.a
libtool: link: ( cd ".libs" && rm -f "libtrim.la" && ln -s "../libtrim.la" "libtrim.la" )
9-US10 $

- 訳書P100からP101へのまたぎ

9-US10 $ libtool --mode=link gcc -o libgraphics.la -lpng -ltiff -ljpeg -lz
libtool: link: ar cru .libs/libgraphics.a
libtool: link: ranlib .libs/libgraphics.a
libtool: link: ( cd ".libs" && rm -f "libgraphics.la" && ln -s "../libgraphics.la" "libgraphics.la" )
9-US10 $

- 訳書P101からP102へのまたぎ
- 実行可能ファイルのリンクをする前の仮定が省略
されているのでそこもやっておく。

hello $ ls
Makefile.am bootstrap configure.ac hello.c main.c
hello $ libtool --mode=compile gcc -c hello.c
libtool: compile: gcc -c hello.c -fPIC -DPIC -o .libs/hello.o
libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1
hello $ libtool --mode=link gcc -rpath /usr/local/lib -o libhello.la hello.lo
libtool: link: gcc -shared .libs/hello.o -Wl,-soname -Wl,libhello.so.0 -o .libs/libhello.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libhello.so.0" && ln -s "libhello.so.0.0.0" "libhello.so.0")
libtool: link: (cd ".libs" && rm -f "libhello.so" && ln -s "libhello.so.0.0.0" "libhello.so")
libtool: link: ar cru .libs/libhello.a hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la" "libhello.la" )
hello $ ls
Makefile.am bootstrap configure.ac hello.c hello.lo hello.o libhello.la main.c
hello $ libtool --mode=link gcc -o hello main.c libhello.la
libtool: link: gcc -o .libs/hello main.c ./.libs/libhello.so
hello $ ls
Makefile.am configure.ac hello.c hello.o main.c
bootstrap hello hello.lo libhello.la
hello $ ./hello
Hello, World!
hello $

- 訳書P102

hello $ libtool --mode=link gcc -static -o hello main.c libhello.la
libtool: link: gcc -o hello main.c ./.libs/libhello.a
hello $

- 訳書P103

- この例は、loader.oが存在しないので実行できな
い。

- 訳書P105

intro-hello $ rm hello *.a *.o
intro-hello $ libtool --mode=compile gcc -c trim.c
libtool: compile: gcc -c trim.c -fPIC -DPIC -o .libs/trim.o
libtool: compile: gcc -c trim.c -o trim.o >/dev/null 2>&1
intro-hello $ libtool --mode=link gcc -rpath /usr/local/lib -o libtrim.la trim.lo
libtool: link: gcc -shared .libs/trim.o -Wl,-soname -Wl,libtrim.so.0 -o .libs/libtrim.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libtrim.so.0" && ln -s "libtrim.so.0.0.0" "libtrim.so.0")
libtool: link: (cd ".libs" && rm -f "libtrim.so" && ln -s "libtrim.so.0.0.0" "libtrim.so")
libtool: link: ar cru .libs/libtrim.a trim.o
libtool: link: ranlib .libs/libtrim.a
libtool: link: ( cd ".libs" && rm -f "libtrim.la" && ln -s "../libtrim.la" "libtrim.la" )
intro-hello $

- 訳書P106

intro-hello $ libtool --mode=compile gcc -c hello.c
libtool: compile: gcc -c hello.c -fPIC -DPIC -o .libs/hello.o
libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1
intro-hello $ libtool --mode=link gcc -rpath /usr/local/lib -o libhello.la hello.lo libtrim.la
libtool: link: gcc -shared .libs/hello.o -Wl,-rpath -Wl,/home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs ./.libs/libtrim.so -Wl,-soname -Wl,libhello.so.0 -o .libs/libhello.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libhello.so.0" && ln -s "libhello.so.0.0.0" "libhello.so.0")
libtool: link: (cd ".libs" && rm -f "libhello.so" && ln -s "libhello.so.0.0.0" "libhello.so")
libtool: link: ar cru .libs/libhello.a hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la" "libhello.la" )
intro-hello $ ls
hello.c hello.lo hello.o libhello.la libtrim.la main.c trim.c trim.lo trim.o
intro-hello $ libtool --mode=link gcc -o hello main.c libhello.la
libtool: link: gcc -o .libs/hello main.c ./.libs/libhello.so /home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs/libtrim.so
main.c: In function 'main':
main.c:7: warning: incompatible implicit declaration of built-in function 'exit'
intro-hello $ ./hello
Hello, World!
intro-hello $

- 訳書P107

intro-hello $ libtool --mode=link gcc -o hello-again -static main.c libhello.la
libtool: link: gcc -o hello-again main.c ./.libs/libhello.a /home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs/libtrim.a
main.c: In function 'main':
main.c:7: warning: incompatible implicit declaration of built-in function 'exit'
intro-hello $ ls
hello hello.c hello.o libtrim.la trim.c trim.o
hello-again hello.lo libhello.la main.c trim.lo
intro-hello $ ./hello-again
Hello, World!
intro-hello $

intro-hello $ libtool --mode=link gcc -o hello main.c libhello.la
libtool: link: gcc -o .libs/hello main.c ./.libs/libhello.so -Wl,-rpath -Wl,/home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/_inst
main.c: In function 'main':
main.c:7: warning: incompatible implicit declaration of built-in function 'exit'
intro-hello $ ./hello
Hello, World!
intro-hello $

- 訳書P109

intro-hello $ libtool --mode=execute gdb hello
GNU gdb 6.8-debian
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu"...
(gdb) run
Starting program: /home/aka/local/work/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs/lt-hello
Hello, World!

Program exited normally.
(gdb)

- 訳書P109
- libhelloはインストールできるが、libtrimはイン
ストールできない。なぜか。

intro-hello $ sudo libtool --mode=install cp libtrim.la /usr/local/lib/
libtool: install: cp .libs/libtrim.lai /usr/local/lib/libtrim.la
cp: cannot stat `.libs/libtrim.lai': No such file or directory
intro-hello $ sudo libtool --mode=install install -c libtrim.la /usr/local/lib/
libtool: install: install -c .libs/libtrim.lai /usr/local/lib/libtrim.la
install: cannot stat `.libs/libtrim.lai': No such file or directory
intro-hello $ sudo libtool --mode=install install -c libhello.la /usr/local/lib/
libtool: install: install -c .libs/libhello.so.0.0.0 /usr/local/lib/libhello.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libhello.so.0.0.0 libhello.so.0 || { rm -f libhello.so.0 && ln -s libhello.so.0.0.0 libhello.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libhello.so.0.0.0 libhello.so || { rm -f libhello.so && ln -s libhello.so.0.0.0 libhello.so; }; })
libtool: install: install -c .libs/libhello.lai /usr/local/lib/libhello.la
libtool: install: install -c .libs/libhello.a /usr/local/lib/libhello.a
libtool: install: chmod 644 /usr/local/lib/libhello.a
libtool: install: ranlib /usr/local/lib/libhello.a
libtool: install: warning: remember to run `libtool --finish /home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/_inst'
intro-hello $

- そうか。コンビニエンスライブラリの流れ
で、-rpathを一度/usr/local/libから外している
から駄目なんだろうな。通常のライブラリでやり
直していれてみる。

intro-hello $ rm hello hello-again *.la *.lo *.o
intro-hello $ ls
hello.c main.c trim.c
intro-hello $ libtool --mode=compile gcc -c trim.c
libtool: compile: gcc -c trim.c -fPIC -DPIC -o .libs/trim.o
libtool: compile: gcc -c trim.c -o trim.o >/dev/null 2>&1
intro-hello $ libtool --mode=link gcc -rpath /usr/local/lib -o libtrim.la trim.lo
libtool: link: rm -fr .libs/libtrim.a .libs/libtrim.la
libtool: link: gcc -shared .libs/trim.o -Wl,-soname -Wl,libtrim.so.0 -o .libs/libtrim.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libtrim.so.0" && ln -s "libtrim.so.0.0.0" "libtrim.so.0")
libtool: link: (cd ".libs" && rm -f "libtrim.so" && ln -s "libtrim.so.0.0.0" "libtrim.so")
libtool: link: ar cru .libs/libtrim.a trim.o
libtool: link: ranlib .libs/libtrim.a
libtool: link: ( cd ".libs" && rm -f "libtrim.la" && ln -s "../libtrim.la" "libtrim.la" )
intro-hello $ libtool --mode=compile gcc -c hello.c
libtool: compile: gcc -c hello.c -fPIC -DPIC -o .libs/hello.o
libtool: compile: gcc -c hello.c -o hello.o >/dev/null 2>&1
intro-hello $ libtool --mode=link gcc -rpath /usr/local/lib -o libhello.la hello.lo libtrim.la
libtool: link: rm -fr .libs/libhello.a .libs/libhello.la .libs/libhello.lai .libs/libhello.so .libs/libhello.so.0 .libs/libhello.so.0.0.0
libtool: link: gcc -shared .libs/hello.o -Wl,-rpath -Wl,/home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs ./.libs/libtrim.so -Wl,-soname -Wl,libhello.so.0 -o .libs/libhello.so.0.0.0
libtool: link: (cd ".libs" && rm -f "libhello.so.0" && ln -s "libhello.so.0.0.0" "libhello.so.0")
libtool: link: (cd ".libs" && rm -f "libhello.so" && ln -s "libhello.so.0.0.0" "libhello.so")
libtool: link: ar cru .libs/libhello.a hello.o
libtool: link: ranlib .libs/libhello.a
libtool: link: ( cd ".libs" && rm -f "libhello.la" && ln -s "../libhello.la" "libhello.la" )
intro-hello $ libtool --mode=link gcc -o hello main.c libhello.la
libtool: link: gcc -o .libs/hello main.c ./.libs/libhello.so /home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs/libtrim.so
main.c: In function 'main':
main.c:7: warning: incompatible implicit declaration of built-in function 'exit'
intro-hello $ ./hello
Hello, World!
intro-hello $ ls .libs
hello libhello.la libhello.so.0 libtrim.la libtrim.so.0 trim.o
hello.o libhello.lai libhello.so.0.0.0 libtrim.lai libtrim.so.0.0.0
libhello.a libhello.so libtrim.a libtrim.so lt-hello
intro-hello $ sudo libtool --mode=install cp libtrim.la /usr/local/lib
[sudo] password for aka:
libtool: install: cp .libs/libtrim.so.0.0.0 /usr/local/lib/libtrim.so.0.0.0
libtool: install: (cd /usr/local/lib && { ln -s -f libtrim.so.0.0.0 libtrim.so.0 || { rm -f libtrim.so.0 && ln -s libtrim.so.0.0.0 libtrim.so.0; }; })
libtool: install: (cd /usr/local/lib && { ln -s -f libtrim.so.0.0.0 libtrim.so || { rm -f libtrim.so && ln -s libtrim.so.0.0.0 libtrim.so; }; })
libtool: install: cp .libs/libtrim.lai /usr/local/lib/libtrim.la
libtool: install: cp .libs/libtrim.a /usr/local/lib/libtrim.a
libtool: install: chmod 644 /usr/local/lib/libtrim.a
libtool: install: ranlib /usr/local/lib/libtrim.a
libtool: finish: PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/X11R6/bin:/sbin" ldconfig -n /usr/local/lib
----------------------------------------------------------------------
Libraries have been installed in:
/usr/local/lib

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
- add LIBDIR to the `LD_LIBRARY_PATH' environment variable
during execution
- add LIBDIR to the `LD_RUN_PATH' environment variable
during linking
- use the `-Wl,-rpath -Wl,LIBDIR' linker flag
- have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
intro-hello $

- 入った。

- 訳書P109

intro-hello $ sudo libtool --mode=execute cp hello /usr/local/bin
intro-hello $

- helloではなく、lt-helloとして入る。
- ライブラリパスをみるとローカルになっている。
なんでだろう。

intro-hello $ readelf -d /usr/local/bin/lt-hello

Dynamic section at offset 0xe10 contains 24 entries:
Tag Type Name/Value
0x0000000000000001 (NEEDED) Shared library: [libhello.so.0]
0x0000000000000001 (NEEDED) Shared library: [libtrim.so.0]
0x0000000000000001 (NEEDED) Shared library: [libc.so.6]
0x000000000000000f (RPATH) Library rpath: [/home/aka/scratch/autotools/9-US10/hello-2.0/intro-hello/.libs]
0x000000000000000c (INIT) 0x400568
0x000000000000000d (FINI) 0x4007b8
0x0000000000000004 (HASH) 0x400278
0x000000006ffffef5 (GNU_HASH) 0x4002b8
0x0000000000000005 (STRTAB) 0x4003f8
0x0000000000000006 (SYMTAB) 0x4002f0
0x000000000000000a (STRSZ) 213 (bytes)
0x000000000000000b (SYMENT) 24 (bytes)
0x0000000000000015 (DEBUG) 0x0
0x0000000000000003 (PLTGOT) 0x600fe8
0x0000000000000002 (PLTRELSZ) 72 (bytes)
0x0000000000000014 (PLTREL) RELA
0x0000000000000017 (JMPREL) 0x400520
0x0000000000000007 (RELA) 0x400508
0x0000000000000008 (RELASZ) 24 (bytes)
0x0000000000000009 (RELAENT) 24 (bytes)
0x000000006ffffffe (VERNEED) 0x4004e8
0x000000006fffffff (VERNEEDNUM) 1
0x000000006ffffff0 (VERSYM) 0x4004ce
0x0000000000000000 (NULL) 0x0
intro-hello $


- 訳書P115
- lt-helloが謎だ。

intro-hello $ sudo libtool --mode=execute cp hello /usr/local/bin
intro-hello $ sudo libtool --mode=uninstall rm -f /usr/local/bin/hello
intro-hello $ ls /usr/local/bin
gauche-cesconv gauche-config gauche-install gauche-package gosh lt-hello
intro-hello $ sudo libtool --mode=uninstall rm -f /usr/local/lib/libhello.la
libtool: uninstall: rm -f /usr/local/lib/libhello.la /usr/local/lib/libhello.so.0.0.0 /usr/local/lib/libhello.so.0 /usr/local/lib/libhello.so /usr/local/lib/libhello.a
intro-hello $ sudo libtool --mode=uninstall rm -f /usr/local/bin/lt-hello
libtool: uninstall: rm -f /usr/local/bin/lt-hello
intro-hello $ sudo libtool --mode=uninstall rm -f /usr/local/lib/libtrim.la
libtool: uninstall: rm -f /usr/local/lib/libtrim.la /usr/local/lib/libtrim.so.0.0.0 /usr/local/lib/libtrim.so.0 /usr/local/lib/libtrim.so /usr/local/lib/libtrim.a
intro-hello $ ls /usr/local/lib
eclipse gauche libgauche.so libgauche.so.0 libgauche.so.0.8.14 python2.5 site_ruby
intro-hello $


こつこつ。