Skip to content

Instantly share code, notes, and snippets.

@katabame
Last active May 18, 2024 06:15
Show Gist options
  • Save katabame/e368988c968278c83c19bd5f5b60f407 to your computer and use it in GitHub Desktop.
Save katabame/e368988c968278c83c19bd5f5b60f407 to your computer and use it in GitHub Desktop.
Build Hyprland on Ubuntu 23.10

Maintaing gist file is kinda hard way, so I moved this project to katabame/Ubuntu-Hyprland repository.
future updates are only available at the repository.
and any issue or improvements are should be go to the repository's issue or pullrequest.

#!/bin/bash
set -ex
# For Ubuntu 22.04
UBUNTU_VERSION=`lsb_release -r | awk '{print $2}'`
OLD_UBUNTU_VERSION='22.04'
PIXMAN_VERSION='0.43.4'
XCBPROTO_VERSION='1.17.0'
LIBXCB_VERSION='1.17.0'
HYPRLAND_VERSION='0.38.1'
HYPRLANG_VERSION='0.5.0'
HYPRCURSOR_VERSION='0.1.7'
WAYLAND_VERSION='1.22.0'
WAYLAND_PROTOCOLS_VERSION='1.34'
LIBDISPLAY_INFO_VERSION='0.1.1'
TOMLPLUSPLUS_VERSION='3.4.0'
if [ "${UBUNTU_VERSION}" = "${OLD_UBUNTU_VERSION}" ]; then
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get install -y --no-install-recommends \
wget build-essential cmake-extras cmake \
gettext gettext-base fontconfig libfontconfig-dev libffi-dev libxml2-dev \
libxkbcommon-x11-dev libxkbregistry-dev libxkbcommon-dev libpixman-1-dev \
libudev-dev libseat-dev seatd libvulkan-dev libvulkan-volk-dev \
vulkan-validationlayers-dev libvkfft-dev libgulkan-dev libegl-dev libgles2 \
libegl1-mesa-dev glslang-tools libinput-bin libinput-dev \
libavutil-dev libavcodec-dev libavformat-dev \
libpango1.0-dev xdg-desktop-portal-wlr hwdata \
libcairo2-dev libzip-dev librsvg2-dev libgbm-dev jq \
gcc-13 g++-13 python3-pip autoconf automake xutils-dev libtool
sudo pip3 install meson ninja
export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13
else
sudo apt-get install -y --no-install-recommends \
meson wget build-essential ninja-build cmake-extras cmake \
gettext gettext-base fontconfig libfontconfig-dev libffi-dev libxml2-dev \
libxkbcommon-x11-dev libxkbregistry-dev libxkbcommon-dev libpixman-1-dev \
libudev-dev libseat-dev seatd libxcb-dri3-dev libvulkan-dev libvulkan-volk-dev \
vulkan-validationlayers-dev libvkfft-dev libgulkan-dev libegl-dev libgles2 \
libegl1-mesa-dev glslang-tools libinput-bin libinput-dev libxcb-composite0-dev \
libavutil-dev libavcodec-dev libavformat-dev libxcb-ewmh2 libxcb-ewmh-dev \
libxcb-present-dev libxcb-icccm4-dev libxcb-render-util0-dev libxcb-res0-dev \
libxcb-xinput-dev libpango1.0-dev xdg-desktop-portal-wlr hwdata \
libcairo2-dev libzip-dev librsvg2-dev libgbm-dev jq
fi
mkdir ~/HyprSource
cd ~/HyprSource
## Clone sources
# hyprland
wget -O hyprland.tar.gz "https://github.com/hyprwm/Hyprland/releases/download/v${HYPRLAND_VERSION}/source-v${HYPRLAND_VERSION}.tar.gz"
mkdir ~/HyprSource/hyprland &&
tar -xzf hyprland.tar.gz -C ~/HyprSource/hyprland --strip-components 1 &&
rm hyprland.tar.gz
# hyprlang
wget -O hyprlang.tar.gz "https://github.com/hyprwm/hyprlang/archive/refs/tags/v${HYPRLANG_VERSION}.tar.gz"
mkdir ~/HyprSource/hyprlang &&
tar -xzf hyprlang.tar.gz -C ~/HyprSource/hyprlang --strip-components 1 &&
rm hyprlang.tar.gz
# hyprcursor
wget -O hyprcursor.tar.gz "https://github.com/hyprwm/hyprcursor/archive/refs/tags/v${HYPRCURSOR_VERSION}.tar.gz"
mkdir ~/HyprSource/hyprcursor &&
tar -xzf hyprcursor.tar.gz -C ~/HyprSource/hyprcursor --strip-components 1 &&
rm hyprcursor.tar.gz
# wayland
wget -O wayland.tar.gz "https://gitlab.freedesktop.org/wayland/wayland/-/archive/${WAYLAND_VERSION}/wayland-${WAYLAND_VERSION}.tar.gz"
mkdir ~/HyprSource/wayland &&
tar -xzf wayland.tar.gz -C ~/HyprSource/wayland --strip-components 1 &&
rm wayland.tar.gz
# wayland-protocols
wget -O wayland-protocols.tar.gz "https://gitlab.freedesktop.org/wayland/wayland-protocols/-/archive/${WAYLAND_PROTOCOLS_VERSION}/wayland-protocols-${WAYLAND_PROTOCOLS_VERSION}.tar.gz"
mkdir ~/HyprSource/wayland-protocols &&
tar -xzf wayland-protocols.tar.gz -C ~/HyprSource/wayland-protocols --strip-components 1 &&
rm wayland-protocols.tar.gz
# libdisplay-info
wget -O libdisplay-info.tar.gz "https://gitlab.freedesktop.org/emersion/libdisplay-info/-/archive/${LIBDISPLAY_INFO_VERSION}/libdisplay-info-${LIBDISPLAY_INFO_VERSION}.tar.gz"
mkdir ~/HyprSource/libdisplay-info &&
tar -xzf libdisplay-info.tar.gz -C ~/HyprSource/libdisplay-info --strip-components 1 &&
rm libdisplay-info.tar.gz
# tomlplusplus
wget -O tomlplusplus.tar.gz "https://github.com/marzer/tomlplusplus/archive/refs/tags/v${TOMLPLUSPLUS_VERSION}.tar.gz"
mkdir ~/HyprSource/tomlplusplus &&
tar -xzf tomlplusplus.tar.gz -C ~/HyprSource/tomlplusplus --strip-components 1 &&
rm tomlplusplus.tar.gz
# libdrm
wget -O libdrm.tar.gz "https://gitlab.freedesktop.org/mesa/drm/-/archive/main/drm-main.tar.gz"
mkdir ~/HyprSource/libdrm &&
tar -xzf libdrm.tar.gz -C ~/HyprSource/libdrm --strip-components 1 &&
rm libdrm.tar.gz
if [ "${UBUNTU_VERSION}" = "${OLD_UBUNTU_VERSION}" ]; then
# pixman
wget -O pixman.tar.gz "https://cairographics.org/releases/pixman-${PIXMAN_VERSION}.tar.gz"
mkdir ~/HyprSource/pixman &&
tar -xzf pixman.tar.gz -C ~/HyprSource/pixman --strip-components 1 &&
rm pixman.tar.gz
# xcb-proto
wget -O xcb-proto.tar.gz "https://xcb.freedesktop.org/dist/xcb-proto-${XCBPROTO_VERSION}.tar.gz"
mkdir ~/HyprSource/xcb-proto &&
tar -xzf xcb-proto.tar.gz -C ~/HyprSource/xcb-proto --strip-components 1 &&
rm xcb-proto.tar.gz
# libxcb
wget -O libxcb.tar.gz "https://xcb.freedesktop.org/dist/libxcb-${LIBXCB_VERSION}.tar.gz"
mkdir ~/HyprSource/libxcb &&
tar -xzf libxcb.tar.gz -C ~/HyprSource/libxcb --strip-components 1 &&
rm libxcb.tar.gz
fi
## Build dependencies
# wayland
cd ~/HyprSource/wayland
mkdir ./build &&
cd ./build &&
meson setup .. \
--prefix=/usr \
--buildtype=release \
-Ddocumentation=false &&
ninja
sudo ninja install
# wayland-protocols
cd ~/HyprSource/wayland-protocols
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
# libdisplay-info
cd ~/HyprSource/libdisplay-info
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
# tomlplusplus
cd ~/HyprSource/tomlplusplus
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
# libdrm
cd ~/HyprSource/libdrm
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
# hyprlang
cd ~/HyprSource/hyprlang
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target hyprlang -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
sudo cmake --install ./build
# hyprcursor
cd ~/HyprSource/hyprcursor
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
sudo cmake --install ./build
if [ "${UBUNTU_VERSION}" = "${OLD_UBUNTU_VERSION}" ]; then
# pixman
cd ~/HyprSource/pixman
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
# xcb-proto
cd ~/HyprSource/xcb-proto
./autogen.sh
./configure &&
make
sudo make install
# libxcb
cd ~/HyprSource/libxcb
./autogen.sh
./configure &&
make
sudo make install
fi
# hyprland
cd ~/HyprSource/hyprland
sed -i 's/\/usr\/local/\/usr/g' Makefile
mkdir ./build &&
cd ./build &&
meson setup --prefix=/usr --buildtype=release &&
ninja
sudo ninja install
## back to home directory
cd ~
echo "NOW YOU HAVE HYPRLAND INSTALLED!!!"
@ashyAU
Copy link

