(no commit message)
authorcolepoirier@1ec9c8c87c85f09e4718cd80e0605065e33975f0 <colepoirier@1ec9c8c87c85f09e4718cd80e0605065e33975f0@web>
Thu, 27 Aug 2020 20:13:32 +0000 (21:13 +0100)
committerIkiWiki <ikiwiki.info>
Thu, 27 Aug 2020 20:13:32 +0000 (21:13 +0100)
3d_gpu/mesa.mdwn

index db61847b63877dc61873443f3b09b9b4ba4f52f9..ad72fa81f404fbe66363f64b18ba869d24da2aa2 100644 (file)
@@ -2,20 +2,91 @@
 
 todo http://lists.libre-soc.org/pipermail/libre-soc-dev/2020-August/000246.html
 
-# build instructions, by vivek
+# Build Instructions (by Cole from Vivek's comments on the mailing list)
 
-Sure I will add details about how to build the code, I use basically meson
-and ninja commands,
-My build directory located in mesa source here is my meson command to
-configure (I know this does more work than require please add more options
-if you find useful):
+This tutorial assumes, like the rest of the info on the wiki, that you are running Debian 10.4 either natively or in a virtualized setup.
 
-    meson -Dbuildtype=debug -Dprefix=/home/vivek/install -Dvulkan-drivers=libresoc ..
+The following is available as scripts in the libre-soc dev-env-setup repo, and can be easily used by running `sudo ./install-mesa-apt-reqs && ./lsoc-mesa-dev-env-setup`.
 
-and then
+First, we need to install the necessary apt dependencies for building `drm` and `mesa`.
 
-    ninja
-    ninja install.
+In order to install a `meson` version recent enough to configure `mesa`, add buster-backports to /etc/apt/sources.list by running the following as root:
+
+    echo "deb http://deb.debian.org/debian buster-backports main" | tee \
+     -a /etc/apt/sources.list
+
+Install `meson` (version 52.0 or later):
+
+    apt-get install -y -t buster-backports meson
+
+Then install the necessary packages by running the following commands as root:
+
+    apt-get update -y
+    apt-get upgrade -y
+    apt-get install -y build-essential \
+        cmake \
+        git \
+        pkg-config \
+        libatomic-ops-dev \
+        libcairo2-dev \
+        libcunit1-dev \
+        libpciaccess-dev \
+        libunwind-dev \
+        llvm-8 \
+        llvm-8-dev \
+        python3.7 \
+        python3.7-dev \
+        python3-setuptools \
+        libzstd-dev \
+        libzstd1 \
+        zlib1g
+
+Then, still as root, run the following to get the necessary dependencies for building `drm` and `mesa`.
+
+    apt-get build-dep -y libdrm
+    apt-get build-dep -y mesa
+
+Now we are going to build and install `drm` from source as the debian apt versions are not recent enough to build mesa. Run all of these command as a regular user, *DO NOT RUN AS ROOT* it is not necessary.
+
+First, create our working directory `opt` in our user directory. In order to not mess with system `drm` and `mesa` libraries, also create a sub-directory `lsoc_mesa` to hold our header files and libraries. After creating the `opt` directory, cd into it to make it our active, current working directory.
+
+    mkdir -p ~/opt/lsoc_mesa
+    cd ~/opt
+    
+Now clone `drm` from mesa's gitlab. Change to the `drm` directory. Create a build directory and cd into it.
+
+    git clone https://gitlab.freedesktop.org/mesa/drm.git
+    cd drm
+    mkdir build && cd build
+
+In order to configure `drm` for building and installation run the following command. It is very important to specify `prefix=/home/$USER/opt/lsoc_mesa` because as mentioned above we need these files for development purposes, but we do not want to corrupt or interfere with our *system* `drm` libraries.
+
+    meson -Dbuildtype=release -Dprefix=/home/$USER/opt/lsoc_mesa ..
+
+After configuration has completed, run ninja to build and install the `drm` libraries.
+
+    ninja install
+In order for meson to be able to find the up-to-date `drm` files we have just built, we need to specify their location with the environment variable `PKG_CONFIG_PATH`.
+
+    export PKG_CONFIG_PATH=~/opt/lsoc_mesa/lib/x86_64-linux-gnu/pkgconfig/
+
+Now change back to the base `~/opt` directory and clone the `mesa` git repo from the `mesa` gitlab instance. Change to the `mesa` directory. Create a build directory and cd into it.
+
+    cd ~/opt
+    git clone https://gitlab.freedesktop.org/mesa/mesa.git
+    cd mesa
+    mkdir build && cd build
+
+In order to configure `mesa` for building and installation run the following command. Again, it is *very* important to specify `prefix=/home/$USER/opt/lsoc_mesa` because as mentioned above we need these files for development purposes, but we do not want to corrupt or interfere with our *system* `mesa` libraries.
+
+    meson -Dbuildtype=debug -Dprefix=/home/$USER/opt/lsoc_mesa                
+
+After configuration has completed, run ninja to build and install the `mesa` libraries.
+
+    ninja install
+
+# From here on is solely Vivek's instructions
 
 I also have script to set few environment variables like