ptexliveのインストールメモ

ptexliveMac OS Xにインストールしたので,そのメモ.

環境は:

インストールするのは:

  • TeX Live 2009 (texlive2009-20091107.iso)
  • ptexlive (ptexlive-20100711.tar.gz)

手順

1. READMEの指示通りにtexlive2009-20091107.iso.xzをダウンロード.
古いのでどこにも置いていない場合がある. ftp://tug.org/historic/systems/texlive/2009/ に古いものがアーカイブされている.
2. 伸長してISOファイルをマウント.
3. 次にインストーラを実行するのだが,環境によってはumaskによって問題が生じる可能性がある.
4. root権限でインストーラ(install-tl)を実行.
5. ここで,もしも4でumaskが0077などの場合,ptexliveのコンパイルが上手く行かない場合があるので,TeXLiveのインストール先を確認し,適切なパーミッションに変更すること.
6. READMEの指示通りにptexlive-20100711.tar.gzをダウンロードして展開.
7. ptexlive.sampleを../ptexlive.cfgにコピーしてこれを編集.
8. ビルド.対話的実行の部分があるので,これに答える.ちなみに一時作業場所は「/var/tmp/ptexlive2009」らしい.otfパッケージを使いたかったので,make otfを実行.babelは未実装らしい.
9. 「make test」と打ってテストを実行.この時「[CVE-2007-0104] test」でテストが失敗する.これはどうやらテストのスクリプトが間違えているらしい:

$ diff -u 8test.sh.back 8test.sh
--- 8test.sh.back       2010-08-11 15:55:27.000000000 +0900
+++ 8test.sh    2010-08-11 15:55:58.000000000 +0900
@@ -222,7 +222,7 @@
 \includegraphics{../security/MOAB-06-01-2007.pdf}
 \end{document}
 EOF
-if ! $BIN/pdflatex xpdf.tex 2>&1 | grep "recursive calls" > /dev/null; then
+if ! $BIN/pdflatex xpdf.tex 2>&1 | grep "Loop in Pages tree" > /dev/null; then
     echo "CVE-2007-0104 is not fixed."
     exit 1
 fi

このように変更すると,テストが通った.
10. ここで再びumaskを確認する.環境によっては11で行うインストールで,グループとその他に適切なパーミッションが与えられない場合がある.
11. 「make install」と打ってインストールを実行.
12. インストール先にパスを通す.
13. ヒラギノフォントをPDFに埋め込みたい場合は「sudo updmap-sys --setoption kanjiEmbed hiragino」と打つ(参考情報).これだけで埋め込み設定を行ってくれるようだ,非常に素晴らしい.ユーザ権限でupdmapを使ってもいいだろうけれど,実は私の場合はパーミッションの設定が適切ではなかった(私の設定ミスなのか分かならないので,回避策不明)ので,設定できなかった.

TODO

Wikiに動作報告を投げる.

ビルドがautoreconf(autoconf)でこける

という環境において,いくつかのportで「error: possibly undefined macro: AS_MESSAGE_LOG_FDdnl」というエラーになる.

解決方法は,Changeset 69426 – MacPortsを使ってautoconf @2.65_1に戻し,これを使ってエラーが出たportのビルドする.

moveが気になったので

魔導書Vol.1で触れられていたC++0xのmoveが気になったので,ちょっと書いてみた.

#include <iostream>

using namespace std;

struct Foo {
  int v_;
  
  Foo() : v_(0) { cout << "ctor (default) for " << this << endl; }
  Foo(int a) : v_(a) { cout << "ctor (with int) for " << this << endl; }
  Foo(const Foo &x) : v_(x.v_) { cout << "ctor (copy) for " << this << endl; }
  Foo(Foo &&x) : v_(move(x.v_)) { cout << "ctor (move) for " << this << endl; }
  ~Foo() { cout << "dtor for " << this << endl; }
  
  friend ostream &operator<<(ostream &ost, const Foo &x)
  {
    ost << x.v_ << " in " << &x;
    return ost;
  }
  
  friend Foo operator+(const Foo &a, const Foo &b)
  {
    cout << __func__ << endl;
    Foo ret;
    ret.v_ = a.v_ + b.v_;
    return ret;
  }
  
