File: rules

package info (click to toggle)
openscad 2021.01-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 35,608 kB
  • sloc: cpp: 53,187; sh: 4,384; ansic: 4,382; python: 1,813; yacc: 853; javascript: 762; lex: 417; lisp: 163; xml: 127; makefile: 114
file content (141 lines) | stat: -rwxr-xr-x 6,498 bytes parent folder | download
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

# export DH_VERBOSE=1

include /usr/share/dpkg/pkg-info.mk
include /usr/share/dpkg/architecture.mk

# workaround for virtual memory exhaustion, see #883986
ifneq (,$(filter $(DEB_HOST_ARCH), mips mipsel powerpcspe))
    export DEB_CXXFLAGS_MAINT_APPEND = -g1
endif
TEST_DISABLE_MISC = issue1165\\|issue1215\\|throwntogethertest_issue1089\\|openscad-cameyeortho_camera-tests\\|openscad-cameyeortho-viewall_camera-tests
TEST_DISABLE_EXPERIMENTAL = astdumptest_allexpressions\\|echotest_function-literal-compare\\|echotest_function-literal-tests\\|echotest_allexpressions\\|lazyunion-.*
# Disable know failing tests on big-endian
# (https://github.com/3MFConsortium/lib3mf/issues/160)
ifeq ($(DEB_TARGET_ARCH_ENDIAN), big)
	TEST_DISABLE_BIGENDIAN = \\|3mfpngtest_cube10\\|3mfexport_3mf-export\\|cgalbinstlcgalpngtest_bad-stl-pcbvicebar\\|cgalbinstlcgalpngtest_bad-stl-tardis\\|cgalbinstlcgalpngtest_issue1225\\|cgalbinstlcgalpngtest_fn_bug
else
	TEST_DISABLE_BIGENDIAN =
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export QT_SELECT = qt5

# Limit parallel builds. The compilation can take a lot of memory (on the order
# of 2GB per process), try to avoid running out of memory or taking down the
# system in swap-o-death.
MAX_PARALLEL := $(shell perl -ne '$$p = int($$1/(3*1024**2)) if m/MemTotal:\s+(\d+)\s+kB/; END { if (defined($$p)) { $$p = 1 if $$p < 1; print "--max-parallel=$$p"} }' /proc/meminfo )

%:
	dh $@ --buildsystem=qmake

override_dh_auto_configure:
	dh_auto_configure -- \
		VERSION=$$(echo "$(DEB_VERSION_UPSTREAM)" | sed -e 's/-.*//' -e 's/~/-/') \
		CONFIG-=debug CONFIG+=qopenglwidget


