sylware / nyanlinux (public) (License: AFFERO GPLv3) (since 2019-09-09) (hash sha1)
scripts for a lean, from scratch, amd hardware, linux distro

/builders/mesa-gl-amd-sh-90c6eec0c1bbadcd83b87be0e73e1ec78d2923ef/contrib/x86_64_linux_glibc_amdgpu.sh (92c700d81f0f3d6c5a569b6fd6ecce91141a865e) (9792 bytes) (mode 100755) (type blob)

#!/bin/sh
# Canonical specialized build scripts for AMD hardware on gnu/linux distros.
# Look for "unset", you'll find the values you can override in $1 or
# $build_dir/local_conf.sh file, that in order to tune the script for your
# specific distro/needs.

# Usage, drop the scripts in the contrib directory at the top of mesa source tree
# create somewhere else a build directory, cd into it, and call from there the
# main script.

# you get an install root tree in $build_dir/install_root

#===============================================================================
# NOTES
# the shared lib link command has 3 important sections:
#  - between whole-archive and no-whole-archive is for finding symbols which are
#    going to be dynamic.
#  - exclude-libs, remove the symbols of a list of archives/objects from the final
#    shared lib. Since with are using the hidden default visibility, it's for
#    external archives which could be compiled without the hidden visibility.
#  - between as-needed and no-as-needed, will add an explicit shared lib
#    dependencies if some symbols from those shared libs are actually used.
#    (don't know if this is done based on the shared lib dependendy tree)
# 
# the dri platform is actually the os:
#  - drm -> linux
#  - apple -> macos
#  - windows -> microsoft
#
# the EGL platforms are, mainly:
#  - GBM/dri/drm (the one used by the xserver glamor acceleration)
#  - x11/dri3 (used by real egl client application)
#  - wayland/etc
#===============================================================================

#===============================================================================
# build dir, src dir and script dir
build_dir=$(readlink -f .)
echo "build_dir=$build_dir"
# we are in contrib
src_dir=$(readlink -f $(dirname $0)/..)
echo "src_dir=$src_dir"
# script location
script_dir=$(readlink -f $(dirname $0))
echo "script_dir=$script_dir"
echo 
#===============================================================================

 
#===============================================================================
# the current configur-able variables may be individually overridden with the
# content of the file in $1 or $build_dir/local_conf.sh. Look for "unset"
# in those scripts to find what you can override to tune the build.
if test -f "$1"; then
	. "$1"
else
	if test -f $build_dir/local_conf.sh; then
		. $build_dir/local_conf.sh
	fi
fi
#===============================================================================


#===============================================================================
if test "${prefix-unset}" = unset; then
prefix='/nyan/mesa-gl/x86_64_linux_glibc_amdgpu'
fi

if test "${sysconfdir-unset}" = unset; then
sysconfdir='/nyan/mesa-gl/x86_64_linux_glibc_amdgpu/etc'
fi

if test "${datadir-unset}" = unset; then
datadir='/nyan/mesa-gl/x86_64_linux_glibc_amdgpu/share'
fi

if test "${libdir-unset}" = unset; then
libdir='/nyan/mesa-gl/x86_64_linux_glibc_amdgpu/lib'
fi

if test "${incdir-unset}" = unset; then
incdir='/nyan/mesa-gl/x86_64_linux_glibc_amdgpu/include'
fi
#===============================================================================


#===============================================================================
if test "${version-unset}" = unset; then
	if test -f $src_dir/VERSION; then
		version=$(cat $src_dir/VERSION)
	else
		echo 'error:missing version'
		exit 1
	fi
fi

if test "${dri_driver_search_dir-unset}" = unset; then
dri_driver_search_dir=/nyan/mesa-gl/x86_64_linux_glibc_amdgpu/lib/dri
fi
#===============================================================================


#===============================================================================
# linux
linux_cppflags="\
-DHAVE_DRM=1 \
-DHAVE_LINUX_FUTEX_H=1 \
"
#===============================================================================


#===============================================================================
# glibc
glibc_cppflags="\
-DPIC=1 \
-D_GNU_SOURCE=1 \
-DHAVE_SYS_SYSCTL_H=1 \
-DHAVE_ENDIAN_H=1 \
-DHAVE_DLFCN_H=1 \
-DHAVE_UNISTD_H=1 \
\
-DMAJOR_IN_SYSMACROS=1 \
-DHAVE_STRTOF=1 \
-DHAVE_MKOSTEMP=1 \
-DHAVE_POSIX_MEMALIGN=1 \
-DHAVE_TIMESPEC_GET=1 \
-DHAVE_STRTOD_L=1 \
-DHAVE_DLADDR=1 \
-DHAVE_DL_ITERATE_PHDR=1 \
-DHAVE_PTHREAD=1 \
-DHAVE_PTHREAD_SETAFFINITY=1 \
\
-DHAVE_PROGRAM_INVOCATION_NAME=1 \
-DHAVE_FLOCK=1 \
"
#-------------------------------------------------------------------------------
# glibc linux wrappers
glibc_linux_cppflags="\
-DHAVE_MEMFD_CREATE=1 \
-DHAVE_MINCORE=1 \
"
#-------------------------------------------------------------------------------
glibc_ldflags='-pthread -ldl -lm'
#===============================================================================


#===============================================================================
# lexer and parser
if test "${bison-unset}" = unset; then
bison=/nyan/nyanbison/current/bin/bison
fi
if test "${flex-unset}" = unset; then
flex=/nyan/flex/current/bin/flex
fi
#===============================================================================


