You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
179 lines
4.5 KiB
179 lines
4.5 KiB
#!/bin/bash
|
|
|
|
|
|
|
|
|
|
TARGET=$1 # 编译的输出目标位置
|
|
DIST=$2 # 下载依赖的目录
|
|
|
|
#根据$TARGET中的目录名设置 指令架构
|
|
ARCH="x86_64"
|
|
if echo $TARGET | grep -q '\-32'
|
|
then ARCH="i686"
|
|
fi
|
|
|
|
|
|
|
|
|
|
# 建立python库链接
|
|
function symlink_python() {
|
|
local pylib=$1
|
|
local location=$2
|
|
|
|
echo " * 发现于 $location"
|
|
echo " * 更新符号链接"
|
|
ln -vfs $location $TARGET/lib/$pylib
|
|
}
|
|
|
|
# 建立C++标准库链接
|
|
function symlink_libstdc() {
|
|
local location=$1
|
|
directory=`dirname $location `
|
|
|
|
echo " * 发现于 $location"
|
|
echo " * 更新符号链接"
|
|
ln -vfs $location $TARGET/lib/libstdc++.a
|
|
|
|
# echo " * Symlinking GOMP"
|
|
# for filename in libgomp.a libgomp.spec ; do
|
|
# ln -vfs $directory/$filename $TARGET/lib/$filename
|
|
# done
|
|
}
|
|
|
|
# 检查下载文件的完整性
|
|
function verify_hash() {
|
|
local hash=$1
|
|
local filepath=$2
|
|
echo "$hash $filepath" | sha1sum --status -c -
|
|
return $?
|
|
}
|
|
|
|
|
|
|
|
|
|
# 检查 $DIST 中的目录,是否已经存在 linux_deps.tgz文件包,否则下载这个文件包
|
|
echo -e "\n * 开始检查distfiles目录中依赖包\n"
|
|
FILE=linux_deps.tgz
|
|
HASH=7aab4a72ffebe961f0df734364436c99f29f4708
|
|
URL=https://github.com/LuxCoreRender/LinuxCompileDeps/releases/download/luxcorerender_v2.6alpha0/linux_deps.tgz
|
|
|
|
if [ ! -f $DIST/$FILE ] ; then
|
|
echo " * 正在下载文件包 $FILE"
|
|
wget -O $DIST/$FILE $URL
|
|
fi
|
|
|
|
verify_hash $HASH "$DIST/$FILE"
|
|
if [ $? != 0 ] ; then
|
|
echo " * 重新开始下载文件包 $FILE"
|
|
wget -c -O $DIST/$FILE $URL
|
|
|
|
verify_hash $HASH "$DIST/$FILE"
|
|
if [ $? != 0 ] ; then
|
|
echo " !!! 下载文件包 $FILE 失败"
|
|
exit 1
|
|
fi
|
|
fi
|
|
# 将linux_deps.tgz文件包 解压到 $DIST 中的目录
|
|
tar zxvf $DIST/$FILE -C $DIST
|
|
|
|
# 检查 $TARGET 中的目录是否存在,并创建如下目录结构
|
|
if [[ ! -d $TARGET ]] ; then
|
|
mkdir -pv $TARGET/{bin,include,lib,share}
|
|
else
|
|
echo " * 目标目录树已存在"
|
|
fi
|
|
echo " * 已完成 distfiles目录中依赖包 检查"
|
|
|
|
|
|
|
|
|
|
# 检查 C++标准库 是否存在
|
|
echo " * 开始检查 C++标准库"
|
|
if [[ ! -e $TARGET/lib/libstdc++.a ]] ; then
|
|
|
|
echo " * 缺少 libstdc++.a库 符号链接,正在尝试找出正确的位置"
|
|
GCCVER=`gcc -dumpversion`
|
|
GCCVERMAJOR=`echo $GCCVER | cut -d'.' -f1-2`
|
|
|
|
if STDCLIBPATH=/usr/lib/gcc/${ARCH}-linux-gnu/$GCCVER/libstdc++.a && [[ -e $STDCLIBPATH ]] ; then
|
|
symlink_libstdc $STDCLIBPATH
|
|
elif STDCLIBPATH=/usr/lib/gcc/${ARCH}-linux-gnu/$GCCVERMAJOR/libstdc++.a && [[ -e $STDCLIBPATH ]] ; then
|
|
symlink_libstdc $STDCLIBPATH
|
|
else
|
|
echo " !!! 找不到 libstdc++.a库 文件位置"
|
|
echo " !!! 您必须手动查找库并进行符号链接"
|
|
echo " !!! 它将沿着以下路径运行:"
|
|
echo " !!! $TARGET/lib/libstdc++.a"
|
|
exit 1
|
|
fi
|
|
|
|
fi
|
|
echo " * 已完成 C++标准库 检查"
|
|
|
|
|
|
|
|
|
|
# 检查 python版是否为3.0以上,及配置是否正确
|
|
echo " * 开始检查 python配置"
|
|
PYVER=`${PYTHON_CMD} --version 2>&1`
|
|
if [ `echo $PYVER | cut -d' ' -f2 | cut -d'.' -f1` != '3' ] ; then
|
|
echo " !!! Python 的主要版本必需是“3”"
|
|
exit 1
|
|
fi
|
|
|
|
PYVER=`echo $PYVER | cut -d' ' -f2 | cut -d'.' -f'1-2'`
|
|
PYLIB=libpython"$PYVER".a
|
|
PYLIBm=libpython"$PYVER"m.a
|
|
if echo $TARGET | grep -q '\-64' ; then EXT="64" ; fi
|
|
|
|
|
|
if [[ ! -e $TARGET/lib/$PYLIB ]] ; then
|
|
echo " * 缺少 python标准库的符号链接,正在尝试找出正确的位置"
|
|
if PYLIBPATH=/usr/lib${EXT}/$PYLIB && [[ -e $PYLIBPATH ]] ; then
|
|
symlink_python $PYLIB $PYLIBPATH
|
|
elif PYLIBPATH=/usr/lib/${ARCH}-linux-gnu/$PYLIB && [[ -e $PYLIBPATH ]] ; then
|
|
symlink_python $PYLIB $PYLIBPATH
|
|
elif PYLIBPATH=/usr/lib/${ARCH}-linux-gnu/$PYLIBm && [[ -e $PYLIBPATH ]] ; then
|
|
symlink_python $PYLIB $PYLIBPATH
|
|
else
|
|
echo " !!! 无法找到 $PYLIB 或 $PYLIBm"
|
|
echo " !!! 你必须手动找到并重新链接"
|
|
echo " !!! 将其符号链接到以下路径:"
|
|
echo " !!! $TARGET/lib/$PYLIB"
|
|
exit 1
|
|
fi
|
|
fi
|
|
echo " * 已完成 python配置 检查"
|
|
|
|
|
|
|
|
|
|
echo " * 开始检查 LuxMark配置"
|
|
if [[ -d "LuxMark" ]] ; then
|
|
FILE=scenes.tgz
|
|
HASH=5db2cedea47d2f7758ecaa6802632f598cfd4ab7
|
|
URL=https://github.com/LuxCoreRender/LuxMark/releases/download/luxmark_v4.0alpha0/scenes.tgz
|
|
if [ ! -f $DIST/$FILE ] ; then
|
|
echo " * 正在下载文件包 $FILE"
|
|
wget -O $DIST/$FILE $URL
|
|
fi
|
|
verify_hash $HASH "$DIST/$FILE"
|
|
if [ $? != 0 ] ; then
|
|
echo " * 正在重新下载文件包 $FILE"
|
|
wget -c -O $DIST/$FILE $URL
|
|
|
|
verify_hash $HASH "$DIST/$FILE"
|
|
if [ $? != 0 ] ; then
|
|
echo " !!! 文件包 $FILE 下载失败"
|
|
exit 1
|
|
fi
|
|
fi
|
|
fi
|
|
echo -e "\n * 已完成 LuxMark配置 检查\n"
|
|
|
|
|
|
|
|
|
|
# updating target link
|
|
#ln -fs $TARGET ../target
|
|
sleep 2
|