diff --git a/build.sh b/build.sh index 27e4268..51bb745 100755 --- a/build.sh +++ b/build.sh @@ -1,39 +1,42 @@ #!/bin/sh -e -opts="-O2 -g0 -DNDEBUG -Wall -Wextra -s" +CC=${CC:-gcc} +CXX=${CXX:-g++} + +opts="-O2 -g0 -DNDEBUG -Wall -Wextra" [ -n "$DEBUG" ] && opts="-O0 -g3 -Wall -Wextra"; build_gsr_kms_server() { dependencies="libdrm" includes="$(pkg-config --cflags $dependencies)" libs="$(pkg-config --libs $dependencies) -ldl" - gcc -c kms/server/kms_server.c $opts $includes - gcc -o gsr-kms-server -O2 kms_server.o $libs $opts + $CC -c kms/server/kms_server.c $opts $includes + $CC -o gsr-kms-server -O2 kms_server.o $libs $opts } build_gsr() { dependencies="libavcodec libavformat libavutil x11 xcomposite xrandr xfixes libpulse libswresample libavfilter libva libcap" includes="$(pkg-config --cflags $dependencies)" libs="$(pkg-config --libs $dependencies) -ldl -pthread -lm" - gcc -c src/capture/capture.c $opts $includes - gcc -c src/capture/nvfbc.c $opts $includes - gcc -c src/capture/xcomposite_cuda.c $opts $includes - gcc -c src/capture/xcomposite_vaapi.c $opts $includes - gcc -c src/capture/kms_vaapi.c $opts $includes - gcc -c kms/client/kms_client.c $opts $includes - gcc -c src/egl.c $opts $includes - gcc -c src/cuda.c $opts $includes - gcc -c src/xnvctrl.c $opts $includes - gcc -c src/overclock.c $opts $includes - gcc -c src/window_texture.c $opts $includes - gcc -c src/shader.c $opts $includes - gcc -c src/color_conversion.c $opts $includes - gcc -c src/cursor.c $opts $includes - gcc -c src/utils.c $opts $includes - gcc -c src/library_loader.c $opts $includes - g++ -c src/sound.cpp $opts $includes - g++ -c src/main.cpp $opts $includes - g++ -o gpu-screen-recorder -O2 capture.o nvfbc.o kms_client.o egl.o cuda.o xnvctrl.o overclock.o window_texture.o shader.o color_conversion.o cursor.o utils.o library_loader.o xcomposite_cuda.o xcomposite_vaapi.o kms_vaapi.o sound.o main.o $libs $opts + $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 + $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 + $CXX -c src/sound.cpp $opts $includes + $CXX -c src/main.cpp $opts $includes + $CXX -o gpu-screen-recorder -O2 capture.o nvfbc.o kms_client.o egl.o cuda.o xnvctrl.o overclock.o window_texture.o shader.o color_conversion.o cursor.o utils.o library_loader.o xcomposite_cuda.o xcomposite_vaapi.o kms_vaapi.o sound.o main.o $libs $opts } build_gsr_kms_server diff --git a/install.sh b/install.sh index f898534..563a3b6 100755 --- a/install.sh +++ b/install.sh @@ -6,6 +6,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 rm -f "/usr/local/bin/gpu-screen-recorder" install -Dm755 "gsr-kms-server" "/usr/bin/gsr-kms-server" install -Dm755 "gpu-screen-recorder" "/usr/bin/gpu-screen-recorder" diff --git a/src/main.cpp b/src/main.cpp index f24a3f0..9515d8d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -732,20 +732,26 @@ static bool is_hex_num(char c) { } static bool contains_non_hex_number(const char *str) { + bool hex_start = false; size_t len = strlen(str); if(len >= 2 && memcmp(str, "0x", 2) == 0) { str += 2; len -= 2; + hex_start = true; } + bool is_hex = false; for(size_t i = 0; i < len; ++i) { char c = str[i]; if(c == '\0') return false; if(!is_hex_num(c)) return true; + if((c >= 'A' && c <= 'F') || (c >= 'a' && c <= 'f')) + is_hex = true; } - return false; + + return is_hex && !hex_start; } static std::string get_date_str() {