File: rules

package info (click to toggle)
emscripten 2.0.12~dfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 108,440 kB
  • sloc: ansic: 510,324; cpp: 384,763; javascript: 84,341; python: 51,362; sh: 50,019; pascal: 4,159; makefile: 3,409; asm: 2,150; lisp: 1,869; ruby: 488; cs: 142
file content (382 lines) | stat: -rwxr-xr-x 11,648 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
#!/usr/bin/make -f

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

# resolve if release is experimental
EXP_RELEASE = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))

DEB_VERSION_UPSTREAM_ORIG = $(firstword $(subst ~,$() ,$(DEB_VERSION_UPSTREAM)))

ifneq (,$(DEB_BUILD_OPTION_PARALLEL))
export EMCC_CORES=$(DEB_BUILD_OPTION_PARALLEL)
endif

EM_OPTS = PATH="$(CURDIR):$$PATH" EM_CACHE="$(CURDIR)/debian/em_cache"
EMCC = $(EM_OPTS) emcc
TESTS_RUNNER = $(EM_OPTS) EMTEST_SKIP_SLOW=1 EMTEST_LACKS_CLOSURE_COMPILER=1 tests/runner.py
# use ccache when available
ifneq (,$(wildcard /usr/bin/ccache))
override_dh_auto_test: export EM_COMPILER_WRAPPER=ccache
endif

# files generated during build
SOURCE_MAP_MIN_JS = src/emscripten-source-map.min.js
NEON_H = system/include/neon/arm_neon.h

# requires third-party tests and EH functions renaming bugfix (see bug#975069)
#  * test_freetype also requires symlinked LiberationSansBold.ttf
#  * test_poppler also requires tests.poppler.paper.pdf
ERRORS_wasm += \
 test_freetype \
 test_lua \
 test_poppler

# requires Emscripten Ports
ERRORS_other += \
 test_bullet \
 test_bullet_autoconf \
 test_bullet_cmake \
 test_bzip2 \
 test_freetype \
 test_libjpeg \
 test_libpng \
 test_sdl2_mixer_wav \
 test_vorbis
FAILS_CERTAIN_other += \
 test_boost_graph

# requires bugfix for LinkError: WebAssembly.instantiate():
# Import #151 module="env" function="__stack_pointer" error:
# imported global does not match the expected mutability
FAILS_wasm += \
 test_dlfcn_alignment_and_zeroing \
 test_dlfcn_basic \
 test_dlfcn_data_and_fptr \
 test_dlfcn_funcs \
 test_dlfcn_handle_alloc \
 test_dlfcn_i64 \
 test_dlfcn_info \
 test_dlfcn_longjmp \
 test_dlfcn_mallocs \
 test_dlfcn_missing \
 test_dlfcn_qsort \
 test_dlfcn_self \
 test_dlfcn_stacks \
 test_dlfcn_unique_sig \
 test_dlfcn_varargs \
 test_dylink_basics \
 test_dylink_class \
 test_dylink_dot_a \
 test_dylink_dso_needed \
 test_dylink_dynamic_cast \
 test_dylink_floats \
 test_dylink_funcpointer \
 test_dylink_funcpointers_wrapper \
 test_dylink_function_pointer_equality \
 test_dylink_global_init \
 test_dylink_global_inits \
 test_dylink_global_var \
 test_dylink_global_var_modded \
 test_dylink_i64 \
 test_dylink_i64_b \
 test_dylink_i64_c \
 test_dylink_iostream \
 test_dylink_jslib \
 test_dylink_many_postsets \
 test_dylink_memory_growth \
 test_dylink_no_export \
 test_dylink_postsets_chunking \
 test_dylink_printfs \
 test_dylink_rtti \
 test_dylink_safe_heap \
 test_dylink_spaghetti \
 test_dylink_static_funcpointer_float \
 test_dylink_static_funcpointers \
 test_dylink_stdlib \
 test_dylink_zlib \
 test_em_js_linked \
 test_main_module_static_align \
 test_relocatable_void_function \
 test_safe_stack_dylink \
 test_stack_placement_pic
