Subject: [alpine-devel] [PATCH] Beat gpm with a stick until it builds.

From: Isaac Dunham <[email-masked]>
Date: Tue, 15 Jul 2014 18:40:00 -0700

* gpm.h is in src/headers/; some but not all rules allowed for this.
 * FD_ZERO, FD_SET, and fd_set are defined in <sys/select.h>
 * gpm-root had a number of bad assumptions about non-glibc systems.
---
 testing/gpm/01-Iheaders.patch   |  40 ++++++++++++
 testing/gpm/02-sys-select.patch | 138 ++++++++++++++++++++++++++++++++++++++++
 testing/gpm/03-gpmroot.patch    |  26 ++++++++
 testing/gpm/APKBUILD            |  12 ++++
 4 files changed, 216 insertions(+)
 create mode 100644 testing/gpm/01-Iheaders.patch
 create mode 100644 testing/gpm/02-sys-select.patch
 create mode 100644 testing/gpm/03-gpmroot.patch

diff --git a/testing/gpm/01-Iheaders.patch b/testing/gpm/01-Iheaders.patch
new file mode 100644
index 0000000..e0f2892
--- /dev/null
+++ b/testing/gpm/01-Iheaders.patch
@@ -0,0 +1,40 @@
+commit 462cd6c81a2321872a5807e652780eb90a0fb40e
+Author: Isaac Dunham <[email-masked]>
+Date:   Tue Jul 15 14:39:37 2014 -0700
+
+    Add -Iheaders so we can find gpm.h
+
+diff --git a/src/Makefile.in b/src/Makefile.in
+index d3b1dcd..1f8a4dc 100644
+--- a/src/Makefile.in
++++ b/src/Makefile.in
+@@ -65,7 +65,7 @@ prog/%:	prog/%.o
+ 	$(CC) @LDFLAGS@ $(LDFLAGS) -o $@ $^ @LIBS@ $(LIBS)
+ 
+ %.o: %.c
+-	$(CC) @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@ $<
++	$(CC) -Iheaders @CPPFLAGS@ $(CPPFLAGS) @CFLAGS@ $(CFLAGS) -c -o $@ $<
+ 
+ %.lo:	%.c
+ 	$(CC) @CPPFLAGS@ $(CPPFLAGS) @PICFLAGS@ @CFLAGS@ $(CFLAGS) -c -o $@ $<
+@@ -96,7 +96,7 @@ $(DEPFILE) dep: prog/gpm-root.c
+ 
+ 	# create dependencies
+ 	for DEPS in `echo *.c */*.c`; do \
+-	$(CC) -I. -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \
++	$(CC) -I. -Iheaders -I $(srcdir) -M @CPPFLAGS@ $(CPPFLAGS) $$DEPS | \
+ 	$(SED) 's/^\(.*\)\.o\([ :]+\)/\1.o \1.lo\2/g' >> $(DEPFILE) ; done
+ 
+ ### INSTALL
+diff --git a/src/daemon/open_console.c b/src/daemon/open_console.c
+index 98297c9..f7df875 100644
+--- a/src/daemon/open_console.c
++++ b/src/daemon/open_console.c
+@@ -22,6 +22,7 @@
+ #include <fcntl.h>                  /* open and co.      */
+ #include <sys/stat.h>               /* stat()            */
+ #include <sys/ioctl.h>              /* ioctl             */
++#include <sys/sysmacros.h>          /* major()           */
+ 
+ /* Linux specific (to be outsourced in gpm2 */
+ #include <linux/serial.h>           /* for serial console check */
diff --git a/testing/gpm/02-sys-select.patch b/testing/gpm/02-sys-select.patch
new file mode 100644
index 0000000..31c4ed0
--- /dev/null
+++ b/testing/gpm/02-sys-select.patch
@@ -0,0 +1,138 @@
+commit 6d05d3d02fac411080363665e1c4fc7a2c84f7aa
+Author: Isaac Dunham <[email-masked]>
+Date:   Tue Jul 15 17:11:04 2014 -0700
+
+    Add sys/select.h to headers
+
+diff --git a/src/daemon/old_main.c b/src/daemon/old_main.c
+index 9cd4e56..0ea0b84 100644
+--- a/src/daemon/old_main.c
++++ b/src/daemon/old_main.c
+@@ -26,6 +26,7 @@
+ #include <errno.h>                  /* guess again       */
+ #include <unistd.h>                 /* unlink            */
+ #include <sys/stat.h>               /* chmod             */
++#include <sys/select.h>             /* fd_set, FD_ZERO   */
+ 
+ #include <linux/kd.h>               /* linux hd*         */
+ 
+diff --git a/src/daemon/processmouse.c b/src/daemon/processmouse.c
+index b3f3994..af3400a 100644
+--- a/src/daemon/processmouse.c
++++ b/src/daemon/processmouse.c
+@@ -30,6 +30,7 @@
+ #include <unistd.h>                 /* close             */
+ #include <time.h>                   /* time              */
+ #include <sys/time.h>               /* gettimeofday      */
++#include <sys/select.h>             /* FD_ZERO           */
+ 
+ #include "headers/message.h"        /* messaging in gpm */
+ #include "headers/daemon.h"         /* daemon internals */
+diff --git a/src/lib/libcurses.c b/src/lib/libcurses.c
+index e7ebf84..e6fa877 100644
+--- a/src/lib/libcurses.c
++++ b/src/lib/libcurses.c
+@@ -26,6 +26,7 @@
+ #include <unistd.h>        /* select(); */
+ #include <sys/time.h>      /* timeval */
+ #include <sys/types.h>     /* socket() */
++#include <sys/select.h>    /* FD_ZERO  */
+ 
+ #include "headers/gpmInt.h"
+ 
+diff --git a/src/lib/liblow.c b/src/lib/liblow.c
+index e789d09..e449321 100644
+--- a/src/lib/liblow.c
++++ b/src/lib/liblow.c
+@@ -35,6 +35,7 @@
+ #include <sys/un.h>        /* struct sockaddr_un */
+ #include <sys/fcntl.h>     /* O_RDONLY */
+ #include <sys/stat.h>      /* stat() */
++#include <sys/select.h>    /* FD_ZERO */
+ 
+ #ifdef  SIGTSTP         /* true if BSD system */
+ #include <sys/file.h>
+diff --git a/src/lib/libxtra.c b/src/lib/libxtra.c
+index e6dd4aa..b7ec631 100644
+--- a/src/lib/libxtra.c
++++ b/src/lib/libxtra.c
+@@ -25,6 +25,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <sys/time.h>
++#include <sys/select.h>
+ #include <sys/types.h>
+ #include <unistd.h>
+ #include <string.h>
+diff --git a/src/mice.c b/src/mice.c
+index 6cbd491..6989f92 100644
+--- a/src/mice.c
++++ b/src/mice.c
+@@ -55,6 +55,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h> /* stat() */
+ #include <sys/time.h> /* select() */
++#include <sys/select.h> /* select() */
+ 
+ #include <linux/kdev_t.h> /* MAJOR */
+ #include <linux/keyboard.h>
+diff --git a/src/prog/display-buttons.c b/src/prog/display-buttons.c
+index de8e5b2..2385bf0 100644
+--- a/src/prog/display-buttons.c
++++ b/src/prog/display-buttons.c
+@@ -37,6 +37,7 @@
+ #include <time.h>             /* time()               */
+ #include <errno.h>            /* errno                */
+ #include <gpm.h>              /* gpm information      */
++#include <sys/select.h>       /* FD_ZERO              */
+ 
+ /* display resulting data */
+ int display_data(Gpm_Event *event, void *data)
+diff --git a/src/prog/display-coords.c b/src/prog/display-coords.c
+index ed15c8a..5aa7228 100644
+--- a/src/prog/display-coords.c
++++ b/src/prog/display-coords.c
+@@ -37,6 +37,7 @@
+ #include <stdio.h>            /* printf()             */
+ #include <time.h>             /* time()               */
+ #include <errno.h>            /* errno                */
++#include <sys/select.h>       /* FD_ZERO()            */
+ #include <gpm.h>              /* gpm information      */
+ 
+ /* display resulting data */
+diff --git a/src/prog/mev.c b/src/prog/mev.c
+index 97622d4..22cfb05 100644
+--- a/src/prog/mev.c
++++ b/src/prog/mev.c
+@@ -36,6 +36,7 @@
+ #include <signal.h>
+ #include <sys/types.h>
+ #include <sys/time.h>
++#include <sys/select.h>
+ #include <unistd.h>
+ #include <termios.h>
+ #include <errno.h>
+diff --git a/src/prog/mouse-test.c b/src/prog/mouse-test.c
+index 0bb1982..9a1b624 100644
+--- a/src/prog/mouse-test.c
++++ b/src/prog/mouse-test.c
+@@ -37,6 +37,7 @@
+ #include <sys/types.h>
+ #include <sys/stat.h>
+ #include <sys/time.h>
++#include <sys/select.h>
+ #include <fcntl.h>
+ #include <time.h>
+ #include <signal.h>
+diff --git a/src/synaptics.c b/src/synaptics.c
+index 2418c75..ea40a53 100644
+--- a/src/synaptics.c
++++ b/src/synaptics.c
+@@ -216,6 +216,7 @@
+ #include <string.h>
+ #include <sys/time.h>
+ #include <sys/ioctl.h>
++#include <sys/select.h>
+ 
+ #include "headers/gpm.h"
+ #include "headers/daemon.h"       /* which_mouse */
diff --git a/testing/gpm/03-gpmroot.patch b/testing/gpm/03-gpmroot.patch
new file mode 100644
index 0000000..fd3258c
--- /dev/null
+++ b/testing/gpm/03-gpmroot.patch
@@ -0,0 +1,26 @@
+commit eb333988d937f3665348240c5551db3ec98fc679
+Author: Isaac Dunham <[email-masked]>
+Date:   Tue Jul 15 18:18:26 2014 -0700
+
+    make gpm-root build
+
+diff --git a/src/prog/gpm-root.y b/src/prog/gpm-root.y
+index 069d801..3ad0d03 100644
+--- a/src/prog/gpm-root.y
++++ b/src/prog/gpm-root.y
+@@ -1196,12 +1196,10 @@ int main(int argc, char **argv)
+                                                         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);
++#ifdef SA_INTERRUPT
+    childaction.sa_flags=SA_INTERRUPT; /* need to break the select() call */
++#endif
+    sigaction(SIGCHLD,&childaction,NULL);
+ 
+    /*....................................... Connect and get your buffer */
diff --git a/testing/gpm/APKBUILD b/testing/gpm/APKBUILD
index 17cb942..8c3b614 100644
--- a/testing/gpm/APKBUILD
+++ b/testing/gpm/APKBUILD
@@ -14,6 +14,9 @@ install=""
 subpackages="$pkgname-dev $pkgname-doc"
 source="http://www.nico.schottelius.org/software/gpm/archives/gpm-$pkgver.tar.bz2
 	error-format.patch
