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
|
#!/usr/bin/make -f
# resolve DEB_VERSION_UPSTREAM DEB_DISTRIBUTION
include /usr/share/dpkg/pkg-info.mk
# resolve DEB_BUILD_OPTION_PARALLEL
-include /usr/share/dpkg/buildopts.mk
# resolve if release is experimental
EXP_RELEASE = $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION))
# will run a subset of tests generated by test/runner.py randomcore2100, test/runner.py randomwasm2js2100
TESTS_SUBSET = debian/tests_subset.txt
# Handle both "~dfsg" and the future "+dfsg"
DEB_VERSION_UPSTREAM_ORIG := $(firstword $(subst ~,$() ,$(DEB_VERSION_UPSTREAM)))
DEB_VERSION_UPSTREAM_ORIG := $(firstword $(subst +,$() ,$(DEB_VERSION_UPSTREAM_ORIG)))
DOCS_SRC = README.md
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
DOCS = $(DOCS_SRC:md=html) $(DOCS_SRC:md=txt)
CHANGELOGS = ChangeLog.html ChangeLog.txt
endif
_ENV = $(strip \
PATH="$(CURDIR)/debian/tmpbin:$$PATH" \
EM_CACHE="$(CURDIR)/debian/em_cache")
# generate manpage with help2man from --help option of python script
_mkman = $(_ENV) \
help2man $(if $3,--name "$(strip $3)") --no-info --version-string $(DEB_VERSION_UPSTREAM) --output $2 $1 \
|| { $(_ENV) $1 --help; false; }
_mkman_sloppy = $(_ENV) \
help2man $(if $3,--name "$(strip $3)") --no-info --version-string $(DEB_VERSION_UPSTREAM) --no-discard-stderr --output $2 $1 \
|| true
ifneq (,$(DEB_BUILD_OPTION_PARALLEL))
export EMCC_CORES=$(DEB_BUILD_OPTION_PARALLEL)
endif
EMCC = $(_ENV) emcc
TESTS_RUNNER = $(_ENV) EMTEST_LACKS_CLOSURE_COMPILER=1 EMTEST_SKIP_V8=1 EMTEST_SKIP_WASM64=1 EMTEST_SKIP_EH=1 EMTEST_SKIP_FLAKY=1 EMTEST_SKIP_JSPI=1 test/runner.py --skip-slow --cores=1
# files generated during build
SOURCE_MAP_MIN_JS = src/emscripten-source-map.min.js
NEON_H = system/include/compat/arm_neon.h
# libraries available for compilation (ports are unavailable)
LIBS_ALL = $(shell $(_ENV) embuilder --em-config .emscripten --help \
| grep -Po '^ \K\S+')
LIBSTEMS_PORTS = $(shell find tools/ports -maxdepth 1 -type f \
| grep -Po 'tools/ports/\K[a-z]+' | sort -u) \
$(shell find tools/ports -maxdepth 2 -type f | grep -Po 'tools/ports/\Kcontrib/[a-z0-9]+' | tr / . | sort -u)
LIBS_MAIN = $(filter-out $(addsuffix %,$(LIBSTEMS_PORTS)),$(LIBS_ALL))
# requires third-party tests
# * test_freetype also requires symlinked LiberationSansBold.ttf
# * test_poppler also requires tests.poppler.paper.pdf
ERRORS_core += \
test_freetype \
test_lua \
test_openjpeg \
test_poppler
# requires Emscripten Ports
ERRORS_other += \
test_boost_graph \
test_bullet \
test_bullet_autoconf \
test_bullet_cmake \
test_bzip2 \
test_cmake_find_sdl2 \
test_cmake_find_stuff \
test_cmake_html \
test_deps_info \
test_freetype \
test_giflib \
test_libjpeg \
test_libpng \
test_contrib_ports \
test_sdl2_config \
test_sdl2_gfx_linkable \
test_sdl2_linkable \
test_sdl2_mixer_wav \
test_sdl2_ttf \
test_vorbis
# attempts to download files from a remote server
ERRORS_other += \
test_icu \
test_pthread_icu
# avoid unimportant mode causing multiple failures: strict
CHECK_MODES_coreX = core0 core1 core2 core3 cores corez
CHECK_MODES_coreZ = corez wasm2jsz
CHECK_MODES_core23Z = core2 core3 corez
CHECK_MODES_coreJS = wasm2js1 wasm2js2 wasm2js3 wasm2jss wasm2jsz
CHECK_MODES_coreJS1S = wasm2js1 wasm2jss
# expects smaller output
FAILS_core1 += \
test_emscripten_lazy_load_code_unconditional
FAILS_other += \
test_function_exports_are_small \
test_js_function_names_are_minified \
test_metadce_minimal_pthreads \
test_minimal_runtime_code_size_*
# needs node module wasm2c
FAILS_other += \
test_wasm2c_multi_lib \
# requires bugfix for Error: FS error
FAILS_core += \
test_fs_nodefs_home
# requires bugfix for RuntimeError: memory access out of bounds
FAILS_core += \
test_pthread_dylink_exceptions
# unreliable; sometimes fails with AssertionError: Expected to find ... pthread sent an error! undefined:undefined: Aborted().
FAILS_core += \
test_pthread_abort \
# likely requires newer LLVM
ERRORS_core += \
test_dylink_syslibs_missing_assertions
FAILS_other += \
test_lld_report_undefined_exceptions
# unknown cause
FAILS_coreX += \
test_dlfcn_self \
test_pthread_exit_process \
test_pthread_proxying
FAILS_other += \
test_cmake_stdproperty \
test_embind_finalization \
test_ld_library_path \
test_metadce_hello_main_module_2 \
test_minimal_dynamic \
test_split_main_module
BIN_WRAPPER_SYMLINK = \
em++ \
em-config \
emar \
embuilder \
emcc \
emcmake \
emconfigure \
emdump \
emdwp \
emmake \
emnm \
emprofile \
emranlib \
emrun \
emscons \
emsize \
emstrip \
emsymbolizer
NONSCRIPT_EXECUTABLE = \
cache/cache.lock \
system/lib/libcxx/readme.txt \
test/other/wasm_sourcemap/foo.wasm \
test/other/wasm_sourcemap_dead/t.wasm \
tools/system_libs.py \
cache/symbol_lists.lock
SCRIPT_NOT_EXECUTABLE = \
test/embind/build_benchmark \
test/sourcemap2json.js
override_dh_clean:
dh_clean -- $(DOCS) $(CHANGELOGS)
override_dh_auto_configure: $(SOURCE_MAP_MIN_JS) $(NEON_H)
# refresh upstream version hints from Debian package
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
# setup binaries for use during build-time testing
mkdir --parents debian/tmpbin
sed "s,/usr/share/emscripten/,$$PWD/," < debian/bin/wrapper > debian/tmpbin/wrapper
chmod +x debian/tmpbin/wrapper
$(foreach symlink,$(BIN_WRAPPER_SYMLINK),ln -fsT wrapper debian/tmpbin/$(symlink);)
execute_before_dh_auto_build:
$(EMCC) --generate-config
# build frozen cache of non-port libraries unless noopt requested
override_dh_auto_build:
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
$(_ENV) embuilder build $(LIBS_MAIN)
$(_ENV) embuilder build $(LIBS_MAIN) --lto
$(_ENV) embuilder build $(LIBS_MAIN) --pic
$(_ENV) embuilder build $(LIBS_MAIN) --pic --lto
endif
perl -p \
-e "s/^# FROZEN_CACHE/FROZEN_CACHE/;" \
-e "s,^EMSCRIPTEN_ROOT = '\K[^']+,/usr/share/emscripten,;" \
.emscripten > debian/.emscripten
execute_after_dh_auto_build-arch: $(DOCS) $(CHANGELOGS)
# build documentation unless nodoc requested
execute_after_dh_auto_build-indep: $(DOCS) $(CHANGELOGS)
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS)))
sphinx-build -b html site/source debian/doc/html
endif
execute_before_dh_auto_test:
ln -sT /usr/share/fonts/truetype/liberation/LiberationSans-Bold.ttf test/freetype/LiberationSansBold.ttf
execute_after_dh_auto_test:
rm -f test/freetype/LiberationSansBold.ttf
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
override_dh_auto_test:
pkgjs-install-minimal
$(EMCC) test/hello_world.c
esbuild --target=es6 a.out.js > /dev/null
$(EMCC) -O3 test/hello_world.c
esbuild --target=es6 a.out.js > /dev/null
rm a.out.js a.out.wasm
ifeq (,$(TESTS_SUBSET))
$(TESTS_RUNNER) test_zlib_configure test_zlib_cmake
$(TESTS_RUNNER) \
$(CHECK_MODES_coreX) $(CHECK_MODES_coreJS) \
$(addprefix skip:core*.,$(ERRORS_core) $(FAILS_core)) \
$(addprefix skip:wasm*.,$(ERRORS_core) $(FAILS_core)) \
$(addprefix skip:core1.,$(FAILS_core1)) \
$(addprefix skip:core2.,$(FAILS_core2)) \
$(foreach mode,$(CHECK_MODES_coreX),\
$(addprefix skip:$(mode).,$(FAILS_coreX))) \
$(foreach mode,$(CHECK_MODES_coreZ),\
$(addprefix skip:$(mode).,$(FAILS_coreZ))) \
$(foreach mode,$(CHECK_MODES_core23Z),\
$(addprefix skip:$(mode).,$(FAILS_core23Z))) \
$(foreach mode,$(CHECK_MODES_coreJS),\
$(addprefix skip:$(mode).,$(FAILS_coreJS))) \
$(foreach mode,$(CHECK_MODES_coreJS1S),\
$(addprefix skip:$(mode).,$(FAILS_coreJS1S))) \
$(TESTS_RUNNER) other \
$(addprefix skip:other.,$(ERRORS_other) $(FAILS_other))
else
$(TESTS_RUNNER) $(shell cat $(TESTS_SUBSET) | tr '\n' ' ')
endif
endif
execute_after_dh_auto_install:
$(call _mkman, debian/tmpbin/em++, debian/em++.1,\
emscripten compiler for WASM and JavaScript like g++ or clang++)
$(call _mkman_sloppy, debian/tmpbin/em-config, debian/em-config.1,\
helper tool to read emscripten configuration variables)
$(call _mkman, debian/tmpbin/emar, debian/emar.1,\
emscripten archiver for WASM and JavaScript like ar or llvm-ar)
$(call _mkman, debian/tmpbin/embuilder, debian/embuilder.1,\
Tool to manage building of Emscripten system libraries and ports)
$(call _mkman, debian/tmpbin/emcc, debian/emcc.1,\
emscripten compiler for WASM and JavaScript like gcc or clang)
$(call _mkman_sloppy, debian/tmpbin/emcmake, debian/emcmake.1,\
emscripten wrapper cmake)
$(call _mkman_sloppy, debian/tmpbin/emconfigure, debian/emconfigure.1,\
emscripten wrapper around ./configure scripts)
$(call _mkman, debian/tmpbin/emdump, debian/emdump.1,\
emscripten tool to print out statistics about compiled code sizes)
$(call _mkman, debian/tmpbin/emdwp, debian/emdwp.1,\
emscripten wrapper around llvm-dwp)
$(call _mkman_sloppy, debian/tmpbin/emmake, debian/emmake.1,\
emscripten wrapper around make)
$(call _mkman, debian/tmpbin/emnm, debian/emnm.1,\
emscripten wrapper around llvm-nm)
$(call _mkman, debian/tmpbin/emprofile, debian/emprofile.1,\
emscripten profiler tool)
$(call _mkman, debian/tmpbin/emranlib, debian/emranlib.1,\
emscripten wrapper around llvm-ranlib)
$(call _mkman, debian/tmpbin/emrun, debian/emrun.1,\
emscripten tool to compile as an HTML page)
$(call _mkman_sloppy, debian/tmpbin/emscons, debian/emscons.1,\
emscripten wrapper around scons)
$(call _mkman, debian/tmpbin/emsize, debian/emsize.1,\
emscripten replacement for size)
$(call _mkman, debian/tmpbin/emstrip, debian/emstrip.1,\
emscripten wrapper around llvm-strip)
$(call _mkman, debian/tmpbin/emsymbolizer, debian/emsymbolizer.1,\
emscripten utility for looking up symbol names and/or file+line numbers of code addresses)
# avoid cache sanity hint, license and Visual Studio files
ifeq (,$(filter noopt,$(DEB_BUILD_OPTIONS)))
INSTALL_FROZEN_CACHE = debian/em_cache/* /usr/share/emscripten/cache
endif
override_dh_install:
dh_install $(addprefix --exclude=,\
sanity.txt \
COPYING GPL LICENSE License.txt license.dox \
.dsp .dsw .sln .vcproj) \
$(INSTALL_FROZEN_CACHE)
rmdir debian/emscripten/usr/share/emscripten/cache/build
override_dh_installdocs:
dh_installdocs -- $(DOCS)
override_dh_installchangelogs:
dh_installchangelogs -- $(CHANGELOGS)
# webassembly code is alien to dh_strip
override_dh_strip:
dh_strip --exclude=/usr/share/emscripten/cache
execute_after_dh_fixperms:
chmod -x $(addprefix debian/emscripten/usr/share/emscripten/,\
$(NONSCRIPT_EXECUTABLE))
chmod +x $(addprefix debian/emscripten/usr/share/emscripten/,\
$(SCRIPT_NOT_EXECUTABLE))
# 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 debian/tmpbin
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://raw.githubusercontent.com/emscripten-core/emscripten/$(DEB_VERSION_UPSTREAM_ORIG)/src/emscripten-source-map.min.js \
| tail -n +2 \
> debian/missing-sources/source-map-footer_$(DEB_VERSION_UPSTREAM_ORIG).js
override_dh_gencontrol:
dh_gencontrol -- -V"types:Version=$(shell jq --raw-output .version < Xtypes/package.json)~$(DEB_VERSION)"
%.html: %.md
cmark-gfm $< > $@
%.txt: %.md
cmark-gfm --to plaintext $< > $@
%:
dh $@
|