2022-01-30 22:24:20 +00:00
|
|
|
#!/bin/sh -e
|
|
|
|
|
2023-07-17 20:27:14 +00:00
|
|
|
script_dir=$(dirname "$0")
|
|
|
|
cd "$script_dir"
|
|
|
|
|
2023-06-04 11:49:47 +00:00
|
|
|
CC=${CC:-gcc}
|
|
|
|
CXX=${CXX:-g++}
|
|
|
|
|
|
|
|
opts="-O2 -g0 -DNDEBUG -Wall -Wextra"
|
2023-05-17 17:30:30 +00:00
|
|
|
[ -n "$DEBUG" ] && opts="-O0 -g3 -Wall -Wextra";
|
2023-05-17 16:49:16 +00:00
|
|
|
|
2023-07-21 00:49:02 +00:00
|
|
|
build_wayland_protocol() {
|
|
|
|
wayland-scanner private-code external/wlr-export-dmabuf-unstable-v1.xml external/wlr-export-dmabuf-unstable-v1-protocol.c
|
|
|
|
wayland-scanner client-header external/wlr-export-dmabuf-unstable-v1.xml external/wlr-export-dmabuf-unstable-v1-client-protocol.h
|
|
|
|
}
|
2023-07-17 20:27:14 +00:00
|
|
|
|
2023-04-07 03:31:46 +00:00
|
|
|
build_gsr_kms_server() {
|
2023-07-10 00:06:44 +00:00
|
|
|
# TODO: -fcf-protection=full, not supported on arm
|
|
|
|
extra_opts="-fstack-protector-all"
|
2023-04-07 03:31:46 +00:00
|
|
|
dependencies="libdrm"
|
|
|
|
includes="$(pkg-config --cflags $dependencies)"
|
|
|
|
libs="$(pkg-config --libs $dependencies) -ldl"
|
2023-06-19 22:26:28 +00:00
|
|
|
$CC -c kms/server/kms_server.c $opts $extra_opts $includes
|
2023-07-18 01:32:36 +00:00
|
|
|
$CC -o gsr-kms-server kms_server.o $libs $opts $extra_opts
|
2023-04-07 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
build_gsr() {
|
2023-07-17 20:27:14 +00:00
|
|
|
dependencies="libavcodec libavformat libavutil x11 xcomposite xrandr xfixes libpulse libswresample libavfilter libva libcap libdrm wayland-egl wayland-client"
|
2023-04-07 03:31:46 +00:00
|
|
|
includes="$(pkg-config --cflags $dependencies)"
|
|
|
|
libs="$(pkg-config --libs $dependencies) -ldl -pthread -lm"
|
2023-06-04 11:49:47 +00:00
|
|
|
$CC -c src/capture/capture.c $opts $includes
|
|
|
|
$CC -c src/capture/nvfbc.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
|
2023-07-17 20:27:14 +00:00
|
|
|
$CC -c src/capture/kms_cuda.c $opts $includes
|
2023-06-04 11:49:47 +00:00
|
|
|
$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/cursor.c $opts $includes
|
|
|
|
$CC -c src/utils.c $opts $includes
|
|
|
|
$CC -c src/library_loader.c $opts $includes
|
2023-07-21 00:49:02 +00:00
|
|
|
$CC -c external/wlr-export-dmabuf-unstable-v1-protocol.c $opts $includes
|
2023-06-04 11:49:47 +00:00
|
|
|
$CXX -c src/sound.cpp $opts $includes
|
|
|
|
$CXX -c src/main.cpp $opts $includes
|
2023-07-18 01:32:36 +00:00
|
|
|
$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 \
|
2023-07-21 00:49:02 +00:00
|
|
|
color_conversion.o cursor.o utils.o library_loader.o xcomposite_cuda.o xcomposite_vaapi.o kms_vaapi.o kms_cuda.o wlr-export-dmabuf-unstable-v1-protocol.o sound.o main.o $libs $opts
|
2023-04-07 03:31:46 +00:00
|
|
|
}
|
|
|
|
|
2023-07-21 00:49:02 +00:00
|
|
|
build_wayland_protocol
|
2023-04-07 03:31:46 +00:00
|
|
|
build_gsr_kms_server
|
|
|
|
build_gsr
|
2023-07-18 01:21:16 +00:00
|
|
|
echo "Successfully built gpu-screen-recorder"
|