aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <yalhcru@gmail.com>2022-03-31 13:51:56 +0100
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2022-04-02 18:19:18 +0700
commitd3a4af2a131b3ee3b8a34517aaaff7b04c84b0c0 (patch)
treef64a525bcc670fc24ad8d6ba8598d533285268f2
parente20fb7b2fc0e61bb98632ffe6de549e2520de8b7 (diff)
games/joy2key: Added (control applications with joystick/gamepad)
Signed-off-by: Dave Woodfall <dave@slackbuilds.org> Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r--games/joy2key/README5
-rw-r--r--games/joy2key/button_list_segfault.patch25
-rw-r--r--games/joy2key/home_not_set_segfault.patch34
-rw-r--r--games/joy2key/joy2key.SlackBuild95
-rw-r--r--games/joy2key/joy2key.info10
-rw-r--r--games/joy2key/slack-desc19
6 files changed, 188 insertions, 0 deletions
diff --git a/games/joy2key/README b/games/joy2key/README
new file mode 100644
index 0000000000000..f76f27ec2f3c5
--- /dev/null
+++ b/games/joy2key/README
@@ -0,0 +1,5 @@
+joy2key (control keyboard-only applications with joystick/gamepad)
+
+Joy2key allows you to control applications accepting keyboard commands
+with your joystick. It does not work with all applications, however,
+because some do not accept synthetic events for security reasons.
diff --git a/games/joy2key/button_list_segfault.patch b/games/joy2key/button_list_segfault.patch
new file mode 100644
index 0000000000000..2a6e95d197bf1
--- /dev/null
+++ b/games/joy2key/button_list_segfault.patch
@@ -0,0 +1,25 @@
+Author: Jonathan Niehof <jtniehof@gmail.com>
+Subject: Fix a segfault when parsing options to -buttons
+Last-Update: 2009-12-06
+Forwarded: yes
+Bug: https://sourceforge.net/tracker/?func=detail&aid=2909756&group_id=227783&atid=1072387
+
+joy2key segfaults when reading the list of keystrokes to associate with
+buttons. This is a regression from 1.6.1 and this patch simply reverts
+the offending line to that earlier version. I have verified that, with
+the patch applied, all buttons on the joystick are usable and all buttons
+listed on the command line are processed appropriately.
+
+Index: joy2key-1.6.3/joy2key.c
+===================================================================
+--- joy2key-1.6.3.orig/joy2key.c 2009-12-06 15:38:56.000000000 -0500
++++ joy2key-1.6.3/joy2key.c 2009-12-06 15:50:48.000000000 -0500
+@@ -576,7 +576,7 @@
+ exit(1);
+ }
+ button_act_counter=0;
+- while((i+1)<=argc && (argv[i+1][0]!='-' ||
++ while((i+1)<argc && (argv[i+1][0]!='-' ||
+ (argv[i+1][0]=='-' && !argv[i+1][1])))
+ {
+ button_actions[button_act_counter]=argtokey(argv[++i]);
diff --git a/games/joy2key/home_not_set_segfault.patch b/games/joy2key/home_not_set_segfault.patch
new file mode 100644
index 0000000000000..0e0fb08c816fa
--- /dev/null
+++ b/games/joy2key/home_not_set_segfault.patch
@@ -0,0 +1,34 @@
+Author: Jonathan Niehof <jtniehof@gmail.com>
+Subject: Fix segfault if $HOME not set and -config passed
+Bug-Debian: https://bugs.debian.org/716582
+Forwarded: https://sourceforge.net/p/joy2key/patches/5/
+Last-Update: 2013-07-13
+
+--- a/joy2key.c
++++ b/joy2key.c
+@@ -386,6 +386,7 @@
+ FILE *file;
+ int rcargc;
+ char *rcargv[255], line[255];
++ char *homedir;
+
+ for(i=1; i<argc; i++)
+ {
+@@ -442,9 +443,15 @@
+ }
+ if(strcmp(rcfile,DEFAULT_RCFILE) == 0)
+ {
+- x=strlen(getenv("HOME")) + strlen(rcfile) + 2;
++ homedir=getenv("HOME");
++ if(homedir==NULL)
++ {
++ printf("No home directory; cannot open default rc file\n");
++ exit(1);
++ }
++ x=strlen(homedir) + strlen(rcfile) + 2;
+ rcfile=(char*)malloc(x);
+- sprintf(rcfile, "%s/%s", getenv("HOME"), DEFAULT_RCFILE);
++ sprintf(rcfile, "%s/%s", homedir, DEFAULT_RCFILE);
+ }
+ if((file=fopen(rcfile, "r"))==NULL)
+ {
diff --git a/games/joy2key/joy2key.SlackBuild b/games/joy2key/joy2key.SlackBuild
new file mode 100644
index 0000000000000..692e67927c752
--- /dev/null
+++ b/games/joy2key/joy2key.SlackBuild
@@ -0,0 +1,95 @@
+#!/bin/bash
+
+# Slackware build script for joy2key
+
+# Written by B. Watson (yalhcru@gmail.com)
+
+# Licensed under the WTFPL. See http://www.wtfpl.net/txt/copying/ for details.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=joy2key
+VERSION=${VERSION:-1.6.3}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "i686" ]; then
+ SLKCFLAGS="-O2 -march=i686 -mtune=i686"
+ LIBDIRSUFFIX=""
+elif [ "$ARCH" = "x86_64" ]; then
+ SLKCFLAGS="-O2 -fPIC"
+ LIBDIRSUFFIX="64"
+else
+ SLKCFLAGS="-O2"
+ LIBDIRSUFFIX=""
+fi
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.bz2
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . -perm /111 -a \! -perm 755 -a -exec chmod 755 {} \+ -o \
+ \! -perm /111 -a \! -perm 644 -a -exec chmod 644 {} \+
+
+# these bugfix patches are from Debian.
+patch -p1 < $CWD/button_list_segfault.patch
+patch -p1 < $CWD/home_not_set_segfault.patch
+
+# someone forgot to update the FILES section in the man page.
+sed -i 's,/dev/js,/dev/input/js,' $PRGNAM.1
+
+CFLAGS="$SLKCFLAGS" \
+CXXFLAGS="$SLKCFLAGS" \
+./configure \
+ --prefix=/usr \
+ --libdir=/usr/lib${LIBDIRSUFFIX} \
+ --sysconfdir=/etc \
+ --localstatedir=/var \
+ --mandir=/usr/man \
+ --docdir=/usr/doc/$PRGNAM-$VERSION \
+ --disable-static \
+ --build=$ARCH-slackware-linux
+
+make
+
+# 'make install' is broken, it's just 2 files.
+mkdir -p $PKG/usr/bin $PKG/usr/man/man1
+install -s -m0755 $PRGNAM $PKG/usr/bin/$PRGNAM
+gzip -9c < $PRGNAM.1 > $PKG/usr/man/man1/$PRGNAM.1.gz
+
+PKGDOC=$PKG/usr/doc/$PRGNAM-$VERSION
+mkdir -p $PKGDOC
+cp -a AUTHORS COPYING ChangeLog README TODO rawscancodes joy2keyrc.sample $PKGDOC
+cat $CWD/$PRGNAM.SlackBuild > $PKGDOC/$PRGNAM.SlackBuild
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/games/joy2key/joy2key.info b/games/joy2key/joy2key.info
new file mode 100644
index 0000000000000..1e23d6fd2e552
--- /dev/null
+++ b/games/joy2key/joy2key.info
@@ -0,0 +1,10 @@
+PRGNAM="joy2key"
+VERSION="1.6.3"
+HOMEPAGE="https://packages.debian.org/sid/joy2key"
+DOWNLOAD="https://ftp.osuosl.org/pub/gentoo/distfiles/joy2key-1.6.3.tar.bz2"
+MD5SUM="e1119b8cbfd221b4f692d9968fad9ee5"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES=""
+MAINTAINER="B. Watson"
+EMAIL="yalhcru@gmail.com"
diff --git a/games/joy2key/slack-desc b/games/joy2key/slack-desc
new file mode 100644
index 0000000000000..823ff9377d31c
--- /dev/null
+++ b/games/joy2key/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+joy2key: joy2key (control keyboard-only applications with joystick/gamepad)
+joy2key:
+joy2key: Joy2key allows you to control applications accepting keyboard commands
+joy2key: with your joystick. It does not work with all applications, however,
+joy2key: because some do not accept synthetic events for security reasons.
+joy2key:
+joy2key: https://packages.debian.org/sid/joy2key
+joy2key:
+joy2key:
+joy2key:
+joy2key: