mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-11-22 11:32:17 +03:00
makefile: add asan
This commit is contained in:
parent
f590505daf
commit
4937352761
21
Makefile
21
Makefile
@ -106,3 +106,24 @@ man:
|
||||
--variable=section:1 \
|
||||
--from rst \
|
||||
--to man > ./docs/hyprctl.1
|
||||
|
||||
asan:
|
||||
@echo -en "!!WARNING!!\nOnly run this in the TTY.\n"
|
||||
@pidof Hyprland > /dev/null && echo -ne "Refusing to run with Hyprland running.\n" || echo ""
|
||||
@pidof Hyprland > /dev/null && exit 1 || echo ""
|
||||
|
||||
rm -rf ./wayland
|
||||
git reset --hard
|
||||
|
||||
git clone --recursive https://gitlab.freedesktop.org/wayland/wayland
|
||||
cd wayland && patch -p1 < ../scripts/waylandStatic.diff && meson setup build --buildtype=debug -Db_sanitize=address -Ddocumentation=false && ninja -C build && cd ..
|
||||
cp ./wayland/build/src/libwayland-server.a .
|
||||
@echo "Wayland done"
|
||||
|
||||
patch -p1 < ./scripts/hyprlandStaticAsan.diff
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
@echo "Hyprland done"
|
||||
|
||||
ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland
|
||||
|
||||
|
21
scripts/hyprlandStaticAsan.diff
Normal file
21
scripts/hyprlandStaticAsan.diff
Normal file
@ -0,0 +1,21 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 857e21de..122d6a78 100755
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -101,7 +101,7 @@ message(STATUS "Checking deps...")
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(PkgConfig REQUIRED)
|
||||
find_package(OpenGL REQUIRED)
|
||||
-pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo libdrm xkbcommon libinput pango pangocairo pixman-1 hyprlang>=0.3.2) # we do not check for wlroots, as we provide it ourselves
|
||||
+pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-cursor wayland-protocols cairo libdrm xkbcommon libinput pango pangocairo pixman-1 hyprlang>=0.3.2 libffi) # we do not check for wlroots, as we provide it ourselves
|
||||
|
||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
|
||||
@@ -121,6 +121,7 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
message(STATUS "Enabling ASan")
|
||||
|
||||
target_link_libraries(Hyprland asan)
|
||||
+ target_link_libraries(Hyprland ${CMAKE_SOURCE_DIR}/libwayland-server.a)
|
||||
target_compile_options(Hyprland PUBLIC -fsanitize=address)
|
||||
endif()
|
||||
|
23
scripts/waylandStatic.diff
Normal file
23
scripts/waylandStatic.diff
Normal file
@ -0,0 +1,23 @@
|
||||
diff --git a/src/meson.build b/src/meson.build
|
||||
index 5d04334..6645eec 100644
|
||||
--- a/src/meson.build
|
||||
+++ b/src/meson.build
|
||||
@@ -170,7 +170,7 @@ if get_option('libraries')
|
||||
error('We probably need to bump the SONAME of libwayland-server and -client')
|
||||
endif
|
||||
|
||||
- wayland_server = library(
|
||||
+ wayland_server = static_library(
|
||||
'wayland-server',
|
||||
sources: [
|
||||
wayland_server_protocol_core_h,
|
||||
@@ -180,9 +180,6 @@ if get_option('libraries')
|
||||
'wayland-shm.c',
|
||||
'event-loop.c'
|
||||
],
|
||||
- # To avoid an unnecessary SONAME bump, wayland 1.x.y produces
|
||||
- # libwayland-server.so.0.x.y.
|
||||
- version: '.'.join(['0', wayland_version[1], wayland_version[2]]),
|
||||
dependencies: [
|
||||
epoll_dep,
|
||||
ffi_dep,
|
Loading…
Reference in New Issue
Block a user