| 1 | #!/usr/bin/make -f |
| 2 | # -*- makefile -*- |
| 3 | |
| 4 | export NO_PKG_MANGLEscip-makefile . . . NO_PKG_MANGLE.=1 |
| 5 | export LC_ALLscip-makefile . . . LC_ALL.=C.UTF-8 |
| 6 | export PYTHONWARNINGSscip-makefile . . . PYTHONWARNINGS.=d |
| 7 | |
| 8 | export PYBUILD_BEFORE_TESTscip-makefile . . . PYBUILD_BEFORE_TEST.=cp -r sphinx/locale {build_dir}/sphinx/ |
| 9 | export PYBUILD_TEST_ARGSscip-makefile . . . PYBUILD_TEST_ARGS.=--verbose --ignore tests/test_writers/test_api_translator.py |
| 10 | |
| 11 | localesscip-makefile . . . locales. = $(notdir $(patsubst %/LC_MESSAGES,%,$(wildcard sphinx/locale/*/LC_MESSAGES))) |
| 12 | |
| 13 | debrootscip-makefile . . . debroot. = debian/tmp/ |
| 14 | py3_libdirscip-makefile . . . py3_libdir. = /usr/lib/$(shell py3versions -d)/dist-packages |
| 15 | py3_builddirscip-makefile . . . py3_builddir. = $(shell pybuild --print build_dir --interpreter python3) |
| 16 | javascript_pathscip-makefile . . . javascript_path. = /usr/share/javascript/sphinxdoc/1.0/ |
| 17 | |
| 18 | %scip-makefile . . . `%`/: |
| 19 | dh $@scip-makefile . . . `@`. --with python3 --buildsystem=pybuild |
| 20 | |
| 21 | override_dh_auto_buildscip-makefile . . . override_dh_auto_build/: |
| 22 | set -e; \ |
| 23 | cd sphinx/search; for f in $$(ls non-minified-js); do \ |
| 24 | uglifyjs non-minified-js/$$f --compress --mangle --output minified-js/$$f; \ |
| 25 | done |
| 26 | python3 ./utils/generate_snowball.py |
| 27 | dh_auto_build |
| 28 | ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" "" |
| 29 | PYTHONPATH=$(py3_builddirscip-makefile . . . py3_builddir.) python3 ./sphinx/cmd/build.py -T doc build/html/ |
| 30 | find build/html/ -name '*.txt' -or -name '*.html' | xargs -L1 sed -i \ |
| 31 | 's!https://docutils.sourceforge.io/docs/!file:///usr/share/doc/docutils-doc/docs/!g' |
| 32 | PYTHONPATH=$(py3_builddirscip-makefile . . . py3_builddir.) python3 ./sphinx/cmd/build.py -T -b man doc build/man |
| 33 | endif |
| 34 | PYTHONPATH=$(py3_builddirscip-makefile . . . py3_builddir.) python3 ./utils/babel_runner.py compile |
| 35 | |
| 36 | override_dh_auto_installscip-makefile . . . override_dh_auto_install/: |
| 37 | pybuild --install -p $(shell py3versions -vd) |
| 38 | # move static files outside dist-packages |
| 39 | sed -i -e "s!^package_dir: Final = .*!package_dir: Final = _StrPath('/usr/share/sphinx')!" \ |
| 40 | $(debrootscip-makefile . . . debroot.)$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/__init__.py |
| 41 | mkdir -p $(debrootscip-makefile . . . debroot.)/usr/share/sphinx |
| 42 | cd $(debrootscip-makefile . . . debroot.) && mv -t usr/share/sphinx/ \ |
| 43 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/templates \ |
| 44 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/texinputs \ |
| 45 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/themes |
| 46 | mkdir -p $(debrootscip-makefile . . . debroot.)/usr/share/sphinx/ext/autosummary/ |
| 47 | cd $(debrootscip-makefile . . . debroot.) && mv -t usr/share/sphinx/ext/autosummary/ \ |
| 48 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/ext/autosummary/templates |
| 49 | mkdir -p $(debrootscip-makefile . . . debroot.)/usr/share/sphinx/search/ |
| 50 | cd $(debrootscip-makefile . . . debroot.) && mv -t usr/share/sphinx/search/ \ |
| 51 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/search/minified-js \ |
| 52 | .$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/search/non-minified-js |
| 53 | set -e -x; \ |
| 54 | cd $(debrootscip-makefile . . . debroot.) && \ |
| 55 | for lang in $(localesscip-makefile . . . locales.); \ |
| 56 | do \ |
| 57 | install -m 644 -D $(CURDIRscip-makefile . . . CURDIR.)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.js \ |
| 58 | usr/share/sphinx/locale/$$lang/sphinx.js; \ |
| 59 | install -m 644 -D $(CURDIRscip-makefile . . . CURDIR.)/sphinx/locale/$$lang/LC_MESSAGES/sphinx.mo \ |
| 60 | usr/share/locale/$$lang/LC_MESSAGES/sphinx.mo; \ |
| 61 | done |
| 62 | cd $(debrootscip-makefile . . . debroot.)$(py3_libdirscip-makefile . . . py3_libdir.)/sphinx/locale && rm -rf sphinx.pot */ |
| 63 | # Move JavaScript code to libjs-sphinxdoc: |
| 64 | cp -f \ |
| 65 | sphinx/themes/basic/static/doctools.js \ |
| 66 | sphinx/themes/basic/static/searchtools.js \ |
| 67 | sphinx/themes/bizstyle/static/css3-mediaqueries.js \ |
| 68 | sphinx/themes/scrolls/static/theme_extras.js \ |
| 69 | debian/libjs-sphinxdoc$(javascript_pathscip-makefile . . . javascript_path.) |
| 70 | PYTHONPATH=$(py3_builddirscip-makefile . . . py3_builddir.) debian/dh-sphinxdoc/install-js debian/libjs-sphinxdoc$(javascript_pathscip-makefile . . . javascript_path.) |
| 71 | rm -f $(debrootscip-makefile . . . debroot.)/usr/share/sphinx/themes/bizstyle/static/css3-mediaqueries_src.js |
| 72 | set -e; \ |
| 73 | for js in $$(find $(debrootscip-makefile . . . debroot.)/usr/share/sphinx/themes/ -name '*.js' -a '!' -name 'websupport.js'); do \ |
| 74 | mv $$js debian/libjs-sphinxdoc/$(javascript_pathscip-makefile . . . javascript_path.); \ |
| 75 | ln -sf "$(javascript_pathscip-makefile . . . javascript_path.)/$${js##*/}" $$js; \ |
| 76 | done |
| 77 | |
| 78 | override_dh_installchangelogsscip-makefile . . . override_dh_installchangelogs/: |
| 79 | dh_installchangelogs CHANGES.rst |
| 80 | |
| 81 | override_dh_installdocsscip-makefile . . . override_dh_installdocs/: |
| 82 | dh_installdocs |
| 83 | ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" "" |
| 84 | ./debian/dh-sphinxdoc/dh_sphinxdoc -p sphinx-doc /usr/share/doc/sphinx-doc/html/ |
| 85 | endif |
| 86 | |
| 87 | override_dh_installmanscip-makefile . . . override_dh_installman/: |
| 88 | cd debian/dh-sphinxdoc/ && pod2man -c Debhelper -r '' dh_sphinxdoc dh_sphinxdoc.1 |
| 89 | ifeq "$(filter nodoc,$(DEB_BUILD_OPTIONS))" "" |
| 90 | dh_installman |
| 91 | endif |
| 92 | |
| 93 | override_dh_compressscip-makefile . . . override_dh_compress/: |
| 94 | dh_compress -X.py -X.rst -X.json -X.txt |