From f1cc116af11d5f334609330dac6d3d22fa6ecee9 Mon Sep 17 00:00:00 2001 From: dec05eba Date: Tue, 11 Jun 2024 21:22:51 +0200 Subject: Convert build script to meson --- .gitignore | 1 + build.sh | 23 ----------------------- install.sh | 27 +++++---------------------- meson.build | 44 ++++++++++++++++++++++++++++++++++++++++++++ project.conf | 5 +++-- uninstall.sh | 32 ++++++-------------------------- 6 files changed, 59 insertions(+), 73 deletions(-) delete mode 100755 build.sh create mode 100644 meson.build diff --git a/.gitignore b/.gitignore index a881718..84dfc71 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,5 @@ external/wlr-export-dmabuf-unstable-v1-protocol.c *.o .clangd/ +build/ gpu-screen-recorder-gtk diff --git a/build.sh b/build.sh deleted file mode 100755 index c2edd5e..0000000 --- a/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -e - -script_dir=$(dirname "$0") -cd "$script_dir" - -CC=${CC:-gcc} -CXX=${CXX:-g++} - -opts="-O2 -g0 -DNDEBUG -Wall -Wextra -Werror" -[ -n "$DEBUG" ] && opts="-O0 -g3 -Wall -Wextra -Werror"; - -build_gsr_gtk() { - dependencies="gtk+-3.0 x11 xrandr libpulse libdrm wayland-egl wayland-client ayatana-appindicator3-0.1" - includes="$(pkg-config --cflags $dependencies)" - libs="$(pkg-config --libs $dependencies) -ldl" - $CC -c src/egl.c $opts $includes - $CC -c src/library_loader.c $opts $includes - $CXX -c src/main.cpp $opts $includes - $CXX -o gpu-screen-recorder-gtk egl.o library_loader.o main.o $libs $opts -} - -build_gsr_gtk -echo "Successfully built gpu-screen-recorder-gtk" diff --git a/install.sh b/install.sh index bc7f0d6..78e45b8 100755 --- a/install.sh +++ b/install.sh @@ -5,27 +5,10 @@ cd "$script_dir" [ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1 -./build.sh -strip gpu-screen-recorder-gtk +echo "Warning: this install.sh script is deprecated. Use meson directly instead if possible" -install -Dm755 "gpu-screen-recorder-gtk" "/usr/bin/gpu-screen-recorder-gtk" +test -d build || meson setup build +meson configure --prefix=/usr --buildtype=release -Dstrip=true build +ninja -C build install -install -Dm644 "gpu-screen-recorder-gtk.desktop" "/usr/share/applications/com.dec05eba.gpu_screen_recorder.desktop" -install -Dm644 com.dec05eba.gpu_screen_recorder.appdata.xml "/usr/share/metainfo/com.dec05eba.gpu_screen_recorder.appdata.xml" - -install -Dm644 "icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -install -Dm644 "icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -install -Dm644 "icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -install -Dm644 "icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png" "/usr/share/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png" - -install -Dm644 "icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -install -Dm644 "icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -install -Dm644 "icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -install -Dm644 "icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.png" "/usr/share/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.png" - -install -Dm644 "icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -install -Dm644 "icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -install -Dm644 "icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -install -Dm644 "icons/hicolor/128x128/apps/com.dec05eba.gpu_screen_recorder.png" "/usr/share/icons/hicolor/128x128/apps/com.dec05eba.gpu_screen_recorder.png" - -echo "Successfully installed gpu-screen-recorder-gtk" \ No newline at end of file +echo "Successfully installed gpu-screen-recorder-gtk" diff --git a/meson.build b/meson.build new file mode 100644 index 0000000..2a84f30 --- /dev/null +++ b/meson.build @@ -0,0 +1,44 @@ +project('gpu-screen-recorder-gtk', ['c', 'cpp'], version : '3.8.0', default_options : ['warning_level=2']) + +add_project_arguments('-Wshadow', language : ['c', 'cpp']) +if get_option('buildtype') == 'debug' + add_project_arguments('-g3', language : ['c', 'cpp']) +elif get_option('buildtype') == 'release' + add_project_arguments('-DNDEBUG', language : ['c', 'cpp']) +endif + +src = [ + 'src/egl.c', + 'src/library_loader.c', + 'src/main.cpp', +] +dep = [ + dependency('gtk+-3.0'), + dependency('x11'), + dependency('xrandr'), + dependency('libpulse'), + dependency('libdrm'), + dependency('wayland-egl'), + dependency('wayland-client'), + dependency('ayatana-appindicator3-0.1'), +] + +executable('gpu-screen-recorder-gtk', src, dependencies : dep, install : true) + +install_data('gpu-screen-recorder-gtk.desktop', install_dir : '/usr/share/applications') +install_data('com.dec05eba.gpu_screen_recorder.appdata.xml', install_dir : '/usr/share/metainfo') + +install_data('icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-idle.png', install_dir : '/usr/share/icons/hicolor/32x32/status') +install_data('icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-recording.png', install_dir : '/usr/share/icons/hicolor/32x32/status') +install_data('icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-paused.png', install_dir : '/usr/share/icons/hicolor/32x32/status') +install_data('icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png', install_dir : '/usr/share/icons/hicolor/32x32/apps') + +install_data('icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-idle.png', install_dir : '/usr/share/icons/hicolor/64x64/status') +install_data('icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-recording.png', install_dir : '/usr/share/icons/hicolor/64x64/status') +install_data('icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-paused.png', install_dir : '/usr/share/icons/hicolor/64x64/status') +install_data('icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.png', install_dir : '/usr/share/icons/hicolor/64x64/apps') + +install_data('icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-idle.png', install_dir : '/usr/share/icons/hicolor/128x128/status') +install_data('icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-recording.png', install_dir : '/usr/share/icons/hicolor/128x128/status') +install_data('icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-paused.png', install_dir : '/usr/share/icons/hicolor/128x128/status') +install_data('icons/hicolor/128x128/apps/com.dec05eba.gpu_screen_recorder.png', install_dir : '/usr/share/icons/hicolor/128x128/apps') diff --git a/project.conf b/project.conf index 71e7d98..164cf6b 100644 --- a/project.conf +++ b/project.conf @@ -1,10 +1,11 @@ [package] name = "gpu-screen-recorder-gtk" type = "executable" -version = "3.0.0" +version = "3.8.0" platforms = ["posix"] [config] +ignore_dirs = ["build"] error_on_warning = "true" [dependencies] @@ -15,4 +16,4 @@ libpulse = ">=13" libdrm = ">=2" wayland-egl = ">=15" wayland-client = ">=1" -ayatana-appindicator3-0.1 = ">=0" \ No newline at end of file +ayatana-appindicator3-0.1 = ">=0" diff --git a/uninstall.sh b/uninstall.sh index 8e4d137..093002b 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,30 +1,10 @@ -#!/bin/sh +#!/bin/sh -e -[ $(id -u) -ne 0 ] && echo "You need root privileges to run the uninstall script" && exit 1 - -rm -f "/usr/bin/gpu-screen-recorder-gtk" -rm -f "/usr/share/applications/com.dec05eba.gpu_screen_recorder.desktop" -rm -f "/usr/share/metainfo/com.dec05eba.gpu_screen_recorder.appdata.xml" - -rm -f "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -rm -f "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -rm -f "/usr/share/icons/hicolor/32x32/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -rm -f "/usr/share/icons/hicolor/32x32/apps/com.dec05eba.gpu_screen_recorder.png" +script_dir=$(dirname "$0") +cd "$script_dir" -rm -f "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -rm -f "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -rm -f "/usr/share/icons/hicolor/64x64/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -rm -f "/usr/share/icons/hicolor/64x64/apps/com.dec05eba.gpu_screen_recorder.png" - -rm -f "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-idle.png" -rm -f "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-recording.png" -rm -f "/usr/share/icons/hicolor/128x128/status/com.dec05eba.gpu_screen_recorder.tray-paused.png" -rm -f "/usr/share/icons/hicolor/128x128/apps/com.dec05eba.gpu_screen_recorder.png" - -rm -f "/usr/share/com.dec05eba.gpu_screen_recorder/tray-idle.png" -rm -f "/usr/share/com.dec05eba.gpu_screen_recorder/tray-recording.png" -rm -f "/usr/share/com.dec05eba.gpu_screen_recorder/tray-paused.png" +[ $(id -u) -ne 0 ] && echo "You need root privileges to run the uninstall script" && exit 1 -rm -rf "/usr/share/com.dec05eba.gpu_screen_recorder" +ninja -C build uninstall -echo "Successfully uninstalled gpu-screen-recorder-gtk" \ No newline at end of file +echo "Successfully uninstalled gpu-screen-recorder-gtk" -- cgit v1.2.3