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

/builders/x86-mesa-amd-sh/contrib/x86_linux_glibc_amdgpu.sh (788c7a222fc96a4b7d623dfef0c07106b10395ad) (8757 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
#===============================================================================

set -e

#===============================================================================
# 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 \
"
#===============================================================================


#===============================================================================
# XXX: for 32 bits system, MUST use _FILE_OFFSET_BITS=64
# 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 \
\
-D_FILE_OFFSET_BITS=64 \
"
#-------------------------------------------------------------------------------
# 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
#===============================================================================


#===============================================================================
# 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
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\" \
"
#===============================================================================


#===============================================================================
. $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/mapi.sh
. $script_dir/compiler.sh
. $script_dir/mesa.sh
. $script_dir/glx.sh
#------------------------------------------------------------------------------
# hardware dri gallium drivers for above APIs
. $script_dir/amd.sh
. $script_dir/gallium.sh
#===============================================================================


Mode Type Size Ref File
100644 blob 5 8eba6c8dd4dcaf6166bd22285ed34625f38a84ff .gitignore
100755 blob 2487 533016d4902080b22ae5dc5352802ebdd0d78b16 01-x86_64-nyan-linux-gnu.sh
100755 blob 4254 31fdc18cc3e6c6cfd8444fa404f7e82f849bad56 02-nyan-cross-core.sh
100755 blob 3549 7f1362bad6786a6818ce7a7d613d0dc11f611fb9 03-nyan-cross-x11.sh
100755 blob 12534 f9036d33f9f159ea2421ce1a1ebf7067f0f695c1 04-bootstrap-conf.sh
100755 blob 671 5f6bc5de83a883da3a7f0d4a37e1d0ef51c08561 10-sdk-conf.sh
100755 blob 2201 83fa9bf5bddbecb88db53779e324b9f270b1080e 11-sdk.sh
100755 blob 2826 090b622caebd38755ef1e57a9cf0f4f673b22a8e 12-desktop.sh
100755 blob 129 08460f0dece90701f01cbf7d710609ecbb3d56e0 13-beyond.sh
100644 blob 1075 1b5314b511d4c6dc7eb4db36a21dd47ba5a00a9d INSTALL
100644 blob 30 c9b735fa1332286f4b3f5f81fa10527fd7506b6e LICENSE
100644 blob 1973 6aa180fc473777d9ca6b155cbf9b973065cdd77a README
040000 tree - a0e0b5892f7f1553c5372222f0b6bb2ab34795a3 builders
100644 blob 2986 43344438bb4d817ff81f1890de1097f627c6d6c4 conf.sh
040000 tree - 317962325b26fefabb04d8e26db40eae9e5b8d62 files
100755 blob 351 6af534903b47d67a8dcb71653e7a0e1c1a4dfda4 pkg-build
100755 blob 289 7f5fbdbb712f274d04a036b9c486cbc9cf581be6 pkg-build-target
100644 blob 915 a7f21134dbc05d0e8227eaee366856b8171832a4 sdk.sh
100755 blob 5001 ef66a8b35dbba08f4397c2163cf2e7559207783a x86.sh
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