git clone git@github.com:linux-test-project/ltp.git
目录下的build.sh,将
make autotools
./configure
make
make install
等步骤串在一起了。
#CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite" 注释掉 不编译 # TODO: open posix testsuite is currently broken in out-tree-build. Enable it once it's fixed. #CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite" 注释掉 不编译 usage() { cat << EOF Usage: $0 [ -c CC ] [ -o TREE ] [ -p DIR ] [ -t TYPE ] $0 -h Options: -h Print this help -c CC Define compiler ($CC variable) -o TREE Specify build tree, default: $DEFAULT_TREE -p DIR Change installation directory. For in-tree build is this value passed to --prefix option of configure script. For out-of-tree build is this value passed to DESTDIR variable (i.e. sysroot) of make install target, which means that LTP will be actually installed into DIR/PREFIX (i.e. DIR/opt/ltp). Default for in-tree build: '$DEFAULT_PREFIX' Default for out-of-tree build: '$DEFAULT_PREFIX/opt/ltp' -t TYPE Specify build type, default: $DEFAULT_BUILD BUILD TREE: in in-tree build out out-of-tree build BUILD TYPES: 32 32-bit in-tree build cross cross-compile in-tree build (requires set compiler via -c switch) native native in-tree build EOF } while getopts "c:hio:p:t:" opt; do case "$opt" in c) CC="$OPTARG";; h) usage; exit 0;; i) install=1;; #在usage中没有这一项,所以容易忽略,全部编译完了才想起来的话 也可以加一条 make install o) case "$OPTARG" in in|out) tree="$OPTARG";; *) echo "Wrong build tree '$OPTARG'" >&2; usage; exit 1;; esac;; p) PREFIX="$OPTARG";; t) case "$OPTARG" in 32|cross|native) build="$OPTARG";; *) echo "Wrong build type '$OPTARG'" >&2; usage; exit 1;; esac;; ?) usage; exit 1;; esac done
修改三处:
#CONFIGURE_OPTS_IN_TREE="--with-open-posix-testsuite --with-realtime-testsuite" 注释掉 # TODO: open posix testsuite is currently broken in out-tree-build. Enable it once it's fixed. #CONFIGURE_OPTS_OUT_TREE="--with-realtime-testsuite" 注释掉 PREFIX="$DEFAULT_PREFIX" build="$DEFAULT_BUILD" tree="$DEFAULT_TREE" #install=0 install=1 #默认安装
如何调用
./build.sh -c arm-linux-gnueabihf-gcc -t cross -i -p /home/zhangyi/ltp-install