どうもHaskellで書かれたCUIのTwitterクライアントtwidgeを導入しようとした時の記録です.
- まずtwidgeをダウンロード(Old Software Sites - Complete.Org),解凍
- INSTALLによると
Try:
ghc --make -o setup Setup.lhs
./setup configure
./setup build
./setup installTo run, you will need to have curl installed
-
- ghc(The Glasgow Haskell Compiler) でmakeすると知る
- ghcをダウンロード(http://www.haskell.org/ghc/download_ghc_6_12_1.html#macosxintel)(GHC...pkgね),解凍,install
- twidgeをmakeできた.
% ghc --make -o setup Setup.lhs
- setupでパッケージが足りないと出る.
% ./setup configure Configuring twidge-0.99.3... setup: At least the following dependencies are missing: ConfigFile -any, HSH -any, MissingH >=1.0.0, hslogger -any, mtl -any, network -any, parsec -any, regex-posix -any
-
- hs-cabalというものでパッケージ管理ができると知り(cabalコマンドの使い方 - あどけない話)
sudo port install hs-cabal(これは無意味に終わる)Xcodeのバージョンが3.0で,3.1以上を要求される
- > Computing dependencies for hs-cabal
- > Fetching gmp
- > Attempting to fetch gmp-4.3.2.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU/gmp
- > Verifying checksum(s) for gmp
- > Extracting gmp
- > Applying patches to gmp
- > Configuring gmp
- > Building gmp
- > Staging gmp into destroot
- > Installing gmp @4.3.2_0
- > Activating gmp @4.3.2_0
- > Cleaning gmp
- > Fetching ghc
On Mac OS X 10.5, ghc 6.10.4 requires Xcode 3.1 but you have Xcode 3.0.
Error: Target org.macports.fetch returned: incompatible Xcode version
Error: The following dependencies failed to build: hs-http ghc hs-libcabal hs-zlib
Error: Status 1 encountered during processing.
Before reporting a bug, first run the command again with the -d flag to get complete output.
ソースからcabalを入れるThe Haskell CabalこっからCabal libraryをダウンロードして,
ghc --make Setup
./Setup configure --user
./Setup build
./Setup install
-
configureしたら
Configuring Cabal-1.6.0.2...
Setup: failed to parse output of 'ghc-pkg dump'
-
- Setup: failed to parse output of 'ghc-pkg dump'
- 調べるとghc入れたらcabalは入ってるらしい(haskell - Getting Cabal to work with GHC 6.12.1 - Stack Overflow)
- cabal-installをダウンロード(さっきのCabal library の下にある),解凍,インストール
$ ./bootstrap.sh
It will download and install the above three dependencies. The script will
install the library packages into `$HOME/.cabal/` and the `cabal` program will
be installed into `$HOME/.cabal/bin/`.You then have two choices:
* put `$HOME/.cabal/bin` on your `$PATH`
* move the `cabal` program somewhere that is on your `$PATH`The next thing to do is to get the latest list of packages with:
$ cabal update
-
- bootstrap.sh実行して(実行権限がついてなかった),~/.cabal/bin/cabalをパス通ってるところにシンボリックリンクはった.
- cabal update
- これでパッケージ管理ができるはず
- twidgeのディレクトリに戻って
% ./setup configure Configuring twidge-0.99.3... setup: At least the following dependencies are missing: ConfigFile -any, HSH -any, HaXml >=1.13.2 && <1.19, MissingH >=1.0.0, hslogger -any, mtl -any, network -any, parsec -any, regex-posix -any
-
- とのことで,パッケージをまとめてインストール.かなーり時間かかった
% cabal install ConfigFile HSH HaXml MissingH hslogger mtl network parsec regex-posix
% ./setup configure Configuring twidge-0.99.3... setup: At least the following dependencies are missing: ConfigFile -any, HSH -any, HaXml >=1.13.2 && <1.19, MissingH >=1.0.0, hslogger -any, mtl -any, network -any, parsec -any, regex-posix -any
-
- なんでやと思ったら,パッケージもユーザーディレクトリに保存されている模様
% ./setup configure --user Configuring twidge-0.99.3... setup: At least the following dependencies are missing: HaXml >=1.13.2 && <1.19
-
- HaXmlのバージョンが最新のだと新しいすぎるらしいので,HaXml: Utilities for manipulating XML documents | HackageからHaXml-1.13.3.tar.gzをダウンロードして,解凍,
runhaskell Setup.hs configure
runhaskell Setup.hs build
runhaskell Setup.hs install
-
- installにはsudoが必要やった.
- これでやっとパッケージがそろったのでtwidgeディレクトリに戻って
% ./setup configure --user % ./setup build % ./setup install
-
- そんで,twidgeが動くようになった
- でもパスを通してなかったので,下ので動く
% ~/.cabal/bin/twidge
-
- このヘルプは短い
~/.cabal/bin/twidge --help
-
- これで詳細なヘルプ
~/.cabal/bin/twidge lscommands
twitterのユーザー名とパスワードを設定
~/.cabal/bin/twidge setup
~/.cabal/bin/twidge lsrecent curl: (1) Protocol https not supported or disabled in libcurl twidge: user error (("curl",["-A","twidge v1.0.0; Haskell; GHC","-s","-S","-L","-y","60","-Y","1","--retry","2","-f","--user","USERNAME:PASSWORD","https://twitter.com/statuses/friends_timeline.xml?page=1"]): exited with code 1)
- 調べると
So if you’ve already got curl installed with macports, you’ll probably want to uninstall it, then clean to be sure, then reinstall with the variant name:
sudo port uninstall curl
Enabling HTTPS support in curl installed through MacPorts on OSX - Ted Naleid
sudo port clean curl
sudo port install curl +ssl
---> Unable to uninstall curl 7.19.6_0, the following ports depend on it: ---> git-core Error: port uninstall failed: Please uninstall the ports that depend on curl first.
-
- ってわけで,sslを追加してみる
sudo port -f upgrade curl +ssl
-
- おーこれでtwidgeでTLを見ることができるようになった.
- が,文字化けした.
@eagletmtさんがMacで使っているようだったのでつぶやいてみたところすぐにリプライを返してくださったので,以下のパッチを適用.というか書き換えてtwidgeを入れ直す
--- Ls.hs 2010-02-21 04:38:46.000000000 +0900 +++ Ls.hs.orig 2010-02-21 04:37:08.000000000 +0900 @@ -251,8 +251,8 @@ (Just cmd, _) -> runIO $ (cmd, [sId m, sSender m, sRecipient m, sText m, sDate m]) - (Nothing, Nothing) -> putStr (shortfunc m) - (Nothing, Just _) -> putStr (longfunc m) + (Nothing, Nothing) -> UTF8.putStr (shortfunc m) + (Nothing, Just _) -> UTF8.putStr (longfunc m) Just recipient -> mailto section cp args m recipient where msgid = genMsgId section m cp
% ghc --make -o setup Setup.lhs % ./setup configure --user % ./setup build % ./setup install
これで
% ~/.cabal/bin/twidge lsrecent <peccul> やったーーやっとtwidgeが使えるようになった模様!TLをターミナルで見れるぞ.ということはemacsからも見れる笑 <peccul> @eagletmt いけました!ありがとうございます. <peccul> @eagletmt U.putStrというのはUTF8.putStr (shortfunc m)とUTF8.putStr (longfunc m)のことでしょうか?書き換えてインストールし直してみます.ghcは6.12.1でした
と,ばっちり動くようになりましたーー
あー長かった.
使い方またこんど読んでみよ