summaryrefslogtreecommitdiffstats
path: root/debian/rules
blob: d8711beebbc3f920dba8504c9a9ce4efc8f8e44f (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
#!/usr/bin/make -f

export LC_ALL=C.UTF-8

SASS_OPTIONS := --load-path debian/missing-sources/bourbon/app/assets/stylesheets \
                --load-path debian/missing-sources/bourbon-neat/app/assets/stylesheets \
                --load-path /usr/share/sass/font-awesome \
                --load-path debian/missing-sources/wyrm/sass \
                --style compressed \
                --sourcemap=none

COMMON_PATH = debian/sphinx-rtd-theme-common/usr/share/sphinx_rtd_theme
PY3_PATH = debian/python3-sphinx-rtd-theme/usr/lib/python3/dist-packages/sphinx_rtd_theme

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_auto_build:
	mkdir -p sphinx_rtd_theme/static/css
	sass $(SASS_OPTIONS) src/sass/theme.sass      sphinx_rtd_theme/static/css/theme.css
	sass $(SASS_OPTIONS) src/sass/badge_only.sass sphinx_rtd_theme/static/css/badge_only.css
	mkdir -p sphinx_rtd_theme/static/js
	sed s/module.exports.ThemeNav/_ThemeNav/ src/theme.js > sphinx_rtd_theme/static/js/theme.js
	mkdir -p sphinx_rtd_theme/static/fonts
	cp /usr/share/fonts/truetype/lato/Lato-Bold.ttf sphinx_rtd_theme/static/fonts/
	cp /usr/share/fonts/truetype/lato/Lato-BoldItalic.ttf sphinx_rtd_theme/static/fonts/
	cp /usr/share/fonts/truetype/lato/Lato-Italic.ttf sphinx_rtd_theme/static/fonts/
	cp /usr/share/fonts/truetype/lato/Lato-Regular.ttf sphinx_rtd_theme/static/fonts/
	cp /usr/share/fonts/opentype/roboto/slab/RobotoSlab-Bold.otf sphinx_rtd_theme/static/fonts/
	cp /usr/share/fonts/opentype/roboto/slab/RobotoSlab-Regular.otf sphinx_rtd_theme/static/fonts/
	set -ex; cd sphinx_rtd_theme/static/fonts/; for ttf in *.ttf; do woff2_compress $$ttf; done
	set -ex; cd sphinx_rtd_theme/static/fonts/; for otf in *.otf; do woff2_compress $$otf; done
	rm -fv sphinx_rtd_theme/static/fonts/*.otf
	python3 setup.py compile_catalog
	dh_auto_build

override_dh_link:
	dh_link -p sphinx-rtd-theme-common
	rm -rf $(PY3_PATH)/static
	set -ex; for d in static/css static/fonts static/js; do \
		mkdir -p $(PY3_PATH)/$$d; \
	done
	set -ex; for f in `cd $(COMMON_PATH) && find -type f -or -type l | sed "s,^\./,,"`; do \
		ln -sf /usr/share/sphinx_rtd_theme/$$f $(PY3_PATH)/$$f; \
	done
	dh_link --remaining-packages  # To make the created symlinks relative