Skip to content

Commit d5c2ed1

Browse files
committed
Packages: added wasm module packaging for rpm-based distros.
1 parent 1a31863 commit d5c2ed1

File tree

3 files changed

+60
-0
lines changed

3 files changed

+60
-0
lines changed

pkg/rpm/Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ include Makefile.perl
6464
include Makefile.jsc-common
6565
include Makefile.jsc8
6666
include Makefile.jsc11
67+
include Makefile.wasm
6768
endif
6869

6970
ifeq ($(OSVER), centos9)
@@ -74,6 +75,7 @@ include Makefile.perl
7475
include Makefile.jsc-common
7576
include Makefile.jsc8
7677
include Makefile.jsc11
78+
include Makefile.wasm
7779
endif
7880

7981
ifeq ($(OSVER), amazonlinux2)
@@ -84,6 +86,7 @@ include Makefile.go
8486
include Makefile.perl
8587
include Makefile.jsc-common
8688
include Makefile.jsc8
89+
include Makefile.wasm
8790
endif
8891

8992
ifeq ($(OSVER), amazonlinux2023)
@@ -94,6 +97,7 @@ include Makefile.go
9497
include Makefile.perl
9598
include Makefile.jsc-common
9699
include Makefile.jsc17
100+
include Makefile.wasm
97101
endif
98102

99103
ifeq ($(OSVER), fedora)
@@ -105,6 +109,7 @@ include Makefile.ruby
105109
include Makefile.jsc-common
106110
include Makefile.jsc8
107111
include Makefile.jsc11
112+
include Makefile.wasm
108113
endif
109114

110115
ifeq ($(OSVER), fedora37)
@@ -116,6 +121,7 @@ include Makefile.ruby
116121
include Makefile.jsc-common
117122
include Makefile.jsc8
118123
include Makefile.jsc11
124+
include Makefile.wasm
119125
endif
120126

121127
CONFIGURE_ARGS_COMMON=\
@@ -216,6 +222,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil
216222
done ; \
217223
pkgname=$(shell echo $@ | cut -d '/' -f 3 | tr '_' '-' | cut -d '.' -f 1) ; \
218224
definitions=`echo "$$MODULE_DEFINITIONS_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
225+
prebuild=`echo "$$MODULE_PREBUILD_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
219226
preinstall=`echo "$$MODULE_PREINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
220227
postinstall=`echo "$$MODULE_POSTINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
221228
files=`echo "$$MODULE_FILES_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
@@ -234,6 +241,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil
234241
-e "s#%%MODULE_MAKEARGS%%#$(MODULE_MAKEARGS_$*)#g" \
235242
-e "s#%%MODULE_INSTARGS%%#$(MODULE_INSTARGS_$*)#g" \
236243
-e "s#%%MODULE_DEFINITIONS%%#$${definitions}#g" \
244+
-e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
237245
-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
238246
-e "s#%%MODULE_POSTINSTALL%%#$${postinstall}#g" \
239247
-e "s#%%MODULE_FILES%%#$${files}#g" \

pkg/rpm/Makefile.wasm

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
MODULES+= wasm
2+
MODULE_SUFFIX_wasm= wasm
3+
4+
MODULE_SUMMARY_wasm= WASM module for NGINX Unit
5+
6+
MODULE_VERSION_wasm= $(VERSION)
7+
MODULE_RELEASE_wasm= 1
8+
9+
MODULE_CONFARGS_wasm= wasm --include-path=\`pwd\`/pkg/contrib/wasmtime/crates/c-api/include --lib-path=\`pwd\`/pkg/contrib/wasmtime/target/release
10+
MODULE_MAKEARGS_wasm= wasm
11+
MODULE_INSTARGS_wasm= wasm-install
12+
13+
MODULE_SOURCES_wasm=
14+
15+
BUILD_DEPENDS_wasm=
16+
17+
BUILD_DEPENDS+= $(BUILD_DEPENDS_wasm)
18+
19+
define MODULE_PREBUILD_wasm
20+
%{__make} -C pkg/contrib .wasmtime
21+
endef
22+
export MODULE_PREBUILD_wasm
23+
24+
define MODULE_PREINSTALL_wasm
25+
endef
26+
export MODULE_PREINSTALL_wasm
27+
28+
define MODULE_POSTINSTALL_wasm
29+
%{__install} -m 755 -p pkg/contrib/wasmtime/target/release/libwasmtime.so %{buildroot}%{_libdir}/
30+
endef
31+
export MODULE_POSTINSTALL_wasm
32+
33+
define MODULE_FILES_wasm
34+
%{_libdir}/libwasmtime.so
35+
%{_libdir}/unit/modules/*
36+
%{_libdir}/unit/debug-modules/*
37+
endef
38+
export MODULE_FILES_wasm
39+
40+
define MODULE_POST_wasm
41+
cat <<BANNER
42+
----------------------------------------------------------------------
43+
44+
The $(MODULE_SUMMARY_wasm) has been installed.
45+
46+
Online documentation is available at https://unit.nginx.org
47+
48+
----------------------------------------------------------------------
49+
BANNER
50+
endef
51+
export MODULE_POST_wasm

pkg/rpm/unit.module.spec.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ This package contains %%SUMMARY%%.
5959
tar --strip-components=1 -zxf %{SOURCE0}
6060

6161
%build
62+
%%MODULE_PREBUILD%%
6263
./configure \
6364
%{CONFIGURE_ARGS} \
6465
--modulesdir=%{_libdir}/unit/debug-modules \

0 commit comments

Comments
 (0)