Support us on Patreon to keep GamingOnLinux alive. This ensures all of our main content remains free for everyone. Just good, fresh content! Alternatively, you can donate through PayPal. You can also buy games using our partner links for GOG and Humble Store.
Build Mesa packages on Manjaro
Grogan Feb 8, 2023
It has come to my attention that Manjaro is not enabling the video codec acceleration in Mesa, for H.264 and H.265 and friends anymore. This will not do.

To fix that, we need to recompile Mesa with

-D video-codecs=vc1dec,h264dec,h264enc,h265dec,h265enc

Therefore, I'm going to attempt to help people build their own Mesa packages, using some PKGBUILDs I am providing. I just fixed these up and tested them so they should work for other people (mine were too personalized). These should work for Manjaro or Arch and can be used to check out master ("main"), a stable tag or the 23.0.0-rc by commenting or editing a line.

Starting with that:



6f6e3c51d8427d71b1a6b34efc68662e manjaro_PKGBUILDs_mesa-git-feb082022.tar.gz

OK, these started out years ago as the mesa-git AUR PKGBUILDs from Lone_Wolf, but I found some things in it to be too silly for me. For example a stanza that makes you set a variable for specific distro LLVM packages. I don't like that, I satisfy my own LLVM dependency. Let it use your system's (currently LLVM 15.0.7). Anyway, I gutted it but I have left all the original credits in the files.

Unpack the tarball and it will create two directories, mesa-git and lib32-mesa-git.

You will need to build both.

Open the PKGBUILD files in your editor of choice.

Take a look at makedepends and depends. You can save yourself trouble by making sure those packages are installed. (Otherwise the makepkg will fail for each one at a time lol)

If you have never compiled anything on Manjaro or Arch before, start by installing the base-devel meta

pacman -Syu base-devel

(-Syu will check and queue up all packages for update while installing your package. Use at least pacman -S)

Now, take a look at the prepare() function in the PKGBUILD. This is actually executed before pkgver() even though it's usually listed below it in PKGBUILDs

prepare() {
    cd mesa
    git checkout tags/mesa-22.3.5
    if [  -d _build ]; then
        rm -rf _build

See the git checkout line. I have it set to check out the current stable at the moment.

If you want mesa master (currently 23.1.0-devel) simply comment out the git checkout line

If you want to build mesa-23.0.0-rc4 change it to that. the PKGVER commands will strip out the extra hyphen and replace it with a dot for the pkgver variable.

Another thing to note. This will use your CFLAGS and CXXFLAGS from your /etc/makepkg.conf. We're doing a release build here, and the makepkg.conf flags will override it with -O2. So I'm simply removing the -O2 from existing variables so as not to override the build's -O3 optimization level.

export CFLAGS=${CFLAGS/-O2}

-D b_lto=false \

Arch turns on link time optimization for this build. I have found that to cause subtle breakage that can have me chasing my tail, so I don't do it. Change it to true if you want to try that (it should be OK with the stable). It also makes the build take more than twice as long (e.g. 20 minutes vs. 8). I see zero benefit from doing it, it might make more sense if you're using OSMesa/llvmpipe)

Alright, simply cd into mesa-git and type


Do the same with the lib32-mesa-git

Installing the Packages

To make it easier, you can put the resulting mesa-git .pkg.tar.zstd files together in a directory by themselves so you can just install them with a wildcard. In any case, install them with "pacman -U"

pacman -U mesa-git-
pacman -U lib32-mesa-git-

Or if you put them both in the same subdir with no other packages...

pacman -U *.pkg.tar.zstd

Now, here comes the tricky part. Manjaro/Arch split their Mesa packages into several subpackages. That bites the weenie.

In the provides= and conflicts= lines in the PKGBUILD, are the packages that it provides and conflicts with, intended to replace. You will be prompted to remove the conflicting packages. Do so, as our mesa-git and lib32-mesa-git are going to be providing those things.

It gets easier after this, you'll just be upgrading two packages from now on when you do new builds.

There should be no need to add IgnorePkg entries in /etc/pacman.conf as we are removing distro packages and replacing them with the mesa-git packages. HOWEVER, I HAVE seen Manjaro make available compiled mesa-git packages in the past, so to /etc/pacman.conf it's a good idea to add mesa-git and lib32-mesa-git to IgnorePkg directives.

IgnorePkg = mesa-git lib32-mesa-git

You can have as many IgnorePkg lines as you want (e.g. the lines can get pretty long for me lol)

Good Luck :-)

Last edited by Grogan on 9 February 2023 at 1:27 am UTC
Grogan Feb 9, 2023
I have updated and re-uploaded since. I corrected a typo in the provides= and conflicts= lines, I had vulkan-mesa-layer which may have been correct at one time (I'm sure I pasted it lol), but the package is vulkan-mesa-layers and lib32-vulkan-mesa-layers. It may just match a pattern anyway, but I'm unsure so it's been corrected.

Also, since I started working on this today, mesa-22.3.5 has been released as the stable.

I'm personally using master right now, because I want the latest bits related to the vulkan graphics pipeline library as they are committed, but master could have something broken at any moment you roll the dice. Not usually, they are pretty careful, but that's the nature of it.

A few weeks ago I was using mesa-22.3.0-rc (currently -rc4) without problems as well.

So pick your poison :-)

Last edited by Grogan on 9 February 2023 at 1:58 am UTC
mylka Feb 9, 2023
are there any differences to the mesa-git in AUR?
Grogan Feb 9, 2023
It depends on what you check out as to how different it would be, but one thing I did not do was enable the gallium driver "d3d12" (which is not really for our environment and would just be another build dep, directx headers)

I have simplified the PKGBUILDs a lot, they are easier to follow, but it basically builds mesa-git much like the AUR PKGBUILDs would (single package for mesa-git and lib32-mesa-git). If you comment out, #git checkout line it would build "main" like the AUR's would.
While you're here, please consider supporting GamingOnLinux on:

Reward Tiers: Patreon. Plain Donations: PayPal.

This ensures all of our main content remains totally free for everyone! Patreon supporters can also remove all adverts and sponsors! Supporting us helps bring good, fresh content. Without your continued support, we simply could not continue!

You can find even more ways to support us on this dedicated page any time. If you already are, thank you!
Login / Register

Or login with...
Sign in with Steam Sign in with Google
Social logins require cookies to stay logged in.