ERRORS_other += \
 test_bad_function_pointer_cast \
 test_binaryen_ctors \
 test_dlopen_rtld_global \
 test_dlsym_rtld_default \
 test_export_aliasee \
 test_ld_library_path \
 test_main_module_without_exceptions_message \
 test_main_module_without_main \
 test_minimal_dynamic

# requires EH functions renaming bugfix (see bug#975069)
FAILS_wasm += \
 test_*_eh \
 test_bad_typeid \
 test_dylink_i64_invoke \
 test_dylink_raii_exceptions \
 test_exceptions \
 test_exceptions_2 \
 test_exceptions_3 \
 test_exceptions_alias \
 test_exceptions_allowed \
 test_exceptions_allowed_2 \
 test_exceptions_allowed_uncaught \
 test_exceptions_convert \
 test_exceptions_custom \
 test_exceptions_destroy_virtual \
 test_exceptions_libcxx \
 test_exceptions_minimal_runtime \
 test_exceptions_multi \
 test_exceptions_multiple_inherit \
 test_exceptions_multiple_inherit_rethrow \
 test_exceptions_primary \
 test_exceptions_resume \
 test_exceptions_rethrow \
 test_exceptions_simplify_cfg \
 test_exceptions_std \
 test_exceptions_typed \
 test_exceptions_uncaught_2 \
 test_exceptions_uncaught \
 test_exceptions_uncaught_count \
 test_exceptions_virtual_inheritance
FAILS_wasm0 += \
 test_exceptions_refcount
FAILS_other += \
 test_locale_wrong \
 test_metadce_cxx_except \
 test_metadce_cxx_mangle \
 test_no_legalize_js_ffi \
 test_only_force_stdlibs_2 \
 test_wasm_backend_lto_libcxx_noexcept

# requires bugfix for AssertionError:
# JS subprocess failed (/usr/bin/nodejs src.js): 7.  Output:
# Assertion failed: failure to getMemory
FAILS_wasm0 += \
 test_dylink_basics_no_modify

# requires bugfix for AssertionError:
# JS subprocess failed (/usr/bin/nodejs test_nodefs_home.js): 1.  Output:
# exception thrown: Error: No such file or directory,Error
FAILS_wasm += \
 test_fs_nodefs_home

# requires bugfix for error: undefined symbol: ...
FAILS_wasm += \
 test_i64_invoke_bigint \
 test_longjmp \
 test_longjmp2 \
 test_longjmp2_main_module \
 test_longjmp3 \
 test_longjmp4 \
 test_longjmp_exc \
 test_longjmp_funcptr \
 test_longjmp_i64 \
 test_longjmp_repeat \
 test_longjmp_stacked \
 test_longjmp_throw \
 test_longjmp_unwind \
 test_pthread_exceptions \
 test_setjmp_many \
 test_setjmp_many_2 \
 test_setjmp_noleak \
 test_siglongjmp
FAILS_other += \
 test_exception_settings \
 test_f_exception \
 test_fignore_exceptions

# requires bugfix for FileNotFoundError:
# [Errno 2] No such file or directory: 'emcc'
FAILS_other += \
 test_scons

# requires bugfix for FileNotFoundError:
# [Errno 2] No such file or directory: '/usr/share/emscripten/emcmake'
FAILS_other += \
 test_cmake_stdproperty

# requires bugfix for AssertionError: Unexpected difference: ...
FAILS_other += \
 test_metadce_hello_main_module_2

# requires bugfix for AssertionError: subprocess exited with non-zero return code(1):
# `emcc /usr/share/emscripten/tests/hello_world.cpp -Wl,--no-check-features,-mllvm,-debug`
#  * wasm-ld (LLVM option parsing): Unknown command line argument '-debug'
FAILS_other += \
 test_supported_linker_flags

