Initial commit

This commit is contained in:
2026-05-23 22:14:40 +03:00
commit e16a403afe
6 changed files with 414 additions and 0 deletions
+3
View File
@@ -0,0 +1,3 @@
# Ignore BPM archives and signatures
*.bpm
*.bpm.sig
+15
View File
@@ -0,0 +1,15 @@
#!/bin/bash
# Gitlab repository
REPO="mesa/demos"
# Replace slash with URL encoded representation
REPO=$(echo "$REPO" | sed 's|/|%2F|g')
# Get tag name using Gitlab Rest API
TAG_NAME=$(curl -s -L https://gitlab.freedesktop.org/api/v4/projects/"$REPO"/repository/tags | jq -r '.[].name' | sort -V | tail -n1)
# Trim prefix
VERSION=${TAG_NAME//mesa-demos-/}
echo "$VERSION"
+45
View File
@@ -0,0 +1,45 @@
name: mesa-demos
description: Mesa demos
version: 9.0.0
revision: 1
url: https://mesa3d.org/
license: MIT
maintainers:
- [email protected]
architecture: any
type: source
depends:
- freeglut
- glibc
- glu
- libglvnd
- libx11
- libxext
make_depends:
- glslang
- libdecor
- libxkbcommon
- mesa
- meson
- vulkan-headers
- vulkan-loader
- wayland-protocols
downloads:
- url: https://mesa.freedesktop.org/archive/demos/mesa-demos-${BPM_PKG_VERSION}.tar.xz
extract_to: ${BPM_SOURCE}
extract_strip_components: 1
checksum: 3046a3d26a7b051af7ebdd257a5f23bfeb160cad6ed952329cdff1e9f1ed496b
split_packages:
- name: mesa-demos
- name: mesa-utils
description: Essential Mesa utilities
depends:
- glibc
- libdecor
- libdrm
- libglvnd
- libx11
- libxcb
- libxkbcommon
- vulkan-loader
- wayland
+82
View File
@@ -0,0 +1,82 @@
Disclaimer
Mesa is a 3-D graphics library with an API which is very similar to
that of OpenGL*
To the extent that Mesa utilizes the OpenGL command syntax or state
machine, it is being used with authorization from Silicon Graphics,
Inc.(SGI). However, the author does not possess an OpenGL license
from SGI, and makes no claim that Mesa is in any way a compatible
replacement for OpenGL or associated with SGI. Those who want a
licensed implementation of OpenGL should contact a licensed
vendor.
Please do not refer to the library as MesaGL (for legal
reasons). It's just Mesa or The Mesa 3-D graphics
library
* OpenGL is a trademark of Silicon Graphics Incorporated.
License / Copyright Information
The Mesa distribution consists of several components. Different copyrights
and licenses apply to different components. For example, GLUT is copyrighted
by Mark Kilgard, some demo programs are copyrighted by SGI, some of the Mesa
device drivers are copyrighted by their authors. See below for a list of
Mesa's main components and the license for each.
The core Mesa library is licensed according to the terms of the MIT license.
This allows integration with the XFree86, Xorg and DRI projects.
The default Mesa license is as follows:
Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Attention, Contributors
When contributing to the Mesa project you must agree to the licensing terms
of the component to which you're contributing.
The following section lists the primary components of the Mesa distribution
and their respective licenses.
Mesa Component Licenses
Component Location Primary Author License
----------------------------------------------------------------------------
Main Mesa code src/mesa/ Brian Paul Mesa (MIT)
Device drivers src/mesa/drivers/* See drivers See drivers
Ext headers include/GL/glext.h SGI SGI Free B
include/GL/glxext.h
GLUT src/glut/ Mark Kilgard Mark's copyright
Mesa GLU library src/glu/mesa/ Brian Paul GNU-LGPL
SGI GLU library src/glu/sgi/ SGI SGI Free B
demo programs progs/demos/ various see source files
X demos progs/xdemos/ Brian Paul see source files
SGI demos progs/samples/ SGI SGI copyright
RedBook demos progs/redbook/ SGI SGI copyright
+209
View File
@@ -0,0 +1,209 @@
diff --git a/src/glsl/bezier.c b/src/glsl/bezier.c
index 84e0367..62996fb 100644
--- a/src/glsl/bezier.c
+++ b/src/glsl/bezier.c
@@ -13,7 +13,7 @@
#include "glut_wrap.h"
#include "shaderutil.h"
-static const char *filename = "bezier.geom";
+static const char *filename = DEMOS_DATA_DIR "bezier.geom";
static GLuint fragShader;
static GLuint vertShader;
diff --git a/src/glsl/blinking-teapot.c b/src/glsl/blinking-teapot.c
index 62451e9..3420066 100644
--- a/src/glsl/blinking-teapot.c
+++ b/src/glsl/blinking-teapot.c
@@ -63,8 +63,8 @@ init_opengl (void)
exit(1);
}
- vshad_id = CompileShaderFile (GL_VERTEX_SHADER, "blinking-teapot.vert");
- fshad_id = CompileShaderFile (GL_FRAGMENT_SHADER, "blinking-teapot.frag");
+ vshad_id = CompileShaderFile (GL_VERTEX_SHADER, DEMOS_DATA_DIR "blinking-teapot.vert");
+ fshad_id = CompileShaderFile (GL_FRAGMENT_SHADER, DEMOS_DATA_DIR "blinking-teapot.frag");
prog_id = LinkShaders (vshad_id, fshad_id);
glUseProgram (prog_id);
diff --git a/src/glsl/brick.c b/src/glsl/brick.c
index 00d8349..f9f0ec7 100644
--- a/src/glsl/brick.c
+++ b/src/glsl/brick.c
@@ -14,8 +14,8 @@
#include "shaderutil.h"
-static char *FragProgFile = "CH06-brick.frag";
-static char *VertProgFile = "CH06-brick.vert";
+static char *FragProgFile = DEMOS_DATA_DIR "CH06-brick.frag";
+static char *VertProgFile = DEMOS_DATA_DIR "CH06-brick.vert";
/* program/shader objects */
static GLuint fragShader;
diff --git a/src/glsl/bump.c b/src/glsl/bump.c
index 95ad19f..f40cba0 100644
--- a/src/glsl/bump.c
+++ b/src/glsl/bump.c
@@ -15,9 +15,9 @@
#include "readtex.h"
-static char *FragProgFile = "CH11-bumpmap.frag";
-static char *FragTexProgFile = "CH11-bumpmaptex.frag";
-static char *VertProgFile = "CH11-bumpmap.vert";
+static char *FragProgFile = DEMOS_DATA_DIR "CH11-bumpmap.frag";
+static char *FragTexProgFile = DEMOS_DATA_DIR "CH11-bumpmaptex.frag";
+static char *VertProgFile = DEMOS_DATA_DIR "CH11-bumpmap.vert";
static char *TextureFile = DEMOS_DATA_DIR "tile.rgb";
/* program/shader objects */
diff --git a/src/glsl/convolutions.c b/src/glsl/convolutions.c
index 567b358..4c681dd 100644
--- a/src/glsl/convolutions.c
+++ b/src/glsl/convolutions.c
@@ -340,7 +340,7 @@ static void init(void)
menuInit();
readTexture(textureLocation);
- createProgram("convolution.vert", "convolution.frag");
+ createProgram(DEMOS_DATA_DIR "convolution.vert", DEMOS_DATA_DIR "convolution.frag");
glEnable(GL_TEXTURE_2D);
glClearColor(1.0, 1.0, 1.0, 1.0);
diff --git a/src/glsl/mandelbrot.c b/src/glsl/mandelbrot.c
index 18b817c..6bbeffd 100644
--- a/src/glsl/mandelbrot.c
+++ b/src/glsl/mandelbrot.c
@@ -14,8 +14,8 @@
#include "shaderutil.h"
-static char *FragProgFile = "CH18-mandel.frag";
-static char *VertProgFile = "CH18-mandel.vert";
+static char *FragProgFile = DEMOS_DATA_DIR "CH18-mandel.frag";
+static char *VertProgFile = DEMOS_DATA_DIR "CH18-mandel.vert";
/* program/shader objects */
static GLuint fragShader;
diff --git a/src/glsl/meson.build b/src/glsl/meson.build
index db8c613..13564a4 100644
--- a/src/glsl/meson.build
+++ b/src/glsl/meson.build
@@ -83,3 +83,38 @@ executable(
],
install: true
)
+
+glsl_data = [
+ 'bezier.geom',
+ 'blinking-teapot.frag',
+ 'blinking-teapot.vert',
+ 'brick.shtest',
+ 'CH06-brick.frag',
+ 'CH06-brick.vert',
+ 'CH11-bumpmap.frag',
+ 'CH11-bumpmaptex.frag',
+ 'CH11-bumpmap.vert',
+ 'CH11-toyball.frag',
+ 'CH11-toyball.vert',
+ 'CH18-mandel.frag',
+ 'CH18-mandel.vert',
+ 'convolution.frag',
+ 'convolution.vert',
+ 'cubemap.frag',
+ 'mandelbrot.shtest',
+ 'multitex.frag',
+ 'multitex.shtest',
+ 'multitex.vert',
+ 'reflect.vert',
+ 'shadowtex.frag',
+ 'simple.vert',
+ 'simplex-noise.glsl',
+ 'skinning.frag',
+ 'skinning.vert',
+ 'toyball.shtest',
+]
+
+install_data(
+ glsl_data,
+ install_dir: get_option('datadir') / 'mesa-demos'
+)
diff --git a/src/glsl/multitex.c b/src/glsl/multitex.c
index 2f9a2fa..b51aba3 100644
--- a/src/glsl/multitex.c
+++ b/src/glsl/multitex.c
@@ -35,8 +35,8 @@
static const char *Demo = "multitex";
-static const char *VertFile = "multitex.vert";
-static const char *FragFile = "multitex.frag";
+static const char *VertFile = DEMOS_DATA_DIR "multitex.vert";
+static const char *FragFile = DEMOS_DATA_DIR "multitex.frag";
static const char *TexFiles[2] =
{
diff --git a/src/glsl/simplex-noise.c b/src/glsl/simplex-noise.c
index a687508..9a2a029 100644
--- a/src/glsl/simplex-noise.c
+++ b/src/glsl/simplex-noise.c
@@ -169,7 +169,7 @@ SpecialKey(int key, int x, int y)
static void
Init(void)
{
- const char *filename = "simplex-noise.glsl";
+ const char *filename = DEMOS_DATA_DIR "simplex-noise.glsl";
char noiseText[10000];
FILE *f;
int len;
diff --git a/src/glsl/skinning.c b/src/glsl/skinning.c
index b451d13..0f4e943 100644
--- a/src/glsl/skinning.c
+++ b/src/glsl/skinning.c
@@ -20,8 +20,8 @@
#define M_PI 3.1415926535
#endif
-static char *FragProgFile = "skinning.frag";
-static char *VertProgFile = "skinning.vert";
+static char *FragProgFile = DEMOS_DATA_DIR "skinning.frag";
+static char *VertProgFile = DEMOS_DATA_DIR "skinning.vert";
/* program/shader objects */
static GLuint fragShader;
diff --git a/src/glsl/texdemo1.c b/src/glsl/texdemo1.c
index 861d696..42308d1 100644
--- a/src/glsl/texdemo1.c
+++ b/src/glsl/texdemo1.c
@@ -35,11 +35,11 @@
static const char *Demo = "texdemo1";
-static const char *ReflectVertFile = "reflect.vert";
-static const char *CubeFragFile = "cubemap.frag";
+static const char *ReflectVertFile = DEMOS_DATA_DIR "reflect.vert";
+static const char *CubeFragFile = DEMOS_DATA_DIR "cubemap.frag";
-static const char *SimpleVertFile = "simple.vert";
-static const char *SimpleTexFragFile = "shadowtex.frag";
+static const char *SimpleVertFile = DEMOS_DATA_DIR "simple.vert";
+static const char *SimpleTexFragFile = DEMOS_DATA_DIR "shadowtex.frag";
static const char *GroundImage = DEMOS_DATA_DIR "tile.rgb";
diff --git a/src/glsl/toyball.c b/src/glsl/toyball.c
index 17aa765..5b1f7d3 100644
--- a/src/glsl/toyball.c
+++ b/src/glsl/toyball.c
@@ -14,8 +14,8 @@
#include "shaderutil.h"
-static char *FragProgFile = "CH11-toyball.frag";
-static char *VertProgFile = "CH11-toyball.vert";
+static char *FragProgFile = DEMOS_DATA_DIR "CH11-toyball.frag";
+static char *VertProgFile = DEMOS_DATA_DIR "CH11-toyball.vert";
/* program/shader objects */
static GLuint fragShader;
+60
View File
@@ -0,0 +1,60 @@
# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package
# BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE
# BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT
# The prepare function is executed in the root of the temp directory
# This function is used for putting downloaded files to the correct location or applying patches
prepare() {
cd "$BPM_SOURCE"
# Patch from fedora
patch -Np1 -i "$BPM_WORKDIR"/mesa-demos-system-data.patch
}
# The build function is executed in the source directory
# This function is used to compile the source code
build() {
meson setup build --prefix=/usr -Dgles1=disabled -Dosmesa=disabled -Dwith-system-data-files=true
meson compile -C build
}
_pick() {
local p="$1" f d; shift
for f; do
[ -d "$BPM_WORKDIR"/output_"$p" ] || { echo "Split package $p not found"; exit 1; }
d="$BPM_WORKDIR"/output_"$p"/"${f#$BPM_OUTPUT}"
mkdir -p "$(dirname "$d")"
mv "$f" "$d"
rmdir -p --ignore-fail-on-non-empty "$(dirname "$f")"
done
}
# The package function is executed in the source directory
# This function is used to move the compiled files into the output directory
package_mesa-demos() {
meson install -C build --destdir="$BPM_OUTPUT"
cd "$BPM_OUTPUT"
# Move mesa utilities into split package
_pick mesa-utils usr/bin/eglinfo
_pick mesa-utils usr/bin/eglgears_*
_pick mesa-utils usr/bin/eglkms
_pick mesa-utils usr/bin/egltri_*
_pick mesa-utils usr/bin/peglgears
_pick mesa-utils usr/bin/xeglgears
_pick mesa-utils usr/bin/xeglthreads
_pick mesa-utils usr/bin/es2_info
_pick mesa-utils usr/bin/es2gears_*
_pick mesa-utils usr/bin/es2tri
_pick mesa-utils usr/bin/glxinfo
_pick mesa-utils usr/bin/glxgears
_pick mesa-utils usr/bin/vkgears
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/mesa-demos/LICENSE
}
package_mesa-utils() {
# Install package license
install -Dm644 "$BPM_WORKDIR"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/mesa-utils/LICENSE
}