  friend Foo &&operator+(const Foo &a, Foo &&b)
  {
    cout << __func__ << " (with [l, r])"<< endl;
    b.v_ += a.v_;
    return move(b);
  }
  
  friend Foo &&operator+(Foo &&a, const Foo &b)
  {
    cout << __func__ << " (with [r, l])"<< endl;
    a.v_ += b.v_;
    return move(a);
  }
  
  friend Foo &&operator+(Foo &&a, Foo &&b)
  {
    cout << __func__ << " (with [r, r])"<< endl;
    a.v_ += b.v_;
    return move(a);
  }
};

int main()
{
  {
    Foo a(1) ,b(2), c(3), d(4), e(5);
    puts("");
    
    Foo f = a + b + c + d + e;
    cout << f << endl;
    puts("");

    Foo g = a + (b + (c + (d + e)));
    cout << g << endl;
    puts("");
    
    Foo i = (a + b) + c + (d + e);
    cout << i << endl;
    puts("");
  }
  
  return 0;
}
$ g++-mp-4.5 -std=c++0x move.cpp
$ ./a.out 
ctor (with int) for 0xbfffeb5c
ctor (with int) for 0xbfffeb58
ctor (with int) for 0xbfffeb54
ctor (with int) for 0xbfffeb50
ctor (with int) for 0xbfffeb4c

operator+
ctor (default) for 0xbfffeb60
operator+ (with [r, l])
operator+ (with [r, l])
operator+ (with [r, l])
ctor (move) for 0xbfffeb48
dtor for 0xbfffeb60
15 in 0xbfffeb48

operator+
ctor (default) for 0xbfffeb64
operator+ (with [l, r])
operator+ (with [l, r])
operator+ (with [l, r])
ctor (move) for 0xbfffeb44
dtor for 0xbfffeb64
15 in 0xbfffeb44

operator+
ctor (default) for 0xbfffeb68
operator+
ctor (default) for 0xbfffeb6c
operator+ (with [r, l])
operator+ (with [r, r])
ctor (move) for 0xbfffeb40
dtor for 0xbfffeb6c
dtor for 0xbfffeb68
15 in 0xbfffeb40

dtor for 0xbfffeb40
dtor for 0xbfffeb44
dtor for 0xbfffeb48
dtor for 0xbfffeb4c
dtor for 0xbfffeb50
dtor for 0xbfffeb54
dtor for 0xbfffeb58
dtor for 0xbfffeb5c

仕様書とその実装の全てを把握している訳ではないので何とも言えないし,Fooのメンバ変数はintだからあまり意味が無いかもしれないけど,Expression Templateの方が全体を構成した後に計算できそうな感じだなぁ…

たぶん,コンストラクタ周りでオーバーヘッドを潰すスパイス,みたいな感じで使えばいいのかな?(抽象的な表現だなぁ

追記

暗黙なムーブコンストラクタとムーブ代入演算子が導入されるそうだ.

あ,上のコードは代入演算子は定義してないや…

リンク先の定義だと,メンバ変数が実体であれポインタ(参照)であれ「移動」ではなくて「コピー」になるのか?…コメントされているような定義ではないんだなぁ.

新バージョンがリリースされているのにfetchに失敗する場合

新バージョンがリリースされているのに,ダウンロード元に指定している配信サーバーに新しいファイルが無いため,fetchでエラーが起きる場合は:

  • ${PREFIX}/var/macports/distfiles/${PORTNAME} にマニュアルでダウンロードして保存.

して対処.

関数を1つ引数に取り,これを二回適用する(合成する)関数を返す高階関数

ふむ,元ネタは:

かな?

ffmpegでiPod touch用に再エンコード

$ ffmpeg -i _INPUT_FILE_ -vcodec libx264 -vpre default -acodec libfaac -coder 0 -level 13 -threads 2 -flags loop -deblockalpha 2 -qmin 21 -sameq _OUTPUT_FILE_.mp4

入力ファイルはmpegだけど,詳しい形式はメモし忘れたので,後で調べる.