Skip to content

Commit

Permalink
add cursor disable preloaded tool
Browse files Browse the repository at this point in the history
Also clean up build to remove never-to-be-seen-again ARMs.
  • Loading branch information
krokodilerian committed May 19, 2024
1 parent 1aa3a00 commit 94ced31
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 24 deletions.
27 changes: 5 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,11 @@ jobs:

steps:
- run: apt-get update
- run: apt-get -y install build-essential git openssh-client musl-dev musl-tools crossbuild-essential-armhf crossbuild-essential-arm64
- run: apt-get -y install build-essential git openssh-client musl-dev musl-tools libsdl2-dev
- checkout
- run: mkdir -v -p build/amd64 build/armhf build/arm64
- run: mkdir -v -p build/amd64
- run: make
- run: mv -v sproxy usb_reset wait_next_second build/amd64/
- run: CC=arm-linux-gnueabihf-gcc make
- run: mv -v sproxy usb_reset wait_next_second build/armhf/
- run: CC=aarch64-linux-gnu-gcc make
- run: mv -v sproxy usb_reset wait_next_second build/arm64/
- run: mv -v sproxy usb_reset wait_next_second cursor_disable.so build/amd64/
- persist_to_workspace:
root: .
paths:
Expand All @@ -49,18 +45,7 @@ jobs:
build/amd64/sproxy=/usr/bin/ \
build/amd64/usb_reset=/usr/bin/ \
build/amd64/wait_next_second=/usr/bin/ \
README.md=/usr/share/doc/sproxy/
- run: >
fpm -n sproxy -s dir -t deb -a armhf -v ${CIRCLE_TAG#v} -p release \
build/armhf/sproxy=/usr/bin/ \
build/armhf/usb_reset=/usr/bin/ \
build/armhf/wait_next_second=/usr/bin/ \
README.md=/usr/share/doc/sproxy/
- run: >
fpm -n sproxy -s dir -t deb -a arm64 -v ${CIRCLE_TAG#v} -p release \
build/arm64/sproxy=/usr/bin/ \
build/arm64/usb_reset=/usr/bin/ \
build/arm64/wait_next_second=/usr/bin/ \
build/amd64/cursor_disable.so=/usr/lib/ \
README.md=/usr/share/doc/sproxy/
- run: package_cloud push fosdem/video-team/debian/bookworm release/*deb
- store_artifacts:
Expand All @@ -78,9 +63,7 @@ jobs:
- attach_workspace:
at: .
- run: mkdir -v -p release
- run: fakeroot tar -czvf release/sproxy-${CIRCLE_TAG}.amd64.tar.gz -C build/amd64 sproxy usb_reset wait_next_second
- run: fakeroot tar -czvf release/sproxy-${CIRCLE_TAG}.armhf.tar.gz -C build/armhf sproxy usb_reset wait_next_second
- run: fakeroot tar -czvf release/sproxy-${CIRCLE_TAG}.arm64.tar.gz -C build/arm64 sproxy usb_reset wait_next_second
- run: fakeroot tar -czvf release/sproxy-${CIRCLE_TAG}.amd64.tar.gz -C build/amd64 sproxy usb_reset wait_next_second cursor_disable.so
- run: cd release && sha256sum sproxy-*.tar.gz *deb > sha256sums.txt
- run: >
ghr \
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
sproxy
usb_reset
wait_next_second
*.so
# Build pipline dirs
build
package
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Defaults
CC_OPTS ?= -Wall -O3 -g

TARGETS=sproxy wait_next_second usb_reset
TARGETS=sproxy wait_next_second usb_reset cursor_disable.so

all: $(TARGETS)

Expand All @@ -14,6 +14,9 @@ usb_reset: usb_reset.c
sproxy: sproxy.c config.h
$(CC) $(CC_OPTS) -o $@ sproxy.c

cursor_disable.so: cursor_disable.c
$(CC) -fPIC -shared -o $@ $^ -ldl

install: $(TARGETS)
install $(TARGETS) /usr/local/bin/

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ normal plackages.

# Extras

There are two extra tools in the repository, needed by the FOSDEM video team:
There are three extra tools in the repository, needed by the FOSDEM video team:

* `usb_reset` - reset an USB device by the /dev/bus/usb/BUS/DEV path
* `wait_next_second` - sleep until the next exact second
* `cursor_disable.so` - a .so preloaded before ffmpeg to hide the SDL cursor

# Availability

Expand Down
26 changes: 26 additions & 0 deletions cursor_disable.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <dlfcn.h>
#include <SDL2/SDL_events.h>
#include <SDL2/SDL_video.h>

void SDL_ShowWindow(SDL_Window * window)
{
void *(*original_showwindow)(SDL_Window *);

abort();
original_showwindow = dlsym(RTLD_NEXT, "SDL_ShowWindow");
(*original_showwindow)(window);
SDL_ShowCursor(SDL_DISABLE);
return;

}
void SDL_GL_SwapWindow(SDL_Window * window)
{
void *(*original_swapwindow)(SDL_Window *);

original_swapwindow = dlsym(RTLD_NEXT, "SDL_GL_SwapWindow");
(*original_swapwindow)(window);
SDL_ShowCursor(SDL_DISABLE);
return;

}

0 comments on commit 94ced31

Please sign in to comment.