# requires bugfix for AssertionError: subprocess exited with non-zero return code(1):
# `emcc -nostdlib++ /<<PKGBUILDDIR>>/tests/other/test_split_main_module.c
# -o test_split_main_module.js -Werror
# -g -sMAIN_MODULE=2 -sEXPORTED_FUNCTIONS=[_printf] -sSPLIT_MODULE=1
# -Wno-experimental --embed-file libhello.wasm
# --post-js /<<PKGBUILDDIR>>/tests/other/test_split_module.post.js
# -sINITIAL_TABLE=16
# -I. -I/<<PKGBUILDDIR>>/tests/other -I/<<PKGBUILDDIR>>/tests/other/include`
FAILS_other += \
 test_split_main_module

# avoid unimportant mode causing multiple failures: strict
CHECK_MODES_WASMX = wasm0 wasm1 wasm2 wasm3 wasms wasmz
CHECK_MODES_WASMJS = wasm2js1 wasm2js2 wasm2js3 wasm2jss wasm2jsz

# maybe requires setting EMSCRIPTEN_TOOLPATH
FAILS_other += \
 test_emscons

# requires bugfix for TypeError:
# Cannot read property 'toString' of undefined
FAILS_other += \
 test_dlopen_bad_flags \
 test_dlsym_rtld_default_js_symbol

# expects smaller output
FAILS_wasm1 += \
 test_emscripten_lazy_load_code_unconditional
FAILS_other += \
 test_function_exports_are_small \
 test_js_function_names_are_minified \
 test_minimal_runtime_code_size_*

# needs node module wasm2c
FAILS_wasmX_wasm2c += \
 test_autodebug_wasm_standalone \
 test_cube2hash_standalone \
 test_longjmp_standalone \
 test_posixtime_standalone
FAILS_other += \
 test_wasm2c_reactor \

NONSCRIPT_EXECUTABLE = \
 system/include/libcxx/readme.txt \
 system/lib/libcxx/readme.txt \
 tests/other/wasm_sourcemap/foo.wasm \
 tests/other/wasm_sourcemap_dead/t.wasm \
 tools/system_libs.py

SCRIPT_NOT_EXECUTABLE = \
 src/compiler.js \
 tests/embind/build_benchmark \
 third_party/uglify-js/test/beautify.js \
 third_party/uglify-js/test/testparser.js \
 third_party/uglify-js/tmp/test.js \
 tools/js-optimizer.js \
 tools/preprocessor.js \
 tools/source-maps/sourcemap2json.js \
 tools/source-maps/sourcemapper.js

%:
	dh $@

# refresh upstream version hints from Debian package
override_dh_auto_configure: $(SOURCE_MAP_MIN_JS) $(NEON_H)
	cp -f emscripten-version.txt emscripten-version.txt.orig
	echo $(DEB_VERSION_UPSTREAM_ORIG) > emscripten-version.txt
	echo $(patsubst $(DEB_VERSION_UPSTREAM_ORIG)-%,%,$(DEB_VERSION_UPSTREAM_ORIG_REVISION)) \
		> emscripten-revision.txt
	tools/create_dom_pk_codes.py
	mkdir -p debian/em_cache

override_dh_auto_build:

# build documentation unless nodoc requested
execute_after_dh_auto_build-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
	sphinx-build -b html site/source debian/doc/html
endif

ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
	$(EMCC) -v 2>&1
	$(EMCC) tests/hello_world.c
	eslint --no-eslintrc --quiet --env browser --format unix a.out.js
	$(EMCC) -O3 tests/hello_world.c
	eslint --no-eslintrc --quiet --env browser --format unix a.out.js
	rm a.out.js a.out.wasm
	ln -sT /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf \
		tests/freetype/LiberationSansBold.ttf
	$(TESTS_RUNNER) \
		$(CHECK_MODES_WASMX) \
		$(addprefix skip:wasm*.,$(ERRORS_wasm) $(FAILS_wasm)) \
		$(addprefix skip:wasm0.,$(FAILS_wasm0)) \
		$(addprefix skip:wasm1.,$(FAILS_wasm1)) \
		$(foreach wasm,$(CHECK_MODES_WASMX),\
			$(addprefix skip:$(wasm).,$(FAILS_wasmX_wasm2c))) \
		$(if $(EXP_RELEASE),|| true)
	$(TESTS_RUNNER) other \
		$(addprefix skip:other.,$(ERRORS_other) $(FAILS_CERTAIN_other) $(FAILS_other)) \
		$(if $(EXP_RELEASE),|| true)
