1
2PACKAGE_NAME = font-manager
3PACKAGE_VERSION = 0.8.7
4
5ABS_TOP_SRCDIR = $(shell realpath ../)
6ABS_SRCDIR = $(shell realpath .)
7UNICODE_DATA_DIR = $(ABS_SRCDIR)/unicode/
8PKG_LIB_DIR = $(ABS_TOP_SRCDIR)/lib
9
10UNICODE_URL = http://www.unicode.org/Public
11UNICODE_VERSION = 13.0.0
12WGET = $(shell which wget)
13WGETFLAGS = -np -nd -rc -P $(UNICODE_DATA_DIR)
14UNZIP = $(shell which unzip)
15
16UNICODE_FILES = \
17	Blocks.txt \
18	DerivedAge.txt \
19	NamesList.txt \
20	Scripts.txt \
21	UnicodeData.txt \
22	Unihan.zip \
23	$(NULL)
24
25UNICODE_SOURCES = \
26	unicode-blocks.h \
27	unicode-categories.h \
28	unicode-names.h \
29	unicode-nameslist.h \
30	unicode-scripts.h \
31	unicode-unihan.h \
32	unicode-versions.h \
33	$(NULL)
34
35download-unicode-data:
36	[ -e $(UNICODE_DATA_DIR) ] || mkdir -p $(UNICODE_DATA_DIR); \
37	for f in $(UNICODE_FILES); \
38	do \
39		[ -e $(UNICODE_DATA_DIR)$${f} ] || \
40		$(WGET) $(WGETFLAGS) "$(UNICODE_URL)/$(UNICODE_VERSION)/ucd/$${f}"; \
41	done
42
43unicode-headers: download-unicode-data
44	PROG_UNZIP=$(UNZIP) ./gen-unicode-headers.pl $(UNICODE_VERSION) $(UNICODE_DATA_DIR) && \
45	for f in $(UNICODE_SOURCES); \
46	do \
47		mv $${f} $(PKG_LIB_DIR)/unicode/; \
48	done && \
49	rm -rf $(UNICODE_DATA_DIR)
50
51$(PACKAGE_NAME).pot:
52	cd $(ABS_TOP_SRCDIR)  && \
53	meson build && \
54	ninja -C build font-manager-pot && \
55	ninja -C build help-font-manager-pot && \
56	cd $(ABS_SRCDIR)
57
58$(PACKAGE_NAME)-license.h:
59	cd license && \
60	./genheader.py $(PKG_LIB_DIR)/common && \
61	cd ..
62
63$(PACKAGE_NAME)-vendor.h:
64	cd vendor && \
65	./genheader.py $(PKG_LIB_DIR)/common && \
66	cd ..
67
68update-headers: $(PACKAGE_NAME)-license.h $(PACKAGE_NAME)-vendor.h unicode-headers
69update: update-headers $(PACKAGE_NAME).pot
70
71rpm:
72	@echo -e "\n**** Need to ensure build dependencies are installed\n";
73	pkexec dnf install rpmdevtools
74	pkexec dnf builddep $(ABS_TOP_SRCDIR)/fedora/$(PACKAGE_NAME).spec
75	rpmdev-setuptree
76	cp $(ABS_TOP_SRCDIR)/fedora/$(PACKAGE_NAME).spec ~/rpmbuild/SPECS/
77	cd ~/rpmbuild/SPECS/ || exit && \
78	spectool -g -R $(PACKAGE_NAME).spec && \
79	rpmbuild -ba $(PACKAGE_NAME).spec
80
81BUILD_DEPENDS = \
82	build-essential \
83	debhelper \
84	valac \
85	meson \
86	libxml2-dev \
87	libfreetype6-dev \
88	libfontconfig1-dev \
89	libglib2.0-dev \
90	libjson-glib-dev \
91	libcairo2-dev \
92	libgtk-3-dev \
93	libpango1.0-dev \
94	libsqlite3-dev \
95	libgirepository1.0-dev \
96	yelp-tools \
97	python3 \
98	python-gi-dev \
99	python3-nautilus \
100	libsoup2.4-dev \
101	libwebkit2gtk-4.0-dev \
102	libnautilus-extension-dev \
103	libnemo-extension-dev \
104	libthunarx-3-dev
105
106deb:
107	@echo -e '\n*** Need to ensure build dependencies are installed ***\n\n'
108	pkexec apt install $(BUILD_DEPENDS)
109	cd $(ABS_TOP_SRCDIR) || exit && \
110	meson build && \
111	ninja -C build dist && \
112	cd build/meson-dist/ || exit && \
113	tar -xvf $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.xz && \
114	mv $(PACKAGE_NAME)-$(PACKAGE_VERSION).tar.xz \
115	./$(PACKAGE_NAME)_$(PACKAGE_VERSION).orig.tar.xz && \
116	cd $(PACKAGE_NAME)-$(PACKAGE_VERSION) || exit && \
117	cp -R ../../../debian . && \
118	dpkg-buildpackage -us -uc && \
119	cd $(ABS_SRCDIR) || exit && \
120	xdg-open ../build/meson-dist/
121
122