override_dh_auto_build:
	dh_auto_build $(MAX_PARALLEL)

	# not run in dh_auto_configure stage, as it requires the openscad binary to be already built
	dh_auto_configure -Dtests --buildsystem=cmake

	dh_auto_build -Dtests --buildsystem=cmake

	# fix absolute paths in ctest scripts (relative paths will work during
	# the build time tests, and are catered for by the openscad-testrun
	# script).
	#
	# note that often, a `../openscad` reference remains. this is left in
	# place, as not all tools involved honor $PATH (eg. because they do an
	# explicit `os.path.exists` on their openscad binary).
	cd obj-* && perl -i.bak -npe 'use Cwd; my $$here = getcwd(); s/\Q$$here\E/./g' *.cmake
	perl -i.bak -npe 'use Cwd; my $$here = getcwd(); s/\Q$$here\/tests\E/./g' obj-*/*.cmake

override_dh_auto_test:
	# Workaround to have the test suite usable out-of-tree, until a fix can
	# be introduced upstream that makes ctest also work with out-of-tree
	# building.
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	cd obj-* && ln -s ../tests/* -t. || echo "Some files are expected to already be present."
endif

	# OPENSCADPATH has to be set because the default library dir is
	# determined based on the openscad binary's path (will be ok after
	# installation).
	#
	# clearing DISPLAY is not strictly necessary here as this is already
	# done by the build environment (at least by gbp buildpackage), but it
	# makes it clear that the intent is to always render the build-time
	# tests in software.
	#
	# as for the tests excluded with --exclude-regex, see README.testsuite.
	DISPLAY= OPENSCADPATH=/usr/share/openscad/libraries dh_auto_test -Dtests --buildsystem=cmake -- ARGS+="--exclude-regex $(TEST_DISABLE_MISC)\\|$(TEST_DISABLE_EXPERIMENTAL)$(TEST_DISABLE_BIGENDIAN)" || ( echo '---- content of ' obj-*/Testing/Temporary/*_report.html ' ----'; cat obj-*/Testing/Temporary/*_report.html; echo; echo '---- end content ----'; exit 0)

override_dh_auto_install:
	# fix absolute paths in generated scad files. this step logically
	# belongs to the similar lines in the dh_auto_build override, but can
	# first be done here because for the build time tests, the original
	# paths are still required.
	find testdata -name \*.scad  -exec perl -i -pe 'use Cwd; my $$here = getcwd(); s[\Q$$here\E/tests/../testdata][/usr/share/openscad/testdata]g' {} +

	dh_auto_install --destdir=debian/openscad

	install -d debian/openscad/usr/share/doc/openscad
	mv debian/openscad/usr/share/openscad/color-schemes/readme.txt \
	   debian/openscad/usr/share/doc/openscad/readme_color-schemes.txt

	# don't ship mcad, neither the empty directory (when this is built from
	# a normal git source checkout) nor the full library (when this is
	# built from a git checkout with submodules or from a tarball). mcad
	# gets its own package.
	rm -rf debian/openscad/usr/share/openscad/libraries

	# remove fonts
	rm -rf debian/openscad/usr/share/openscad/fonts

	# Remove this, which is available in debian/copyright instead.
	rm -f debian/openscad/usr/share/openscad/examples/COPYING-CC0.txt

override_dh_install:
	dh_install -X.uuid \
		-Xtestdata/python \
		-Xtestdata/ttf/liberation-2.00.1/LICENSE \
		-Xtestdata/ttf/liberation-2.00.1/AUTHORS \
		-Xtestdata/ttf/liberation-2.00.1/ChangeLog \
		-Xtestdata/ttf/liberation-2.00.1/README \
		-Xtestdata/ttf/liberation-2.00.1/TODO \
		-Xtestdata/ttf/marvosym-3.10/FILE_ID.DIZ \
		-Xtestdata/ttf/marvosym-3.10/liesmich.txt \
		-Xtestdata/ttf/marvosym-3.10/readme.txt \
		-Xtestdata/ttf/amiri-0.106/OFL-FAQ.txt \
		-Xtestdata/ttf/amiri-0.106/OFL.txt \
		-Xtestdata/ttf/amiri-0.106/README.txt

	# Rename a couple random readme's installed by upstream. The if [ ]
	# check is needed so binary-arch doesn't try to rename files in
	# -indep-only packages.
	if [ -e debian/openscad-testing-data/usr/share/openscad/testdata/manual/issue214/README.md ] ; then \
	  install -d debian/openscad-testing-data/usr/share/doc/openscad-testing-data ; \
	  mv debian/openscad-testing-data/usr/share/openscad/testdata/manual/issue214/README.md \
	     debian/openscad-testing-data/usr/share/doc/openscad-testing-data/README_issue214.md ; \
	  mv debian/openscad-testing-data/usr/share/openscad/testdata/modulecache-tests/README.txt \
	     debian/openscad-testing-data/usr/share/doc/openscad-testing-data/README_modulecache-tests.txt ; \
	fi

	# Fix missing exec bit for script that goes into /usr/libexec/...
	if [ -e debian/openscad-testing/usr/libexec/openscad/testprograms/export_import_pngtest.py ] ; then \
	  chmod +x debian/openscad-testing/usr/libexec/openscad/testprograms/export_import_pngtest.py ; \
	  chmod +x debian/openscad-testing/usr/libexec/openscad/testprograms/export_pngtest.py ; \
	fi

override_dh_strip:
	dh_strip --dbgsym-migration='openscad-dbg (<<2019.05-1~)'

override_dh_auto_clean:
	dh_auto_clean

	dh_auto_clean -Dtests --buildsystem=cmake