ifneq (,$(EXP_RELEASE))
# TODO: always check CHECK_MODES_WASMJS when handling its output:
#  BlockingIOError: [Errno 11] write could not complete without blocking
	EMCC_CORES=1 $(TESTS_RUNNER) \
		$(CHECK_MODES_WASMJS) \
		$(addprefix skip:wasm*.,$(ERRORS_wasm) $(FAILS_wasm)) \
		|| true
	EMCC_CORES=1 $(TESTS_RUNNER) \
		$(foreach wasm,$(CHECK_MODES_WASMX),\
			$(addprefix $(wasm).,$(FAILS_wasm) $(FAILS_wasmX_wasm2c))) \
		$(addprefix wasm1.,$(FAILS_wasm1)) \
		|| true
	EMCC_CORES=1 $(TESTS_RUNNER) \
		$(foreach wasm,$(CHECK_MODES_WASMJS),\
			$(addprefix $(wasm).,$(FAILS_wasm))) \
		|| true
	EMCC_CORES=1 $(TESTS_RUNNER) \
		$(addprefix other.,$(FAILS_other)) \
		|| true
endif
	rm -f tests/freetype/LiberationSansBold.ttf
endif

# avoid license and Visual Studio files
override_dh_install:
	dh_install $(addprefix --exclude=,\
		COPYING GPL LICENSE License.txt license.dox \
		.dsp .dsw .sln .vcproj)

# webassembly code is alien to dh_strip
override_dh_strip:
	dh_strip --exclude=/usr/share/emscripten/cache

override_dh_fixperms:
	dh_fixperms
	chmod -x $(addprefix debian/emscripten/usr/share/emscripten/,\
		$(NONSCRIPT_EXECUTABLE))
	chmod +x $(addprefix debian/emscripten/usr/share/emscripten/,\
		$(SCRIPT_NOT_EXECUTABLE))

override_dh_missing:
	dh_missing --fail-missing

# restore maybe-outdated upstream version hint
override_dh_auto_clean:
	[ ! -e emscripten-version.txt.orig ] \
		|| mv -f emscripten-version.txt.orig emscripten-version.txt
	rm -rf debian/em_cache
	rm -f .emscripten $(SOURCE_MAP_MIN_JS) $(NEON_H)

# generate header file from SIMDe source
$(NEON_H): /usr/include/simde/arm/neon.h
	echo '#define SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES' > $@
	echo '#define SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES' >> $@
	cat $< >> $@
	echo '#undef SIMDE_ARM_NEON_A32V7_ENABLE_NATIVE_ALIASES' >> $@
	echo '#undef SIMDE_ARM_NEON_A64V8_ENABLE_NATIVE_ALIASES' >> $@

# join source-less and source-only parts of upstream source-map script
$(SOURCE_MAP_MIN_JS): \
 /usr/share/javascript/source-map/source-map.min.js \
 debian/missing-sources/source-map-footer_$(DEB_VERSION_UPSTREAM_ORIG).js
	cat $^ > $@

# custom rule: get source-only part of upstream source-map script
# (see README.source)
get-source-map-footer:
	wget -O- https://github.com/emscripten-core/emscripten/raw/$(DEB_VERSION_UPSTREAM_ORIG)/src/emscripten-source-map.min.js \
		| tail -n +2 \
		> debian/missing-sources/source-map-footer_$(DEB_VERSION_UPSTREAM_ORIG).js