wgetをビルド

宗教上の理由で、入れないに越したことはないのだが、wgetのビルドにgccが必要で、観念してxcode入れる。
https://itunes.apple.com/jp/app/xcode/id497799835
Mac App Storeで見るボタンを押してやる。
AppStoreアプリが起動したら、青い無料ボタンをクリック。
"Appをインストール"の緑色に変わったら、もう一度クリック。
サインインを求められる。
ダウンロード開始される。
入ったのはバージョン 4.6.3。


アプリケーションフォルダにインストールされるので、起動する。
3.54GBって、でかすぎでしょ...
ライセンスに同意。英語しかないのかよ。
いらないが、Device Supportのインストールを求められる。
キャンセルできないので入れる。
インストールが終わると起動ボタンが出る。
起動したら、メニューからPreferencesを選ぶ。
Downloadsタブを選び、Command Line Toolsの右にあるインストールボタンを押す。
118.5MBだというのに、えらく時間がかかる。
Installedに変わったら終わり。
xcodeを終わる。


gccのバージョン確認。

$ gcc -v
Using built-in specs.
Target: i686-apple-darwin11
Configured with: /private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/src/configure --disable-checking --enable-werror --prefix=/Applications/Xcode.app/Contents/Developer/usr/llvm-gcc-4.2 --mandir=/share/man --enable-languages=c,objc,c++,obj-c++ --program-prefix=llvm- --program-transform-name=/^[cg][^.-]*$/s/$/-4.2/ --with-slibdir=/usr/lib --build=i686-apple-darwin11 --enable-llvm=/private/var/tmp/llvmgcc42/llvmgcc42-2336.11~182/dst-llvmCore/Developer/usr/local --program-prefix=i686-apple-darwin11- --host=x86_64-apple-darwin11 --target=i686-apple-darwin11 --with-gxx-include-dir=/usr/include/c++/4.2.1
Thread model: posix
gcc version 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)


wgetを入れる。

$ mkdir localbuild
$ cd localbuild/
$ curl -O http://ftp.gnu.org/pub/gnu/wget/wget-1.14.tar.gz
$ tar zxvf wget-1.14.tar.gz
$ cd wget-1.14
$ ./configure
(snip)
configure: error: --with-ssl was given, but GNUTLS is not available.

TLSライブラリを明示しないとダメのようだ。
httpsが使えないのも困るな。
opensslは入っているのようなので、それで。

$ ./configure --with-ssl=openssl
(snip)
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile
$ make
(snip)
gcc  -O2 -Wall   -o wget cmpt.o connect.o convert.o cookies.o ftp.o css_.o css-url.o ftp-basic.o ftp-ls.o hash.o host.o html-parse.o html-url.o http.o init.o log.o main.o netrc.o progress.o ptimer.o recur.o res.o retr.o spider.o url.o warc.o utils.o exits.o build_info.o  version.o ftp-opie.o openssl.o http-ntlm.o ../lib/libgnu.a -liconv  -lssl -lcrypto -lz -ldl -lz -lz
Making all in doc
./texi2pod.pl -D VERSION="1.14" ./wget.texi wget.pod
/usr/bin/pod2man --center="GNU Wget" --release="GNU Wget 1.14" wget.pod > wget.1
Making all in po
Making all in tests
make[2]: Nothing to be done for `all'.
Making all in util
make[2]: Nothing to be done for `all'.
make[2]: Nothing to be done for `all-am'.
$ ls -l src/wget
-rwxr-xr-x  1 kinneko  staff  515856  8 26 18:30 src/wget
$ file src/wget
src/wget: Mach-O 64-bit executable x86_64

できた。

$ make install
(snip)
Making install in tests
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
Making install in util
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.
make[3]: Nothing to be done for `install-exec-am'.
make[3]: Nothing to be done for `install-data-am'.

入った。pathも通っている。

$ which wget
/usr/local/bin/wget

他のアカウントからも使えるようにしておく。

$ sudo ln -s /usr/local/bin/wget /usr/bin/wget
$ ls -l /usr/bin/wget
lrwxr-xr-x  1 root  wheel  19  8 26 18:35 /usr/bin/wget -> /usr/local/bin/wget

パーミッションはさわってないけど、実行権限はあるので問題なさそう。
/usr/bin/の他のコマンドも同様のパーミッションだった。