+	01-Iheaders.patch
+	02-sys-select.patch
+	03-gpmroot.patch
 	gpm.initd
 	gpm.confd
 	"
@@ -59,13 +62,22 @@ package() {
 
 md5sums="bf84143905a6a903dbd4d4b911a2a2b8  gpm-1.20.7.tar.bz2
 ba7ffe9a3b6e3f672081a5b7d17f4766  error-format.patch
+3adbe10e28d14d5b498a83bbccbba427  01-Iheaders.patch
+6b6ef5234d6903c666e0f12eb8a1b958  02-sys-select.patch
+3b2fe9f664c36f5cd395376eca43e63f  03-gpmroot.patch
 0eeefbbd956ee14cb20161d5a7a5bdc6  gpm.initd
 2243adac99a888b0598d6b9233862788  gpm.confd"
 sha256sums="f011b7dc7afb824e0a017b89b7300514e772853ece7fc4ee640310889411a48d  gpm-1.20.7.tar.bz2
 290e032640c8cfb95d5a8dddfd99e11887100b08750b9f5ceaec6e3209e3ebf3  error-format.patch
+4b99946b86d9f21d7ec4f3e366dab18a57133903c480408bf0eb838fccc2f11d  01-Iheaders.patch
+04487ddfe3e2f5ada548d55bc0e62bf5f36e92641d254f4f24ee0428253b26a5  02-sys-select.patch
+a202d783c586e959ca28bc8bea5c99f0f1c68679f223a2241b04f74d9a31d01c  03-gpmroot.patch
 41849c683967590db3217dd231df3fdf83ecdf01c657221ff4cbe45aa63d498f  gpm.initd
 daad6a5d900215b27ad86d1352724fea2df39581e1ae6e808f627d6f8bab3b2e  gpm.confd"
 sha512sums="51c1141ed502f8b6bc846485a8e315bafe3cf2b7c9d1ea8a710d9748ff2058f29c7ab5715fc1730a8437c613181d2050f37b134e9288c69ba8ff7fb0be7ec0d1  gpm-1.20.7.tar.bz2
 caad0472374b9bb9bdf8f31480f88895b2d65dc0565611932fa185592ffcc18065bb66b433f54f0df9f6173056b6c34ec5d57f79bd19f38edefeca57603bc76c  error-format.patch
+cb9fa2c48b5fa7f06ccfa8be57e421ee228b49707027094a2fdca5809407e7e277484c820ed4ee0800ef1a36bfc322ac33b2f29b4411ffab345c900931113863  01-Iheaders.patch
+24fbc48408388a7481dadbccc6da3edbd5f82a644460e5a9ca6039fbac2d2eff6c16002b2158c1955fbd2677655b8b1acd1e12b94b9c29eeddb1a883e813e2a7  02-sys-select.patch
+5a021516a4833a270cbb7537f2096d6deabd40d874a9f4f9ba4d5728a89e1626ea9cbc4fefee354950f145d4c8735504a128da0fac7fa74a9c32c0d5a93125e9  03-gpmroot.patch
 81b0854b6d8b3fcf5a26690b9cb17878af412e773726cdd7c3e90504e85fd5aff0614c171757256c832e20521a734d353f4c38684ab5f749f20dbc497cc680e5  gpm.initd
 25a7ebc60df8e9dda197ae7cf18fdb036793e15aeb06757a872ad25b8ad28cd0686e7ef89a47ee677ae6bfee980abd3777e89be84b2a2611141dc688c20c3ed6  gpm.confd"
-- 
2.0.1

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---