aboutsummaryrefslogtreecommitdiffstats
path: root/meta-oe/recipes-graphics/unclutter-xfixes/unclutter-xfixes/0001-build-use-autotools.patch
blob: 0c9fe62b1fc2ce3abc8f9d285a12a528899a9e25 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
From 2a5cf5021b56bc92c9953d2c82e8c90502d22c97 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date: Fri, 13 Sep 2019 10:20:53 +0200
Subject: [PATCH] build: use autotools

This removes the hand-crafted Makefile in favor of standardized autotools
build configuration. This is done to allow for easy cross-compilation of
this project.

Upstream-Status: Submitted

Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
---
 .gitignore          | 17 ++++++++++++
 Makefile            | 66 ---------------------------------------------
 Makefile.am         | 10 +++++++
 configure.ac        | 36 +++++++++++++++++++++++++
 include/Makefile.am |  9 +++++++
 man/Makefile.am     |  7 +++++
 obj/.gitkeep        |  0
 src/Makefile.am     | 13 +++++++++
 8 files changed, 92 insertions(+), 66 deletions(-)
 delete mode 100644 Makefile
 create mode 100644 Makefile.am
 create mode 100644 configure.ac
 create mode 100644 include/Makefile.am
 create mode 100644 man/Makefile.am
 delete mode 100644 obj/.gitkeep
 create mode 100644 src/Makefile.am

