-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
283 lines (228 loc) · 8.48 KB
/
Makefile
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
# Create a local.mk file to store default local settings to override the
# defaults below.
include $(wildcard local.mk)
# packagers, set DESTDIR to your "package directory" and PREFIX to the prefix you want to have on the end-user system
# end-users who build from source: don't care about DESTDIR, update PREFIX if you want to
# RUN_PREFIX : what the prefix is when the software is run. usually the same as PREFIX
PREFIX ?= /usr/local
INSTALLDIR ?= $(DESTDIR)$(PREFIX)
MANDIR ?= $(INSTALLDIR)/share/man
DOCDIR ?= $(INSTALLDIR)/share/uzbl/docs
RUN_PREFIX ?= $(PREFIX)
INSTALL ?= install -p
ENABLE_WEBKIT2 ?= no
ENABLE_GTK3 ?= auto
PYTHON = python3
# --- configuration ends here ---
ifeq ($(ENABLE_WEBKIT2),auto)
ENABLE_WEBKIT2 := $(shell pkg-config --exists webkit2gtk-3.0 && echo yes)
endif
ifeq ($(ENABLE_GTK3),auto)
ENABLE_GTK3 := $(shell pkg-config --exists gtk+-3.0 && echo yes)
endif
ifeq ($(ENABLE_WEBKIT2),yes)
REQ_PKGS += 'webkit2gtk-3.0 >= 1.2.4' javascriptcoregtk-3.0
CPPFLAGS += -DUSE_WEBKIT2
# WebKit2 requires GTK3
ENABLE_GTK3 := yes
else
ifeq ($(ENABLE_GTK3),yes)
REQ_PKGS += 'webkitgtk-3.0 >= 1.2.4' javascriptcoregtk-3.0
else
REQ_PKGS += 'webkit-1.0 >= 1.2.4' javascriptcoregtk-1.0
endif
endif
ifeq ($(ENABLE_GTK3),yes)
REQ_PKGS += gtk+-3.0
CPPFLAGS += -DG_DISABLE_DEPRECATED
# WebKitGTK uses deprecated features, so uzbl can't blanket this out.
#CPPFLAGS += -DGTK_DISABLE_DEPRECATED
else
REQ_PKGS += gtk+-2.0
endif
REQ_PKGS += 'libsoup-2.4 >= 2.33.4' gthread-2.0 glib-2.0
ARCH := $(shell uname -m)
COMMIT_HASH := $(shell ./misc/hash.sh)
CPPFLAGS += -D_XOPEN_SOURCE=500 -DARCH=\"$(ARCH)\" -DCOMMIT=\"$(COMMIT_HASH)\"
HAVE_LIBSOUP_VERSION := $(shell pkg-config --exists 'libsoup-2.4 >= 2.41.1' && echo yes)
ifeq ($(HAVE_LIBSOUP_VERSION),yes)
CPPFLAGS += -DHAVE_LIBSOUP_CHECK_VERSION
endif
ifeq ($(ENABLE_WEBKIT2),yes)
HAVE_WEBKIT2_TLS_API := $(shell pkg-config --exists 'webkit2gtk-3.0 >= 2.3.1' && echo yes)
ifeq ($(HAVE_WEBKIT2_TLS_API),yes)
REQ_PKGS += gnutls
endif
endif
PKG_CFLAGS := $(shell pkg-config --cflags $(REQ_PKGS))
LDLIBS := $(shell pkg-config --libs $(REQ_PKGS) x11)
CFLAGS += -std=c99 $(PKG_CFLAGS) -ggdb -W -Wall -Wextra -pthread -Wunused-function
SOURCES := \
comm.c \
commands.c \
events.c \
gui.c \
inspector.c \
io.c \
js.c \
requests.c \
scheme.c \
status-bar.c \
util.c \
uzbl-core.c \
variables.c \
3p/async-queue-source/rb-async-queue-watch.c
HEADERS := \
comm.h \
commands.h \
config.h \
events.h \
gui.h \
inspector.h \
io.h \
js.h \
requests.h \
menu.h \
scheme.h \
setup.h \
status-bar.h \
util.h \
uzbl-core.h \
variables.h \
webkit.h \
3p/async-queue-source/rb-async-queue-watch.h
ifneq ($(ENABLE_WEBKIT2),yes)
SOURCES += \
cookie-jar.c \
scheme-request.c \
soup.c
HEADERS += \
cookie-jar.h \
scheme-request.h \
soup.h
endif
SRC = $(addprefix src/,$(SOURCES))
HEAD = $(addprefix src/,$(HEADERS))
OBJ = $(foreach obj, $(SRC:.c=.o), $(obj))
LOBJ = $(foreach obj, $(SRC:.c=.lo), $(obj))
PY = $(wildcard uzbl/*.py uzbl/plugins/*.py)
all: uzbl-browser
VPATH := src
${OBJ}: ${HEAD}
uzbl-core: ${OBJ}
uzbl-browser: uzbl-core uzbl-event-manager uzbl-browser.1 uzbl.desktop bin/uzbl-browser
uzbl-browser.1: uzbl-browser.1.in
sed 's#@PREFIX@#$(PREFIX)#' < uzbl-browser.1.in > uzbl-browser.1
uzbl.desktop: uzbl.desktop.in
sed 's#@PREFIX@#$(PREFIX)#' < uzbl.desktop.in > uzbl.desktop
bin/uzbl-browser: bin/uzbl-browser.in
sed 's#@PREFIX@#$(PREFIX)#' < bin/uzbl-browser.in > bin/uzbl-browser
chmod +x bin/uzbl-browser
build: ${PY}
$(PYTHON) setup.py build
.PHONY: uzbl-event-manager
uzbl-event-manager: build
# this is here because the .so needs to be compiled with -fPIC on x86_64
${LOBJ}: ${SRC} ${HEAD}
$(CC) $(CPPFLAGS) $(CFLAGS) -fPIC -c src/$(@:.lo=.c) -o $@
test-uzbl-core: uzbl-core
./uzbl-core --uri http://www.uzbl.org --verbose
test-uzbl-browser: uzbl-browser
./bin/uzbl-browser --uri http://www.uzbl.org --verbose
test-uzbl-core-sandbox: sandbox uzbl-core sandbox-install-uzbl-core sandbox-install-example-data
./sandbox/env.sh uzbl-core --uri http://www.uzbl.org --verbose
make DESTDIR=./sandbox uninstall
rm -rf ./sandbox/usr
test-uzbl-browser-sandbox: sandbox uzbl-browser sandbox-install-uzbl-browser sandbox-install-example-data
./sandbox/env.sh ${PYTHON} -S sandbox/usr/bin/uzbl-event-manager restart -navv &
./sandbox/env.sh uzbl-browser --uri http://www.uzbl.org --verbose
./sandbox/env.sh ${PYTHON} -S sandbox/usr/bin/uzbl-event-manager stop -vv -o /dev/null
make DESTDIR=./sandbox uninstall
rm -rf ./sandbox/usr
test-uzbl-tabbed-sandbox: sandbox uzbl-browser sandbox-install-uzbl-browser sandbox-install-uzbl-tabbed sandbox-install-example-data
./sandbox/env.sh ${PYTHON} -S sandbox/usr/bin/uzbl-event-manager restart -avv
./sandbox/env.sh uzbl-tabbed
./sandbox/env.sh ${PYTHON} -S sandbox/usr/bin/uzbl-event-manager stop -avv
make DESTDIR=./sandbox uninstall
rm -rf ./sandbox/usr
test-uzbl-event-manager-sandbox: sandbox uzbl-browser sandbox-install-uzbl-browser sandbox-install-example-data
./sandbox/env.sh ${PYTHON} -S sandbox/usr/bin/uzbl-event-manager restart -navv
make DESTDIR=./sandbox uninstall
rm -rf ./sandbox/usr
clean:
rm -f uzbl-core
rm -f $(OBJ) ${LOBJ}
rm -f uzbl.desktop
rm -f bin/uzbl-browser
find ./examples/ -name "*.pyc" -delete || :
find -name __pycache__ -type d -delete || :
rm -rf ./sandbox/
$(PYTHON) setup.py clean
strip:
@echo Stripping binary
@strip uzbl-core
@echo ... done.
SANDBOXOPTS=\
DESTDIR=./sandbox \
PREFIX=/usr \
RUN_PREFIX=`pwd`/sandbox/usr \
PYINSTALL_EXTRA='--prefix=./usr --install-scripts=./usr/bin'
sandbox: misc/env.sh
mkdir -p sandbox/usr/lib64
cp -p misc/env.sh sandbox/env.sh
test -e sandbox/usr/lib || ln -s lib64 sandbox/usr/lib
sandbox-install-uzbl-browser:
make ${SANDBOXOPTS} install-uzbl-browser
sandbox-install-uzbl-tabbed:
make ${SANDBOXOPTS} install-uzbl-tabbed
sandbox-install-uzbl-core:
make ${SANDBOXOPTS} install-uzbl-core
sandbox-install-event-manager:
make ${SANDBOXOPTS} install-event-manager
sandbox-install-example-data:
make ${SANDBOXOPTS} install-example-data
install: install-uzbl-core install-uzbl-browser install-uzbl-tabbed
install-dirs:
[ -d "$(INSTALLDIR)/bin" ] || $(INSTALL) -d -m755 $(INSTALLDIR)/bin
[ -d "$(MANDIR)/man1" ] || $(INSTALL) -d $(MANDIR)/man1
[ -d "$(DOCDIR)" ] || $(INSTALL) -d $(DOCDIR)
[ -d "$(INSTALLDIR)/share/uzbl" ] || $(INSTALL) -d $(INSTALLDIR)/share/uzbl
[ -d "$(INSTALLDIR)/share/applications" ] || $(INSTALL) -d $(INSTALLDIR)/share/applications
install-uzbl-core: uzbl-core install-dirs
$(INSTALL) -m644 docs/*.md $(DOCDIR)/
$(INSTALL) -m644 src/config.h $(DOCDIR)/
$(INSTALL) -m644 README.md $(DOCDIR)/
$(INSTALL) -m644 AUTHORS $(DOCDIR)/
$(INSTALL) -m755 uzbl-core $(INSTALLDIR)/bin/uzbl-core
$(INSTALL) -m644 uzbl-core.1 $(MANDIR)/man1/uzbl-core.1
install-event-manager: install-dirs
$(INSTALL) -m644 uzbl-event-manager.1 $(MANDIR)/man1/uzbl-event-manager.1
ifeq ($(DESTDIR),)
$(PYTHON) setup.py install --prefix=$(PREFIX) $(PYINSTALL_EXTRA)
else
$(PYTHON) setup.py install --prefix=$(PREFIX) --root=$(DESTDIR) $(PYINSTALL_EXTRA)
endif
install-uzbl-browser: install-dirs install-uzbl-core install-event-manager
$(INSTALL) -m755 bin/uzbl-browser $(INSTALLDIR)/bin/uzbl-browser
#sed 's#@PREFIX@#$(PREFIX)#g' < README.browser.md > README.browser.md
#$(INSTALL) -m644 README.browser.md $(DOCDIR)/README.browser.md
#sed 's#@PREFIX@#$(PREFIX)#g' < README.event-manager.md > README.event-manager.md
#$(INSTALL) -m644 README.event-manager.md $(DOCDIR)/README.event-manager.md
cp -rv examples $(INSTALLDIR)/share/uzbl/examples
chmod 755 $(INSTALLDIR)/share/uzbl/examples/data/scripts/*.sh $(INSTALLDIR)/share/uzbl/examples/data/scripts/*.py
$(INSTALL) -m644 uzbl.desktop $(INSTALLDIR)/share/applications/uzbl.desktop
$(INSTALL) -m644 uzbl-browser.1 $(MANDIR)/man1/uzbl-browser.1
install-uzbl-tabbed: install-dirs
$(INSTALL) -m755 bin/uzbl-tabbed $(INSTALLDIR)/bin/uzbl-tabbed
# you probably only want to do this manually when testing and/or to the sandbox. not meant for distributors
install-example-data:
$(INSTALL) -d $(DESTDIR)/home/.config/uzbl
$(INSTALL) -d $(DESTDIR)/home/.cache/uzbl
$(INSTALL) -d $(DESTDIR)/home/.local/share/uzbl
cp -rp examples/config/* $(DESTDIR)/home/.config/uzbl/
cp -rp examples/data/* $(DESTDIR)/home/.local/share/uzbl/
uninstall:
rm -rf $(INSTALLDIR)/bin/uzbl-*
rm -rf $(MANDIR)/man1/uzbl-*
rm -rf $(INSTALLDIR)/share/uzbl
rm -rf $(INSTALLDIR)/share/applications/uzbl.desktop