Merge pull request #1884 from pullmoll/gpm

gpm: unbreak musl
This commit is contained in:
Jürgen Buchmüller 2015-06-22 20:36:33 +02:00
commit 88c98f763f
7 changed files with 115 additions and 14 deletions

View File

@ -1,9 +0,0 @@
[Unit]
Description=Virtual console mouse server
[Service]
Type=forking
ExecStart=/usr/bin/gpm -m /dev/input/mice -t imps2
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,24 @@
The location <sys/fcntl.h> is wrong, it is just <fcntl.h>
--- src/lib/liblow.c 2012-10-26 23:21:38.000000000 +0200
+++ src/lib/liblow.c 2015-06-22 15:36:38.956046661 +0200
@@ -33,7 +33,7 @@
#include <sys/types.h> /* socket() */
#include <sys/socket.h> /* socket() */
#include <sys/un.h> /* struct sockaddr_un */
-#include <sys/fcntl.h> /* O_RDONLY */
+#include <fcntl.h> /* O_RDONLY */
#include <sys/stat.h> /* stat() */
#ifdef SIGTSTP /* true if BSD system */
--- src/daemon/gpm.c 2012-10-26 23:21:38.000000000 +0200
+++ src/daemon/gpm.c 2015-06-22 15:44:46.825020280 +0200
@@ -29,7 +29,7 @@
#include <signal.h> /* SIGPIPE */
#include <time.h> /* time() */
#include <sys/param.h>
-#include <sys/fcntl.h> /* O_RDONLY */
+#include <fcntl.h> /* O_RDONLY */
#include <sys/wait.h> /* wait() */
#include <sys/stat.h> /* mkdir() */
#include <sys/time.h> /* timeval */

View File

@ -0,0 +1,13 @@
There is no -Isrc/headers, thus specify gpm.h relative location
--- src/prog/get-versions.c 2012-10-26 23:21:38.000000000 +0200
+++ src/prog/get-versions.c 2015-06-22 15:49:30.536004939 +0200
@@ -22,7 +22,7 @@
********/
#include <stdio.h> /* printf() */
-#include <gpm.h> /* gpm information */
+#include "headers/gpm.h" /* gpm information */
int main()
{

View File

@ -0,0 +1,12 @@
The macro major() is defined in sys/sysmacros.h
--- src/daemon/open_console.c 2012-10-26 23:21:38.000000000 +0200
+++ src/daemon/open_console.c 2015-06-22 16:13:14.921927918 +0200
@@ -25,6 +25,7 @@
/* Linux specific (to be outsourced in gpm2 */
#include <linux/serial.h> /* for serial console check */
+#include <sys/sysmacros.h> /* for major() */
#include <asm/ioctls.h> /* for serial console check */

View File

@ -0,0 +1,36 @@
The FD_ISSET macro and fd_set are defined in sys/select.h
--- src/prog/display-buttons.c 2012-10-26 23:21:38.000000000 +0200
+++ src/prog/display-buttons.c 2015-06-22 15:40:19.594034730 +0200
@@ -36,7 +36,8 @@
#include <stdio.h> /* printf() */
#include <time.h> /* time() */
#include <errno.h> /* errno */
-#include <gpm.h> /* gpm information */
+#include <sys/select.h> /* FD_ISSET */
+#include "headers/gpm.h" /* gpm information */
/* display resulting data */
int display_data(Gpm_Event *event, void *data)
--- src/prog/display-coords.c 2012-10-26 23:21:38.000000000 +0200
+++ src/prog/display-coords.c 2015-06-22 15:41:05.433032252 +0200
@@ -37,7 +37,8 @@
#include <stdio.h> /* printf() */
#include <time.h> /* time() */
#include <errno.h> /* errno */
-#include <gpm.h> /* gpm information */
+#include <sys/select.h> /* FD_ISSET */
+#include "headers/gpm.h" /* gpm information */
/* display resulting data */
int display_data(Gpm_Event *event, void *data)
--- src/prog/open_console.c 2012-10-26 23:21:38.000000000 +0200
+++ src/prog/open_console.c 2015-06-22 15:40:35.002033897 +0200
@@ -22,6 +22,7 @@
#include "headers/message.h" /* messaging in gpm */
#include "headers/daemon.h" /* daemon internals */
#include <fcntl.h>
+#include <sys/select.h>
int open_console(const int mode)
{

View File

@ -0,0 +1,29 @@
Use the generic sigemptyset() available on both, glibc and musl libc
The SA_INTERRUPT is not defined in musl libc. Copy the (unused?)
definition from glibc's header bits/sigaction.h
--- src/prog/gpm-root.y 2012-10-26 23:21:38.000000000 +0200
+++ src/prog/gpm-root.y 2015-06-22 15:56:19.167982843 +0200
@@ -56,6 +56,9 @@
#define minor(dev) ((dev)&0xff)
#endif
+#if !defined(SA_INTERRUPT)
+# define SA_INTERRUPT 0x20000000 /* Historical no-op. */
+#endif
#define GPM_NULL_DEV "/dev/null"
@@ -1196,11 +1199,7 @@
LOG_DAEMON : LOG_USER);
/* reap your zombies */
childaction.sa_handler=reap_children;
-#if defined(__GLIBC__)
- __sigemptyset(&childaction.sa_mask);
-#else /* __GLIBC__ */
- childaction.sa_mask=0;
-#endif /* __GLIBC__ */
+ sigemptyset(&childaction.sa_mask);
childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
sigaction(SIGCHLD,&childaction,NULL);

View File

@ -1,8 +1,7 @@
# Template file for 'gpm'
pkgname=gpm
version=1.20.7
revision=7
build_options="systemd"
revision=8
build_style=gnu-configure
configure_args="--sbindir=/usr/bin"
hostmakedepends="automake libtool flex"
@ -23,9 +22,6 @@ post_install() {
touch ${DESTDIR}/usr/share/info/dir
vinstall ${FILESDIR}/gpm.sh 644 etc/profile.d
if [ "$build_option_systemd" ]; then
vinstall ${FILESDIR}/gpm.service 644 usr/lib/systemd/system
fi
vsv gpm
}
gpm-devel_package() {