diff --git a/.gitignore b/.gitignore
index af88e94..4e7355a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,20 @@ obj/*.o
 man/*.1
 man/*.xml
 test/GLOB*
+*.o
+
+# autotools stuff
+.deps/
+Makefile
+Makefile.in
+aclocal.m4
+autom4te.cache/
+autostuff/
+config.h
+config.h.in
+config.h.in~
+config.log
+config.status
+configure
+m4/
+stamp-h1
diff --git a/Makefile b/Makefile
deleted file mode 100644
index 6264da0..0000000
--- a/Makefile
+++ /dev/null
@@ -1,66 +0,0 @@
-TARGET = unclutter
-VERSION = 1.6
-SDIR = src
-IDIR = include
-ODIR = obj
-
-INSTALL = install
-PREFIX = /usr
-
-BINDIR = $(PREFIX)/bin
-MANDIR = $(PREFIX)/share/man/man1
-LICENSEDIR = $(PREFIX)/share/licenses/$(TARGET)
-
-CC = gcc
-LD = $(CC)
-PKG_CONFIG = pkg-config
-
-CPPFLAGS += -D'__VERSION="${VERSION}"' "-I$(IDIR)"
-
-CFLAGS += -std=gnu99
-CFLAGS += -Wall -Wundef -Wshadow -Wformat-security
-
-LDFLAGS += $(shell $(PKG_CONFIG) --libs x11 xi xfixes)
-# libev has no pkg-config support
-LDFLAGS += -lev
-
-INCS = $(wildcard $(IDIR)/*.h)
-SRCS = $(wildcard $(SDIR)/*.c)
-OBJS = $(patsubst %,$(ODIR)/%,$(notdir $(SRCS:.c=.o)))
-
-MANS = man/unclutter-xfixes.1
-
-.NOTPARALLEL:
-
-.PHONY: all
-all: clean $(TARGET) mans
-
-.PHONY: $(TARGET)
-$(TARGET): $(OBJS)
-	$(LD) $(OBJS) $(LDFLAGS) -o "$(TARGET)"
-
-$(ODIR)/%.o: $(SDIR)/%.c $(INCS)
-	$(CC) $(CPPFLAGS) $(CFLAGS) -o "$@" -c "$<"
-
-.PHONY: install
-install: $(TARGET) mans
-	$(INSTALL) -Dm 0755 "$(TARGET)" "$(DESTDIR)$(BINDIR)/$(TARGET)"
-	$(INSTALL) -Dm 0644 man/unclutter-xfixes.1 "$(DESTDIR)$(MANDIR)/unclutter.1"
-	$(INSTALL) -Dm 0644 -t "$(DESTDIR)$(LICENSEDIR)/" LICENSE
-
-.PHONY: uninstall
-uninstall:
-	$(RM) "$(DESTDIR)$(BINDIR)/$(TARGET)"
-	$(RM) "$(DESTDIR)$(MANDIR)/unclutter.1"
-	$(RM) "$(DESTDIR)$(LICENSEDIR)/LICENSE"
-
-.PHONY: mans
-mans: $(MANS)
-
-$(MANS): %.1: %.man
-	a2x --no-xmllint -f manpage "$<"
-
-.PHONY: clean
-clean:
-	$(RM) $(TARGET) $(OBJS)
-	$(RM) man/*.1 man/*.xml
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..38ecaa1
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,10 @@
+ACLOCAL_AMFLAGS = -I m4
+AUTOMAKE_OPTIONS = foreign
+SUBDIRS = include src
+
+if HAS_A2X
+SUBDIRS += man
+endif
+
+licensedir = $(datadir)/licenses/unclutter
+license_DATA = LICENSE
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..1d59197
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,36 @@
+AC_PREREQ(2.61)
+
+AC_INIT([unclutter-xfixes], 1.6)
+AC_DEFINE_UNQUOTED([VERSION], ["$PACKAGE_VERSION"])
+
+AC_CONFIG_AUX_DIR([autostuff])
+AC_CONFIG_MACRO_DIRS([m4])
+AM_INIT_AUTOMAKE([foreign subdir-objects])
+
+m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
+
+AC_CONFIG_SRCDIR([src])
+AC_CONFIG_HEADER([config.h])
+
+AM_PROG_AR
+AC_PROG_CC
+AC_PROG_INSTALL
+
+# libev has no pkg-config support
+AC_CHECK_HEADERS([ev.h], [], [AC_MSG_ERROR([ev.h not found - please install libev])])
+
+PKG_CHECK_MODULES([X11], [x11 xi xfixes])
+
+AC_CHECK_PROG([has_a2x], [a2x], [true], [false])
+AM_CONDITIONAL([HAS_A2X], [test "x$has_a2x" = xtrue])
+if test "x$has_a2x" = xfalse
+then
+	AC_MSG_NOTICE([a2x not found - needed to generate man pages])
+fi
+
+AC_CONFIG_FILES([Makefile
+		 include/Makefile
+		 src/Makefile
+		 man/Makefile])
+
+AC_OUTPUT
diff --git a/include/Makefile.am b/include/Makefile.am
new file mode 100644
index 0000000..90d8bbc
--- /dev/null
+++ b/include/Makefile.am
@@ -0,0 +1,9 @@
+noinst_HEADERS = \
+	all.h \
+	cursor.h \
+	event.h \
+	extensions.h \
+	externals.h \
+	globals.h \
+	types.h \
+	util.h
diff --git a/man/Makefile.am b/man/Makefile.am
new file mode 100644
index 0000000..7856e6a
--- /dev/null
+++ b/man/Makefile.am
@@ -0,0 +1,7 @@
+unclutter-xfixes.1:
+	a2x --no-xmllint -f manpage unclutter-xfixes.man
+
+dist_man1_MANS = unclutter-xfixes.1
+
+clean-local:
+	rm -f unclutter-xfixes.1
diff --git a/obj/.gitkeep b/obj/.gitkeep
deleted file mode 100644
index e69de29..0000000
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100644
index 0000000..c7f0729
--- /dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,13 @@
+AM_CFLAGS = -D'__VERSION="${VERSION}"' "-I$(top_srcdir)/include"
+AM_CFLAGS += -std=gnu99 -Wall -Wundef -Wshadow -Wformat-security
+AM_CFLAGS += $(X11_CFLAGS)
+AM_LDFLAGS = -lev $(X11_LIBS)
+
+bin_PROGRAMS = unclutter
+
+unclutter_SOURCES = \
+	cursor.c \
+	event.c \
+	extensions.c \
+	unclutter.c \
+	util.c
-- 
2.21.0