blob: 7a6370ae0e06c91a0685799879ca510f3aadd7d4 (
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
|
CFLAGS = -g -O2 -Wall -Wunused -Waddress
DBUS_FLAGS = $(shell pkg-config --cflags --libs dbus-1)
GIO_FLAGS := $(shell pkg-config --cflags --libs 'glib-2.0 >= 2.26' gio-2.0 gio-unix-2.0)
PCAP_CONFIG ?= pcap-config
PCAP_FLAGS := $(shell $(PCAP_CONFIG) --cflags pcap-config --libs)
DESTDIR =
PREFIX = /usr/local
BINDIR = $(DESTDIR)$(PREFIX)/bin
DATADIR = $(DESTDIR)$(PREFIX)/share
MAN1DIR = $(DATADIR)/man/man1
BINARIES = \
dist/build/bustle-pcap \
$(NULL)
MANPAGE = bustle-pcap.1
DESKTOP_FILE = org.freedesktop.Bustle.desktop
APPDATA_FILE = org.freedesktop.Bustle.appdata.xml
SCALABLE_ICONS = \
data/icons/hicolor/scalable/apps/org.freedesktop.Bustle.svg \
data/icons/hicolor/scalable/apps/org.freedesktop.Bustle.Devel.svg \
data/icons/hicolor/scalable/apps/org.freedesktop.Bustle-symbolic.svg \
$(NULL)
all: $(BINARIES) $(MANPAGE) $(DESKTOP_FILE) $(APPDATA_FILE) $(SCALABLE_ICONS)
BUSTLE_PCAP_SOURCES = c-sources/pcap-monitor.c c-sources/bustle-pcap.c
BUSTLE_PCAP_GENERATED_HEADERS = dist/build/autogen/version.h
BUSTLE_PCAP_HEADERS = c-sources/pcap-monitor.h $(BUSTLE_PCAP_GENERATED_HEADERS)
bustle-pcap.1: dist/build/bustle-pcap
help2man --output=$@ --no-info --name='Generate D-Bus logs for bustle' $<
org.freedesktop.Bustle.desktop: data/org.freedesktop.Bustle.desktop.in
msgfmt --desktop -d po --template $< -o $@
org.freedesktop.Bustle.appdata.xml: data/org.freedesktop.Bustle.appdata.xml.in
msgfmt --xml -d po --template $< -o $@
# https://github.com/flathub/flathub/wiki/Review-Guidelines
validate-metadata: org.freedesktop.Bustle.desktop org.freedesktop.Bustle.appdata.xml
desktop-file-validate org.freedesktop.Bustle.desktop
appstream-util validate-relax org.freedesktop.Bustle.appdata.xml
# This is only a SHOULD. Screenshots currently violate it because they
# are hidpi.
appstream-util validate org.freedesktop.Bustle.appdata.xml || true
dist/build/bustle-pcap: $(BUSTLE_PCAP_SOURCES) $(BUSTLE_PCAP_HEADERS)
@mkdir -p dist/build
$(CC) -Idist/build/autogen $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) \
-o $@ $(BUSTLE_PCAP_SOURCES) \
$(GIO_FLAGS) $(PCAP_FLAGS)
dist/build/autogen/version.txt: bustle.cabal
@mkdir -p `dirname $@`
perl -nle 'm/^Version:\s+(.*)$$/ and print $$1' \
$< > $@
dist/build/autogen/version.h: dist/build/autogen/version.txt
echo '#define BUSTLE_VERSION "'`cat $<`'"' > $@
install: all
mkdir -p $(BINDIR)
cp $(BINARIES) $(BINDIR)
-mkdir -p $(MAN1DIR)
-cp $(MANPAGE) $(MAN1DIR)
mkdir -p $(DATADIR)/applications
cp $(DESKTOP_FILE) $(DATADIR)/applications
mkdir -p $(DATADIR)/appdata
cp $(APPDATA_FILE) $(DATADIR)/appdata
mkdir -p $(DATADIR)/icons/hicolor/scalable/apps
cp $(SCALABLE_ICONS) $(DATADIR)/icons/hicolor/scalable/apps
$(MAKE) update-icon-cache
uninstall:
rm -f $(BINDIR)/$(notdir $(BINARIES))
rm -f $(MAN1DIR)/$(MANPAGE)
rm -f $(DATADIR)/applications/$(DESKTOP_FILE)
rm -f $(DATADIR)/appdata/$(APPDATA_FILE)
rm -f $(DATADIR)/icons/hicolor/scalable/apps/org.freedesktop.Bustle.svg
rm -f $(DATADIR)/icons/hicolor/scalable/apps/org.freedesktop.Bustle.Devel.svg
rm -f $(DATADIR)/icons/hicolor/scalable/apps/org.freedesktop.Bustle-symbolic.svg
$(MAKE) update-icon-cache
clean:
rm -f $(BINARIES) $(MANPAGE) $(BUSTLE_PCAP_GENERATED_HEADERS) $(DESKTOP_FILE) $(APPDATA_FILE)
# Icon cache stuff
gtk_update_icon_cache = gtk-update-icon-cache -f -t $(DATADIR)/icons/hicolor
update-icon-cache:
@-if test -z "$(DESTDIR)"; then \
echo "Updating GTK+ icon cache."; \
$(gtk_update_icon_cache); \
else \
echo "*** Icon cache not updated. After (un)install, run this:"; \
echo "*** $(gtk_update_icon_cache)"; \
fi
# Flatpak stuff
org.freedesktop.Bustle.flatpak: flatpak/org.freedesktop.Bustle.json
rm -rf _build
flatpak-builder --repo=repo -v _build $<
flatpak build-bundle repo org.freedesktop.Bustle.flatpak org.freedesktop.Bustle
# Maintainer stuff
maintainer-update-messages-pot:
find Bustle -name '*.hs' -print0 | xargs -0 stack exec -- hgettext -k __ -o po/messages.pot
xgettext data/bustle.ui data/org.freedesktop.Bustle.desktop.in \
data/org.freedesktop.Bustle.appdata.xml.in --join-existing -o po/messages.pot
maintainer-make-release: bustle.cabal dist/build/autogen/version.txt
stack sdist --test-tarball
git tag -s -m 'Bustle '`cat dist/build/autogen/version.txt` \
bustle-`cat dist/build/autogen/version.txt`
gpg --detach-sign --armor dist/bustle-`cat dist/build/autogen/version.txt`.tar.gz
|