From e62ac037f7f70da4e46618b02243366f247f5f80 Mon Sep 17 00:00:00 2001 From: yuanjiajia <1139393632@qq.com> Date: Thu, 26 May 2022 17:32:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=B8=80=E4=B8=AA=E6=B2=A1?= =?UTF-8?q?=E6=9C=89=E8=BE=93=E5=87=BA=E9=87=8D=E5=AE=9A=E5=90=91=E7=9A=84?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 + build | 236 ++++++++++ build-64-sse2 | 64 +++ compileing/compile-CBlosc.sh | 27 ++ compileing/compile-Embree.sh | 27 ++ compileing/compile-FreeType.sh | 31 ++ compileing/compile-Jpeg.sh | 31 ++ compileing/compile-LuxCore.sh | 63 +++ compileing/compile-LuxMark.sh | 32 ++ compileing/compile-NVRTC.sh | 27 ++ compileing/compile-Oidn.sh | 27 ++ compileing/compile-OpenEXR.sh | 52 +++ compileing/compile-OpenImageIO.sh | 38 ++ compileing/compile-PNG.sh | 32 ++ compileing/compile-TBB.sh | 27 ++ compileing/compile-Tiff.sh | 31 ++ compileing/compile-boost.sh | 41 ++ compileing/compile-bzip2.sh | 28 ++ compileing/compile-lzma.sh | 28 ++ compileing/compile-qt.sh | 32 ++ compileing/compile-zlib.sh | 36 ++ distfiles/boost.python-1.72.0.patch | 22 + distfiles/bzip2-1.0.8-fpic.patch | 11 + distfiles/luxcore.cmake | 21 + distfiles/oiio-2.2.13.1-compiler.cmake | 589 +++++++++++++++++++++++++ first_run.sh | 56 +++ installLib/cblosc-install.sh | 14 + installLib/embree-install.sh | 21 + installLib/luxmark.start | 12 + installLib/nvrtc-install.sh | 25 ++ installLib/oidn-install.sh | 21 + installLib/qt-install.sh | 8 + installLib/tbb-install.sh | 17 + utils/begin_stage | 50 +++ utils/clear | 29 ++ utils/create_python_wheel.sh | 40 ++ utils/install | 129 ++++++ utils/prepare | 179 ++++++++ utils/replace | 5 + 39 files changed, 2164 insertions(+) create mode 100644 .gitignore create mode 100755 build create mode 100755 build-64-sse2 create mode 100755 compileing/compile-CBlosc.sh create mode 100755 compileing/compile-Embree.sh create mode 100755 compileing/compile-FreeType.sh create mode 100755 compileing/compile-Jpeg.sh create mode 100755 compileing/compile-LuxCore.sh create mode 100755 compileing/compile-LuxMark.sh create mode 100755 compileing/compile-NVRTC.sh create mode 100755 compileing/compile-Oidn.sh create mode 100755 compileing/compile-OpenEXR.sh create mode 100755 compileing/compile-OpenImageIO.sh create mode 100755 compileing/compile-PNG.sh create mode 100755 compileing/compile-TBB.sh create mode 100755 compileing/compile-Tiff.sh create mode 100755 compileing/compile-boost.sh create mode 100755 compileing/compile-bzip2.sh create mode 100755 compileing/compile-lzma.sh create mode 100755 compileing/compile-qt.sh create mode 100755 compileing/compile-zlib.sh create mode 100644 distfiles/boost.python-1.72.0.patch create mode 100644 distfiles/bzip2-1.0.8-fpic.patch create mode 100644 distfiles/luxcore.cmake create mode 100644 distfiles/oiio-2.2.13.1-compiler.cmake create mode 100755 first_run.sh create mode 100755 installLib/cblosc-install.sh create mode 100755 installLib/embree-install.sh create mode 100755 installLib/luxmark.start create mode 100755 installLib/nvrtc-install.sh create mode 100755 installLib/oidn-install.sh create mode 100755 installLib/qt-install.sh create mode 100755 installLib/tbb-install.sh create mode 100755 utils/begin_stage create mode 100755 utils/clear create mode 100755 utils/create_python_wheel.sh create mode 100755 utils/install create mode 100755 utils/prepare create mode 100755 utils/replace diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..124b573 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +distfiles/*.gz +distfiles/*.tgz +distfiles/*.xz +distfiles/*.bz2 +target-64-sse2/ diff --git a/build b/build new file mode 100755 index 0000000..fd46231 --- /dev/null +++ b/build @@ -0,0 +1,236 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET="$2" +WORK="$3" +STAGE=$9 + +# 记录已经完成的编译阶段,如果上一次编译发生错误,则提前终此脚本运行 +function complete_stage() { + + local next=$1 + cd $SHELLROOT + + if [ $2 -eq 0 ] + then + echo -n $next > $TARGET/stage + else + exit 1 + fi + sleep 2 + +} + + + + +####################################################################################################################################################################################### + + + + +# 开始编译 + + + + + +cd $SHELLROOT # 建入到 本编译脚本项目 的根目录 +mkdir -p tempDIR # 新建 本编译脚本项目 在运行所需要的临时工作目录 +echo -ne "\033]0;Preparing\007" # 检查当前编译工作已经进入哪个阶段 +if [ ! $STAGE ] ; then + S=`cat $TARGET/stage 2>/dev/null` + if [[ ! $S ]] ; then + STAGE=0 + else + STAGE=$S + fi +fi +echo " * 使用 GCC 编译器" + + + + + +# STAGE 0.1 -- zlib +NEXT=0.2 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-zlib.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 0.2 -- bzip2 +NEXT=0.3 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-bzip2.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + + +# STAGE 0.3 -- lzma +NEXT=0.4 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-lzma.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.1 -- Boost +NEXT=1.2 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-boost.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.2 -- Jpeg +NEXT=1.3 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-Jpeg.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.3 -- Tiff +NEXT=1.4 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-Tiff.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.4 -- PNG +NEXT=1.5 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-PNG.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.5 -- FreeType +NEXT=1.6 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-FreeType.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 1.6 -- OpenEXR +NEXT=2.1 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-OpenEXR.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 2.1 -- OpenImageIO +NEXT=2.2 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-OpenImageIO.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 3 -- Qt +NEXT=4.1 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-qt.sh "$TARGET" "$CONFIGOPTS" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 4.1 -- Embree +NEXT=4.2 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-Embree.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 4.2 -- Oidn +NEXT=4.3 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-Oidn.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 4.3 -- C-blosc +NEXT=4.4 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-CBlosc.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 4.4 -- TBB +NEXT=4.5 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-TBB.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 4.5 -- NVRTC +NEXT=5 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-NVRTC.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + + + +# STAGE 5 -- LuxCore +NEXT=6 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-LuxCore.sh "$TARGET" + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# STAGE 6 -- LuxMark +NEXT=7 +if [[ $STAGE && $STAGE < $NEXT ]] ; then + echo $BOUNDARYSTART + ${SHELLROOT}/compileing/compile-LuxMark.sh + complete_stage $NEXT $? + echo $BOUNDARYEND +fi + +# 编译已经完成,执行 install脚本,完成最后的安装部署 +echo $BOUNDARYSTART +echo -e "\n 正在完成最后的安装部署\n" +if ! ${SHELLROOT}/utils/install "$TARGET" "LuxCore" "${SHELLROOT}/distfiles" ; then + echo " * 安装失败" +else + echo -e "\n * 安装成功 $TARGET/$LUX_TAG" + echo -e " * 恭喜你,LuxCore已经编译安装成功\n" +fi +echo $BOUNDARYEND + + +sleep 2 +exit 0 diff --git a/build-64-sse2 b/build-64-sse2 new file mode 100755 index 0000000..1695967 --- /dev/null +++ b/build-64-sse2 @@ -0,0 +1,64 @@ +#!/bin/bash + + + + +# 编译配置 +ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # 获得 本编译脚本项目 自身所在的目录(也就是 本编译脚本项目 的根目录) +TARGET="${ROOT}/target-64-sse2" # 设置编译的输出目标位置 +DIST="${ROOT}/distfiles" # 设置运行 本编译脚本项目 需要的依赖库目录 +LUX_TAG="${1%/}" # LuxCore项目目录 +STAGE=$2 # 设置当前编译阶段 +GENERIC_FLAGS="-w -mtune=generic -mno-ssse3 -mmmx -msse -msse2 -O2 -pipe -mfpmath=sse -fPIC" # 设置 将一个通用的 GCC 编译参数,作为 执行编译LuxCore项目时 的参数。 +LUXCORE_FLAGS="-std=c++11 -mtune=generic -mno-ssse3 -static-libgcc -mmmx -msse -msse2 -O3 -pipe \ + -mfpmath=sse -fvisibility=hidden -fvisibility-inlines-hidden \ + -ftree-vectorize -fno-math-errno -fno-signed-zeros -fno-trapping-math \ + -fassociative-math -fno-rounding-math -fno-signaling-nans \ + -fcx-limited-range -DBOOST_DISABLE_ASSERTS -floop-interchange \ + -floop-strip-mine -floop-block -fsee -ftree-loop-linear \ + -ftree-loop-distribution -ftree-loop-im -fivopts -ftracer \ + -fomit-frame-pointer \ + -DHAVE_PTHREAD_H -fPIC -fno-stack-protector" # 设置 一个特定 GCC 编译参数,作为 执行编译LuxCore项目时 的参数。 +CHOST="x86_64-pc-linux-gnu" # 设置编译目标 系统平台 + + + + +# 向系统注册环境变量,生命周期为 本编译脚本项目 运行结束 为止 +unset CC CXX # 注销两个变量 + +export LDFLAGS="-static-libgcc -static-libstdc++" + +export PYTHON_CMD="python3.10" +export PYTHON_CMD="python3" + +export SHELLROOT="$ROOT" # 将 本 shell项目 的根目录注册到环境变量 + +export CORE_COUNT=$(( `grep processor /proc/cpuinfo | wc -l` + 1)) # 根据CPU信息,充许N个编译任务同时进行 +export MAKEOPTS="-j $CORE_COUNT" # 根据CPU信息,充许N个编译任务同时进行 + +export CFLAGS="$GENERIC_FLAGS" # 通用的编译参数 +export CXXFLAGS="${CFLAGS}" # 通用的编译参数 + +export CHOST="$7" # 特定的编译参数 +export CBUILD=$CHOST # 特定的编译参数 +CONFIGOPTS="--build=$CBUILD --host=$CHOST" # 特定的编译参数 + + + + +# 编译前,检查各种依赖文件包、C++标准库、python版本及其标准库 以及 编译目标目录树结构,否是已准备就续 +echo $BOUNDARYSTART +if ! $SHELLROOT/utils/prepare "$TARGET" "$DIST" +then exit 1 +fi +echo $BOUNDARYEND + + + +# 执行 build构建脚本,如果脚本执行错误,将终止脚本运行 +if ! $ROOT/build "$ROOT" "$TARGET" "$WORK" "$DIST" "$LUX_TAG" "$GENERIC_FLAGS" "$LUX_FLAGS" "$CHOST" "$STAGE" +then + exit 1 +fi +exit 0 diff --git a/compileing/compile-CBlosc.sh b/compileing/compile-CBlosc.sh new file mode 100755 index 0000000..6f3373f --- /dev/null +++ b/compileing/compile-CBlosc.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 二进制数据进行深度压缩代码库(C-blosc)……\n" + +${SHELLROOT}/utils/begin_stage C-blosc c-blosc-*.tgz +cd ${SHELLROOT}/tempDIR/`echo c-blosc-*.tgz | sed 's/\*.*//'`* + +cp -v ${SHELLROOT}/installLib/cblosc-install.sh . + +sleep 2 +if ./cblosc-install.sh $TARGET; then + echo -e "\n * 二进制数据进行深度压缩代码库(C-blosc),编译和安装成功\n" +else + echo -e "\n !!! 二进制数据进行深度压缩代码库(C-blosc),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-Embree.sh b/compileing/compile-Embree.sh new file mode 100755 index 0000000..ecc3522 --- /dev/null +++ b/compileing/compile-Embree.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 英特尔高性能光线追踪内核(Embree)……\n" + +${SHELLROOT}/utils/begin_stage Embree embree-*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo embree-*.tar.gz | sed 's/\*.*//'`* + +cp -v ${SHELLROOT}/installLib/embree-install.sh . + +sleep 2 +if ./embree-install.sh $TARGET ; then + echo -e "\n * 英特尔高性能光线追踪内核(Embree),编译和安装成功\n" +else + echo -e "\n !!! 英特尔高性能光线追踪内核(Embree),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-FreeType.sh b/compileing/compile-FreeType.sh new file mode 100755 index 0000000..430d0e2 --- /dev/null +++ b/compileing/compile-FreeType.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 FreeType字体引擎……\n" + +${SHELLROOT}/utils/begin_stage freetype freetype*.tar.bz2 +cd ${SHELLROOT}/tempDIR/`echo freetype*.tar.bz2 | sed 's/\*.*//'`* + +if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET ; then + echo -e "\n !!! 配置 FreeType字体引擎 失败,无法安装成功\n" + exit 1 +fi + +sleep 2 +if make $MAKEOPTS && make install ; then + echo -e "\n * FreeType字体引擎,编译和安装成功\n" +else + echo -e "\n !!! FreeType字体引擎,编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-Jpeg.sh b/compileing/compile-Jpeg.sh new file mode 100755 index 0000000..06861c2 --- /dev/null +++ b/compileing/compile-Jpeg.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + +echo -e "\n正在编译和安装 jpeg图像函数库(jpeg)……\n" + +${SHELLROOT}/utils/begin_stage jpeg jpeg*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo jpeg*.tar.gz | sed 's/\*.*//'`* + +cp /usr/bin/libtool . +if ! ./configure $CONFIGOPTS --enable-static --prefix=$TARGET ; then + echo -e "\n !!! 配置 jpeg图像函数库(jpeg)失败,无法安装成功\n" + exit 1 +fi + +sleep 2 +if make $MAKEOPTS && cp -vf .libs/libjpeg.a $TARGET/lib && cp -vf *.h $TARGET/include ; then + echo -e "\n * jpeg图像函数库(jpeg),编译和安装成功\n" +else + echo -e "\n !!! jpeg图像函数库(jpeg),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-LuxCore.sh b/compileing/compile-LuxCore.sh new file mode 100755 index 0000000..92daef6 --- /dev/null +++ b/compileing/compile-LuxCore.sh @@ -0,0 +1,63 @@ +#!/bin/bash + + + + +echo -e "\n正在编译和安装 LuxCore项目……\n\n" + +# 接收参数 +TARGET=$1 + + +# 设置编译LuxCore项目的四个模块,分别是luxrays、luxcore、pyluxcore、luxcoreui +LUXCORE_TARGET='luxrays luxcore pyluxcore luxcoreui' + +# 设置 将一个通用参数,作为 执行编译LuxCore项目时 的参数。 +# LUXCORE_FLAGS=`echo $6 | sed s/'-fvisibility=hidden'//`" -pthread -lrt" # 使用 GCC 编译器 时的编译参数 +# LUXCORE_FLAGS="-mtune=generic -mno-ssse3 -mmmx -msse -msse2 -O3 -pipe -fvisibility-inlines-hidden -fno-stack-protector -fPIC -fopenmp=libomp" # 使用 clang++ 编译器 时的编译参数 + +# 设置链接库的编译方式 +# BUILD_LUXCORE_DLL="-D BUILD_LUXCORE_DLL=1" # 动态链接 +# BUILD_LUXCORE_DLL='' # 静态链接 + +PYTHON_LIB=`find $TARGET -name 'libpython*'` +PYTHON_VARIANT=`if $(basename "$PYTHON_LIB" | grep -q 'm') ; then echo 'm' ; fi` +PYTHON_INCLUDE=`find /usr/include -type d -name "${PYTHON_CMD}*${PYTHON_VARIANT}" | awk '{ print length($0) " " $0; }' $file | sort -r -n | cut -d ' ' -f 2- | tail -n1 | sed s/'\n'//` +echo " * 使用Python库路径: $PYTHON_LIB" +echo " * 使用Python头路径: $PYTHON_INCLUDE" +echo + + + +echo -ne "\033]0;LuxCore stage\007" +cd ${SHELLROOT}/LuxCore +echo " * 正在配置 $LUXCORE_TARGET" + +if ! cmake -G "Unix Makefiles" $BUILD_LUXCORE_DLL \ + -Wno-dev \ + -D LUXRAYS_CUSTOM_CONFIG=cmake/SpecializedConfig/Config_Linux-Static.cmake \ + -D PYTHON_LIBRARY:FILEPATH="$PYTHON_LIB" \ + -D PYTHON_INCLUDE_DIR:PATH="$PYTHON_INCLUDE" \ + -D PYTHON_INCLUDE_DIRS:PATH="$PYTHON_INCLUDE" . ; then + echo -e "\n !!! $LUXCORE_TARGET LuxCore项目 配置失败\n" + exit 1 +fi +sleep 2 +echo " * Compiling $LUXCORE_TARGET" +if cmake --build . -- $MAKEOPTS ; then + echo -e "\n * $LUXCORE_TARGET LuxCore项目,编译和安装成功\n" +else + echo -e "\n !!! $LUXCORE_TARGET LuxCore项目,编译和安装失败\n" + exit 1 +fi + +mkdir ${TARGET}/LuxCore +if echo "LuxCore" | grep -iq 'pyluxcore' ; then + cp -vf lib/*.so ${TARGET}/LuxCore + sleep 2 + cd $SHELLROOT + exit 0 +fi + +exit 0 + diff --git a/compileing/compile-LuxMark.sh b/compileing/compile-LuxMark.sh new file mode 100755 index 0000000..a0453f5 --- /dev/null +++ b/compileing/compile-LuxMark.sh @@ -0,0 +1,32 @@ +#!/bin/bash + + + + +echo -e "\n正在编译和安装 LuxMark……\n" +echo -ne "\033]0;LuxMark stage\007" + +if [[ ! -d "LuxMark" ]] ; then + echo + echo -e "\n!!! LuxMark源码不可用,跳过这个阶段\n" +else + cd ${SHELLROOT}/LuxMark + echo " * 正在配置 LuxMark" + if ! cmake -G "Unix Makefiles" -Wno-dev \ + -D LUXMARK_CUSTOM_CONFIG=cmake/SpecializedConfig/Config_Linux-Static.cmake \ + -D LuxRays_HOME="${SHELLROOT}/LuxCore" . ; then + echo -e "\n !!! 配置 LuxMark 失败,无法安装成功\n" + exit 1 + fi + + sleep 2 + echo " * 正在编译 LuxMark" + if cmake --build . --target all -- $MAKEOPTS ; then + echo -e "\n * LuxMark ,编译和安装成功\n" + else + echo -e "\n !!! LuxMark ,编译和安装失败\n" + exit 1 + fi +fi + +exit 0 \ No newline at end of file diff --git a/compileing/compile-NVRTC.sh b/compileing/compile-NVRTC.sh new file mode 100755 index 0000000..f9463eb --- /dev/null +++ b/compileing/compile-NVRTC.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 CUDA工程编译库(NVRTC)……\n" + +${SHELLROOT}/utils/begin_stage NVRTC cuda*nvrtc*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo cuda*nvrtc*.tar.gz | sed 's/\*.*//'`* + +cp -v ${SHELLROOT}/installLib/nvrtc-install.sh . + +sleep 2 +if ./nvrtc-install.sh $TARGET; then + echo -e "\n * CUDA工程编译库(NVRTC),编译和安装成功\n" +else + echo -e "\n !!! CUDA工程编译库(NVRTC),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-Oidn.sh b/compileing/compile-Oidn.sh new file mode 100755 index 0000000..1703dc0 --- /dev/null +++ b/compileing/compile-Oidn.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 英特尔降噪引擎(oidn)……\n" + +${SHELLROOT}/utils/begin_stage Oidn oidn-*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo oidn-*.tar.gz | sed 's/\*.*//'`* + +cp -v ${SHELLROOT}/installLib/oidn-install.sh . + +sleep 2 +if ./oidn-install.sh $TARGET ; then + echo -e "\n * 英特尔降噪引擎(oidn),编译和安装成功\n" +else + echo -e "\n !!! 英特尔降噪引擎(oidn),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-OpenEXR.sh b/compileing/compile-OpenEXR.sh new file mode 100755 index 0000000..68aa50c --- /dev/null +++ b/compileing/compile-OpenEXR.sh @@ -0,0 +1,52 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 EXR高动态图像函数库……\n" + +${SHELLROOT}/utils/begin_stage openexr openexr*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo openexr*.tar.gz | sed 's/\*.*//'`* + +cd IlmBase +if ! ./bootstrap ; then + echo -e "\n !!! 生成 ilmbase库 的安装引导 失败\n" + exit 1 +fi +if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET ; then + echo -e "\n !!! 配置 ilmbase库 失败,无法安装成功\n" + exit 1 +fi +sleep 2 +if make $MAKEOPTS && make install ; then + echo -e "\n * ilmbase库,编译和安装成功\n" +else + echo -e "\n !!! ilmbase库,编译和安装失败\n" + exit 1 +fi + +cd ../OpenEXR +if ! ./bootstrap ; then + echo -e "\n !!! 生成 EXR高动态图像函数库 的安装引导 失败\n" + exit 1 +fi +if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET --with-ilmbase-prefix=$TARGET ; then + echo -e "\n !!! 配置 EXR高动态图像函数库 失败,无法安装成功\n" + exit 1 +fi +sleep 2 +if make $MAKEOPTS && make install ; then + echo -e "\n * EXR高动态图像函数库,编译和安装成功\n" +else + echo -e "\n !!! EXR高动态图像函数库,编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-OpenImageIO.sh b/compileing/compile-OpenImageIO.sh new file mode 100755 index 0000000..50c7912 --- /dev/null +++ b/compileing/compile-OpenImageIO.sh @@ -0,0 +1,38 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 图像编码与转换库(OpenImageIO)……\n" + +${SHELLROOT}/utils/begin_stage openimageio oiio*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo oiio*.tar.gz | sed 's/\*.*//'`* + +echo " * 正在修补 OpenImageIO" +cp -vf ${SHELLROOT}/distfiles/oiio-2.2.13.1-compiler.cmake src/cmake/compiler.cmake +if CMAKE_BUILD_PARALLEL_LEVEL=$CORE_COUNT CMAKE_PREFIX_PATH=$TARGET make $MAKEOPTS BOOST_HOME=$TARGET ILMBASE_HOME=$TARGET VERBOSE=1 USE_FFMPEG=0 EMBEDPLUGINS=1 USE_OPENGL=0 USE_QT=0 \ + USE_GIF=0 USE_OPENJPEG=0 USE_OPENSSL=0 USE_FIELD3D=0 USE_OCIO=0 USE_OPENCV=0 USE_PYTHON=0 BUILD_SHARED_LIBS=0 LINKSTATIC=1 OIIO_BUILD_TOOLS=0 OIIO_BUILD_TESTS=0 STOP_ON_WARNING=0 ; then + echo -e "\n * openimageio 编译成功\n" +else + echo -e "\n !!! openimageio 编译失败\n" + exit 1 +fi + +echo " * 安装 openimageio库和头 文件" +sleep 2 +if cp -vr dist/linux*/* $TARGET && cd $TARGET/lib && mv -v libOpenImageIO.a libOpenImageIOBase.a && ar -rcT libOpenImageIO.a libOpenImageIOBase.a libpng.a libjpeg.a libtiff.a libHalf.a \ + libIex.a libIexMath.a libIlmImf.a libIlmThread.a libImath.a libz.a libbz2.a liblzma.a libfreetype.a ; then + echo -e "\n * 图像编码与转换库(OpenImageIO),编译和安装成功\n" +else + echo -e "\n !!! 图像编码与转换库(OpenImageIO),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-PNG.sh b/compileing/compile-PNG.sh new file mode 100755 index 0000000..2107c17 --- /dev/null +++ b/compileing/compile-PNG.sh @@ -0,0 +1,32 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 png图像函数库……\n" + +${SHELLROOT}/utils/begin_stage png libpng*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo libpng*.tar.gz | sed 's/\*.*//'`* + +# --with-libpng-prefix=lux_ +if ! ./configure --enable-static --disable-shared $CONFIGOPTS --prefix=$TARGET ; then + echo -e "\n !!! 配置 png图像函数库 失败,无法安装成功\n" + exit 1 +fi + +sleep 2 +if make $MAKEOPTS && make install && cd $TARGET/include && ln -vs libpng* libpng; then + echo -e "\n * png图像函数库,编译和安装成功\n" +else + echo -e "\n !!! png图像函数库,编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-TBB.sh b/compileing/compile-TBB.sh new file mode 100755 index 0000000..c7fb2d1 --- /dev/null +++ b/compileing/compile-TBB.sh @@ -0,0 +1,27 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 并行编程框架(TBB)……\n" + +${SHELLROOT}/utils/begin_stage TBB tbb*_lin.tgz +cd ${SHELLROOT}/tempDIR/`echo tbb*_lin.tgz | sed 's/\*.*//'`* + +cp -v ${SHELLROOT}/installLib/tbb-install.sh . + +sleep 2 +if ./tbb-install.sh $TARGET ; then + echo -e "\n * 并行编程框架(TBB),编译和安装成功\n" +else + echo -e "\n !!! 并行编程框架(TBB),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-Tiff.sh b/compileing/compile-Tiff.sh new file mode 100755 index 0000000..ac35d61 --- /dev/null +++ b/compileing/compile-Tiff.sh @@ -0,0 +1,31 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 tiff图像函数库……\n" + +${SHELLROOT}/utils/begin_stage tiff tiff*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo tiff*.tar.gz | sed 's/\*.*//'`* + +if ! ./configure --enable-static --disable-shared --disable-jbig $CONFIGOPTS --prefix=$TARGET ; then + echo -e "\n !!! 配置 tiff图像函数库 失败,无法安装成功\n" + exit 1 +fi + +sleep 2 +if make $MAKEOPTS && make install ; then + echo -e "\n * tiff图像函数库,编译和安装成功\n" +else + echo -e "\n !!! tiff图像函数库,编译和安装失败\n" + exit 1 +fi + +exit 0 \ No newline at end of file diff --git a/compileing/compile-boost.sh b/compileing/compile-boost.sh new file mode 100755 index 0000000..4da8708 --- /dev/null +++ b/compileing/compile-boost.sh @@ -0,0 +1,41 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + +echo -e "\n正在编译和安装 C++语言标准库扩展程序库(boost)……\n" + +${SHELLROOT}/utils/begin_stage boost boost*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo boost*.tar.gz | sed 's/\*.*//'`* + +echo " * 正在修补Boost 以支持Python" +patch libs/python/src/exec.cpp ${SHELLROOT}/distfiles/boost.python-1.72.0.patch + +PYVER=`${PYTHON_CMD} --version 2>&1 | cut -d' ' -f2 | cut -d '.' -f'1 2'` +TOOLSET=`if [[ $CLANG ]] ; then echo clang ; else echo gcc ; fi` + +echo " * 正在编译安装 支持 python 的 C++语言标准库扩展程序库(boost)插件-${PYVER}" +sleep 2 +if ! ./bootstrap.sh --with-toolset=$TOOLSET --without-icu --prefix=$TARGET/boost --with-python=/usr/bin/python${PYVER} --with-python-root=`python${PYVER} -c "import sys; print(sys.prefix)"` ; then + echo -e "\n !!! 支持 python 的 C++语言标准库扩展程序库(boost)插件,编译和安装失败\n" + exit 1 +fi +# b2 debug options --debug-configuration -d0 +if ./b2 $MAKEOPTS --debug-configuration -d0 -aq --toolset=$TOOLSET cflags="$CFLAGS" cxxflags="$CXXFLAGS" $CONFIGOPTS --prefix=$TARGET --layout=system --with-date_time --with-filesystem \ + --with-iostreams --with-locale --with-program_options --with-python --with-regex --with-serialization --with-system --with-thread --with-chrono threading=multi link=static release install ; then + # Fix boost python lib names + mv -f $TARGET/lib/libboost_python*.a $TARGET/lib/libboost_python.a + mv -f $TARGET/lib/libboost_numpy*.a $TARGET/lib/libboost_numpy.a + echo -e "\n * C++语言标准库扩展程序库(boost),编译和安装成功\n" +else + echo -e "\n !!! C++语言标准库扩展程序库(boost),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-bzip2.sh b/compileing/compile-bzip2.sh new file mode 100755 index 0000000..0350b41 --- /dev/null +++ b/compileing/compile-bzip2.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 数据压缩工具(bzip2)……\n" + +${SHELLROOT}/utils/begin_stage bzip2 bzip2*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo bzip2*.tar.gz | sed 's/\*.*//'`* + +echo " * 正在修补bzip2 Makefile以支持-fPIC" +patch Makefile ${SHELLROOT}/distfiles/bzip2-1.0.8-fpic.patch + +sleep 2 +if make $MAKEOPTS && make install PREFIX=$TARGET ; then + echo -e "\n * 数据压缩工具(bzip2),编译和安装成功\n" +else + echo -e "\n !!! 数据压缩工具(bzip2),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-lzma.sh b/compileing/compile-lzma.sh new file mode 100755 index 0000000..f789714 --- /dev/null +++ b/compileing/compile-lzma.sh @@ -0,0 +1,28 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + +echo -e "\n正在编译和安装 压缩算法(lzma)……\n" + +${SHELLROOT}/utils/begin_stage lzma xz*.tar.xz +cd ${SHELLROOT}/tempDIR/`echo xz*.tar.xz | sed 's/\*.*//'`* + +if ! ./configure --enable-static --disable-shared --disable-scripts --disable-xz --disable-xzdec --disable-lzmadec --disable-lzmainfo --disable-lzma-links $CONFIGOPTS --prefix=$TARGET ; then + echo -e "\n !!! 配置 压缩算法(lzma)失败,无法安装成功\n" + exit 1 +fi +sleep 2 + +if make $MAKEOPTS && make install ; then + echo -e "\n * 压缩算法(lzma),编译和安装成功\n" +else + echo -e "\n !!! 压缩算法(lzma),编译和安装失败\n" + exit 1 +fi + +exit 0 diff --git a/compileing/compile-qt.sh b/compileing/compile-qt.sh new file mode 100755 index 0000000..03ae7a7 --- /dev/null +++ b/compileing/compile-qt.sh @@ -0,0 +1,32 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 +CONFIGOPTS=$2 + + + + +echo -e "\n正在编译和安装 Qt应用程序开发框架……\n" + +if [[ ! -d "LuxMark" ]] ; then + echo + echo -e "\nLuxMark src不可用,跳过编译安装 Qt 阶段\n" +else + + ${SHELLROOT}/utils/begin_stage Qt qt-*.tar.gz + cp -v ${SHELLROOT}/installLib/qt-install.sh . + + sleep 2 + if ./qt-install.sh $TARGET ; then + echo -e "\n * Qt库和头,编译和安装成功\n" + else + echo -e "\n !!! Qt库和头,编译和安装失败\n" + exit 1 + fi +fi + +exit 0 diff --git a/compileing/compile-zlib.sh b/compileing/compile-zlib.sh new file mode 100755 index 0000000..8c722ee --- /dev/null +++ b/compileing/compile-zlib.sh @@ -0,0 +1,36 @@ +#!/bin/bash + + + + +# 接收参数 +TARGET=$1 + + + + +echo -e "\n正在编译和安装 数据压缩用函式库(zlib)……\n" + +${SHELLROOT}/utils/begin_stage zlib zlib*.tar.gz +cd ${SHELLROOT}/tempDIR/`echo zlib*.tar.gz | sed 's/\*.*//'`* + +if echo $TARGET | grep -q '\-64' ; then + ZLIB_PLATFORM="--64" +else + ZLIB_PLATFORM="" +fi + +if ! ./configure --static $ZLIB_PLATFORM --prefix=$TARGET ; then +echo -e "\n !!! 配置 数据压缩用函式库(zlib)失败,无法安装成功\n" +exit 1 +fi + +sleep 2 +if make $MAKEOPTS && make install ; then +echo -e "\n * 数据压缩用函式库(zlib),编译和安装成功\n" +else +echo -e "\n * !!! 数据压缩用函式库(zlib),编译和安装失败\n" +exit 1 +fi + +exit 0 diff --git a/distfiles/boost.python-1.72.0.patch b/distfiles/boost.python-1.72.0.patch new file mode 100644 index 0000000..c1f0ec1 --- /dev/null +++ b/distfiles/boost.python-1.72.0.patch @@ -0,0 +1,22 @@ +--- exec.cpp.orig 2019-12-10 01:19:39.000000000 +0100 ++++ exec.cpp 2021-11-25 11:11:49.933084600 +0100 +@@ -104,9 +104,16 @@ + if (local.is_none()) local = global; + // should be 'char const *' but older python versions don't use 'const' yet. + char *f = const_cast(filename); +- // Let python open the file to avoid potential binary incompatibilities. +-#if PY_VERSION_HEX >= 0x03040000 +- FILE *fs = _Py_fopen(f, "r"); ++#if PY_VERSION_HEX >= 0x03010000 ++ // Backported from Boost.Python v1.75.0 to build LuxCore for Python 3.10 ++ // Let python manage any UTF bits to avoid potential incompatibilities. ++ PyObject *fo = Py_BuildValue("s", f); ++ PyObject *fb = Py_None; ++ PyUnicode_FSConverter(fo, &fb); ++ f = PyBytes_AsString(fb); ++ FILE *fs = fopen(f, "r"); ++ Py_DECREF(fo); ++ Py_DECREF(fb); + #elif PY_VERSION_HEX >= 0x03000000 + PyObject *fo = Py_BuildValue("s", f); + FILE *fs = _Py_fopen(fo, "r"); diff --git a/distfiles/bzip2-1.0.8-fpic.patch b/distfiles/bzip2-1.0.8-fpic.patch new file mode 100644 index 0000000..407617c --- /dev/null +++ b/distfiles/bzip2-1.0.8-fpic.patch @@ -0,0 +1,11 @@ +--- Makefile.bak 2014-05-16 13:58:28.994279562 +0700 ++++ Makefile 2014-05-16 13:58:36.964278887 +0700 +@@ -21,7 +21,7 @@ + LDFLAGS= + + BIGFILES=-D_FILE_OFFSET_BITS=64 +-CFLAGS=-Wall -Winline -O2 -g $(BIGFILES) ++CFLAGS=-Wall -Winline -O2 -fPIC -g $(BIGFILES) + + # Where you want it installed when you do 'make install' + PREFIX=/usr/local diff --git a/distfiles/luxcore.cmake b/distfiles/luxcore.cmake new file mode 100644 index 0000000..a02e5f4 --- /dev/null +++ b/distfiles/luxcore.cmake @@ -0,0 +1,21 @@ + +########################################################################### +# +# Configuration +# +########################################################################### + +#cmake -DLUXRAYS_CUSTOM_CONFIG=cmake/SpecializedConfig/sattva.cmake . + +MESSAGE(STATUS "Using my own settings") + +set(FREEIMAGE_ROOT "${LuxRays_SOURCE_DIR}/../target/include") +set(BOOST_SEARCH_PATH "${LuxRays_SOURCE_DIR}/../target/lib") + +# set(OPENCL_SEARCH_PATH "$ENV{ATISTREAMSDKROOT}") +set(OPENCL_SEARCH_PATH "/usr/src/opencl-sdk/include") +set(OPENCL_LIBRARYDIR "${OPENCL_SEARCH_PATH}/lib/x86_64") + +# set(BUILD_LUXMARK TRUE) +set(CMAKE_BUILD_TYPE "Release") + diff --git a/distfiles/oiio-2.2.13.1-compiler.cmake b/distfiles/oiio-2.2.13.1-compiler.cmake new file mode 100644 index 0000000..60f5d93 --- /dev/null +++ b/distfiles/oiio-2.2.13.1-compiler.cmake @@ -0,0 +1,589 @@ +# Copyright 2008-present Contributors to the OpenImageIO project. +# SPDX-License-Identifier: BSD-3-Clause +# https://github.com/OpenImageIO/oiio/blob/master/LICENSE.md + +########################################################################### +# +# This file contains compiler-related detection, options, and actions. +# +# Each option declaration is kept close to the related logic for that +# option. +# +########################################################################### + + +########################################################################### +# Print some basic status about the system and compiler +# +if (VERBOSE) + message (STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") + message (STATUS "CMAKE_SYSTEM_VERSION = ${CMAKE_SYSTEM_VERSION}") + message (STATUS "CMAKE_SYSTEM_PROCESSOR = ${CMAKE_SYSTEM_PROCESSOR}") +endif () +message (STATUS "CMAKE_CXX_COMPILER = ${CMAKE_CXX_COMPILER}") +message (STATUS "CMAKE_CXX_COMPILER_ID = ${CMAKE_CXX_COMPILER_ID}") + + +########################################################################### +# C++ language standard +# +set (CMAKE_CXX_STANDARD 11 CACHE STRING + "C++ standard to prefer (11, 14, 17, 20, etc.)") +set (CMAKE_CXX_STANDARD_REQUIRED ON) +set (CMAKE_CXX_EXTENSIONS OFF) +message (STATUS "Building for C++${CMAKE_CXX_STANDARD}") + + +########################################################################### +# Figure out which compiler we're using +# + +if (CMAKE_COMPILER_IS_GNUCC) + execute_process (COMMAND ${CMAKE_CXX_COMPILER} -dumpversion + OUTPUT_VARIABLE GCC_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (VERBOSE) + message (STATUS "Using gcc ${GCC_VERSION} as the compiler") + endif () +else () + set (GCC_VERSION 0) +endif () + +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER MATCHES "[Cc]lang") + # If using any flavor of clang, set CMAKE_COMPILER_IS_CLANG. If it's + # Apple's variety, set CMAKE_COMPILER_IS_APPLECLANG and + # APPLECLANG_VERSION_STRING, otherwise for generic clang set + # CLANG_VERSION_STRING. + set (CMAKE_COMPILER_IS_CLANG 1) + EXECUTE_PROCESS( COMMAND ${CMAKE_CXX_COMPILER} --version OUTPUT_VARIABLE clang_full_version_string ) + if (clang_full_version_string MATCHES "Apple") + set (CMAKE_CXX_COMPILER_ID "AppleClang") + set (CMAKE_COMPILER_IS_APPLECLANG 1) + string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" APPLECLANG_VERSION_STRING ${clang_full_version_string}) + if (VERBOSE) + message (STATUS "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${APPLECLANG_VERSION_STRING}") + endif () + else () + string (REGEX REPLACE ".* version ([0-9]+\\.[0-9]+).*" "\\1" CLANG_VERSION_STRING ${clang_full_version_string}) + if (VERBOSE) + message (STATUS "The compiler is Clang: ${CMAKE_CXX_COMPILER_ID} version ${CLANG_VERSION_STRING}") + endif () + endif () +elseif (CMAKE_CXX_COMPILER_ID MATCHES "Intel") + set (CMAKE_COMPILER_IS_INTEL 1) + if (VERBOSE) + message (STATUS "Using Intel as the compiler") + endif () +endif () + + +########################################################################### +# Turn on more detailed warnings and optionally consider warnings as errors +# +if (${PROJECT_NAME}_SUPPORTED_RELEASE) + option (STOP_ON_WARNING "Stop building if there are any compiler warnings" OFF) +else () + option (STOP_ON_WARNING "Stop building if there are any compiler warnings" ON) +endif() +option (EXTRA_WARNINGS "Enable lots of extra pedantic warnings" OFF) +if (NOT MSVC) + add_compile_options ("-Wall") + if (EXTRA_WARNINGS) + add_compile_options ("-Wextra") + endif () + if (STOP_ON_WARNING OR DEFINED ENV{CI}) + add_compile_options ("-Werror") + # N.B. Force CI builds to use -Werror, even if STOP_ON_WARNING has + # been switched off by default, which we may do in release + # branches. + endif () +endif () + + +########################################################################### +# Control symbol visibility +# +# We try hard to make default symbol visibility be "hidden", except for +# symbols that are part of the public API, which should be marked in the +# source code with a special decorator, OIIO_API. +# +# Additionally, there is a hidesymbols.map file that on some platforms may +# give more fine-grained control for hiding symbols, because sometimes +# dependent libraries may not be well behaved and need extra hiding. +# +set (CXX_VISIBILITY_PRESET "hidden" CACHE STRING "Symbol visibility (hidden or default") +option (VISIBILITY_INLINES_HIDDEN "Hide symbol visibility of inline functions" ON) +set (VISIBILITY_MAP_FILE "${PROJECT_SOURCE_DIR}/src/build-scripts/hidesymbols.map" CACHE FILEPATH "Visibility map file") +set (C_VISIBILITY_PRESET ${CXX_VISIBILITY_PRESET}) +if (${CXX_VISIBILITY_PRESET} STREQUAL "hidden" AND + (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) AND + (CMAKE_SYSTEM_NAME MATCHES "Linux|kFreeBSD" OR CMAKE_SYSTEM_NAME STREQUAL "GNU")) + # Linux/FreeBSD/Hurd: also hide all the symbols of dependent libraries + # to prevent clashes if an app using this project is linked against + # other versions of our dependencies. + set (VISIBILITY_MAP_COMMAND "-Wl,--version-script=${VISIBILITY_MAP_FILE}") +endif () + + +########################################################################### +# Compiler-specific and platform-specific options. +# +# Here is where we add a whole bunch of options for specific compilers or +# platforms. Usually this is to suppress false-positive compiler warnings. +# +if (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG) + # Clang-specific options + add_compile_options ("-Wno-unused-function") + add_compile_options ("-Wno-overloaded-virtual") + add_compile_options ("-Wno-unneeded-internal-declaration") + add_compile_options ("-Wno-unused-private-field") + add_compile_options ("-Wno-tautological-compare") + # disable warning about unused command line arguments + add_compile_options ("-Qunused-arguments") + # Don't warn if we ask it not to warn about warnings it doesn't know + add_compile_options ("-Wunknown-warning-option") + if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.6 OR + APPLECLANG_VERSION_STRING VERSION_GREATER 6.1) + add_compile_options ("-Wno-unused-local-typedefs") + endif () + if (CLANG_VERSION_STRING VERSION_GREATER_EQUAL 3.9) + # Don't warn about using unknown preprocessor symbols in `#if` + add_compile_options ("-Wno-expansion-to-defined") + endif () +endif () + +if (CMAKE_COMPILER_IS_GNUCC AND NOT (CMAKE_COMPILER_IS_CLANG OR CMAKE_COMPILER_IS_APPLECLANG)) + # gcc specific options + add_compile_options ("-Wno-unused-local-typedefs") + add_compile_options ("-Wno-unused-result") + if (NOT ${GCC_VERSION} VERSION_LESS 7.0) + add_compile_options ("-Wno-aligned-new") + add_compile_options ("-Wno-noexcept-type") + endif () +endif () + +if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG) + # Options common to gcc and clang + + # Ensure this macro is set for stdint.h + add_definitions ("-D__STDC_LIMIT_MACROS") + add_definitions ("-D__STDC_CONSTANT_MACROS") + # this allows native instructions to be used for sqrtf instead of a function call + add_compile_options ("-fno-math-errno") +endif () + +if (MSVC) + # Microsoft specific options + add_compile_options (/W1) + add_definitions (-D_CRT_SECURE_NO_DEPRECATE) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + add_definitions (-D_CRT_NONSTDC_NO_WARNINGS) + add_definitions (-D_SCL_SECURE_NO_WARNINGS) + add_definitions (-DJAS_WIN_MSVC_BUILD) +endif (MSVC) + +if (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" + AND ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386") + # For FreeBSD, minimum arch of i586 is needed for atomic cpu instructions + add_compile_options (-march=i586) +endif () + + +########################################################################### +# Use ccache if found +# +# This can really speed up compilation by caching object files that have +# been compiled previously with identical arguments and inputs. Putting this +# logic here makes it work even if the user is unaware of ccache. If it's +# not found on the system, it will simply be silently not used. +option (USE_CCACHE "Use ccache if found" ON) +find_program (CCACHE_FOUND ccache) +if (CCACHE_FOUND AND USE_CCACHE) + if (CMAKE_COMPILER_IS_CLANG AND USE_QT AND (NOT DEFINED ENV{CCACHE_CPP2})) + message (STATUS "Ignoring ccache because clang + Qt + env CCACHE_CPP2 is not set") + else () + set_property (GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + set_property (GLOBAL PROPERTY RULE_LAUNCH_LINK ccache) + endif () +endif () + + +########################################################################### +# Option to force use of libc++ (the LLVM project's alternate C++ standard +# library). Currently this only has an effect if using clang as the +# compiler. Maybe it would also work for g++? Investigate. +option (USE_LIBCPLUSPLUS "Compile with clang libc++" OFF) +if (USE_LIBCPLUSPLUS AND CMAKE_COMPILER_IS_CLANG) + message (STATUS "Using libc++") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +endif () + + +########################################################################### +# For gcc >= 5, allow an option to force which version of the C++ ABI to +# use (mostly this affects the implementation of std::string). +# +# FIXME: In theory, this should also be needed for clang, if compiling with +# the gcc libstdc++ toolchain. In practice, I could not get things to build +# with clang properly when using this option, and I haven't yet seen a case +# where it's needed. We can return to this and fix for clang if it becomes a +# legit problem later. +# +set (GLIBCXX_USE_CXX11_ABI "" CACHE STRING "For gcc, use the new C++11 library ABI (0|1)") +if (CMAKE_COMPILER_IS_GNUCC AND ${GCC_VERSION} VERSION_GREATER_EQUAL 5.0) + if (NOT ${GLIBCXX_USE_CXX11_ABI} STREQUAL "") + add_definitions ("-D_GLIBCXX_USE_CXX11_ABI=${GLIBCXX_USE_CXX11_ABI}") + endif () +endif () + + +########################################################################### +# SIMD and machine architecture options. +# +# The USE_SIMD option may be set to a comma-separated list of machine / +# instruction set options, such as "avx3,f16c". The list will be parsed and +# the proper compiler directives added to generate code for those ISA +# capabilities. +# +set (USE_SIMD "" CACHE STRING "Use SIMD directives (0, sse2, sse3, ssse3, sse4.1, sse4.2, avx, avx2, avx512f, f16c, aes)") +set (SIMD_COMPILE_FLAGS "") +if (NOT USE_SIMD STREQUAL "") + message (STATUS "Compiling with SIMD level ${USE_SIMD}") + if (USE_SIMD STREQUAL "0") + set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "-DOIIO_NO_SSE=1") + else () + string (REPLACE "," ";" SIMD_FEATURE_LIST ${USE_SIMD}) + foreach (feature ${SIMD_FEATURE_LIST}) + if (VERBOSE) + message (STATUS "SIMD feature: ${feature}") + endif () + if (MSVC OR CMAKE_COMPILER_IS_INTEL) + set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "/arch:${feature}") + else () + set (SIMD_COMPILE_FLAGS ${SIMD_COMPILE_FLAGS} "-m${feature}") + endif () + if (feature STREQUAL "fma" AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)) + # If fma is requested, for numerical accuracy sake, turn it + # off by default except when we explicitly use madd. At some + # future time, we should look at this again carefully and + # see if we want to use it more widely by ffp-contract=fast. + add_compile_options ("-ffp-contract=off") + endif () + endforeach() + endif () + add_compile_options (${SIMD_COMPILE_FLAGS}) +endif () + + +########################################################################### +# Preparation to test for compiler/language features +if (NOT VERBOSE) + set (CMAKE_REQUIRED_QUIET 1) +endif () +include (CMakePushCheckState) +include (CheckCXXSourceRuns) +include (CheckLibraryExists) + +########################################################################### +# Find out if it's safe for us to use std::regex or if we need boost.regex. +# This is primarily about gcc 4.8 having a broken regex implementation. +# This will be obsolete once our minimum supported gcc is >= 4.9. +# +#cmake_push_check_state () +#check_cxx_source_runs(" +# #include +# int main() { +# std::string r = std::regex_replace(std::string(\"abc\"), std::regex(\"b\"), \" \"); +# return r == \"a c\" ? 0 : -1; +# }" +# USE_STD_REGEX) +#cmake_pop_check_state () +#if (USE_STD_REGEX) +# add_definitions (-DUSE_STD_REGEX) +#else () + add_definitions (-DUSE_BOOST_REGEX) +#endif () + +########################################################################### +# Check if we need libatomic on this platform. We shouldn't on mainstream +# x86/x86_64, but might on some other platforms. +# +if (NOT MSVC AND NOT APPLE) + cmake_push_check_state () + check_cxx_source_runs( + "#include + #include + std::atomic x {0}; + int main() { + uint64_t i = x.load(std::memory_order_relaxed); + return 0; + }" + COMPILER_SUPPORTS_ATOMIC_WITHOUT_LIBATOMIC) + cmake_pop_check_state () + if (NOT COMPILER_SUPPORTS_ATOMIC_WITHOUT_LIBATOMIC) + check_library_exists (atomic __atomic_load_8 "" LIBATOMIC_WORKS) + if (LIBATOMIC_WORKS) + list (APPEND GCC_ATOMIC_LIBRARIES "-latomic") + message (STATUS "Compiler needs libatomic, added") + else () + message (FATAL_ERROR "Compiler needs libatomic, but not found") + endif () + else () + if (VERBOSE) + message (STATUS "Compiler supports std::atomic, no libatomic necessary") + endif () + endif () +endif () + + +########################################################################### +# Code coverage options +# +option (CODECOV "Build code coverage tests" OFF) +if (CODECOV AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)) + message (STATUS "Compiling for code coverage analysis") + add_compile_options ("-ftest-coverage -fprofile-arcs -O0") + add_definitions ("-D${PROJ_NAME}_CODE_COVERAGE=1") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -ftest-coverage -fprofile-arcs") + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -ftest-coverage -fprofile-arcs") +endif () + + +########################################################################### +# Sanitizer options +# +set (SANITIZE "" CACHE STRING "Build code using sanitizer (address, thread)") +if (SANITIZE AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)) + message (STATUS "Compiling for sanitizer=${SANITIZE}") + string (REPLACE "," ";" SANITIZE_FEATURE_LIST ${SANITIZE}) + foreach (feature ${SANITIZE_FEATURE_LIST}) + message (STATUS " sanitize feature: ${feature}") + add_compile_options (-fsanitize=${feature}) + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=${feature}") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fsanitize=${feature}") + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fsanitize=${feature}") + endforeach() + add_compile_options (-g -fno-omit-frame-pointer) + if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + set (SANITIZE_ON_LINUX 1) + endif () + if (CMAKE_COMPILER_IS_GNUCC AND ${CMAKE_SYSTEM_NAME} STREQUAL "Linux") + add_compile_options ("-fuse-ld=gold") + set (CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=gold") + set (CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} -fuse-ld=gold") + set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -fuse-ld=gold") + set (SANITIZE_LIBRARIES "asan;pthread") + # set (SANITIZE_LIBRARIES "asan" "ubsan") + endif() + if (CMAKE_COMPILER_IS_GNUCC) + # turn on glibcxx extra annotations to find vector writes past end + add_definitions ("-D_GLIBCXX_SANITIZE_VECTOR=1") + endif () + add_definitions ("-D${PROJECT_NAME}_SANITIZE=1") +endif () + + +########################################################################### +# clang-tidy options +# +# clang-tidy is a static analyzer that is part of the LLVM tools. It has a +# variety of the usual bug and security tests, linting, and also tests for +# things like finding (and correcting!) use of older language constructs. +# +# If clang-tidy is found and enabled, a "clang-tidy" build target will be +# enabled. The set of tests can be customized both here and through +# the .clang-tidy file that is part of this project. +# +option (CLANG_TIDY "Enable clang-tidy" OFF) +set (CLANG_TIDY_CHECKS "-*" CACHE STRING "clang-tidy checks to perform (none='-*')") +set (CLANG_TIDY_ARGS "" CACHE STRING "clang-tidy args") +option (CLANG_TIDY_FIX "Have clang-tidy fix source" OFF) +if (CLANG_TIDY) + find_program(CLANG_TIDY_EXE NAMES "clang-tidy" + DOC "Path to clang-tidy executable") + message (STATUS "CLANG_TIDY_EXE ${CLANG_TIDY_EXE}") + if (CLANG_TIDY_EXE AND NOT ${CMAKE_VERSION} VERSION_LESS 3.6) + set (CMAKE_CXX_CLANG_TIDY + "${CLANG_TIDY_EXE}" + ) + if (CLANG_TIDY_ARGS) + list (APPEND CMAKE_CXX_CLANG_TIDY ${CLANG_TIDY_ARGS}) + endif () + if (CLANG_TIDY_CHECKS) + list (APPEND CMAKE_CXX_CLANG_TIDY -checks="${CLANG_TIDY_CHECKS}") + endif () + execute_process (COMMAND ${CMAKE_CXX_CLANG_TIDY} -list-checks + OUTPUT_VARIABLE tidy_checks + OUTPUT_STRIP_TRAILING_WHITESPACE) + if (CLANG_TIDY_FIX) + list (APPEND CMAKE_CXX_CLANG_TIDY "-fix") + endif () + message (STATUS "clang-tidy command line is: ${CMAKE_CXX_CLANG_TIDY}") + message (STATUS "${tidy_checks}") + else () + message (STATUS "Cannot run clang-tidy as requested") + endif () + # Hint: run with CLANG_TIDY_ARGS=-list-checks to list all the checks +endif () + + +########################################################################### +# clang-format options +# +# clang-format is a source code reformatter that is part of the LLVM tools. +# It can be used to check adherence to project code formatting rules and +# correct any deviations. If clang-format is found on the system, a +# "clang-format" build target will trigger a reformatting. +# +# Note: skip all of this checking, setup, and cmake-format target if this +# is being built as a subproject. +if (NOT ${PROJECT_NAME}_IS_SUBPROJECT) + set (CLANG_FORMAT_EXE_HINT "" CACHE PATH "clang-format executable's directory (will search if not specified") + set (CLANG_FORMAT_INCLUDES "src/*.h" "src/*.cpp" + CACHE STRING "Glob patterns to include for clang-format") + set (CLANG_FORMAT_EXCLUDES "*pugixml*" "*SHA1*" "*/farmhash.cpp" + "src/dpx.imageio/libdpx/*" + "src/cineon.imageio/libcineon/*" + "src/dds.imageio/squish/*" + "src/gif.imageio/gif.h" + "src/hdr.imageio/rgbe.cpp" + "src/libutil/stb_sprintf.h" + CACHE STRING "Glob patterns to exclude for clang-format") + find_program (CLANG_FORMAT_EXE + NAMES clang-format bin/clang-format + HINTS ${CLANG_FORMAT_EXE_HINT} ENV CLANG_FORMAT_EXE_HINT + ENV LLVM_DIRECTORY + NO_DEFAULT_PATH + DOC "Path to clang-format executable") + find_program (CLANG_FORMAT_EXE NAMES clang-format bin/clang-format) + if (CLANG_FORMAT_EXE) + message (STATUS "clang-format found: ${CLANG_FORMAT_EXE}") + # Start with the list of files to include when formatting... + file (GLOB_RECURSE FILES_TO_FORMAT ${CLANG_FORMAT_INCLUDES}) + # ... then process any list of excludes we are given + foreach (_pat ${CLANG_FORMAT_EXCLUDES}) + file (GLOB_RECURSE _excl ${_pat}) + list (REMOVE_ITEM FILES_TO_FORMAT ${_excl}) + endforeach () + #message (STATUS "clang-format file list: ${FILES_TO_FORMAT}") + file (COPY ${CMAKE_CURRENT_SOURCE_DIR}/.clang-format + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + add_custom_target (clang-format + COMMAND "${CLANG_FORMAT_EXE}" -i -style=file ${FILES_TO_FORMAT} ) + else () + message (STATUS "clang-format not found.") + endif () +endif () + +########################################################################### +# Another way to sneak in custom compiler and DSO linking flags. +# +set (EXTRA_CPP_ARGS "" CACHE STRING "Extra C++ command line definitions") +if (EXTRA_CPP_ARGS) + message (STATUS "Extra C++ args: ${EXTRA_CPP_ARGS}") + add_compile_options ("${EXTRA_CPP_ARGS}") +endif() +set (EXTRA_DSO_LINK_ARGS "" CACHE STRING "Extra command line definitions when building DSOs") + + +########################################################################### +# Set the versioning for shared libraries. +# +if (${PROJECT_NAME}_SUPPORTED_RELEASE) + # Supported releases guarantee ABI back-compatibility within the release + # family, so SO versioning is major.minor. + set (SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} + CACHE STRING "Set the SO version for dynamic libraries") +else () + # Development master makes no ABI stability guarantee, so we make the + # SO naming capture down to the major.minor.patch level. + set (SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} + CACHE STRING "Set the SO version for dynamic libraries") +endif () +if (VERBOSE) + message(STATUS "Setting SOVERSION to: ${SOVERSION}") +endif () + + +########################################################################### +# BUILD_SHARED_LIBS, if turned off, will disable building of .so/.dll +# dynamic libraries and instead only build static libraries. +# +option (BUILD_SHARED_LIBS "Build shared libraries (set to OFF to build static libs)" ON) +if (NOT BUILD_SHARED_LIBS) + add_definitions (-D${PROJ_NAME}_STATIC_DEFINE=1) +endif () + + +########################################################################### +# LINKSTATIC, if enabled, will cause us to favor linking static versions +# of library dependencies, if they are available. +# +option (LINKSTATIC "Link with static external libraries when possible" OFF) +if (LINKSTATIC) + #set (_orig_link_suffixes ${CMAKE_FIND_LIBRARY_SUFFIXES}) + message (STATUS "Statically linking external libraries when possible") + if (WIN32) + set (CMAKE_FIND_LIBRARY_SUFFIXES .lib .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + else () + set (CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif () +endif () + + +########################################################################### +# Any extra logic to be run only for CI builds goes here. +# +if (DEFINED ENV{CI} OR DEFINED ENV{GITHUB_ACTIONS}) + add_definitions ("-D${PROJ_NAME}_CI=1" "-DBUILD_CI=1") + if (APPLE) + # Keep Mono framework from being incorrectly searched for include + # files on GitHub Actions CI. + set(CMAKE_FIND_FRAMEWORK LAST) + endif () +endif () + + +########################################################################### +# Rpath handling at the install step +# +set (MACOSX_RPATH ON) +if (CMAKE_SKIP_RPATH) + # We need to disallow the user from truly setting CMAKE_SKIP_RPATH, since + # we want to run the generated executables from the build tree in order to + # generate the manual page documentation. However, we make sure the + # install rpath is unset so that the install tree is still free of rpaths + # for linux packaging purposes. + set (CMAKE_SKIP_RPATH FALSE) + unset (CMAKE_INSTALL_RPATH) +else () + if (NOT CMAKE_INSTALL_RPATH) + set (CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") + endif () + # add the automatically determined parts of the RPATH that + # point to directories outside the build tree to the install RPATH + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + if (VERBOSE) + message (STATUS "CMAKE_INSTALL_RPATH = ${CMAKE_INSTALL_RPATH}") + endif () +endif () + + + +########################################################################### +# Macro to install targets to the appropriate locations. Use this instead +# of the install(TARGETS ...) signature. Note that it adds it to the +# export targets list for when we generate config files. +# +# Usage: +# +# install_targets (target1 [target2 ...]) +# +macro (install_targets) + install (TARGETS ${ARGN} + EXPORT ${PROJ_NAME}_EXPORTED_TARGETS + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT user + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT user + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT developer) +endmacro() diff --git a/first_run.sh b/first_run.sh new file mode 100755 index 0000000..ea5f3ab --- /dev/null +++ b/first_run.sh @@ -0,0 +1,56 @@ +#!/bin/bash + + + + +# 分界线 开始 +export BOUNDARYSTART=">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\ +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>\ +>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" +# 分界线 结束 +export BOUNDARYEND="<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\ +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<\ +<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<" + + + + +# 在开始编译之前,需要先安装如下库或工具: +# +# libtool-bin 是一个通用库支持脚本,将使用动态库的复杂性隐藏在统一、可移植的接口中。 +# cmake CMake是一个跨平台的安装(编译)工具,可以用简单的语句来描述所有平台的安装(编译过程)。 +# flex 词法分析工具 +# bison 语法分析工具 +# libgtk-3-dev GTK图形库及开发环境 +# libgl1-mesa-dev +# python3-dev 可面向对象的解释型编程语言 +# python3-numpy python3的数学计算扩展 +# git 版本控制工具 +# patchelf 是一个用来修改elf格式的动态库和可执行程序的小工具,可以修改动态链接库的库名字,以及链接库的RPATH。 +# RPATH规定了可执行文件在寻找.so文件时的第一优先位置。另外,elf文件中还规定了runpath。它与rpath +# 相同,只是优先级低一些 +echo $BOUNDARYSTART +echo -e "\n运行脚本需要使用下列工具,如果没有将会被安装,按回车键继 ……" +echo -e "\n\n[ libtool-bin cmake flex bison libgtk-3-dev libgl1-mesa-dev python3-dev python3-numpy git patchelf ]\n\n" +read +sudo apt update +sudo apt install -y libtool-bin cmake flex bison libgtk-3-dev libgl1-mesa-dev python3-dev python3-numpy git patchelf +echo -e "\n\n已经安装完成 运行脚本需要的工具 ……\n" +echo $BOUNDARYEND + + + + +# TODO:下载项目源码,后续将使用自己的源码 +echo $BOUNDARYSTART +echo -e "\n正在下载LuxCore项目源码……\n" +git clone https://github.com/LuxCoreRender/LuxCore.git +echo -e "\n\n下载LuxCore项目源码 已完成……\n" +echo $BOUNDARYEND + + + +# 开始构建脚本,将路径传递给LuxCore源代码作为第一个参数 +# 这将在第一次运行时花费很长时间,因为它需要编译所有依赖项 +./build-64-sse2 LuxCore +exit 0 diff --git a/installLib/cblosc-install.sh b/installLib/cblosc-install.sh new file mode 100755 index 0000000..b48edb0 --- /dev/null +++ b/installLib/cblosc-install.sh @@ -0,0 +1,14 @@ +#!/bin/bash + + + + +INCLUDE_INSTALL_DIR="$1"/include +LIBRARY_INSTALL_DIR="$1"/lib + +mkdir -p $INCLUDE_INSTALL_DIR +mkdir -p $LIBRARY_INSTALL_DIR + +cp -vr include/*.h $INCLUDE_INSTALL_DIR + +cp -vr lib/lib*.a $LIBRARY_INSTALL_DIR diff --git a/installLib/embree-install.sh b/installLib/embree-install.sh new file mode 100755 index 0000000..bdaaacd --- /dev/null +++ b/installLib/embree-install.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + + + +INCLUDE_INSTALL_DIR="$1"/include +LIBRARY_INSTALL_DIR="$1"/lib + +mkdir -p $INCLUDE_INSTALL_DIR +mkdir -p $LIBRARY_INSTALL_DIR + +cp -av include/embree3 $INCLUDE_INSTALL_DIR + +cp -av lib/lib* $LIBRARY_INSTALL_DIR + +rm $LIBRARY_INSTALL_DIR/libtbb.so +rm $LIBRARY_INSTALL_DIR/libtbb.so.12 +cp $LIBRARY_INSTALL_DIR/libtbb.so.12.1 $LIBRARY_INSTALL_DIR/libtbb.so.12 + +sudo cp $LIBRARY_INSTALL_DIR/libembree3.so.3 /usr/local/lib +sudo cp $LIBRARY_INSTALL_DIR/libembree3.so /usr/local/lib diff --git a/installLib/luxmark.start b/installLib/luxmark.start new file mode 100755 index 0000000..5a22ce1 --- /dev/null +++ b/installLib/luxmark.start @@ -0,0 +1,12 @@ +#!/bin/bash + +ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +# You may run in trouble on localized Linux installations +# because of ',' parsed as decimal separator instead of '.' char +export LC_ALL=C +# Embree and OpenImageDenoise dynamic libraries are assumed to be located in the 'lib' +# subdirectory. +export LD_PRELOAD="$ROOT/lib/libembree3.so.3:$ROOT/lib/libOpenImageDenoise.so.0:$ROOT/lib/libtbb.so.2:$ROOT/lib/libtbbmalloc.so.2" + +cd "$ROOT" +./luxmark.bin "$@" diff --git a/installLib/nvrtc-install.sh b/installLib/nvrtc-install.sh new file mode 100755 index 0000000..bdd4c42 --- /dev/null +++ b/installLib/nvrtc-install.sh @@ -0,0 +1,25 @@ +#!/bin/bash + + + + +INCLUDE_INSTALL_DIR="$1"/include +LIBRARY_INSTALL_DIR="$1"/lib + +mkdir -p $INCLUDE_INSTALL_DIR +mkdir -p $LIBRARY_INSTALL_DIR + +cp -avr targets/x86_64-linux/lib/libnvrtc* "$LIBRARY_INSTALL_DIR" + +# Fix missing rpath, so one shared lib can find the other when it is loaded by BlendLuxCore +echo "修复NVRTC rpath" + +NVRTC="$LIBRARY_INSTALL_DIR"/libnvrtc.so +patchelf --set-rpath ./ "$NVRTC" +echo "新rpath的 $NVRTC:" +patchelf --print-rpath "$NVRTC" + +NVRTC_BUILTINS="$LIBRARY_INSTALL_DIR"/libnvrtc-builtins.so +patchelf --set-rpath ./ "$NVRTC_BUILTINS" +echo "新rpath的 $NVRTC_BUILTINS:" +patchelf --print-rpath "$NVRTC_BUILTINS" diff --git a/installLib/oidn-install.sh b/installLib/oidn-install.sh new file mode 100755 index 0000000..b18b181 --- /dev/null +++ b/installLib/oidn-install.sh @@ -0,0 +1,21 @@ +#!/bin/bash + + + +INCLUDE_INSTALL_DIR="$1"/include +LIBRARY_INSTALL_DIR="$1"/lib + +mkdir -p $INCLUDE_INSTALL_DIR +mkdir -p $LIBRARY_INSTALL_DIR + +cp -av include/OpenImageDenoise $INCLUDE_INSTALL_DIR + +cp -av lib/lib* $LIBRARY_INSTALL_DIR + +rm $LIBRARY_INSTALL_DIR/libtbb.so +rm $LIBRARY_INSTALL_DIR/libtbb.so.12 +cp $LIBRARY_INSTALL_DIR/libtbb.so.12.1 $LIBRARY_INSTALL_DIR/libtbb.so.12 + +sudo ln -s ${LIBRARY_INSTALL_DIR}/libOpenImageDenoise.so /usr/local/lib/libOpenImageDenoise.so +sudo ln -s ${LIBRARY_INSTALL_DIR}/libOpenImageDenoise.so.1 /usr/local/lib/libOpenImageDenoise.so.1 +sudo ln -s ${LIBRARY_INSTALL_DIR}/libOpenImageDenoise.so.1.4.0 /usr/local/lib/libOpenImageDenoise.so.1.4.0 \ No newline at end of file diff --git a/installLib/qt-install.sh b/installLib/qt-install.sh new file mode 100755 index 0000000..b8dd54a --- /dev/null +++ b/installLib/qt-install.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +mkdir $1/qt5-v5.12.2 +cp -av 5.12.2/gcc_64/bin $1/qt5-v5.12.2 +cp -av 5.12.2/gcc_64/include $1/qt5-v5.12.2 +cp -av 5.12.2/gcc_64/lib $1/qt5-v5.12.2 +cp -av 5.12.2/gcc_64/mkspecs $1/qt5-v5.12.2 +cp -av 5.12.2/gcc_64/plugins $1/qt5-v5.12.2 diff --git a/installLib/tbb-install.sh b/installLib/tbb-install.sh new file mode 100755 index 0000000..540f7f5 --- /dev/null +++ b/installLib/tbb-install.sh @@ -0,0 +1,17 @@ +#!/bin/bash + + + + +INCLUDE_INSTALL_DIR="$1"/include +LIBRARY_INSTALL_DIR="$1"/lib + +mkdir -p $INCLUDE_INSTALL_DIR +mkdir -p $LIBRARY_INSTALL_DIR + +cp -vr include/serial include/tbb $INCLUDE_INSTALL_DIR + +cp -vr ../tbb2019_20191006oss/lib/intel64/gcc4.8/lib* $LIBRARY_INSTALL_DIR + +sudo ln -s ${LIBRARY_INSTALL_DIR}/libtbb.so.2 /usr/local/lib/libtbb.so.2 +sudo ln -s ${LIBRARY_INSTALL_DIR}/libtbb.so.12 /usr/local/lib/libtbb.so.12 diff --git a/utils/begin_stage b/utils/begin_stage new file mode 100755 index 0000000..350a495 --- /dev/null +++ b/utils/begin_stage @@ -0,0 +1,50 @@ +#!/bin/bash + +set -x + + +# 解压文件包函数 +stage_name=$1 +distfile_mask=$2 + + + + +echo -ne "\033]0;${stage_name} stage\007" +echo " * Cleaning and unpacking ${stage_name}" + + + +if [ -d "${SHELLROOT}/tempDIR" ] +then + rm -rf ${SHELLROOT}/tempDIR/* +else + echo -e "\n!!! 错误, ${SHELLROOT}/tempDIR/目录不存在,无法清空此目录\n" +fi + + + + +if echo $distfile_mask | grep -q '\.tgz$' +then + tar -xzf ${SHELLROOT}/distfiles/$distfile_mask -C ${SHELLROOT}/tempDIR + +elif echo $distfile_mask | grep -q '\.tar\.gz$' +then + tar -xzf ${SHELLROOT}/distfiles/$distfile_mask -C ${SHELLROOT}/tempDIR + +elif echo $distfile_mask | grep -q '\.tar\.bz2$' +then + tar -xjf ${SHELLROOT}/distfiles/$distfile_mask -C ${SHELLROOT}/tempDIR + +elif echo $distfile_mask | grep -q '\.tar\.xz$' +then + tar --xz -xf ${SHELLROOT}/distfiles/$distfile_mask -C ${SHELLROOT}/tempDIR + +elif echo $distfile_mask | grep -q '\.zip$' +then + unzip -d ${SHELLROOT}/tempDIR ${SHELLROOT}/distfiles/$distfile_mask +fi + +echo " * Compiling ${stage_name}" +sleep 2 diff --git a/utils/clear b/utils/clear new file mode 100755 index 0000000..61d99b1 --- /dev/null +++ b/utils/clear @@ -0,0 +1,29 @@ +#!/bin/bash + +cd /root/luxbuild + +if [[ ! -d $1 ]] ; then + echo "Please provide Lux snapshot dir" + echo "Usage: " +fi + +cd ~/luxbuild + +if [[ $2 == 1 ]] ; then + echo " * Removing compiled distributions" + sleep 3 + rm -vfr target-*/"$1" + exit 0 +elif [[ $2 == 2 ]] ; then + echo " * Removing distributions and sources" + sleep 3 + rm -vfr target-*/"$1" + rm -fr $1 + exit 0 +fi + +echo "Targets:" +echo " 1 - compiled distributions" +echo " 2 - distributions and sources" +echo +exit 1 diff --git a/utils/create_python_wheel.sh b/utils/create_python_wheel.sh new file mode 100755 index 0000000..53dbe4a --- /dev/null +++ b/utils/create_python_wheel.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# +# Edit LuxCore/pywheel/setup.y, update version there and in this file, than: +# +# ./utils/create_python_wheel.sh target-64-sse2 luxcorerender-v2.0-linux64 +# ./utils/create_python_wheel.sh target-64-sse2 luxcorerender-v2.0-linux64-opencl + +if [[ ! $2 ]] ; then + echo " * Unable to create Python Wheel" + exit 1 +fi + +TARGET=$1 +LUX_TAG=$2 + +rm -rf $TARGET/$LUX_TAG-wheel +mkdir -p $TARGET/$LUX_TAG-wheel/pyluxcore + +cp $LUX_TAG/pywheel/setup.py $TARGET/$LUX_TAG-wheel +cp $LUX_TAG/pywheel/setup.cfg $TARGET/$LUX_TAG-wheel +cp $LUX_TAG/pywheel/MANIFEST.in $TARGET/$LUX_TAG-wheel +cp $LUX_TAG/pywheel/__init__.py $TARGET/$LUX_TAG-wheel/pyluxcore + +cp -r $LUX_TAG/src/pyluxcoretools/pyluxcoretools $TARGET/$LUX_TAG-wheel/pyluxcoretools + +cp $LUX_TAG/README.md $TARGET/$LUX_TAG-wheel/README.rst +cp $LUX_TAG/AUTHORS.txt $TARGET/$LUX_TAG-wheel/AUTHORS.txt +cp $LUX_TAG/COPYING.txt $TARGET/$LUX_TAG-wheel/LICENSE.txt + +cp $LUX_TAG/lib/*.so $TARGET/$LUX_TAG-wheel/pyluxcore +cp $TARGET/lib/libOpenImageDenoise.so.0 $TARGET/lib/libembree3.so.3 $TARGET/lib/libtbb.so.2 $TARGET/lib/libtbbmalloc.so.2 $TARGET/$LUX_TAG-wheel/pyluxcore + + +cd $TARGET/$LUX_TAG-wheel +python3 setup.py bdist_wheel --plat-name manylinux1_x86_64 +#twine upload dist/luxcorerender-2.0-cp34-cp34m-manylinux1_x86_64.whl +# +mv dist/luxcorerender-2.0-cp34-cp34m-manylinux1_x86_64.whl dist/luxcorerender-2.0b-cp34-cp34m-manylinux1_x86_64.whl +twine upload dist/luxcorerender-2.0b-cp34-cp34m-manylinux1_x86_64.whl +cd - diff --git a/utils/install b/utils/install new file mode 100755 index 0000000..9e049c6 --- /dev/null +++ b/utils/install @@ -0,0 +1,129 @@ +#!/bin/bash + + + +if [[ ! $2 ]] ; then + echo " * Unable to install" + exit 1 +fi + +TARGET=$1 +LUX_TAG=$2 +DIST=$3 + +# Check if I have to build the stand alone version or the SDK version +if echo $LUX_TAG | grep -iq 'sdk' ; then + echo + echo " * 安装SDK版本在 $TARGET/$LUX_TAG" + + rm -rf $TARGET/$LUX_TAG + mkdir $TARGET/$LUX_TAG + + mkdir $TARGET/$LUX_TAG/bin + cp $LUX_TAG/bin/luxcoreui $LUX_TAG/bin/luxcoreconsole $LUX_TAG/bin/luxcoredemo \ + $LUX_TAG/bin/luxcorescenedemo $TARGET/$LUX_TAG/bin + + mkdir $TARGET/$LUX_TAG/lib + cp $LUX_TAG/lib/*.so $TARGET/$LUX_TAG/lib + cp $TARGET/lib/libOpenImageDenoise.so.1 $TARGET/lib/libembree3.so.3 $TARGET/lib/libtbb.so.12 $TARGET/lib/libtbb.so.2 $TARGET/$LUX_TAG/lib + cp -a $TARGET/lib/libnvrtc* $TARGET/$LUX_TAG + + cp $LUX_TAG/README.md $TARGET/$LUX_TAG + cp $LUX_TAG/COPYING.txt $TARGET/$LUX_TAG + cp $LUX_TAG/AUTHORS.txt $TARGET/$LUX_TAG + cp $LUX_TAG/sdk/CMakeLists.txt $TARGET/$LUX_TAG + + mkdir $TARGET/$LUX_TAG/cmake + + mkdir $TARGET/$LUX_TAG/include + mkdir $TARGET/$LUX_TAG/include/luxrays + mkdir $TARGET/$LUX_TAG/include/luxrays/utils + cp -r $LUX_TAG/include/luxrays/utils/cyhair $TARGET/$LUX_TAG/include/luxrays/utils + cp $LUX_TAG/include/luxrays/utils/exportdefs.h $TARGET/$LUX_TAG/include/luxrays/utils + cp $LUX_TAG/include/luxrays/utils/properties.h $TARGET/$LUX_TAG/include/luxrays/utils + cp $LUX_TAG/include/luxrays/utils/utils.h $TARGET/$LUX_TAG/include/luxrays/utils + + mkdir $TARGET/$LUX_TAG/include/luxcore + cp $LUX_TAG/generated/include/luxcore/cfg.h $TARGET/$LUX_TAG/include/luxcore + cp $LUX_TAG/include/luxcore/luxcore.h $TARGET/$LUX_TAG/include/luxcore + + cp -r $LUX_TAG/samples $TARGET/$LUX_TAG + cp -r $LUX_TAG/scenes $TARGET/$LUX_TAG + + cd $TARGET + tar -cvjf ${LUX_TAG}.tar.bz2 $LUX_TAG + cd .. + + echo +else + echo + echo " * 安装独立版本在 $TARGET/$LUX_TAG" + + rm -rf $TARGET/$LUX_TAG + mkdir $TARGET/$LUX_TAG + + # Build PyInstaller + # + # PyInstaller is pretty much broken on Linux: https://github.com/LuxCoreRender/LuxCore/issues/80 +# cd $LUX_TAG +# pyinstaller samples/pyluxcoretool/pyluxcoretool.linux.spec +# cd - +# +# cp $LUX_TAG/bin/luxcoreui $LUX_TAG/dist/pyluxcoretool $TARGET/$LUX_TAG + # Workaround to PyInstaller, just run "python3 pyluxcoretools.zip" + cp $LUX_TAG/lib/pyluxcoretools.zip $TARGET/$LUX_TAG + + cp $LUX_TAG/bin/luxcoreui $TARGET/$LUX_TAG + cp $LUX_TAG/lib/*.so $TARGET/$LUX_TAG + cp $TARGET/lib/libOpenImageDenoise.so.1 $TARGET/lib/libembree3.so.3 $TARGET/lib/libtbb.so.12 $TARGET/lib/libtbb.so.2 $TARGET/$LUX_TAG + cp -a $TARGET/lib/libnvrtc* $TARGET/$LUX_TAG + + cp $LUX_TAG/README.md $TARGET/$LUX_TAG + cp $LUX_TAG/COPYING.txt $TARGET/$LUX_TAG + cp $LUX_TAG/AUTHORS.txt $TARGET/$LUX_TAG + mkdir -p $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/cornell.cfg $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/cornell.scn $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/Khaki.ply $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/HalveRed.ply $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/DarkGreen.ply $TARGET/$LUX_TAG/scenes/cornell + cp $LUX_TAG/scenes/cornell/Grey.ply $TARGET/$LUX_TAG/scenes/cornell + + cd $TARGET + tar -cvjf ${LUX_TAG}.tar.bz2 $LUX_TAG + cd .. + + echo +fi + +# Check if I have to pack LuxMark too +if [[ -d "LuxMark" ]] ; then + echo + echo " * 安装LuxMark在 $TARGET/luxmark" + + rm -rf $TARGET/luxmark + mkdir $TARGET/luxmark + mkdir $TARGET/luxmark/lib + + cp $LUX_TAG/bin/luxcoreui $TARGET/luxmark + cp $TARGET/lib/libOpenImageDenoise.so.1 $TARGET/lib/libembree3.so.3 $TARGET/lib/libtbb.so.12 $TARGET/lib/libtbb.so.2 $TARGET/luxmark/lib + #cp $TARGET/qt5-v5.12.2/lib/libQt5Widgets.so $TARGET/luxmark/libQt5Widgets.so.5 + #cp $TARGET/qt5-v5.12.2/lib/libQt5Network.so $TARGET/luxmark/libQt5Network.so.5 + #cp $TARGET/qt5-v5.12.2/lib/libQt5Gui.so $TARGET/luxmark/libQt5Gui.so.5 + #cp $TARGET/qt5-v5.12.2/lib/libQt5Core.so $TARGET/luxmark/libQt5Core.so.5 + + cp LuxMark/README.md $TARGET/luxmark + cp LuxMark/COPYING.txt $TARGET/luxmark + cp LuxMark/AUTHORS.txt $TARGET/luxmark + cp LuxMark/bin/luxmark $TARGET/luxmark/luxmark.bin + cp ${SHELLROOT}/installLib/luxmark.start $TARGET/luxmark/luxmark + + tar zxf $DIST/scenes.tgz -C $TARGET/luxmark + + cd $TARGET + tar cvjf luxmark.tar.bz2 luxmark + cd .. + + echo +fi + diff --git a/utils/prepare b/utils/prepare new file mode 100755 index 0000000..a9d4c90 --- /dev/null +++ b/utils/prepare @@ -0,0 +1,179 @@ +#!/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 diff --git a/utils/replace b/utils/replace new file mode 100755 index 0000000..d28450e --- /dev/null +++ b/utils/replace @@ -0,0 +1,5 @@ +#!/usr/bin/python3 + +from sys import argv + +print(argv[1].replace('/', '\/'))