Skip to content

Instantly share code, notes, and snippets.

View fredmorcos's full-sized avatar

Fred Morcos fredmorcos

View GitHub Profile
@fredmorcos
fredmorcos / SDL2-rbp
Last active April 29, 2017 13:32
Building and running an SDL2 X-less graphics program on ArchlinuxARM on the Raspberry Pi
It took me a while to figure out how to get SDL_CreateWindow not to fail on ArchlinuxARM on the Raspberry Pi. So I'm documenting what I did here. It's mostly build flags, for SDL2 and for your program.
First of all, SDL2 on ArchlinuxARM doesn't build the Raspberry Pi and EGL backends. So here's the PKGBUILD for that: https://gist.github.com/fredmorcos/9866f5b318435a90c4f9
It essentially disables all the X and Wayland stuff and enables the EGL backend.
Now, here's a Makefile for building your program: https://gist.github.com/fredmorcos/0728031217533079cc90
@fredmorcos
fredmorcos / Makefile
Last active August 29, 2015 14:05
Makefile for building an X-less SDL2 program on the Raspberry Pi
CFLAGS += -Wall -Wextra -pedantic -std=c11 -g `sdl2-config --cflags`
LDFLAGS += `sdl2-config --libs`
.PHONY: clean run
%.o: %.c
$(CC) -I/opt/vc/include $(CFLAGS) -c $< -o $@
prog: main.o
$(CC) -L/opt/vc/lib $(LDFLAGS) $^ -o $@
@fredmorcos
fredmorcos / PKGBUILD
Created August 15, 2014 14:25
SDL2 Archlinux PKGBUILD for the Raspberry Pi
# Maintainer: Sven-Hendrik Haase <[email protected]>
# Modified by Fred Morcos <[email protected]> for the Raspberry Pi
pkgname=sdl2
pkgver=2.0.3
pkgrel=1
pkgdesc="A library for portable low-level access to a video framebuffer, audio output, mouse, and keyboard (Version 2)"
arch=('i686' 'x86_64' 'armv6h')
url="http://www.libsdl.org"
license=('MIT')
depends=('glibc' 'libxext' 'libxrender' 'libx11' 'libgl' 'libxcursor')