ashyAU commented Apr 13, 2024

Same issues with gcc-13, unsure what the heck is going on

@katabame
Copy link
Author

maybe we should specify gcc version by like this
https://stackoverflow.com/questions/17275348/how-to-specify-new-gcc-path-for-cmake

I gonna try reproduce the issue on Ubuntu 22.04 VM when I've time

@zstoimchev
Copy link

zstoimchev commented Apr 13, 2024 via email

@stevenhsimon
Copy link

stevenhsimon commented Apr 18, 2024

I tried to install this on 22.04. I got quite a way in but eventually failed anyway. Here are some things I needed to do. install gcc-13 and gcc-+13 and put into the build.sh script

export CC=/usr/bin/gcc-13
export CXX=/usr/bin/g++-13

up at the top so the compiler uses gcc-13. Then it needed a more modern version of pixman. You can get that from here

https://launchpad.net/ubuntu/+source/pixman/0.42.2-1build1

You have to build and install from source. Then I needed to use a more modern meson and ninja. To do this apt remove them and reinstall them with pip3 install. Also near the top of the build.sh file you need to remove the line that reinstalls meson and ninja otherwise it will automatically reintroduce them with apt and not use the pip3 version.

Doing all of this it gets pretty far into the compilation before eventually failing and I've not figured out what to do next!

@katabame
Copy link
Author

@stevenhsimon thanks for your report. I updated the gist to follow instructions that you reported.
I also did the instructions on my Ubuntu 22.04 VM (using desktop iso for terminal emulator purpose)

image

this error seems related to this issue hyprwm/Hyprland#2932

according to comments in the issue, seems this can be solved by building libxcb ourself.
as you can see in the updated gist, I tried it but still having same error there.

I ended up the research for now, but someone else can be found the solution to solve this I hope...

@katabame
Copy link
Author

katabame commented May 5, 2024

There's Ubuntu noble available. also Hyprland is updated to v0.40.0 from v0.39.x
these means both of Ubuntu and Hyprland got major update.
I'm currently focusing build and run Hyprland v0.40.0 on Ubuntu noble. and since Ubuntu noble is LTS version I discontinue investigating for Ubuntu jammy.

@katabame
Copy link
Author

Maintaing gist file is kinda hard way, so I moved this project to katabame/Ubuntu-Hyprland repository.
future updates are only available at the repository.
and any issue or improvements are should be go to the repository's issue or pullrequest.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment