summaryrefslogtreecommitdiff
path: root/packaging/mesa.spec
blob: b2e5409b8685b280e28c253c2484da9e4b0f144d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
Name:           mesa
Version:        22.3.5
Release:        0
License:        MIT and Apache-2.0 and SGI Free Software License B v2.0 and BSD-3-Clause
Summary:        System for rendering interactive 3-D graphics
Url:            http://www.mesa3d.org
Group:          Graphics & UI Framework/Hardware Adaptation
Source:         %{name}-%{version}.tar.gz
Source1001:     %{name}.manifest
Source1002:     99-GPU-Acceleration.rules


BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(expat)
BuildRequires:  pkgconfig(libdrm) >= 2.4.75
BuildRequires:  pkgconfig(libudev) > 150
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(wayland-server)
BuildRequires:  pkgconfig(wayland-protocols)
BuildRequires:  pkgconfig(tpl-egl)
BuildRequires:  pkgconfig(libtbm)
BuildRequires:  pkgconfig(libtdm)
BuildRequires:  pkgconfig(zlib)
BuildRequires:  pkgconfig(dlog)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  meson
BuildRequires:  python3
BuildRequires:  python3-mako
BuildRequires:  pkgconfig(ttrace)
%ifarch x86_64 %ix86
BuildRequires:  pkgconfig(libdrm_intel) >= 2.4.24
%endif

%if "%{_with_emulator}" == "1"
ExclusiveArch:
%endif

%define enable_driver() %{expand:%%{?!enable_%{1}: %%global enable_%{1} 1}}

%define append_drivers() %{?gallium_drivers: %global gallium_drivers %{expand:%{gallium_drivers}},%{expand:%{1}}}\
						 %{?!gallium_drivers: %global gallium_drivers %{expand:%{1}}}

%define enable_gallium_driver() \
	%append_drivers %{1} \
	%enable_driver %{1}

%ifarch %ix86 x86_64
%enable_gallium_driver i915
%enable_gallium_driver swrast
%enable_gallium_driver virgl

%define vulkan_drivers ""
%define dri_drivers ""

%else
%define USE_VULKAN 1
%define VULKAN_DRIVER broadcom

%if %{USE_VULKAN} == 1
%enable_driver vulkan
%endif

%enable_gallium_driver kmsro
%enable_gallium_driver swrast
%enable_gallium_driver vc4
%enable_gallium_driver v3d
%enable_gallium_driver virgl

%define vulkan_drivers "%{?enable_vulkan:%{VULKAN_DRIVER}}"
%define dri_drivers "auto"
%endif

%enable_driver gbm

%{echo: enabled gallium drivers : %{expand:%{gallium_drivers}}}


%description
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.

%prep
%setup -q -n %{name}-%{version}
cp %{SOURCE1001} .
cp %{SOURCE1002} .

%build
%{?asan:/usr/bin/gcc-unforce-options}
mkdir build

meson --prefix %{_hal_prefix} build/ \
        -Dc_link_args="-lttrace" \
        -Dcpp_link_args="-lttrace" \
        -Dlibdir=%{_hal_libdir} \
        -Dgallium-va=false \
        -Dgallium-vdpau=false \
        -Dgallium-xa=false \
        -Dglx=disabled \
        -Ddri3=false \
        -Ddraw-use-llvm=false \
        -Dllvm=disabled \
        -Dgbm=%{?enable_gbm:enabled}%{?!enable_gbm:disabled} \
        -Dplatforms="tizen" \
        -Dgallium-drivers=%{gallium_drivers} \
        -Dvulkan-drivers=%{vulkan_drivers}

ninja -C build/

%install
DESTDIR=%{buildroot} ninja -C build/ install
mkdir -p %{buildroot}%{_hal_libdir}/driver
mkdir -p %{buildroot}%{_hal_libdir}/dri
mkdir -p %{buildroot}%{_hal_prefix}/share/vulkan/icd.d

cp -a %{buildroot}%{_hal_libdir}/libEGL* %{buildroot}%{_hal_libdir}/driver/
cp -a %{buildroot}%{_hal_libdir}/libGLES* %{buildroot}%{_hal_libdir}/driver/
cp -a %{buildroot}%{_hal_libdir}/libgbm* %{buildroot}%{_hal_libdir}/driver/

mkdir -p %{buildroot}%{_hal_libdir}/udev/rules.d
cp 99-GPU-Acceleration.rules %{buildroot}%{_hal_libdir}/udev/rules.d

mkdir -p %{buildroot}%{_hal_prefix}/share/licenses/%{name}
cp COPYING %{buildroot}%{_hal_prefix}/share/licenses/%{name}/

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%define _unpackaged_files_terminate_build 0
%manifest %{name}.manifest
%defattr(-,root,root)
%{_hal_prefix}/share/licenses/%{name}/COPYING
%{_hal_libdir}/libglapi*
%{_hal_libdir}/driver/*
%if %{expand:%{?enable_vc4:1}%{?!enable_vc4:0}}
%{_hal_libdir}/dri/vc4_dri.so
%endif
%if %{expand:%{?enable_v3d:1}%{?!enable_v3d:0}}
%{_hal_libdir}/dri/v3d_dri.so
%endif
%if %{expand:%{?enable_swrast:1}%{?!enable_swrast:0}}
%{_hal_libdir}/dri/swrast_dri.so
%endif
%if %{expand:%{?enable_virgl:1}%{?!enable_virgl:0}}
%{_hal_libdir}/dri/virtio_gpu_dri.so
%endif
%if %{expand:%{?enable_i915:1}%{?!enable_i915:0}}
%{_hal_libdir}/dri/i915_dri.so
%endif

%if %{enable_gbm}
%{_hal_libdir}/driver/libgbm*
%endif

%if "%{USE_VULKAN}" == "1"
%{_hal_libdir}/libvulkan_%{VULKAN_DRIVER}.so
%{_hal_prefix}/share/vulkan/icd.d/*
%endif
%{_hal_libdir}/udev/rules.d/99-GPU-Acceleration.rules