#!/usr/bin/make -f include /usr/share/dpkg/architecture.mk export DH_GOLANG_INSTALL_EXTRA := \ internal/bundler_tests/snapshots \ internal/resolver/testExpectations.json # The Node.js magic was contributed by Yadd in Dec 2021; # see commit d7a16741f9df8c71f17a1ccdc3babbaa5505fdf5 for more information. # later updated to just use process.arch to avoid hard-coding the mapping node_arch = $(shell node -p process.arch || echo "") export npm_dir = @esbuild/linux-$(node_arch) %: dh $@ --builddirectory=_build --buildsystem=golang ifneq ($(shell command -v node),) execute_after_dh_auto_build: ln -sf _build/bin/esbuild . # Generate npm/esbuild/* node scripts/esbuild.js ./esbuild --neutral # Generate npm/esbuild-wasm/* # See also set_go_env sub in dh-golang GOPATH=$(CURDIR)/_build GOCACHE=$(CURDIR)/_build/go-build GO111MODULE=off GOPROXY=off \ node scripts/esbuild.js ./esbuild --wasm execute_after_dh_auto_test-arch: node -e 'require("./npm/esbuild")' endif ifneq ($(node_arch),) execute_after_dh_install-arch: install -d debian/esbuild/usr/lib/$(DEB_HOST_MULTIARCH)/nodejs/@esbuild cp -a npm/$(npm_dir) debian/esbuild/usr/lib/$(DEB_HOST_MULTIARCH)/nodejs/@esbuild/ find debian/esbuild/usr/lib/$(DEB_HOST_MULTIARCH)/nodejs/ -name '*.md' -delete || true find debian/esbuild/usr/share/nodejs/ -name '*.md' -delete || true execute_after_dh_install-indep: find debian/esbuild-wasm/usr/share/nodejs/ -name '*.md' -delete || true execute_after_dh_fixperms-indep: chmod a-x debian/esbuild-wasm/usr/share/nodejs/esbuild-wasm/esbuild.wasm override_dh_gencontrol-arch: dh_gencontrol -- -Vnodejs:Provides="node-esbuild-linux-$(node_arch)" endif execute_before_dh_installman-indep: sed 's/^\.TH ESBUILD/.TH ESBUILD-WASM/' debian/esbuild.1 > debian/esbuild-wasm.1