From 3313f001b48b40c8f5543271cd679f3bbb118b97 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Wed, 6 May 2020 15:57:25 -0700 Subject: Initial import --- mesa-debug | 8 ++++++ mesa-debug-optimized | 8 ++++++ mesa-gdb | 3 ++ mesa-release | 8 ++++++ mesa-run | 34 +++++++++++++++++++++++ nj | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 138 insertions(+) create mode 100755 mesa-debug create mode 100755 mesa-debug-optimized create mode 100755 mesa-gdb create mode 100755 mesa-release create mode 100755 mesa-run create mode 100755 nj diff --git a/mesa-debug b/mesa-debug new file mode 100755 index 0000000..de11e88 --- /dev/null +++ b/mesa-debug @@ -0,0 +1,8 @@ +#!/bin/sh + +export cflags="-ggdb3 -O0 -march=native -pipe" +export cxxflags="${cflags}" +export buildtype=debug +export builddir=~/projects/mesa/build-debug + +exec mesa-run $@ diff --git a/mesa-debug-optimized b/mesa-debug-optimized new file mode 100755 index 0000000..22b2ff2 --- /dev/null +++ b/mesa-debug-optimized @@ -0,0 +1,8 @@ +#!/bin/sh + +export cflags="-ggdb3 -O2 -march=native -fno-omit-frame-pointer -pipe" +export cxxflags="${cflags}" +export buildtype=debugoptimized +export builddir=~/projects/mesa/build-debug-optimized + +exec mesa-run $@ diff --git a/mesa-gdb b/mesa-gdb new file mode 100755 index 0000000..5288a66 --- /dev/null +++ b/mesa-gdb @@ -0,0 +1,3 @@ +#!/bin/sh + +mesa-debug gdb -q --args $@ diff --git a/mesa-release b/mesa-release new file mode 100755 index 0000000..60c5754 --- /dev/null +++ b/mesa-release @@ -0,0 +1,8 @@ +#!/bin/sh + +export cflags="-O2 -march=native -fno-omit-frame-pointer -pipe" +export cxxflags="${cflags}" +export buildtype=release +export builddir=~/projects/mesa/build-release + +exec mesa-run $@ diff --git a/mesa-run b/mesa-run new file mode 100755 index 0000000..b45932d --- /dev/null +++ b/mesa-run @@ -0,0 +1,34 @@ +#!/bin/sh + +case "$1" in +wipeout) + echo "Removing ${builddir}" + exec rm -rfI "${builddir}" + ;; +configure) + args=( + -Dprefix="${builddir}"/install + -Dc_args="${cflags}" + -Dcpp_args="${cxxflags}" + -Dtools=intel + -Dbuild-tests=true + -Ddri-drivers=i965 + -Dvulkan-drivers=intel + -Dgallium-drivers=iris + -Dgallium-va=auto + -Dbuildtype="${buildtype}" + # -Db_sanitize=address,undefined + -Dbackend=ninja + "${builddir}" + ) + exec meson "${args[@]}" + ;; +build) + exec nj "${buildtype}" install + ;; +esac + +export LD_LIBRARY_PATH="${builddir}"/install/lib64 +export LIBGL_DRIVERS_PATH="${builddir}"/install/lib64/dri +export VK_ICD_FILENAMES="${builddir}"/install/share/vulkan/icd.d/intel_icd.x86_64.json +exec $@ diff --git a/nj b/nj new file mode 100755 index 0000000..7a29e39 --- /dev/null +++ b/nj @@ -0,0 +1,77 @@ +#! /bin/bash +# +# Copyright 2017 Kenneth Graunke +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# _____________________________________________________________________ +# +# The "nj" ninja builder +# +# From any directory in a Git worktree, 'nj' will jump to the build +# directory, build, and optionally install your project. +# +# It supports in-tree builds, a single out-of-tree build (in build/), +# or multiple out-of-tree builds (in build/*/). +# +# Usage: +# $ nj [] [] # if using multiple out-of-tree builds. +# $ nj [] # if using an in-tree or single out-of-tree build +# +# By default, defaults to "debug". +# +# Setup: +# +# You can create multiple out-of-tree builds, named whatever you like. +# An example build called 'debug' would look like: +# +# - build/debug +# - build/debug/extratargets (optional) +# - build/debug/install (optional) +# +# If no targets are specified, nj defaults to 'all'. It appends the contents +# of the 'extratargets' file, if it exists, allowing you to build additional +# targets that aren't enabled by default in your project's build system, such +# as 'check'. +# +# Additionally, if 'install' exists, it runs 'ninja install'. This can be +# a directory which you've set as Meson/CMake's install prefix, or just a +# blank file if you want it to install elsewhere. +# _____________________________________________________________________ + +topdir=$(git rev-parse --show-toplevel) +if [ -f "$topdir/build.ninja" ]; then + # In-tree build exists, use that. + builddir="${topdir}" +elif [ -f "$topdir/build/build.ninja" ]; then + # Single out-of-tree build, use that. + builddir="${topdir}/build" +else + # Select an out of tree build from the first command line argument, + # defaulting to build-debug if no directory was given. + builddir="${topdir}/build-${1:-debug}" + shift + + if [ ! -f "$builddir/build.ninja" ]; then + echo "No build directory in \"$builddir\"...aborting." + exit + fi +fi + +cd "$builddir" + +extratargets="$(cat extratargets 2>/dev/null)" +targets="${@:-all $extratargets}" + +ninja $targets +[[ "$targets" == all* ]] && [ -e install ] && ninja install > /dev/null -- cgit v1.2.3