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
|
#!/usr/bin/make -f
# resolve DEB_VERSION
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
export DEB_CXXFLAGS_MAINT_APPEND = -Wall -pedantic
# trust upstream optimization level unless explicitly disabled
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
export DEB_CFLAGS_MAINT_STRIP=-O2
export DEB_CXXFLAGS_MAINT_STRIP=-O2
endif
# generate documentation unless nodoc requested
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DOCS = README.html README.txt
CHANGELOGS = CHANGELOG.html CHANGELOG.txt
MANPAGES = debian/rsass.1
endif
# reduce risk of out-of-memory issues during build for weak arches
ifneq (,$(filter $(DEB_HOST_ARCH),armel armhf i386 mipsel riscv64))
export RUSTFLAGS += -C embed-bitcode=no -C lto=no -C linker-plugin-lto=no
endif
# Fails on i386 since 0.28.2: <https://github.com/kaj/rsass/issues/182>
ifneq (,$(filter $(DEB_HOST_ARCH_CPU),i386))
TEST_FLAKY += \
core_functions::math::log::base::one_fuzzy
endif
# Fails on i386 since 0.29.0: <https://github.com/kaj/rsass/issues/209>
ifneq (,$(filter $(DEB_HOST_ARCH_CPU),i386))
TEST_FLAKY += \
variablescope::test::color_simple_rgba \
core_functions::color::adjust::hsl::alpha_input \
core_functions::color::adjust::hwb::alpha_input \
core_functions::color::adjust::rgb::alpha_arg \
core_functions::color::adjust::rgb::alpha_input \
core_functions::color::adjust::units::alpha::percent \
core_functions::color::adjust::units::alpha::unitless \
core_functions::color::adjust::units::alpha::unknown \
core_functions::color::change::hsl::alpha_arg \
core_functions::color::change::hsl::alpha_input \
core_functions::color::change::hwb::alpha_arg \
core_functions::color::change::hwb::alpha_input \
core_functions::color::change::rgb::alpha_arg \
core_functions::color::change::rgb::alpha_input \
core_functions::color::complement::alpha \
core_functions::color::desaturate::alpha \
core_functions::color::grayscale::legacy::alpha \
core_functions::color::mix::alpha::even \
core_functions::color::mix::both_weights::transparent::last \
core_functions::color::mix::both_weights::weighted::last \
core_functions::color::rgb::four_args::in_gamut::named \
core_functions::color::rgb::one_arg::alpha::in_gamut::named \
core_functions::color::rgb::one_arg::alpha::in_gamut::parenthesized \
core_functions::color::scale::hsl::alpha_input \
core_functions::color::scale::hwb::alpha_input \
core_functions::color::scale::rgb::alpha_input \
core_functions::meta::get_function::same_module::plain_css \
libsass::color_functions::other::change_color::a::test \
libsass::color_functions::opacity::alpha::test \
libsass::color_functions::rgb::rgba::a::test \
libsass::units::conversion::size::test \
libsass_closed_issues::issue_1332::test \
libsass_closed_issues::issue_550::operator::test \
non_conformant::basic::t22_colors_with_alpha::test \
non_conformant::scss::composed_args::test \
values::calculation::max::simplified::third \
values::numbers::modulo::floats::larger::negative_positive \
values::numbers::modulo::floats::larger::positive_negative \
variablescope::test::color_simple_rgba
endif
# Fails on mips64el since 0.29.0: <https://github.com/kaj/rsass/issues/208>
ifneq (,$(filter $(DEB_HOST_ARCH),mips64el))
TEST_FLAKY += \
core_functions::color::hsl::four_args::out_of_gamut::alpha::degenerate::nan \
core_functions::color::hsl::four_args::out_of_gamut::saturation::degenerate::nan \
core_functions::color::hwb::four_args::alpha::degenerate::nan \
core_functions::color::rgb::four_args::clamped::alpha::degenerate::nan \
core_functions::color::rgb::four_args::clamped::blue::degenerate::nan \
core_functions::color::rgb::four_args::clamped::green::degenerate::nan \
core_functions::color::rgb::four_args::clamped::red::degenerate::nan
endif
# resolve crate version
# * get topmost version except prerelease suffix
# from Cargo.toml file in dir passed as argument
# * source package version if matching upstream part modulo prerelease
# * otherwise append source package version
crate_version = \
$(shell perl -n \
-E '/version\W+\K\d+\.\d+\.\d+/ ' \
-E 'and say "$(DEB_VERSION_UPSTREAM)" =~ /^\Q$$&\E(?:~[a-z]+\d*)?$$/ ? "$(DEB_VERSION)" : "$$&+$(DEB_VERSION_UPSTREAM_REVISION)" and exit' \
$1/Cargo.toml)
%:
dh $@
%.html: %.md
cmark-gfm $< > $@
%.txt: %.md
cmark-gfm --to plaintext $< > $@
execute_after_dh_auto_build: $(DOCS) $(CHANGELOGS)
override_dh_auto_test:
dh_auto_test --buildsystem rust -- --no-fail-fast -- $(addprefix --skip ,$(TEST_FLAKY))
RSASS=$(wildcard target/*/*/rsass) prove --verbose debian/tests/*.t
execute_after_dh_auto_install: $(MANPAGES)
# avoid cleaning unless source is patched
override_dh_auto_clean:
grep -q -- -PRE rsass*/Cargo.toml || dh_auto_clean --buildsystem rust
override_dh_installdocs:
dh_installdocs --package rsass -- $(DOCS)
dh_installdocs --remaining-packages --link-doc librust-rsass-dev -- $(DOCS)
override_dh_installchangelogs:
dh_installchangelogs -- $(CHANGELOGS)
# declare version for virtually provided embedded crate
override_dh_gencontrol:
dh_gencontrol -plibrust-rsass-dev -- \
-V'rust:Version:librust-rsass-macros-dev=$(call crate_version,rsass-macros)'
dh_gencontrol --remaining-packages
# build manpages
debian/rsass.1: debian/%.1: debian/rsass/usr/bin/%
mkdir --parents $(dir $@)
help2man --section 1 --no-info \
--name "compiles CSS from SCSS files" \
--output $@ $< \
|| { $1 --help; false; }
|