Tips: 为了保证编译一次成功,可以将『遇到的问题』部分中须安装的依赖提前安装好。
$ cd ~/workspace/git
$ git clone [email protected]:git/git.git
$ cd git
$ git checkout v2.11.0 ; 当前最新版
$ git checkout -b v2.11 ; 创建新分支
$ make prefix=/usr all doc info
$ sudo mv ../git /opt
yum remove git
file: ~/.bashrc
PATH=/opt/git:$PATH
export PATH
. ~/.bashrc
//使环境变量生效
[rainstorm@localhost blog]$ git --version
git version 2.11.0
添加以下代码到 /etc/man_db.conf 最后一行
MANDATORY_MANPATH /opt/git/Documentation
$ cd /opt/git/Documentation
$ mkdir man1 man5 man7
$ mv *.1 man1
$ mv *.5 man5
$ mv *.7 man7
$ man git
- 在运行命令时可能会出现
no such file...
这类的问题,只要把/opt/git/
目录下相应的文件复制到错误指定的位置即可
/usr/libexec/git-core/git-sh-setup: line 343: cd: .git: No such file or directory
$ sudo mkdir /usr/libexec/git-core
$ sudo cp /opt/git/git-sh-setup /usr/libexec/git-core
[rainstorm@localhost git]$ make prefix=/opt/git all doc info
GIT_VERSION = 2.11.0
* new build flags
CC credential-store.o
In file included from cache.h:4:0,
from credential-store.c:1:
git-compat-util.h:280:25: fatal error: openssl/ssl.h: No such file or directory
#include <openssl/ssl.h>
^
compilation terminated.
make: *** [credential-store.o] Error 1
-
# yum groupinstall 'Development Tools'
-
# yum install openssl-devel curl-devel expat-devel gettext-devel zlib-devel
SUBDIR perl
/usr/bin/perl Makefile.PL PREFIX='/usr' INSTALL_BASE='' --localedir='/usr/share/locale'
Can't locate ExtUtils/MakeMaker.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Makefile.PL line 3.
BEGIN failed--compilation aborted at Makefile.PL line 3.
make[1]: *** [perl.mak] Error 2
make: *** [perl/perl.mak] Error 2
# yum install perl-ExtUtils-CBuilder perl-ExtUtils-MakeMaker
ASCIIDOC git-show-branch.html
/bin/sh: line 1: asciidoc: command not found
make[1]: *** [git-show-branch.html] Error 127
make[1]: Leaving directory `/home/rainstorm/workspace/git/git/Documentation'
make: *** [doc] Error 2
# yum install asciidoc
XMLTO git-show-branch.1
/bin/sh: line 1: xmlto: command not found
make[1]: *** [git-show-branch.1] Error 127
make[1]: Leaving directory `/home/rainstorm/workspace/git/git/Documentation'
make: *** [doc] Error 2
# yum install xmlto
DB2TEXI user-manual.texi
/bin/sh: line 1: docbook2x-texi: command not found
make[1]: *** [user-manual.texi] Error 127
make[1]: Leaving directory `/home/rainstorm/workspace/git/git/Documentation'
make: *** [info] Error 2
// 需要 EPEL 源
# yum install docbook2X
//注意 最后 X 为大写$ cd /usr/bin
sudo ln -s /usr/bin/db2x_docbook2texi /usr/bin/docbook2x-texi