#===============================================================================
# python/perl/ruby/javascript/lua/etc whatever...
if test "${python3-unset}" = unset; then
python3=/nyan/python3/current/bin/python3
fi

if test "${mako-unset}" = unset; then
mako=/nyan/mako/current
fi
#===============================================================================


#===============================================================================
. $script_dir/gcc_binutils.sh
#===============================================================================

#===============================================================================
# removing the braindamaged qsort class
cp -f $src_dir/src/compiler/nir/nir.c $src_dir/src/compiler/nir/nir.BK.c
sed -i $src_dir/src/compiler/nir/nir.c \
	-e '/u_qsort.h/ d' \
	-e 's/util_qsort_r/qsort_r/'
#===============================================================================
# configuration of mesa code paths

# enable/disable debug code paths
#debug_cppflags='-DDEBUG'
debug_cppflags='-DNDEBUG=1'

# no GLX_INDIRECT_RENDERING, only GLX_DIRECT_RENDERING
# TODO: removed
#-DGLX_USE_TLS=1 \
mesa_cppflags="\
$debug_cppflags \
-DENABLE_SHADER_CACHE=1 \
-DHAVE_DRI3=1 \
-DHAVE_DRI3_MODIFIERS=1 \
-DGLX_DIRECT_RENDERING=1 \
-DGLX_USE_DRM=1 \
-DPACKAGE_VERSION=\"$version\" \
-DPACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi?product=Mesa\" \
-DHAVE_COMPRESSION \
"
#===============================================================================


#===============================================================================
. $script_dir/external_deps.sh
#===============================================================================


#===============================================================================
# some values repeating often
cco_slib_common_trailer="\
	$mesa_cppflags \
	\
	$external_deps_cppflags \
	\
	$glibc_cppflags \
	$glibc_linux_cppflags \
	$linux_cppflags \
	$gcc_cppflags \
	\
	$cflags_opt \
"

cxxo_slib_common_trailer="\
	$mesa_cppflags \
	\
	$external_deps_cppflags \
	\
	$glibc_cppflags \
	$glibc_linux_cppflags \
	$linux_cppflags \
	$gcc_cppflags \
	\
	$cxxflags_opt \
"
#===============================================================================



################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################
################################################################################


#===============================================================================
# the install root tree
mkdir -p $build_dir/install_root
#===============================================================================


#===============================================================================
# the git sha
mkdir -p $build_dir/src
git_sha1=no_git_sha1_available
if test -d $src_dir/.git; then
	git_sha1=$(git --git-dir=$src_dir/.git rev-parse HEAD)
fi
echo git_sha1=$git_sha1
echo "#define MESA_GIT_SHA1 \"$git_sha1\"" >$build_dir/src/git_sha1.h
#===============================================================================


#===============================================================================
. $script_dir/util.sh
#------------------------------------------------------------------------------
# APIs management
. $script_dir/loader.sh
. $script_dir/gbm.sh
. $script_dir/mapi.sh
. $script_dir/compiler.sh
. $script_dir/mesa.sh
. $script_dir/glx.sh
. $script_dir/egl.sh
#------------------------------------------------------------------------------
# hardware dri gallium drivers for above APIs
. $script_dir/amd.sh
. $script_dir/gallium.sh
#===============================================================================


#===============================================================================
mkdir -p $build_dir/install_root$libdir/pkgconfig
cp $src_dir/contrib/pkgconfig/gl.pc.in $build_dir/install_root$libdir/pkgconfig/gl.pc
sed -i "\
s:@prefix@:$prefix:;\
s:@libdir@:$libdir:;\
s:@includedir@:$incdir:;\
s:@GL_PC_REQ_PRIV@::;\
s:@PACKAGE_VERSION@:$version:;\
s:@GL_PKGCONF_LIB@:GL:;\
s:@GL_PC_LIB_PRIV@::;\
s:@GL_PC_CFLAGS@::;\
s:@GLX_TLS@:yes:;\
" $build_dir/install_root$libdir/pkgconfig/gl.pc
#===============================================================================


Mode Type Size Ref File
100644 blob 5 8eba6c8dd4dcaf6166bd22285ed34625f38a84ff .gitignore
100755 blob 1587 57fa4264b9ee0ae0a6f678f2527a05d3b22dda78 00-bootstrap-build.sh
100755 blob 848 a30f443bf405d56682efe3b4c5d3a19d5f7eb45d 01-re-bootstrap-build.sh
100644 blob 2142 f19c2d6b293244bb11a3f74ee77c10675cadc7d6 INSTALL
100644 blob 30 c9b735fa1332286f4b3f5f81fa10527fd7506b6e LICENSE
040000 tree - 26d84bb94271d88200e951286a9ca3a89ce8cc9d builders
100644 blob 1773 ef1551089a803bde37e36edc8d61bb819d06f793 conf.bootstrap.sh
100644 blob 479 8cc15efe46965ac7750fe304460f5a2b0aa4201c conf.sh
040000 tree - b117ab143649fad475be4801aadbe3c7eccca23e files
100755 blob 333 06859f922e41c1e691c72ada1be3f981ef05f602 pkg-build
100644 blob 22800641 e9e6291054c857401f6835c728f31541dae4311e steam.tar.bz2
100644 blob 173 2047af328b22f9d146585cd9e759edbc18122250 utils.sh
040000 tree - 3ea8b6a0976e4a31f94cf63a35646cd184a55d4a x86
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/sylware/nyanlinux

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/sylware/nyanlinux

Clone this repository using git:
git clone git://git.rocketgit.com/user/sylware/nyanlinux

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main