mirror of
https://repo.dec05eba.com/gpu-screen-recorder
synced 2026-01-31 01:13:06 +09:00
Migrate to Meson build system
This commit is contained in:
53
build.sh
53
build.sh
@@ -1,53 +0,0 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
script_dir=$(dirname "$0")
|
||||
cd "$script_dir"
|
||||
|
||||
CC=${CC:-gcc}
|
||||
CXX=${CXX:-g++}
|
||||
|
||||
opts="-O2 -g0 -DNDEBUG -Wall -Wextra -Wshadow"
|
||||
[ -n "$DEBUG" ] && opts="-O0 -g3 -Wall -Wextra -Wshadow";
|
||||
|
||||
build_gsr_kms_server() {
|
||||
# TODO: -fcf-protection=full, not supported on arm
|
||||
extra_opts="-fstack-protector-all"
|
||||
dependencies="libdrm"
|
||||
includes="$(pkg-config --cflags $dependencies)"
|
||||
libs="$(pkg-config --libs $dependencies) -ldl"
|
||||
$CC -c kms/server/kms_server.c $opts $extra_opts $includes
|
||||
$CC -o gsr-kms-server kms_server.o $libs $opts $extra_opts
|
||||
}
|
||||
|
||||
build_gsr() {
|
||||
dependencies="libavcodec libavformat libavutil x11 xcomposite xrandr xfixes libpulse libswresample libavfilter libva libcap libdrm wayland-egl wayland-client"
|
||||
includes="$(pkg-config --cflags $dependencies)"
|
||||
libs="$(pkg-config --libs $dependencies) -ldl -pthread -lm"
|
||||
$CC -c src/capture/capture.c $opts $includes
|
||||
$CC -c src/capture/nvfbc.c $opts $includes
|
||||
$CC -c src/capture/xcomposite.c $opts $includes
|
||||
$CC -c src/capture/xcomposite_cuda.c $opts $includes
|
||||
$CC -c src/capture/xcomposite_vaapi.c $opts $includes
|
||||
$CC -c src/capture/kms_vaapi.c $opts $includes
|
||||
$CC -c src/capture/kms_cuda.c $opts $includes
|
||||
$CC -c src/capture/kms.c $opts $includes
|
||||
$CC -c kms/client/kms_client.c $opts $includes
|
||||
$CC -c src/egl.c $opts $includes
|
||||
$CC -c src/cuda.c $opts $includes
|
||||
$CC -c src/xnvctrl.c $opts $includes
|
||||
$CC -c src/overclock.c $opts $includes
|
||||
$CC -c src/window_texture.c $opts $includes
|
||||
$CC -c src/shader.c $opts $includes
|
||||
$CC -c src/color_conversion.c $opts $includes
|
||||
$CC -c src/utils.c $opts $includes
|
||||
$CC -c src/library_loader.c $opts $includes
|
||||
$CC -c src/cursor.c $opts $includes
|
||||
$CXX -c src/sound.cpp $opts $includes
|
||||
$CXX -c src/main.cpp $opts $includes
|
||||
$CXX -o gpu-screen-recorder capture.o nvfbc.o kms_client.o egl.o cuda.o xnvctrl.o overclock.o window_texture.o shader.o \
|
||||
color_conversion.o utils.o library_loader.o cursor.o xcomposite.o xcomposite_cuda.o xcomposite_vaapi.o kms_vaapi.o kms_cuda.o kms.o sound.o main.o $libs $opts
|
||||
}
|
||||
|
||||
build_gsr_kms_server
|
||||
build_gsr
|
||||
echo "Successfully built gpu-screen-recorder"
|
||||
@@ -5,16 +5,8 @@ cd "$script_dir"
|
||||
|
||||
[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1
|
||||
|
||||
DEBUG=1 ./build.sh
|
||||
|
||||
install -Dm755 "gsr-kms-server" "/usr/bin/gsr-kms-server"
|
||||
install -Dm755 "gpu-screen-recorder" "/usr/bin/gpu-screen-recorder"
|
||||
if [ -d "/usr/lib/systemd/user" ]; then
|
||||
install -Dm644 "extra/gpu-screen-recorder.service" "/usr/lib/systemd/user/gpu-screen-recorder.service"
|
||||
fi
|
||||
# Not necessary, but removes the password prompt when trying to record a monitor on amd/intel or nvidia wayland
|
||||
setcap cap_sys_admin+ep /usr/bin/gsr-kms-server
|
||||
# Not necessary, but allows use of EGL_CONTEXT_PRIORITY_LEVEL_IMG which allows gpu screen recorder to run without being limited to game fps under heavy load on AMD/Intel
|
||||
setcap cap_sys_nice+ep /usr/bin/gpu-screen-recorder
|
||||
test -d build || meson setup build
|
||||
meson configure --buildtype=debug build
|
||||
ninja -C build install
|
||||
|
||||
echo "Successfully installed gpu-screen-recorder (debug)"
|
||||
|
||||
5
extra/meson_post_install.sh
Executable file
5
extra/meson_post_install.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
setcap cap_sys_admin+ep ${MESON_INSTALL_DESTDIR_PREFIX}/bin/gsr-kms-server \
|
||||
|| echo "\n!!! Please re-run install as root\n"
|
||||
setcap cap_sys_nice+ep ${MESON_INSTALL_DESTDIR_PREFIX}/bin/gpu-screen-recorder
|
||||
16
install.sh
16
install.sh
@@ -5,18 +5,8 @@ cd "$script_dir"
|
||||
|
||||
[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1
|
||||
|
||||
./build.sh
|
||||
strip gsr-kms-server
|
||||
strip gpu-screen-recorder
|
||||
|
||||
install -Dm755 "gsr-kms-server" "/usr/bin/gsr-kms-server"
|
||||
install -Dm755 "gpu-screen-recorder" "/usr/bin/gpu-screen-recorder"
|
||||
if [ -d "/usr/lib/systemd/user" ]; then
|
||||
install -Dm644 "extra/gpu-screen-recorder.service" "/usr/lib/systemd/user/gpu-screen-recorder.service"
|
||||
fi
|
||||
# Not necessary, but removes the password prompt when trying to record a monitor on amd/intel or nvidia wayland
|
||||
setcap cap_sys_admin+ep /usr/bin/gsr-kms-server
|
||||
# Not necessary, but allows use of EGL_CONTEXT_PRIORITY_LEVEL_IMG which allows gpu screen recorder to run without being limited to game fps under heavy load on AMD/Intel
|
||||
setcap cap_sys_nice+ep /usr/bin/gpu-screen-recorder
|
||||
test -d build || meson setup build
|
||||
meson configure --buildtype=release build
|
||||
ninja -C build install
|
||||
|
||||
echo "Successfully installed gpu-screen-recorder"
|
||||
|
||||
58
meson.build
Normal file
58
meson.build
Normal file
@@ -0,0 +1,58 @@
|
||||
project('gpu-screen-recorder', ['c', 'cpp'])
|
||||
|
||||
add_project_arguments('-Wall', '-Wextra', '-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/capture/capture.c',
|
||||
'src/capture/nvfbc.c',
|
||||
'src/capture/xcomposite.c',
|
||||
'src/capture/xcomposite_cuda.c',
|
||||
'src/capture/xcomposite_vaapi.c',
|
||||
'src/capture/kms_vaapi.c',
|
||||
'src/capture/kms_cuda.c',
|
||||
'src/capture/kms.c',
|
||||
'kms/client/kms_client.c',
|
||||
'src/egl.c',
|
||||
'src/cuda.c',
|
||||
'src/xnvctrl.c',
|
||||
'src/overclock.c',
|
||||
'src/window_texture.c',
|
||||
'src/shader.c',
|
||||
'src/color_conversion.c',
|
||||
'src/utils.c',
|
||||
'src/library_loader.c',
|
||||
'src/cursor.c',
|
||||
'src/sound.cpp',
|
||||
'src/main.cpp',
|
||||
]
|
||||
dep = [
|
||||
dependency('libavcodec'),
|
||||
dependency('libavformat'),
|
||||
dependency('libavutil'),
|
||||
dependency('x11'),
|
||||
dependency('xcomposite'),
|
||||
dependency('xrandr'),
|
||||
dependency('xfixes'),
|
||||
dependency('libpulse'),
|
||||
dependency('libswresample'),
|
||||
dependency('libavfilter'),
|
||||
dependency('libva'),
|
||||
dependency('libcap'),
|
||||
dependency('libdrm'),
|
||||
dependency('wayland-egl'),
|
||||
dependency('wayland-client'),
|
||||
]
|
||||
|
||||
executable('gsr-kms-server', 'kms/server/kms_server.c', dependencies : dependency('libdrm'), c_args : '-fstack-protector-all', install : true)
|
||||
executable('gpu-screen-recorder', src, dependencies : dep, install : true)
|
||||
|
||||
if get_option('systemd') == true
|
||||
install_data(files('extra/gpu-screen-recorder.service'), install_dir : '/usr/lib/systemd/user')
|
||||
endif
|
||||
|
||||
meson.add_install_script('extra/meson_post_install.sh')
|
||||
1
meson_options.txt
Normal file
1
meson_options.txt
Normal file
@@ -0,0 +1 @@
|
||||
option('systemd', type : 'boolean', value : false, description : 'Install systemd service file')
|
||||
11
uninstall.sh
11
uninstall.sh
@@ -1,9 +1,10 @@
|
||||
#!/bin/sh
|
||||
#!/bin/sh -e
|
||||
|
||||
script_dir=$(dirname "$0")
|
||||
cd "$script_dir"
|
||||
|
||||
[ $(id -u) -ne 0 ] && echo "You need root privileges to run the uninstall script" && exit 1
|
||||
|
||||
rm -f "/usr/bin/gsr-kms-server"
|
||||
rm -f "/usr/bin/gpu-screen-recorder"
|
||||
rm -f "/usr/lib/systemd/user/gpu-screen-recorder.service"
|
||||
ninja -C build uninstall
|
||||
|
||||
echo "Successfully uninstalled gpu-screen-recorder"
|
||||
echo "Successfully uninstalled gpu-screen-recorder"
|
||||
|
||||
Reference in New Issue
Block a user