Add osk-sdl, directfb, sdl2, tslib (#419)

The sdl2 package is forked from upstream Alpine and:
1) adds directfb video support
2) adds a patch to work around a compile issue when directfb is enabled
This commit is contained in:
clayton craft 2017-08-19 09:50:59 -07:00 committed by Oliver Smith
parent 2d6f9befca
commit c1a1f35239
11 changed files with 372 additions and 0 deletions

View File

@ -0,0 +1,11 @@
--- a/lib/direct/os/linux/glibc/system.c
+++ b/lib/direct/os/linux/glibc/system.c
@@ -111,7 +111,7 @@ direct_tgkill( int tgid, int tid, int sig )
void
direct_trap( const char *domain, int sig )
{
- sigval_t val;
+ union sigval val;
if (direct_config->delay_trap_ms) {
D_LOG( Direct_Trap, VERBOSE, "NOT RAISING signal %d from %s, waiting for %dms... attach gdb --pid=%d\n", sig, domain, direct_config->delay_trap_ms, getpid() );

View File

@ -0,0 +1,47 @@
--- a/lib/direct/os/linux/glibc/mutex.h
+++ b/lib/direct/os/linux/glibc/mutex.h
@@ -46,7 +46,6 @@ struct __D_DirectMutex {
/**********************************************************************************************************************/
#define DIRECT_MUTEX_INITIALIZER(name) { PTHREAD_MUTEX_INITIALIZER }
-#define DIRECT_RECURSIVE_MUTEX_INITIALIZER(name) { PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP }
#endif
--- a/lib/direct/trace.c
+++ b/lib/direct/trace.c
@@ -89,7 +89,7 @@ struct __D_DirectTraceBuffer {
/**************************************************************************************************/
static DirectLink *buffers;
-static DirectMutex buffers_lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(buffers_lock);
+static DirectMutex buffers_lock = DIRECT_MUTEX_INITIALIZER(buffers_lock);
/**************************************************************************************************/
--- a/src/directfb.c
+++ b/src/directfb.c
@@ -163,6 +163,15 @@ DirectFBSetOption( const char *name, const char *value )
return DFB_OK;
}
+
+static pthread_once_t lock_init_once = PTHREAD_ONCE_INIT;
+static DirectMutex lock;
+
+static void lock_init(void)
+{
+ direct_recursive_mutex_init(&lock);
+}
+
/*
* Programs have to call this to get the super interface
* which is needed to access other functions
@@ -215,7 +224,7 @@ DirectFBCreate( IDirectFB **interface_ptr )
if (dfb_config->remote.host)
return CreateRemote( dfb_config->remote.host, dfb_config->remote.port, interface_ptr );
- static DirectMutex lock = DIRECT_RECURSIVE_MUTEX_INITIALIZER(lock);
+ pthread_once(&lock_init_once, lock_init);
direct_mutex_lock( &lock );

View File

@ -0,0 +1,23 @@
--- a/systems/fbdev/fbdev.c
+++ b/systems/fbdev/fbdev.c
@@ -2327,14 +2327,18 @@ dfb_fbdev_set_gamma_ramp( DFBSurfacePixelFormat format )
for (i = 0; i < blue_size; i++)
cmap->blue[i] |= cmap->blue[i] << 8;
}
-
+ /*
+ * Commenting out section setting gamma ramp
+ * per: http://directfb-users.directfb.narkive.com/fUkXSRmm/hello
+ */
+ /*
if (FBDEV_IOCTL( FBIOPUTCMAP, cmap ) < 0) {
D_PERROR( "DirectFB/FBDev: "
"Could not set gamma ramp" );
return errno2result(errno);
}
-
+ */
return DFB_OK;
}

View File

@ -0,0 +1,13 @@
diff --git a/src/core/core.c b/src/core/core.c
index 6676bee..933f0fc 100644
--- a/src/core/core.c
+++ b/src/core/core.c
@@ -1737,7 +1737,7 @@ dfb_core_shutdown( CoreDFB *core, bool emergency )
dfb_gfx_cleanup();
while (loops--) {
- fusion_dispatch( core->world, 16384 );
+ //fusion_dispatch( core->world, 16384 );
ret = dfb_core_wait_all( core, 10000 );
if (ret == DFB_OK)

View File

@ -0,0 +1,14 @@
--- a/configure.in
+++ b/configure.in
@@ -2459,9 +2459,9 @@
enable_tslib=no
if test "$checkfor_tslib" = "yes"; then
- PKG_CHECK_MODULES([TSLIB], [tslib-1.0 >= 1.0.0], [enable_tslib=yes], [enable_tslib=no])
+ PKG_CHECK_MODULES([TSLIB], [tslib >= 1.0.0], [enable_tslib=yes], [enable_tslib=no])
if test "$enable_tslib" = "no"; then
- PKG_CHECK_MODULES([TSLIB], [tslib-0.0], [enable_tslib=yes], [enable_tslib=no
+ PKG_CHECK_MODULES([TSLIB], [tslib], [enable_tslib=yes], [enable_tslib=no
AC_MSG_WARN([*** no tslib -- tslib driver will not be built.])])
fi
fi

View File

@ -0,0 +1,80 @@
pkgname=directfb
pkgver=1.7.7
pkgrel=3
pkgdesc="Library for hw graphics acceleration, input dev, windowing system on top of the Linux fb device"
arch="all"
url="http://www.directfb.org"
license="LGPL"
makedepends="zlib-dev freetype-dev libdrm-dev libpng-dev perl tslib-dev autoconf automake libtool"
depends="libgcc libjpeg libpng freetype libdrm tslib"
subpackages="$pkgname-doc"
source="
http://sources.webos-ports.org/downloads/DirectFB-$pkgver.tar.gz
0001-directfb-fix-musl-compile.patch
0002-Fix-musl-PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP-comp.patch
0003-remove-set-gamma-ramp.patch
0004-disable-fusion_dispatch.patch
0005-fix-tslib-configure.patch"
sha1sums="205d824906906303db9b096cc2d3bea0662e8860"
prepare() {
cd ${srcdir}/DirectFB-${pkgver}
local _patch_failed=
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
}
build() {
cd ${srcdir}/DirectFB-${pkgver}
autoconf
./configure --prefix=/usr \
--sysconfdir=/etc \
--enable-static \
--disable-zlib \
--disable-x11 \
--enable-fbdev \
--disable-vnc \
--disable-osx \
--disable-mesa \
--enable-drmkms \
--enable-freetype \
--with-inputdrivers=input_hub,keyboard,linuxinput,ps2mouse,serialmouse,tslib \
--with-gfxdrivers=omap,vmware,mach64
make
}
package() {
cd ${srcdir}/DirectFB-${pkgver}
make DESTDIR="${pkgdir}" install
}
sha512sums="c9ce8ffe7d7d17b0351da6a031db7345f31fb7112545f9352834ad33225a93e6284ef0e576ef5fc595bc9060c1756051322fa20f7b5b3444b68d7f05bd1ba494 DirectFB-1.7.7.tar.gz
d9325c228a534d2d2b93b4dacf896fc12c703b9e08adf1ae8f5baea2a0ed5c4d07d56b8bc63dc605362f093624eab40686b43028ef15a78a01bc10e5f41c16bc 0001-directfb-fix-musl-compile.patch
ed3bf9bf76616174aca6ae92fd9873c9452951b8a2acb60e1ccbbea0c4a7c9766e510899bc8f58c24dd5888c1e7e1f0a0d4a823f0bd9e03a4c9d2a54fb714221 0002-Fix-musl-PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP-comp.patch
bd1d0738c48411e8e065b8a250c1b31334ac65b26a8f6c91d5ad167a4d8fdac1de862c05940567e48fc740dd45fbecf906ebdfbff63420d4f86bee7a3a0746ee 0003-remove-set-gamma-ramp.patch
d68002702f3521a71405bb403b874dced5b123a2de037c9eb05667123a578c0e9a9f13a822fd8d77e31a83f1e1cc8df1d8511f7d2f427688d5ef6ae0fff448c5 0004-disable-fusion_dispatch.patch
c768ca7a4dae7fc0cd7d4fa559ab74adb6b5f21245e0f9b5d56af15b20effc04e6739e86d52d65c902c5e76ad72e966cd9db68f57a9bad11a004525825d443a4 0005-fix-tslib-configure.patch"

View File

@ -0,0 +1,29 @@
_hash="debd421f276bbad1d0973ba97c69a771c08fe9f4"
pkgname=osk-sdl
pkgver=1
pkgrel=4
pkgdesc="Onscreen Keyboard for Framebuffer"
url="https://github.com/postmarketOS/osk-sdl"
arch="all"
license="MIT"
depends="sdl2_image sdl2 sdl2_ttf cryptsetup-libs mesa-gl directfb"
makedepends="linux-headers sdl2-dev sdl2_image-dev sdl2_ttf-dev cryptsetup-dev"
subpackages=""
source="$pkgname-$_hash.tar.gz::https://github.com/postmarketos/${pkgname}/archive/${_hash}.tar.gz"
options="!strip"
build() {
cd "${srcdir}/${pkgname}-${_hash}"
make
}
package() {
install -D -m755 "${srcdir}/${pkgname}-${_hash}"/osk-sdl \
"$pkgdir"/usr/bin/osk-sdl
install -D -m755 "${srcdir}/${pkgname}-${_hash}"/osk.conf \
"$pkgdir"/osk.conf
}
sha512sums="d0f1f6d277427c664d9f8c1210661ee58bd41b6076ef8871cb5fc35f5362f5e91015adf5e07dce409b3c92436db2af724ffc78880de04277f61122a6632f6ea6 osk-sdl-debd421f276bbad1d0973ba97c69a771c08fe9f4.tar.gz"

View File

@ -0,0 +1,28 @@
diff --git a/src/video/directfb/SDL_DirectFB_shape.c b/src/video/directfb/SDL_DirectFB_shape.c
index 3239e30..e3d4dcd 100644
--- a/src/video/directfb/SDL_DirectFB_shape.c
+++ b/src/video/directfb/SDL_DirectFB_shape.c
@@ -37,18 +37,20 @@ DirectFB_CreateShapedWindow(const char *title,unsigned int x,unsigned int y,unsi
SDL_WindowShaper*
DirectFB_CreateShaper(SDL_Window* window) {
SDL_WindowShaper* result = NULL;
-
+ SDL_ShapeData* data = NULL;
+ int resized_properly = 0;
+
result = malloc(sizeof(SDL_WindowShaper));
result->window = window;
result->mode.mode = ShapeModeDefault;
result->mode.parameters.binarizationCutoff = 1;
result->userx = result->usery = 0;
- SDL_ShapeData* data = SDL_malloc(sizeof(SDL_ShapeData));
result->driverdata = data;
data->surface = NULL;
window->shaper = result;
- int resized_properly = DirectFB_ResizeWindowShape(window);
SDL_assert(resized_properly == 0);
+ data = SDL_malloc(sizeof(SDL_ShapeData));
+ resized_properly = DirectFB_ResizeWindowShape(window);
return result;
}

68
aports/main/sdl2/APKBUILD Normal file
View File

@ -0,0 +1,68 @@
pkgname=sdl2
pkgver=2.0.5
pkgrel=0
_pkgname=SDL2
pkgdesc="A development library designed to provide low level access to audio, keyboard, mouse, joystick and graphics"
url="http://www.libsdl.org"
arch="all"
license="zlib"
depends="directfb"
depends_dev="alsa-lib-dev libxcursor-dev libxrandr-dev libxrender-dev mesa-dev directfb"
makedepends="$depends_dev"
subpackages="$pkgname-dev"
source="https://www.libsdl.org/release/$_pkgname-$pkgver.tar.gz
altivec-fixes.patch
0001-fix-c90-errors.patch"
builddir="$srcdir/$_pkgname-$pkgver"
prepare(){
cd "$builddir"
# first apply patches in specified order
for i in $source; do
case $i in
*.patch)
msg "Applying $i..."
if ! patch -s -p1 -N -i "$srcdir"/$i; then
echo $i >>failed
_patch_failed=1
fi
;;
esac
done
if ! [ -z "$_patch_failed" ]; then
error "The following patches failed:"
cat failed
return 1
fi
}
build() {
cd "$builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
--prefix=/usr \
--enable-alsa \
--enable-clock_gettime \
--disable-arts \
--disable-esd \
--disable-nas \
--disable-rpath \
--with-x \
--enable-video-directfb
make
}
package() {
cd "$builddir"
make DESTDIR="$pkgdir" install || return 1
}
sha512sums="6401f5df08c08316c09bc6ac5b28345c5184bb25770baa5c94c0a582ae130ddf73bb736e44bb31f4e427c1ddbbeec4755a6a5f530b6b4c3d0f13ebc78ddc1750 SDL2-2.0.5.tar.gz
aad37129e8d1259fcceea087794aa45f7d94a5b0b09275a72e20ae53809a587f8a59dba05c9bd763012e6471d6d9d87739e282bcbb7df4de5c66d06d9e23d8d3 altivec-fixes.patch
25dbfa65f15040564f2345c235e8997fcc60e81e03691afcd75b3d5f982941220d4a2b7710de1e40b581b63632f1b667befbc819513a785da01ad40d6ce1ef5f 0001-fix-c90-errors.patch"

View File

@ -0,0 +1,36 @@
--- SDL2-2.0.5.orig/src/video/SDL_blit_N.c
+++ SDL2-2.0.5/src/video/SDL_blit_N.c
@@ -118,12 +118,6 @@
16, 8, 0, 24,
0, NULL
};
- if (!srcfmt) {
- srcfmt = &default_pixel_format;
- }
- if (!dstfmt) {
- dstfmt = &default_pixel_format;
- }
const vector unsigned char plus = VECUINT8_LITERAL(0x00, 0x00, 0x00, 0x00,
0x04, 0x04, 0x04, 0x04,
0x08, 0x08, 0x08, 0x08,
@@ -132,10 +126,16 @@
vector unsigned char vswiz;
vector unsigned int srcvec;
#define RESHIFT(X) (3 - ((X) >> 3))
- Uint32 rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
- Uint32 gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
- Uint32 bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
- Uint32 amask;
+ Uint32 rmask, gmask, bmask, amask;
+ if (!srcfmt) {
+ srcfmt = &default_pixel_format;
+ }
+ if (!dstfmt) {
+ dstfmt = &default_pixel_format;
+ }
+ rmask = RESHIFT(srcfmt->Rshift) << (dstfmt->Rshift);
+ gmask = RESHIFT(srcfmt->Gshift) << (dstfmt->Gshift);
+ bmask = RESHIFT(srcfmt->Bshift) << (dstfmt->Bshift);
/* Use zero for alpha if either surface doesn't have alpha */
if (dstfmt->Amask) {
amask =

View File

@ -0,0 +1,23 @@
pkgname=tslib
pkgver=1.11
pkgrel=0
pkgdesc="Touchscreen Access Library"
arch="all"
url="https://github.com/kergoth/tslib"
license="GPL2"
makedepends="autoconf automake libtool linux-headers"
source="https://github.com/kergoth/tslib/releases/download/$pkgver/$pkgname-$pkgver.tar.xz"
subpackages="$pkgname-dev $pkgname-doc"
build() {
cd $srcdir/$pkgname-$pkgver
./autogen.sh
./configure --prefix=/usr --sysconfdir=/etc
make
}
package() {
cd $srcdir/$pkgname-$pkgver
make DESTDIR="$pkgdir" install
}
sha512sums="c4826fc0b3e13ed8714e6d7f09e4b047fd4c2568426aac2a70e9812b9b472086a5a9a8f9e2ba80905e2f3fe75cdc1a09c8e7349d10a016808c74a09d82a0a874 tslib-1.11.tar.xz"