2009-08-02
Macでxml-lightを使おう
Mac |
xml-light便利ですよね。厳密なスキーマのチェックとかが要らなくて、とりあえずXMLを扱いたいときとかにぴったり。
でもMacPortsでxml-lightをインストールしても、ocamlfindから見えなくて結構不便です。
なんとかしましょう。
何が問題なの?
# xml-lightをインストールした! $ sudo port install xml-light .... # でもocamlfindからは見えない>< $ ocamlfind list | grep xml-light
なぜocamlfindから見えないかというと、xml-lightのMakefileがocamlfindに対応していないからです。
ここで解決方法は2つあります。
方法1:自分でxml-lightをビルドする
普通にビルドする。うっかりmake installしちゃわないように注意してください。
$ wget http://tech.motion-twin.com/zip/xml-light-2.2.zip $ unzip xml-light-2.2.zip $ cd xml-light $ make all $ make opt
適当にMETAファイルを作ってやる。ボクは以下の内容をMETAというファイルに保存して使ってます。
name="xml-light" version="2.2" description="minimal XML parser & printer" requires="" archive(byte) = "xml-light.cma" archive(native) = "xml-light.cmxa"
ocamlfindを使ってインストールする。
$ vi META # 上記の内容を保存する .... $ ocamlfind install xml-light META xml-light.a xml-light.cma xml-light.cmxa *.cmo *.cmi *.cmx *.cmx"
これでocamlfindから使えるようになりました。
$ ocamlfind list | grep xml-light xml-light (version: 2.2)
方法2: ボクの作ったPortfileを使う
上で書いた内容をやってくれるPortfileを作りました。
port installするだけでxml-lightをインストールできます。
$ wget http://howdyworld.org/patches/Portfile
$ sudo port install
$ ocamlfind list | grep xml-light xml-light (version: 2.2)
Portfile
念のためPortfileの中身をここにも貼っておきますね。META.zipは、上記のMETAファイルをzipで圧縮しただけのファイルです。
# $Id: $ PortSystem 1.0 name caml-xml-light version 2.2 categories devel,ml maintainers mzpppp@gmail.com description Objective Caml interface for XML parsing and printing with ocamlfind long_description XML Light is a minimal XML parser & printer for OCaml. \ It provide functions to parse an XML document into an \ OCaml data structure, work with it, and print it back \ to an XML document. homepage http://tech.motion-twin.com/xmllight/ distfiles xml-light-${version}.zip:master META.zip:patch master_sites http://tech.motion-twin.com/zip/:master \ http://howdyworld.org/patches/:patch checksums xml-light-${version}.zip md5 7658985cfdaeeb94b579b932eeaa3e00 \ META.zip md5 7d48a50a3918d7de1d772d83b6700d9d use_zip yes use_configure no worksrcdir xml-light build.target all opt depends_lib port:ocaml \ port:caml-findlib destroot.cmd ocamlfind destroot.target install pre-destroot { set ocaml_site_path [exec ocamlfind printconf destdir] } destroot { set ocaml_site_path [exec ocamlfind printconf destdir] file mkdir ${destroot}/${ocaml_site_path} system "cd ${worksrcpath} && ocamlfind install -destdir ${destroot}/${ocaml_site_path} xml-light META xml-light.a xml-light.cma xml-light.cmxa *.cmo *.cmi *.cmx *.cmx" }
コメントを書く
propella
2009/08/08 08:32
書いてある通りにしたら上手く行きました。ありがとうございます!
トラックバック - http://ocaml-nagoya.g.hatena.ne.jp/mzp/20090802
リンク元
- 4 http://happyabc.org/docs/faq.html
- 4 http://d.hatena.ne.jp/mzp/
- 3 http://www.google.co.jp/search?q=cygwin+ocaml+pervasives&lr=lang_ja&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&client=firefox-a
- 3 http://www.google.co.jp/search?q=ocaml+pervasives.cmi&lr=lang_ja&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:ja:official&client=firefox-a
- 3 http://www.google.co.jp/search?hl=ja&q=omake+ocaml+error&lr=
- 3 http://d.hatena.ne.jp/teens/20090724/1248415581
- 2 http://www.google.co.jp/search?hl=ja&q=Fatal+error:+cannot+open+pervasives.cmi&btnG=Google+検索&lr=&aq=f&oq=
- 2 http://www.google.se/search?q="File "pervasives.mli", line 1, characters 0-1:"
- 2 http://ocaml-nagoya.g.hatena.ne.jp/
- 2 http://www.google.co.jp/