wmapm: fix the build with -fno-common

OK naddy@
This commit is contained in:
cwen 2021-02-02 22:12:13 +00:00
parent 5a26c868fd
commit 5573731bb6
4 changed files with 48 additions and 15 deletions

View File

@ -1,20 +1,20 @@
# $OpenBSD: Makefile,v 1.30 2019/07/12 20:49:54 sthen Exp $
# $OpenBSD: Makefile,v 1.31 2021/02/02 22:12:13 cwen Exp $
ONLY_FOR_ARCHS= ${APM_ARCHS}
COMMENT= wm-dockapp; APM/battery monitor
DISTNAME= wmapm-3.1
REVISION = 3
REVISION = 4
CATEGORIES= sysutils x11 x11/windowmaker
HOMEPAGE= http://nis-www.lanl.gov/~mgh/WindowMaker/DockApps.shtml
HOMEPAGE= https://www.dockapps.net/wmapm
# GPL
PERMIT_PACKAGE= Yes
WANTLIB= X11 Xext Xpm c xcb
WANTLIB= X11 Xext Xpm c
MASTER_SITES= http://nis-www.lanl.gov/~mgh/WindowMaker/
MASTER_SITES= https://www.dockapps.net/download/
NO_TEST= Yes

View File

@ -1,6 +1,7 @@
$OpenBSD: patch-wmapm_c,v 1.2 2005/03/07 05:37:20 mcbride Exp $
--- wmapm/wmapm.c.orig Tue Jan 11 17:37:25 2000
+++ wmapm/wmapm.c Wed Jan 10 17:35:20 2001
$OpenBSD: patch-wmapm_c,v 1.3 2021/02/02 22:12:13 cwen Exp $
Index: wmapm/wmapm.c
--- wmapm/wmapm.c.orig
+++ wmapm/wmapm.c
@@ -151,12 +151,17 @@
#endif
@ -84,20 +85,21 @@ $OpenBSD: patch-wmapm_c,v 1.2 2005/03/07 05:37:20 mcbride Exp $
#endif
/*
@@ -417,9 +427,10 @@ int main(int argc, char *argv[]) {
@@ -417,10 +427,11 @@ int main(int argc, char *argv[]) {
#ifdef Linux
time_left = (my_cur_info.using_minutes) ? my_cur_info.battery_time : my_cur_info.battery_time / 60;
-#endif
-#ifdef FreeBSD
- time_left = (my_cur_info.using_minutes) ? my_cur_info.battery_time / 60 : my_cur_info.battery_time / 3600;
+#elif defined(FreeBSD)
+ time_left = my_cur_info.battery_time / 3600;
+#elif defined(__OpenBSD__)
+ time_left = my_cur_info.battery_time;
#endif
-#ifdef FreeBSD
- time_left = (my_cur_info.using_minutes) ? my_cur_info.battery_time / 60 : my_cur_info.battery_time / 3600;
-#endif
hour_left = time_left / 60;
min_left = time_left % 60;
@@ -689,7 +700,7 @@ void pressEvent(XButtonEvent *xev){
copyXPMArea(21, 106, 13, 11, 46, 48);
RedrawWindow();
@ -131,13 +133,13 @@ $OpenBSD: patch-wmapm_c,v 1.2 2005/03/07 05:37:20 mcbride Exp $
-#endif
+#elif defined(__OpenBSD__)
+int apm_read(struct apm_power_info *temp_info) {
+
-#ifdef SunOS
+ int fd;
+
+ if ( (fd = open(APMDEV, O_RDONLY)) < 0){
+ return(1);
-#ifdef SunOS
+
+ } else if ( ioctl(fd, APM_IOC_GETPOWER, temp_info) == -1 ) {
+
+ close(fd);

View File

@ -0,0 +1,15 @@
$OpenBSD: patch-wmgeneral_wmgeneral_c,v 1.1 2021/02/02 22:12:13 cwen Exp $
Fix -fno-common build failure.
Index: wmgeneral/wmgeneral.c
--- wmgeneral/wmgeneral.c.orig
+++ wmgeneral/wmgeneral.c
@@ -50,6 +50,7 @@ Window iconwin, win;
GC NormalGC;
XpmIcon wmgen;
Pixmap pixmask;
+Display *display;
/*****************/
/* Mouse Regions */

View File

@ -0,0 +1,16 @@
$OpenBSD: patch-wmgeneral_wmgeneral_h,v 1.1 2021/02/02 22:12:13 cwen Exp $
Fix -fno-common build failure.
Index: wmgeneral/wmgeneral.h
--- wmgeneral/wmgeneral.h.orig
+++ wmgeneral/wmgeneral.h
@@ -28,7 +28,7 @@ typedef struct {
/* Global variable */
/*******************/
-Display *display;
+extern Display *display;
/***********************/
/* Function Prototypes */