Linux运维_Bash脚本_编译安装Mesa-23.3.6(OpenGL)

Linux运维_Bash脚本_编译安装Mesa-23.3.6(OpenGL)

Bash (Bourne Again Shell) 是一个解释器,负责处理 Unix 系统命令行上的命令。它是由 Brian Fox 编写的免费软件,并于 1989 年发布的免费软件,作为 Sh (Bourne Shell) 的替代品。

您可以在 Linux 和 MacOS 机器上使用 Bash,甚至可以通过适用于 Linux 的 Windows 子系统在 Windows 10 机器上使用。

使用方法

  • 下载源码包:

expat-2.5.0.tar.gz

libdrm-2.4.120.tar.xz

MarkupSafe-1.1.1.tar.gz (Python 源码)

Mako-1.1.6.tar.gz (Python 源码)

llvm-project-15.0.7.src.tar.xz

glslang-main-linux-Release.zip

xextproto-7.3.0.tar.bz2

libXext-1.3.4.tar.gz (Require: “xextproto >= 7.1.99”)

fixesproto-5.0.tar.gz

libXfixes-5.0.3.tar.gz

libxshmfence_1.3.orig.tar.gz

glproto-1.4.17.tar.gz

dri2proto-2.8.tar.gz

xf86vidmodeproto-2.3.tar.gz

libXxf86vm-1.1.4.tar.gz

randrproto-1.5.0.tar.bz2

libXrandr-1.5.2.tar.gz

mesa-23.3.6.tar.xz

libXi-1.7.6.tar.gz

glu-9.0.3.tar.xz

freeglut-3.4.0.tar.gz

glew-2.2.0.tgz

  • 放于指定路径:

这里 Bash Shell 脚本的全局变量 STORAGE 指定的存放源码包的路径 /home/goufeng 可进行修改。

  • 执行 Bash Shell 脚本:

输入 /[路径名]/[脚本名].sh 即可进行自动编译部署,过程中提示输入 (y/n) 输入 y 则进行下一步,这样分阶段确认的原因是为了确保能够看到上一个源码编译结果中可能的错误和提示。

完整脚本

