概要: さくらインターネットにいれてあった git を update
ソースの取得
$ cd local/src $ wget http://kernel.org/pub/software/scm/git/git-1.7.4.2.tar.bz2 $ tar zxvf git-1.7.4.2.tar.bz2
configure
$ cd git-1.7.4.2 $ ./configure --prefix=$HOME/local/git --with-curl=/usr/local
NOTE:
--with-curlを付けてるのは、これを指定しないと、
どういうわけかgitのconfigureがlibcurlを見つけてくれないため。
多分だけど、curl 一式が、/usr/localに入ってるのが原因だと思う。
コンパイルするためソースを修正
環境にもよるんだろうけど、gitの公式サイトからとってきたパッケージのソースは、
そのままでは途中でコンパイルエラーが出る。
具体的には、
sha1_file.c: In function 'open_packed_git_1': sha1_file.c:718: error: storage size of 'lim' isn't known sha1_file.c:721: warning: implicit declaration of function 'getrlimit' sha1_file.c:721: error: 'RLIMIT_NOFILE' undeclared (first use in this function) sha1_file.c:718: warning: unused variable 'lim'
という感じのエラー。
それで、storage size of 'lim' isn't knownで検索したところ、
- git - [PATCH Include headers for getrlimit() in sha1_file.c http://git.661346.n2.nabble.com/PATCH-Include-headers-for-getrlimit-in-sha1-file-c-td6175992.html]
というページが出てきて、このページの通りにソースを修正したら、コンパイルが通った。
具体的には、上記ページから引用すると、
code:_ diff --git a/git-compat-util.h b/git-compat-util.h index 49b50ee..40498b3 100644 --- a/git-compat-util.h +++ b/git-compat-util.h @@ -118,6 +118,7 @@
endif
ifndef MINGW32
include <sys/wait.h>
+#include <sys/resource.h>
という感じになる。
コンパイル
gitのMakefileは、FreeBSD のmakeではエラーが出るので、
代わりにgmakeを使う。
$ gmake $ gmake install
以上
これでインストール作業は終わり。
メモは以上。