12 Star 2 Fork 32

openEuler/libxml2-rust

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build_with_configure.sh 1.50 KB
一键复制 编辑 原始数据 按行查看 历史
huangduirong 提交于 2023-07-03 23:02 . Modify the README and build script
# 清除上一次编译数据
CUR_PATH=$(cd `dirname $0`; pwd)
cd $CUR_PATH
rm .libs -rf
rm autom4te.cache -rf
rm rust/target -rf
# 赋予脚本执行的权限
sudo chmod 777 ./configure ./autogen.sh
# autogen.sh脚本内部会执行.configure : CPPFLAGS="-fPIC" LIBS=-lxml2 $srcdir/configure $EXTRA_ARGS "$@" --disable-shared
./autogen.sh
if [ $? -ne 0 ];then
echo "autogen.sh failed."
exit 1
fi
make clean
# 执行编译,在.libs下生成libxml2.a静态库
make
if [ $? -ne 0 ];then
echo "first make failed."
exit 1
fi
cd .libs
# 将生成的.a文件放置在项目根目录,使得cargo build能够搜索到
ar x libxml2.a
ar r libxml2_static.a *.o
if [ $? -ne 0 ];then
echo "ar r libxml2_static.a *.o failed."
exit 1
fi
cp -r ./libxml2_static.a ../
cd ..
# rust编译,生成.a静态库
cd rust
cargo clean
cargo build --release -v
if [ $? -ne 0 ];then
echo "cargo build --release -v failed."
exit 1
fi
cd ..
mv libxml2_static.a ./.libs
#cp rust/target/release/librust_project.a /usr/lib
# 开启COMPILE_WITH_RUST宏,并且链接librust_project.a
# 在.libs下生成libxml2.a和libxml2.so
./configure CPPFLAGS="-DCOMPILE_WITH_RUST" LDFLAGS="-L$CUR_PATH/rust/target/release/ -lrust_project" with_xmllint="yes" with_xmlcatalog="yes"
if [ $? -ne 0 ];then
echo "configure failed."
exit 1
fi
make clean
make
if [ $? -ne 0 ];then
echo "second make failed."
exit 1
fi
# 可以在.libs中看到生成的libxml2.a和libxml2.so
ls .libs
echo "Build SUCCESSFUL. target in .libs"
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/openeuler/libxml2-rust.git
git@gitee.com:openeuler/libxml2-rust.git
openeuler
libxml2-rust
libxml2-rust
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385