#! /bin/bash
# Create By GF 2024-02-20 21:42# --------------------------------------------------
# Install First: 
# * GNU-Tools (Contains: pkg-config, m4, autoconf, automake, libtool, gettext, flex, bison, libiconv, make)
# * CMake >= 3.24.0
# * Python == 3.x.x
# * Meson
# * Ninja
# * X11
# * Wayland >= 1.22.0 (Contains: Wayland-Protocols)# ------------------- Dependency -------------------
# Need File: expat-2.5.0.tar.gz
# Need File: libdrm-2.4.120.tar.xz
# ------------------ Mako - 1.1.6 ------------------
# Need File: MarkupSafe-1.1.1.tar.gz -> Python 源码
# Need File: Mako-1.1.6.tar.gz -> Python 源码
# ----------------- LLVM >= 15.0.0 -----------------
# Need File: llvm-project-15.0.7.src.tar.xz
# --------------------- Glslang --------------------
# Need File: glslang-main-linux-Release.zip
# ------------- Special X11 Dependency -------------
# Need File: xextproto-7.3.0.tar.bz2
# Need File: libXext-1.3.4.tar.gz -> Require: "xextproto >= 7.1.99"
# Need File: fixesproto-5.0.tar.gz
# Need File: libXfixes-5.0.3.tar.gz
# Need File: libxshmfence_1.3.orig.tar.gz
# Need File: glproto-1.4.17.tar.gz
# Need File: dri2proto-2.8.tar.gz
# Need File: xf86vidmodeproto-2.3.tar.gz
# Need File: libXxf86vm-1.1.4.tar.gz
# Need File: randrproto-1.5.0.tar.bz2
# Need File: libXrandr-1.5.2.tar.gz
# ------------------ Mesa - 23.3.6 -----------------
# Need File: mesa-23.3.6.tar.xz
# ---------------- freeGlut - 3.4.0 ----------------
# Need File: libXi-1.7.6.tar.gz
# Need File: glu-9.0.3.tar.xz
# Need File: freeglut-3.4.0.tar.gz
# ------------------ GLEW - 2.2.0 ------------------
# Need File: glew-2.2.0.tgz# ##################################################
STORAGE=/home/goufeng# ############################################ Dependency ############################################# Function: 编译安装(Compile Install) expat-2.5.0
# ##################################################
function Compile_Install_expat_2_5_0() {if [[ ! -d "/opt/expat-2.5.0" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( expat-2.5.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/expat-2.5.0.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/expat-2.5.0 && ./configure --prefix=/opt/expat-2.5.0 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................ln -sf /opt/expat-2.5.0/bin/xmlwf /usr/local/bin/# ......................................rsync -av /opt/expat-2.5.0/include/ /usr/local/include/rsync -av /opt/expat-2.5.0/lib/     /usr/local/lib/# ......................................cp -f /opt/expat-2.5.0/lib/pkgconfig/expat.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/expat-2.5.0 && return 0elseecho "[Caution] Path: ( /opt/expat-2.5.0 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 构建安装(Build Install) libdrm-2.4.120
# ##################################################
function Build_Install_libdrm_2_4_120() {# Attention: may conflict with the original "drm" in the system.# 注意: 可能与系统原有的 "drm" 冲突。if [[ ! -d "/opt/libdrm-2.4.120" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Build and Install ( libdrm-2.4.120 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -xvJf $STORAGE/libdrm-2.4.120.tar.xz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libdrm-2.4.120 && meson build --prefix=/opt/libdrm-2.4.120 && STEP_BUILDED=1# ------------------------------------------cd $STORAGE/libdrm-2.4.120 && ninja -C build install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................# Skip # rsync -av /opt/libdrm-2.4.120/include/ /usr/local/include/# Skip # rsync -av /opt/libdrm-2.4.120/lib/     /usr/local/lib/# ......................................cp -f /opt/libdrm-2.4.120/lib/pkgconfig/*.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libdrm-2.4.120 && return 0elseecho "[Caution] Path: ( /opt/libdrm-2.4.120 ) Already Exists."# ------------------------------------------return 0fi
}# ########################################### Mako - 1.1.6 ############################################ Function: 构建安装(Build Install) MarkupSafe-1.1.1 (by Python3)
# ##################################################
function Build_Install_MarkupSafe_1_1_1_by_Python3() {# 使用 expr index "$string" "$substring" 来判断字符串 $string 中是否包含子字符串 $substring。# Use the expr index "$string" and "$substring" to determine whether the string $string contains a substring $substring.# 如果子字符串存在, 则返回子字符串在原字符串中的位置 (从 1 开始), 否则返回 0。# If the substring exists, return the position of the substring in the original string (starting from 1), otherwise return 0.local EXISTS_LINE=$(pip3 list | grep "MarkupSafe")local EXISTS_NAME=$(expr index "$EXISTS" "MarkupSafe")local EXISTS_VERSION=$(expr index "$EXISTS" "1.1.1")if [[ EXISTS_NAME == 0 && EXISTS_VERSION == 0 ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Build and Install ( MarkupSafe-1.1.1 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/MarkupSafe-1.1.1.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/MarkupSafe-1.1.1 && python3 setup.py build && STEP_BUILDED=1# ------------------------------------------cd $STORAGE/MarkupSafe-1.1.1 && python3 setup.py install && STEP_INSTALLED=1# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/MarkupSafe-1.1.1 && return 0elseecho "[Caution] Python Package: ( MarkupSafe-1.1.1 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 构建安装(Build Install) Mako-1.1.6 (by Python3)
# ##################################################
function Build_Install_Mako_1_1_6_by_Python3() {# 使用 expr index "$string" "$substring" 来判断字符串 $string 中是否包含子字符串 $substring。# Use the expr index "$string" and "$substring" to determine whether the string $string contains a substring $substring.# 如果子字符串存在, 则返回子字符串在原字符串中的位置 (从 1 开始), 否则返回 0。# If the substring exists, return the position of the substring in the original string (starting from 1), otherwise return 0.local EXISTS_LINE=$(pip3 list | grep "Mako")local EXISTS_NAME=$(expr index "$EXISTS" "Mako")local EXISTS_VERSION=$(expr index "$EXISTS" "1.1.6")if [[ EXISTS_NAME == 0 && EXISTS_VERSION == 0 ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Build and Install ( Mako-1.1.6 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/Mako-1.1.6.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/Mako-1.1.6 && python3 setup.py build && STEP_BUILDED=1# ------------------------------------------cd $STORAGE/Mako-1.1.6 && python3 setup.py install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenln -sf /opt/Python-3.8.0/bin/mako-render /usr/local/bin/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/Mako-1.1.6 && return 0elseecho "[Caution] Python Package: ( Mako-1.1.6 ) Already Exists."# ------------------------------------------return 0fi
}# ########################################## LLVM >= 15.0.0 ########################################### Function: 构建安装(Build Install) LLVM-Project-15.0.7
# ##################################################
function Build_Install_LLVM_Project_15_0_7() {# Linux 查看 LLVM 版本: llvm-as --versionif [[ ! -f "/usr/local/bin/llvm-as" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CREATED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Build and Install ( LLVM-Project-15.0.7 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -xvJf $STORAGE/llvm-project-15.0.7.src.tar.xz && STEP_UNZIPPED=1# ------------------------------------------mkdir $STORAGE/llvm-project-15.0.7.src/llvm/build && STEP_CREATED=1# ------------------------------------------# 通过以下方式构建 LLVM:# cd llvm-project-15.0.7.src# ..........................................# cmake -S llvm -B build -G <Generator> [options]#     常见的构建系统生成器 <Generator> 包括:#         1) Ninja - 用于生成 Ninja 构建文件。大多数 LLVM 开发人员都使用 Ninja。#         2) Unix Makefiles - 用于生成与 make 兼容的并行 makefiles 生成文件。#         3) Visual Studio - 用于生成 Visual Studio 项目和解决方案。#         4) Xcode - 用于生成 Xcode 项目。#         5) 有关更全面的 List 列表, 请参阅 CMake 文档。# ..........................................# cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=[Type]#     [Type] 的类型有:#         1) Release - 普通使用 Release 就行。#         2) Debug - 通常是为了开发, 如果是 Debug, 请准备足够的内存和硬盘空间。#         3) RelWithDebInfo#         4) MinSizeRel# ..........................................# cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DLLVM_ENABLE_PROJECTS='[Proj1];[Proj2]'#     [Proj1];[Proj2] 要额外构建的 LLVM 子项目的 semicolon-separated 分号分隔列表。可以包括以下任何一项:#         1) clang#         2) clang-tools-extra#         3) lldb#         4) lld#         5) polly#     或跨项目测试: cross-project-tests#     例如, 构建 LLVM, Clang 和 LLD, 请使用 -DLLVM_ENABLE_PROJECTS="clang;lld"# ..........................................# cmake -S llvm -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=[Directory]#     [Directory] 指定要安装的 LLVM 工具和库的完整路径名 (Default 默认路径为: /usr/local)。cd $STORAGE/llvm-project-15.0.7.src/llvm/build && cmake -G "Unix Makefiles" \-DCMAKE_C_COMPILER=/usr/bin/gcc \-DCMAKE_CXX_COMPILER=/usr/bin/g++ \-DLLVM_ENABLE_PROJECTS=clang \-DCMAKE_BUILD_TYPE=Release \../ && STEP_BUILDED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/llvm-project-15.0.7.src && return 0elseecho "[Caution] Bin: ( /usr/local/bin/llvm-as ) Already Exists."# ------------------------------------------return 0fi
}# ############################################## Glslang ############################################## Function: 部署(Deploy) glslang-main-linux-Release
# ##################################################
function Deploy_glslang_main_linux_Release() {# OpenGL / OpenGL ES Reference Compiler# Glslang is the official reference compiler front end for the OpenGL ES and OpenGL shading languages. # It implements a strict interpretation of the specifications for these languages. # It is open and free for anyone to use, either from a command line or programmatically. # The OpenGL and OpenGL ES working groups are committed to maintaining consistency between the reference compiler and the corresponding shading language specifications.# OpenGL / OpenGL ES 参考编译器# Glslang 是 OpenGL 和 OpenGL ES 着色语言的官方参考编译器前端。# 它对这些语言的规范进行了严格的解释。# 它是开放的, 任何人都可以自由使用, 无论是从命令行还是通过编程方式。# OpenGL 和 OpenGL ES 工作组致力于保持参考编译器和相应着色语言规范之间的一致性。# ..............................................# Purpose# The primary purpose of the reference compiler is to identify shader portability issues. # If glslang accepts a shader without errors, then all OpenGL and OpenGL ES implementations claiming to support the shader's language version should also accept the shader without errors. # Likewise, if glslang reports an error when compiling a shader, all OpenGL and OpenGL ES implementations for that language version should report errors, unless the glslang errors are caused by differences in implementation-defined limits or extension support (see below).# 目的# 引用编译器的主要目的是识别着色器的可移植性问题。# 如果 glslang 无错误地接受着色器, 那么所有声称支持着色器语言版本的 OpenGL 和 OpenGL ES 实现也应无错误地接收着色器。# 同样, 如果 glslang 在编译着色器时报告错误, 则该语言版本的所有 OpenGL 和 OpenGL ES 实现都应报告错误, 除非 glslang 错误是由实现定义的限制或扩展支持的差异引起的 (见下文)。# ..............................................# Secondarily, glslang is also suitable for programmatic use in a tool chain or a driver, translating the input source into an abstract syntax tree that can be translated into an intermediate representation for machine-independent processing and lowering to machine-specific code. # Glslang can also return (even from the command line) uniform variable reflection information (before optimization).# 其次, glslang 也适用于工具链或驱动程序中的程序化使用, 将输入源翻译成抽象语法树, 该抽象语法树可以翻译成用于机器独立处理的中间表示, 并降低到机器特定代码。# Glslash还可以 (甚至从命令行) 返回统一的变量反射信息 (在优化之前)。if [[ ! -f "/usr/local/bin/glslang" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_DEPLOYED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( glslang-main-linux-Release )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------unzip $STORAGE/glslang-main-linux-Release.zip && STEP_UNZIPPED=1# ------------------------------------------if [[ $STEP_UNZIPPED == 1 ]]; thensudo cp -r $STORAGE/bin/*     /usr/local/bin/sudo cp -r $STORAGE/include/* /usr/local/include/sudo cp -r $STORAGE/lib/*     /usr/local/lib/ && STEP_DEPLOYED=1fi# ------------------------------------------if [[ $STEP_DEPLOYED == 1 ]]; thenrm -rf $STORAGE/binrm -rf $STORAGE/includerm -rf $STORAGE/libreturn 0fielseecho "[Caution] Bin: ( /usr/local/bin/glslang ) Already Exists."# ------------------------------------------return 0fi
}# ###################################### Special X11 Dependency ####################################### Function: 编译安装(Compile Install) XextProto-7.3.0
# ##################################################
function Compile_Install_XextProto_7_3_0() {if [[ ! -d "/opt/xextproto-7.3.0" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( xextproto-7.3.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------if [[ -d "/opt/xextproto-7.1.0" ]]; then rm -rf /opt/xextproto-7.1.0; fi# ------------------------------------------tar -jxvf $STORAGE/xextproto-7.3.0.tar.bz2 && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/xextproto-7.3.0 && ./configure --prefix=/opt/xextproto-7.3.0 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/xextproto-7.3.0/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/xextproto-7.3.0/lib/ /usr/local/lib/# ......................................cp -f /opt/xextproto-7.3.0/lib/pkgconfig/xextproto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/xextproto-7.3.0 && return 0elseecho "[Caution] Path: ( /opt/xextproto-7.3.0 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) libXext-1.3.4
# ##################################################
function Compile_Install_libXext_1_3_4() {# Require: "xproto >= 7.0.13"# Require: "x11 >= 1.6"# Require: "xextproto >= 7.1.99"if [[ ! -d "/opt/libXext-1.3.4" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libXext-1.3.4 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libXext-1.3.4.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libXext-1.3.4 && ./configure --prefix=/opt/libXext-1.3.4 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libXext-1.3.4/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libXext-1.3.4/lib/ /usr/local/lib/# ......................................cp -f /opt/libXext-1.3.4/lib/pkgconfig/xext.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libXext-1.3.4 && return 0elseecho "[Caution] Path: ( /opt/libXext-1.3.4 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) fixesproto-5.0
# ##################################################
function Compile_Install_fixesproto_5_0() {if [[ ! -d "/opt/fixesproto-5.0" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( fixesproto-5.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/fixesproto-5.0.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/fixesproto-5.0 && ./configure --prefix=/opt/fixesproto-5.0 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/fixesproto-5.0/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/fixesproto-5.0/lib/ /usr/local/lib/# ......................................cp -f /opt/fixesproto-5.0/lib/pkgconfig/fixesproto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/fixesproto-5.0 && return 0elseecho "[Caution] Path: ( /opt/fixesproto-5.0 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) libXfixes-5.0.3
# ##################################################
function Compile_Install_libXfixes_5_0_3() {if [[ ! -d "/opt/libXfixes-5.0.3" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libXfixes-5.0.3 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libXfixes-5.0.3.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libXfixes-5.0.3 && ./configure --prefix=/opt/libXfixes-5.0.3 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libXfixes-5.0.3/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libXfixes-5.0.3/lib/ /usr/local/lib/# ......................................cp -f /opt/libXfixes-5.0.3/lib/pkgconfig/xfixes.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libXfixes-5.0.3 && return 0elseecho "[Caution] Path: ( /opt/libXfixes-5.0.3 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) libxshmfence-1.3
# ##################################################
function Compile_Install_libxshmfence_1_3() {if [[ ! -d "/opt/libxshmfence-1.3" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libxshmfence-1.3 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libxshmfence_1.3.orig.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libxshmfence-1.3 && ./configure --prefix=/opt/libxshmfence-1.3 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libxshmfence-1.3/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libxshmfence-1.3/lib/ /usr/local/lib/# ......................................cp -f /opt/libxshmfence-1.3/lib/pkgconfig/xshmfence.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libxshmfence-1.3 && return 0elseecho "[Caution] Path: ( /opt/libxshmfence-1.3 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) glproto-1.4.17
# ##################################################
function Compile_Install_glproto_1_4_17() {if [[ ! -d "/opt/glproto-1.4.17" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( glproto-1.4.17 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/glproto-1.4.17.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/glproto-1.4.17 && ./configure --prefix=/opt/glproto-1.4.17 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/glproto-1.4.17/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/glproto-1.4.17/lib/ /usr/local/lib/# ......................................cp -f /opt/glproto-1.4.17/lib/pkgconfig/glproto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/glproto-1.4.17 && return 0elseecho "[Caution] Path: ( /opt/glproto-1.4.17 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) dri2proto-2.8
# ##################################################
function Compile_Install_dri2proto_2_8() {if [[ ! -d "/opt/dri2proto-2.8" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( dri2proto-2.8 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/dri2proto-2.8.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/dri2proto-2.8 && ./configure --prefix=/opt/dri2proto-2.8 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/dri2proto-2.8/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/dri2proto-2.8/lib/ /usr/local/lib/# ......................................cp -f /opt/dri2proto-2.8/lib/pkgconfig/dri2proto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/dri2proto-2.8 && return 0elseecho "[Caution] Path: ( /opt/dri2proto-2.8 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) xf86vidmodeproto-2.3
# ##################################################
function Compile_Install_xf86vidmodeproto_2_3() {if [[ ! -d "/opt/xf86vidmodeproto-2.3" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( xf86vidmodeproto-2.3 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/xf86vidmodeproto-2.3.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/xf86vidmodeproto-2.3 && ./configure --prefix=/opt/xf86vidmodeproto-2.3 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/xf86vidmodeproto-2.3/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/xf86vidmodeproto-2.3/lib/ /usr/local/lib/# ......................................cp -f /opt/xf86vidmodeproto-2.3/lib/pkgconfig/xf86vidmodeproto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/xf86vidmodeproto-2.3 && return 0elseecho "[Caution] Path: ( /opt/xf86vidmodeproto-2.3 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) libXxf86vm-1.1.4
# ##################################################
function Compile_Install_libXxf86vm_1_1_4() {if [[ ! -d "/opt/libXxf86vm-1.1.4" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libXxf86vm-1.1.4 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libXxf86vm-1.1.4.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libXxf86vm-1.1.4 && ./configure --prefix=/opt/libXxf86vm-1.1.4 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libXxf86vm-1.1.4/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libXxf86vm-1.1.4/lib/ /usr/local/lib/# ......................................cp -f /opt/libXxf86vm-1.1.4/lib/pkgconfig/xxf86vm.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libXxf86vm-1.1.4 && return 0elseecho "[Caution] Path: ( /opt/libXxf86vm-1.1.4 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) randrproto-1.5.0
# ##################################################
function Compile_Install_randrproto_1_5_0() {if [[ ! -d "/opt/randrproto-1.5.0" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( randrproto-1.5.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -jxvf $STORAGE/randrproto-1.5.0.tar.bz2 && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/randrproto-1.5.0 && ./configure --prefix=/opt/randrproto-1.5.0 && STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/randrproto-1.5.0/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/randrproto-1.5.0/lib/ /usr/local/lib/# ......................................cp -f /opt/randrproto-1.5.0/lib/pkgconfig/randrproto.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/randrproto-1.5.0 && return 0elseecho "[Caution] Path: ( /opt/randrproto-1.5.0 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) libXrandr-1.5.2
# ##################################################
function Compile_Install_libXrandr_1_5_2() {if [[ ! -d "/opt/libXrandr-1.5.2" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libXrandr-1.5.2 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libXrandr-1.5.2.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libXrandr-1.5.2 && ./configure --prefix=/opt/libXrandr-1.5.2 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libXrandr-1.5.2/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libXrandr-1.5.2/lib/ /usr/local/lib/# ......................................cp -f /opt/libXrandr-1.5.2/lib/pkgconfig/xrandr.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libXrandr-1.5.2 && return 0elseecho "[Caution] Path: ( /opt/libXrandr-1.5.2 ) Already Exists."# ------------------------------------------return 0fi
}# ########################################### Mesa - 23.3.6 ########################################### Function: 编译安装(Compile Install) mesa-23.3.6
# ##################################################
function Compile_Install_Mesa_23_3_6() {# Kernel Configuration# Enable the following options in the kernel configuration and recompile the kernel if necessary:# 内核配置# 在内核配置中启用以下选项, 并在必要时重新编译内核:#     Device Drivers --->#       Graphics support --->#         <*/M>   Direct Rendering Manager (XFree86 4.1.0 and higher DRI support) --->#                                                                           ...  [DRM]#         # For r300 or r600:#         < /*/M> ATI Radeon                                              [DRM_RADEON]#         # For radeonsi:#         < /*/M> AMD GPU                                                 [DRM_AMDGPU]#         [*]       Enable amdgpu support for SI parts                 [DRM_AMDGPU_SI]#         [*]       Enable amdgpu support for CIK parts               [DRM_AMDGPU_CIK]#           Display Engine Configuration --->#           [*]   AMD DC - Enable new display engine                      [DRM_AMD_DC]#         # For nouveau:#         < /*/M> Nouveau (NVIDIA) cards                                 [DRM_NOUVEAU]#         # For i915, crocus, or iris:#         < /*/M> Intel 8xx/9xx/G3x/G4x/HD Graphics                         [DRM_I915]#         # For swrast:#         < /*/M> Virtual GEM provider                                      [DRM_VGEM]#         # For svga:#         < /*/M> DRM driver for VMware Virtual GPU                       [DRM_VMWGFX]# NOTE:# # The corresponding Mesa Gallium3D driver name is provided as the comment for the configuration entries. If you don't know the name of the Mesa Gallium3D driver for your GPU, see Mesa Gallium3D Drivers below.# (相应的 Mesa Gallium3D 驱动程序名称作为配置条目的注释提供。如果您不知道 GPU 的 Mesa Gallium3D 驱动程序的名称, 请参阅下面的 Mesa Galium3D 驱动器。)# # CONFIG_DRM_RADEON, CONFIG_DRM_AMDGPU, CONFIG_DRM_NOUVEAU, and CONFIG_DRM_I915 may require firmware. See About Firmware for details.# (CONFIG_DRM_RADEON, CONFIG_DRM_AMDGPU, CONFIG_DRM_NOUVEAU 和 CONFIG_DRM_I915 可能需要固件。有关详细信息, 请参阅关于固件。)# # Selecting CONFIG_DRM_RADEON or CONFIG_DRM_AMDGPU as "y" is not recommended. If it is, any required firmware must be built as a part of the kernel image or the initramfs for the driver to function correctly.# (不建议将 CONFIG_DRM_RADEON 或 CONFIG_DRM_AMDGPU 选择为 "y"。如果是, 则必须将任何所需的固件构建为内核映像或 initramfs 的一部分, 以便驱动程序正常工作。)# # The sub-entries under CONFIG_DRM_AMDGPU are used to ensure the AMDGPU kernel driver supports all GPUs using the radeonsi driver. They are not needed if you won't need CONFIG_DRM_AMDGPU itself. They may be unneeded for some GPU models.# CONFIG_DRM_AMDGPU 下的子条目用于确保 AMDGPU 内核驱动程序支持使用 radeonsi 驱动程序的所有 GPU。如果不需要 CONFIG_DRM_AMDGPU 本身, 则不需要它们。对于某些 GPU 型号来说, 它们可能是不需要的。# # For swrast, CONFIG_DRM_VGEM is not strictly needed but recommended as an optimization.# 对于 swrast, CONFIG_DRM_VGEM 不是严格需要的, 但建议作为优化。if [[ ! -d "/opt/mesa-23.3.6" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_BUILDED=0local STEP_NINJA=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( mesa-23.3.6 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -xvJf $STORAGE/mesa-23.3.6.tar.xz && STEP_UNZIPPED=1# ------------------------------------------# *  Option: --buildtype=release: This switch ensures a fully-optimized build, and disables debug assertions which will severely slow down the libraries in certain use-cases. Without this switch, build sizes can span into the 2GB range.#                                 此选项确保了完全优化的构建, 并禁用调试断言, 这将在某些用例中严重降低库的运行速度。如果没有此交换机, 构建大小可以扩展到 2GB 范围。# ..........................................# *  Option: -Dgallium-drivers=auto: This parameter controls which Gallium3D drivers should be built.#                                    auto selects all Gallium3D drivers available for x86: #                                        r300 (for ATI Radeon 9000 or Radeon X series),#                                        r600 (for AMD/ATI Radeon HD 2000-6000 series),#                                        radeonsi (for AMD Radeon HD 7000 or newer AMD GPU models),#                                        nouveau (for Supported NVIDIA GPUs, they are listed as all "3D features" either "DONE" or "N/A" in the Nouveau status page),#                                        virgl (for QEMU virtual GPU with virglrender support; note that BLFS qemu-8.1.0 is not built with virglrender),#                                        svga (for VMWare virtual GPU),#                                        swrast (using CPU for 3D rasterisation; note that it's much slower than using a modern 3D-capable GPU, so it should be only used if the GPU is not supported by other drivers),#                                        iris (for Intel GPUs shipped with Broadwell or newer CPUs),#                                        crocus (for Intel GMA 3000, X3000 series, 4000 series, or X4000 series GPUs shipped with chipsets, or Intel HD GPUs shipped with pre-Broadwell CPUs),#                                        i915 (for Intel GMA 900, 950, 3100, or 3150 GPUs shipped with chipsets or Atom D/N 4xx/5xx CPUs).#                                    You may replace auto with a comma-separated list to build only a subset of these drivers if you precisely know which drivers you need, for example -Dgallium-drivers=radeonsi,iris,swrast.#                                    此参数控制应构建哪些 Gallium3D 驱动程序。#                                    自动选择所有适用于 x86 的 Gallium3D 驱动程序:#                                        r300 (用于 ATI Radeon 9000 或 Radeon X 系列), #                                        r600 (用于 AMD/ATI Radeon HD 2000-6000 系列), #                                        radeonsi (适用于 AMD Radeon HD 7000 或更新的 AMD GPU 型号), #                                        nouveau (对于支持的 NVIDIA GPU, 在 Nouveau 状态页中它们被列为所有 "3D 功能" ("DONE" 或 "N/A")), #                                        virgl (用于支持 virglrender 的 QEMU 虚拟 GPU; 请注意, BLFS QEMU-81.1.0 不是使用 virglrend 构建的), #                                        svga (用于 VMWare 虚拟 GPU), #                                        swrast (使用 CPU 进行 3D 光栅化; 请注意, 它比使用现代 3D GPU 慢得多, 因此只有在其他驱动程序不支持 GPU 的情况下才能使用), #                                        iris (用于 Broadwell 或更新 CPU 附带的 Intel GPU), #                                        crocus (适用于芯片组附带的 Intel GMA 3000, X3000 系列, 4000 系列或 X4000 系列 GPU, 或 Broadwell CPU 之前附带的 Intel HD GPU), #                                        i915 (适用于芯片组或 Atom D/N 4xx/5xx CPUs 附带的英特尔 GMA 900, 950, 3100, 或 3150 GPUs)。#                                    如果你确切地知道你需要哪些驱动程序, 你可以用逗号分隔的列表来代替auto, 只构建这些驱动程序的一个子集, 例如-Dgala drivers=radeonsi, iris, swrast。# ..........................................# *  Option: -Dplatforms="...": This parameter controls which windowing systems will be supported. Available linux platforms are x11 and wayland.#                               此参数控制将支持哪些窗口系统。可用的 linux 平台有 x11 和 wayland。# ..........................................# *  Option: -Dvulkan-drivers="": This switch allows choosing which Vulkan drivers are built. The default is auto, but this requires the optional dependencies glslang and Vulkan-Loader. #                                 Vulkan is a newer API designed for utilizing the GPUs with a performance better than OpenGL, but nothing in BLFS benefits from it for now.#                                 So we pass an empty list in order to remove the need for these dependencies.#                                 此选项允许选择构建的 Vulkan 驱动程序。默认为 auto, 但这需要可选的依赖关系 glslang 和 Vulkan Loader。#                                 Vulkan 是一款新的 API, 专为使用 GPU 而设计, 其性能优于 OpenGL, 但 BLFS 目前没有从中受益。#                                 因此, 我们传递一个空列表, 以消除对这些依赖项的需求。# ..........................................# *  Option: -Dvalgrind=disabled: This parameter disables the usage of Valgrind during the build process. Remove this parameter if you have Valgrind installed, and wish to check for memory leaks.#                                 此参数禁止在构建过程中使用 Valgrind。如果已经安装了 Valgrind 并希望检查内存是否泄漏, 请移除此参数。# ..........................................# *  Option: -Dlibunwind=disabled: This parameter disables the usage of libunwind.#                                  此参数可禁用 libunwind 的使用。# ..........................................# *  Option: meson configure -Dbuild-tests=true: This command will reconfigure the build to set -Dbuild-tests=true, but keep the other options specified in the meson setup command unchanged.#                                                It allows ninja test to build and run unit tests.#                                                此命令将重新配置生成以设定 -Dbuild-tests=true, 但保持 Meson 设置命令中指定的其他选项不变。#                                                它允许 ninja 测试构建和运行单元测试。# ..........................................# *  Option: -Degl-native-platform="...": This parameter controls which Embedded Graphics Library support will be built. Available linux options are auto (default), x11, wayland, surfaceless, and drm.#                                         此参数控制将构建哪些嵌入式图形库支持。可用的 linux 选项有 auto (默认), x11, wayland, surfaceless 和 drm。# ..........................................# * Problem: Did not find CMake 'cmake'#            Found CMake: NO#   - Solve: Install CMake >= 3.24.0.# ..........................................# * Problem: Program glslangValidator found: NO#   - Solve: Install glslang or Deploy glslang Relese.# ..........................................# * Problem: meson.build:897:2: ERROR: Problem encountered: Python (3.x) mako module >= 0.8.0 required to build mesa.#   - Solve: Install Mako.# ..........................................# * Problem: Run-time dependency expat found: NO (tried pkgconfig and cmake)#            Looking for a fallback subproject for the dependency expat#   - Solve: Install expat >= 2.2.5.# ..........................................# * Problem: Message: libdrm 2.4.110 needed because amdgpu has the highest requirement#            Run-time dependency libdrm_amdgpu found: NO (tried pkgconfig and cmake)#            meson.build:1632:4: ERROR: Dependency "libdrm_amdgpu" not found, tried pkgconfig and cmake#   - Solve: Install libdrm >= 2.4.110.# ..........................................# * Problem: llvm-config found: NO need ['>= 15.0.0']#            Run-time dependency LLVM found: NO (tried config-tool)#            meson.build:1714:2: ERROR: Neither a subproject directory nor a llvm.wrap file was found.#   - Solve: Install llvm >= 15.0.0.# ..........................................# * Problem: Run-time dependency LLVM (modules: amdgpu, bitreader, bitwriter, core, engine, executionengine, instcombine, ipo, mcdisassembler, mcjit, native, scalaropts, transformutils, coroutines, lto) found: NO (tried config-tool)#            Looking for a fallback subproject for the dependency llvm (modules: bitwriter, engine, mcdisassembler, mcjit, core, executionengine, scalaropts, transformutils, instcombine, amdgpu, bitreader, ipo, native)#            Building fallback subproject with default_library=shared#            meson.build:1714:2: ERROR: Neither a subproject directory nor a llvm.wrap file was found.#   - Solve: meson build Add -Dshared-llvm=disabled -Dcpp_rtti=false# ..........................................cd $STORAGE/mesa-23.3.6 && meson build/ --prefix=/opt/mesa-23.3.6 \--buildtype=release \-Dplatforms=x11,wayland \-Dgallium-drivers=swrast \-Dvulkan-drivers="" \-Dvalgrind=disabled \-Dlibunwind=disabled \-Dshared-llvm=disabled \-Dcpp_rtti=false \--pkg-config-path="/opt/lib/pkgconfig" && \STEP_BUILDED=1# ------------------------------------------cd $STORAGE/mesa-23.3.6 && ninja && STEP_NINJA=1# ------------------------------------------# To test the results, issue: "meson configure -Dbuild-tests=true && ninja test". Three tests related to mesa:intel are known to fail.# 要测试结果, 请使用指令:"meson configure -Dbuild-tests=true && ninja test"。与 mesa:intel 相关的三项测试都失败了。# ------------------------------------------cd $STORAGE/mesa-23.3.6 && ninja -C build install && STEP_INSTALLED=1# ------------------------------------------# If desired, install the optional documentation by running the following commands as the root user:# 如果需要, 请以 root 用户身份运行以下命令来安装可选文档:# install -v -dm755 /usr/share/doc/mesa-23.1.6 &&# cp -rfv ../docs/* /usr/share/doc/mesa-23.1.6# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/mesa-23.3.6/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/mesa-23.3.6/lib/ /usr/local/lib/# ......................................cp -f /opt/mesa-23.3.6/lib/pkgconfig/*.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/meson-1.0.1 && return 0elseecho "[Caution] Path: ( /opt/mesa-23.3.6 ) Already Exists."# ------------------------------------------return 0fi
}# ######################################### freeGlut - 3.4.0 ########################################## Function: 编译安装(Compile Install) libXi-1.7.6
# ##################################################
function Compile_Install_libXi_1_7_6() {if [[ ! -d "/opt/libXi-1.7.6" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CONFIGURED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( libXi-1.7.6 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/libXi-1.7.6.tar.gz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/libXi-1.7.6 && ./configure --prefix=/opt/libXi-1.7.6 \PKG_CONFIG_PATH="/opt/lib/pkgconfig" && \STEP_CONFIGURED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/libXi-1.7.6/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/libXi-1.7.6/lib/ /usr/local/lib/# ......................................cp -f /opt/libXi-1.7.6/lib/pkgconfig/xi.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/libXi-1.7.6 && return 0elseecho "[Caution] Path: ( /opt/libXi-1.7.6 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 编译安装(Compile Install) GLU-9.0.3
# ##################################################
function Compile_Install_GLU_9_0_3() {if [[ ! -d "/opt/glu-9.0.3" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Compile and Install ( glu-9.0.3 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -xvJf $STORAGE/glu-9.0.3.tar.xz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/glu-9.0.3 && meson build/ --prefix=/opt/glu-9.0.3 \--buildtype=release \-Dgl_provider=gl \--pkg-config-path="/opt/lib/pkgconfig" && \STEP_BUILDED=1# ------------------------------------------cd $STORAGE/glu-9.0.3 && ninja -C build install && STEP_INSTALLED=1# ------------------------------------------# After installation is completed, as the root user:# rm -vf /usr/lib/libGLU.a# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/glu-9.0.3/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/glu-9.0.3/lib/ /usr/local/lib/# ......................................cp -f /opt/glu-9.0.3/lib/pkgconfig/glu.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/glu-9.0.3 && return 0elseecho "[Caution] Path: ( /opt/glu-9.0.3 ) Already Exists."# ------------------------------------------return 0fi
}# Function: 构建安装(Build Install) freeGlut-3.4.0
# ##################################################
function Build_Install_freeGlut_3_4_0() {# freeGLUT Require: Mesa# freeGLUT 是 GLUT (OpenGL Utility Toolkit) 的一个免费开源替代库。在程序中负责创建窗口, 初始化 OpenGL 上下文和处理输入事件所需的所有系统特定的杂务, 从而允许创建真正可移植的 OpenGL 程序。# GLUT 最初是 <<OpenGL 红皮书 (第二版)>> (Mark Kilgard 著) 中的示例程序。自那以后, GLUT 简单, 跨平台的特点, 使其在各种实际应用中广泛应用。if [[ ! -d "/opt/freeglut-3.4.0" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CREATED=0local STEP_BUILDED=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Build and Install ( freeglut-3.4.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/freeglut-3.4.0.tar.gz && STEP_UNZIPPED=1# ------------------------------------------mkdir $STORAGE/freeglut-3.4.0/build && STEP_CREATED=1# ------------------------------------------# *  Option: -DFREEGLUT_BUILD_DEMOS=OFF: Disable building optional demo programs. Note that if you choose to build them, their installation must be done manually.#                                        The demo programs are limited and installation is not recommended.#                                        禁用构建可选演示程序。请注意, 如果您选择构建它们, 则必须手动完成它们的安装。#                                        演示程序是有限的, 不建议安装。# ..........................................# *  Option: -DFREEGLUT_BUILD_STATIC_LIBS=OFF: Do not build the static library.#                                              不要构建静态库。# ..........................................# * Problem: CMake Error at CMakeLists.txt:277 (MESSAGE):#              Missing X11's XInput2.h (X11/extensions/XInput2.h)#   - Solve: libXi 的路径查找问题, 只把 libXi 的 include 内文件复制到系统路径如 /usr/local/include 仍不能解决, 还需要把 lib 内文件复制到系统路径如 /usr/local/lib# ..........................................# * Problem: [  2%] Building C object CMakeFiles/freeglut.dir/src/fg_callbacks.c.o#            In file included from /home/goufeng/freeglut-3.4.0/include/GL/freeglut.h:17:0,#                             from /home/goufeng/freeglut-3.4.0/src/fg_callbacks.c:28:#            /home/goufeng/freeglut-3.4.0/include/GL/freeglut_std.h:144:13: fatal error: GL/glu.h: No such file or directory#             #   include <GL/glu.h>#                         ^~~~~~~~~~#            compilation terminated.#   - Solve: The include file <GL/glu.h> is part of "libGLU" package. Install "GLU-9.x.x"cd $STORAGE/freeglut-3.4.0/build && cmake -G "Unix Makefiles" \-DCMAKE_INSTALL_PREFIX=/opt/freeglut-3.4.0 \-DCMAKE_BUILD_TYPE=Release \-DFREEGLUT_BUILD_DEMOS=OFF \-DFREEGLUT_BUILD_STATIC_LIBS=OFF \-Wno-dev \../ && STEP_BUILDED=1# ------------------------------------------make && make install && STEP_INSTALLED=1# ------------------------------------------if [[ $STEP_INSTALLED == 1 ]]; thenif [[ ! -d "/opt/lib" ]]; then mkdir /opt/lib; fiif [[ ! -d "/opt/lib/pkgconfig" ]]; then mkdir /opt/lib/pkgconfig; fi# ......................................rsync -av /opt/freeglut-3.4.0/include/ /usr/local/include/# ......................................# Skip # rsync -av /opt/freeglut-3.4.0/lib/ /usr/local/lib/# ......................................cp -f /opt/freeglut-3.4.0/lib/pkgconfig/glut.pc /opt/lib/pkgconfig/fi# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/freeglut-3.4.0 && return 0elseecho "[Caution] Path: ( /opt/freeglut-3.4.0 ) Already Exists."# ------------------------------------------return 0fi
}# ########################################### GLEW - 2.2.0 ############################################ Function: 制作安装(Make Install) GLEW-2.2.0
# ##################################################
function Make_Install_GLEW_2_2_0() {# freeGLUT Require: Mesa# GLEW OpenGL 扩展库是个简单的工具, 用于帮助 C/C++ 开发者初始化扩展 (OpenGL 扩展功能) 并书写可移植的应用程序。GLEW 当前支持各种各样的操作系统, 包含 Windows, Linux, Darwin, Irix 与 Solaris。if [[ ! -f "/usr/bin/glewinfo" ]]; thenlocal VERIFYlocal STEP_UNZIPPED=0local STEP_CHANGE_DIRECTORY=0local STEP_INSTALLED=0# ------------------------------------------read -p "[Confirm] Make and Install ( glew-2.2.0 )? (y/n)>" VERIFYif [[ "$VERIFY" != "y" ]]; then exit 1; fi# ------------------------------------------tar -zxvf $STORAGE/glew-2.2.0.tgz && STEP_UNZIPPED=1# ------------------------------------------cd $STORAGE/glew-2.2.0 && STEP_CHANGE_DIRECTORY=1# ------------------------------------------# * Explain: sed -i 's%lib64%lib%g' ...: This ensures that the library is installed in /usr/lib.#                                        这样可以确保库安装在 /usr/lib 中。# ..........................................# * Explain: sed -i -e '/glew.lib.static:/d' ...: This suppresses the static library.#                                                 这将抑制静态库。if [[ $STEP_CHANGE_DIRECTORY == 1 ]]; thensed -i 's%lib64%lib%g' config/Makefile.linux &&sed -i -e '/glew.lib.static:/d' \-e '/0644 .*STATIC/d'    \-e 's/glew.lib.static//' Makefilefi# ------------------------------------------# * Explain: make install.all: This installs the programs as well as the library.#                              这将安装程序和库。make && make install.all && STEP_INSTALLED=1# ------------------------------------------cd $STORAGE && rm -rf $STORAGE/glew-2.2.0 && return 0elseecho "[Caution] Bin: ( /usr/bin/glewinfo ) Already Exists."# ------------------------------------------return 0fi
}function main() {# 1. 创建 OpenGL 项目并测试##     (1) 创建 VS 项目, 例如 OpglTest#     #     (2) 右键项目 -> 属性 -> VC++ 目录 ->#     #         1) 在 Include 目录添加 .../freeglut/include 和 .../glew/include#     #         2) 在 Library 目录添加 .../freeglut/lib 和 .../glew/lib#     #     (3) 新建 OpglTest.cpp 文件, 输入以下代码: #     #         #include <GL/glew.h>#         #include <GL/freeglut.h>#         #         void Display()#         {#             glClear(GL_COLOR_BUFFER_BIT);#             glRectf(-0.6f, -0.6f, 0.6f, 0.6f);#             glFlush();#         }#         #         int main(int argc, char* argv[])#         {#             glutInit(&argc, argv);#             glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);#             glutInitWindowPosition(100, 100);#             glutInitWindowSize(500, 500);#             glutCreateWindow("OpenGL test");#             glutDisplayFunc(&Display);#             glutMainLoop();#             return 0;#         }# # 2. freeglutd.lib 的错误提示处理# #     如果弹出错误提示说 "找不到freeglutd.lib文件", 打开 .../freeglut/include/GL/ 目录中的 freeglut_std.h 文件#     #     找到 pragma comment (lib, "freeglutd.lib"), 改成 pragma comment (lib, "freeglut.lib"), 就是说把末尾的 d 去掉#     #     重新编译即可。# ----------------- Dependency -----------------Compile_Install_expat_2_5_0Build_Install_libdrm_2_4_120# ---------------- Mako - 1.1.6 ----------------Build_Install_MarkupSafe_1_1_1_by_Python3Build_Install_Mako_1_1_6_by_Python3# --------------- LLVM >= 15.0.0 ---------------Build_Install_LLVM_Project_15_0_7# ------------------- Glslang ------------------Deploy_glslang_main_linux_Release# ----------- Special X11 Dependency -----------Compile_Install_XextProto_7_3_0Compile_Install_libXext_1_3_4Compile_Install_fixesproto_5_0Compile_Install_libXfixes_5_0_3Compile_Install_libxshmfence_1_3Compile_Install_glproto_1_4_17Compile_Install_dri2proto_2_8Compile_Install_xf86vidmodeproto_2_3Compile_Install_libXxf86vm_1_1_4Compile_Install_randrproto_1_5_0Compile_Install_libXrandr_1_5_2# ---------------- Mesa - 23.3.6 ---------------Compile_Install_Mesa_23_3_6# -------------- freeGlut - 3.4.0 --------------Compile_Install_libXi_1_7_6Compile_Install_GLU_9_0_3Build_Install_freeGlut_3_4_0# ---------------- GLEW - 2.2.0 ----------------Make_Install_GLEW_2_2_0
}main

总结

以上就是关于 Linux运维 Bash脚本 编译安装Mesa-23.3.6(OpenGL) 的全部内容。

更多内容可以访问我的代码仓库:

https://gitee.com/goufeng928/public

https://github.com/goufeng928/public

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/732743.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

为什么main方法在Java中代表主线程?

main 方法在 Java 等编程语言中确实代表着程序的入口点&#xff0c;也就是程序开始执行的地方。当我们启动一个 Java 应用程序时&#xff0c;JVM&#xff08;Java 虚拟机&#xff09;会首先查找 main 方法&#xff0c;并从那里开始执行程序。 关于为什么 main 方法代表主线程&a…

unity学习(53)——选择角色界面--分配服务器返回的信息

好久没写客户端了&#xff0c;一上手还不太适应 1.经过测试&#xff0c;成功登陆后&#xff0c;客户端请求list_request&#xff0c;成功返回&#xff0c;如下图&#xff1a; 可见此时model第三个位置的参数是1.也成功返回了所有已注册角色的信息。 2.之前已知创建的角色信息…

141 Linux 系统编程18 ,线程,线程实现原理,ps –Lf 进程 查看

一 线程概念 什么是线程 LWP&#xff1a;light weight process 轻量级的进程&#xff0c;本质仍是进程(在Linux环境下) 进程&#xff1a;独立地址空间&#xff0c;拥有PCB 线程&#xff1a;有独立的PCB&#xff0c;但没有独立的地址空间(共享) 区别&#xff1a;在于是否共…

html前端的几种加密/解密方式

HTML前端的加密解密方式有以下几种&#xff1a; 一、base64加密 Base64编码&#xff1a;Base64是一种将二进制数据转换为可打印字符的编码方式。在前端&#xff0c;可以使用JavaScript的btoa()函数进行Base64编码&#xff0c;使用atob()函数进行解码。 var str "hello…

uniapp发行H5获取当前页面query

阅读uni的文档大致可得通过 onLoad与 onShow()的形参都能获取页面传递的参数&#xff0c;例如在开发时鼠标移动到方法上可以看到此方法的简短介绍 实际这里说的是打开当前页面的参数&#xff0c;在小程序端的时候测试并无问题&#xff0c;但是发行到H5时首页加载会造成参数获取…

掌握mysql,看完这篇文章就够了

1.mysql 学习数据库就是学习数据库管理系统&#xff08;一个数据管理系统可以管理多个数据库&#xff09; 安装 安装版本&#xff1a;mysql -installter -community-5.7.41.0.msl 流程 1.custom自定义安装 2.选择安装MySQl Server 5.7.41 - x64 3.默…

c++ 常用新特性总结【c++11】,【c++14】,【c++17】,【c++20】

文章目录 常用的c11新特性1.自动推导类型(auto)2.lambda表达式3.智能指针4.范围for循环5.右值引用 - 移动语义6.类型别名7.constexpr8.static_assert(静态断言)9.nullptr10.列表初始化11.继承构造函数12.显示虚函数重载(override)13.final14.变长模板参数15.新的容器与算法16.强…

代码随想录算法训练营第四十八天|583. 两个字符串的删除操作,72. 编辑距离

系列文章目录 代码随想录算法训练营第一天|数组理论基础&#xff0c;704. 二分查找&#xff0c;27. 移除元素 代码随想录算法训练营第二天|977.有序数组的平方 &#xff0c;209.长度最小的子数组 &#xff0c;59.螺旋矩阵II 代码随想录算法训练营第三天|链表理论基础&#xff…

第三方神秘顾客调查:如何选择专业的营业厅神秘顾客公司

选择专业的营业厅神秘顾客公司时&#xff0c;确实需要考虑多个因素&#xff0c;以确保您合作的公司能够为您提供高质量的服务和有价值的反馈。以下是选择营业厅神秘顾客公司时应考虑的关键因素&#xff1a; 1、公司声誉与经验&#xff1a;选择在行业内有良好声誉和丰富经验的神…

内容管理平台原来这么好用,优秀企业必备

内容管理平台是企业的强有力支持者&#xff0c;它可以使企业对旗下的各种网站、应用和其他数字内容进行集中管理&#xff0c;有效提高工作效率。对于企业的运营、市场推广和客户服务等各方面都有着重要的影响。今天&#xff0c;我们就来推荐三款值得尝试的内容管理平台。 首先…

论文的引用书写方法

前置操作 1、全选文献 2、在开始选项卡 段落功能区 选择编号功能 3、设置编号格式 [1] 论文的引用 1、光标放在需要引用论文的地方 2、选择引用选项卡 点击交叉引用 3、引用类型为编号项 引用内容为段落编号 选择需要的第几条参考文献

备战蓝桥杯---动态规划的一些思想2

话不多说&#xff0c;直接看题&#xff1a; 1.换根DP&#xff1a; 我们肯定不能对每一个根节点暴力求&#xff0c;我们不妨先求f[1]&#xff0c;我们发现当他的儿子作为根节点时深度和为f[1](n-cnt[i])-cnt[i](cnt[i]表示以i为根的节点数&#xff09;&#xff0c;这样子两遍DFS…

论文阅读:Diffusion Model-Based Image Editing: A Survey

Diffusion Model-Based Image Editing: A Survey 论文链接 GitHub仓库 摘要 这篇文章是一篇基于扩散模型&#xff08;Diffusion Model&#xff09;的图片编辑&#xff08;image editing&#xff09;方法综述。作者从多个方面对当前的方法进行分类和分析&#xff0c;包括学习…

Python exec 函数解析:探索动态代码执行的无限可能!

在 Python 中&#xff0c;exec() 是一个内置函数&#xff0c;用于执行储存在字符串或文件中的 Python 代码。这个函数的灵活性使得它在某些情况下成为一种有用的工具&#xff0c;但也因为其潜在的安全风险而需要谨慎使用。本文将深入探讨 exec() 函数的使用方法、注意事项以及适…

P10095 [ROIR 2023 Day 1] 斐波那契乘积

难度&#xff1a;普及/提高- 题目背景 翻译自 ROIR 2023 D1T2。 斐波那契数指斐波那契数列&#xff08;f0​1,f1​1,fi​fi−2​fi−1​&#xff09;中出现的数。 题目描述 给定一个自然数 n&#xff0c;求出将其表示为大于 1 的斐波那契数的乘积的方式数量。 输入格式 …

微信小程序-可以用区域

简介 movable-view和movable-area是可移动的视图容器&#xff0c;在页面中可以拖拽滑动。 本篇文章将会通过该容器实现一个常用的拖拽按钮功能。 使用效果 代码实现 side-view.wtml 布局见下面代码&#xff0c;left view为内容区域&#xff0c;right view为操作按钮&a…

【初中up主分享】自己动手,丰衣足食!看我打造的下载利器!

代码如下&#xff1a; import os.path import tkinter as tk import tkinter.ttk as ttk import tkinter.filedialog as tf import pytube from urllib.error import URLError import tkinter.messagebox as tm import requests import io from PIL import ImageTk, Image imp…

软件测试自学和报班学习的区别,各有各的优势和缺点,大家看完之后自己选择喔

时代在进步&#xff0c;人们汲取知识的方式不再是单一的在书本上面&#xff0c;现在网络发达&#xff0c;只需要上网就能找到相关的好多知识&#xff0c;慢慢的大家越来越觉得有了这些知识&#xff0c;只要自己有自制力就完全能够自学到一定的程度。 在自学氛围的影响下&#…

【Python】科研代码学习:五 Data Collator,Datasets

【Python】科研代码学习&#xff1a;五 Data Collator&#xff0c;Datasets Data CollatorDefault data collatorDefaultDataCollatorDataCollatorWithPaddingPadding 其他 Data Collator Datasetsload_dataset其他一些基本操作 Data Collator HF官网API&#xff1a;Data Coll…

抖音短视频素材哪里找,推荐五个好用的抖音素材网站

不知道你有没有想过一个问题&#xff0c;为什么别人都能找到那种高质量的视频素材&#xff0c;画质特别高清&#xff0c;甚至是4K的内容&#xff0c;而你需要视频素材却不知道去哪里找&#xff1f;网上有各种参差不齐的网站&#xff0c;变着法的想掏空你那本不富裕的腰包。今天…