summaryrefslogtreecommitdiffhomepage
path: root/pkg/rpm/Makefile.wasm
blob: fe5c680839b59902cc5caa5f0c8c34d38ce5556f (plain) (blame)
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
MODULES+=		wasm
MODULE_SUFFIX_wasm=	wasm

MODULE_SUMMARY_wasm=	WASM module for NGINX Unit

MODULE_VERSION_wasm=	$(VERSION)
MODULE_RELEASE_wasm=	1

MODULE_CONFARGS_wasm=	wasm-wasi-component
MODULE_MAKEARGS_wasm=	wasm-wasi-component CFLAGS=\"\$$(grep ^CFLAGS build/Makefile | cut -d' ' -f 3-) -Wno-missing-prototypes\"
MODULE_INSTARGS_wasm=	wasm-wasi-component-install

ifeq (,$(findstring $(OSVER),amazonlinux2))
MODULE_CONFARGS_wasm+=	\&\& ./configure wasm --include-path=\`pwd\`/pkg/contrib/wasmtime/artifacts/include --lib-path=\`pwd\`/pkg/contrib/wasmtime/artifacts/lib
MODULE_MAKEARGS_wasm+=	wasm
MODULE_INSTARGS_wasm+=	wasm-install

MODULE_SOURCES_wasm=

BUILD_DEPENDS_wasm=	cmake

BUILD_DEPENDS+=		$(BUILD_DEPENDS_wasm)

define MODULE_PREBUILD_wasm
%{__make} -C pkg/contrib .wasmtime
endef
export MODULE_PREBUILD_wasm

define MODULE_PREINSTALL_wasm
\# brp-mangle-shebangs parses all executable files for a shebang
\# this fails on a vendored code that somehow ships with exec bit enabled
find pkg/contrib/wasmtime/ -type f -executable -name "*.rs" | xargs chmod -x
endef
export MODULE_PREINSTALL_wasm

define MODULE_POSTINSTALL_wasm
%{__install} -m 755 -p pkg/contrib/wasmtime/artifacts/lib/libwasmtime.so %{buildroot}%{_libdir}/
endef
export MODULE_POSTINSTALL_wasm
endif

define MODULE_FILES_wasm
%if 0%{?amzn2}
%else
%{_libdir}/libwasmtime.so
%endif
%{_libdir}/unit/modules/*
%{_libdir}/unit/debug-modules/*
endef
export MODULE_FILES_wasm

define MODULE_POST_wasm
cat <<BANNER
----------------------------------------------------------------------

The $(MODULE_SUMMARY_wasm) has been installed.

Online documentation is available at https://unit.nginx.org

----------------------------------------------------------------------
BANNER
endef
export MODULE_POST_wasm