summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorKonstantin Pavlov <thresh@nginx.com>2023-08-22 14:55:10 -0700
committerKonstantin Pavlov <thresh@nginx.com>2023-08-22 14:55:10 -0700
commitd5c2ed1755c16ddf27b2eb018824a1226af99423 (patch)
treec39989ce4223cfbf8ecc8907c604dcb6d08cac97
parent1a31863f8295182ca66aa96a9438ca947ce84aba (diff)
downloadunit-d5c2ed1755c16ddf27b2eb018824a1226af99423.tar.gz
unit-d5c2ed1755c16ddf27b2eb018824a1226af99423.tar.bz2
Packages: added wasm module packaging for rpm-based distros.
Diffstat (limited to '')
-rw-r--r--pkg/rpm/Makefile8
-rw-r--r--pkg/rpm/Makefile.wasm51
-rw-r--r--pkg/rpm/unit.module.spec.in1
3 files changed, 60 insertions, 0 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index d3cc34bd..0573bd4c 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -64,6 +64,7 @@ include Makefile.perl
include Makefile.jsc-common
include Makefile.jsc8
include Makefile.jsc11
+include Makefile.wasm
endif
ifeq ($(OSVER), centos9)
@@ -74,6 +75,7 @@ include Makefile.perl
include Makefile.jsc-common
include Makefile.jsc8
include Makefile.jsc11
+include Makefile.wasm
endif
ifeq ($(OSVER), amazonlinux2)
@@ -84,6 +86,7 @@ include Makefile.go
include Makefile.perl
include Makefile.jsc-common
include Makefile.jsc8
+include Makefile.wasm
endif
ifeq ($(OSVER), amazonlinux2023)
@@ -94,6 +97,7 @@ include Makefile.go
include Makefile.perl
include Makefile.jsc-common
include Makefile.jsc17
+include Makefile.wasm
endif
ifeq ($(OSVER), fedora)
@@ -105,6 +109,7 @@ include Makefile.ruby
include Makefile.jsc-common
include Makefile.jsc8
include Makefile.jsc11
+include Makefile.wasm
endif
ifeq ($(OSVER), fedora37)
@@ -116,6 +121,7 @@ include Makefile.ruby
include Makefile.jsc-common
include Makefile.jsc8
include Makefile.jsc11
+include Makefile.wasm
endif
CONFIGURE_ARGS_COMMON=\
@@ -216,6 +222,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil
done ; \
pkgname=$(shell echo $@ | cut -d '/' -f 3 | tr '_' '-' | cut -d '.' -f 1) ; \
definitions=`echo "$$MODULE_DEFINITIONS_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
+ prebuild=`echo "$$MODULE_PREBUILD_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
preinstall=`echo "$$MODULE_PREINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
postinstall=`echo "$$MODULE_POSTINSTALL_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \
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
-e "s#%%MODULE_MAKEARGS%%#$(MODULE_MAKEARGS_$*)#g" \
-e "s#%%MODULE_INSTARGS%%#$(MODULE_INSTARGS_$*)#g" \
-e "s#%%MODULE_DEFINITIONS%%#$${definitions}#g" \
+ -e "s#%%MODULE_PREBUILD%%#$${prebuild}#g" \
-e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \
-e "s#%%MODULE_POSTINSTALL%%#$${postinstall}#g" \
-e "s#%%MODULE_FILES%%#$${files}#g" \
diff --git a/pkg/rpm/Makefile.wasm b/pkg/rpm/Makefile.wasm
new file mode 100644
index 00000000..c638071b
--- /dev/null
+++ b/pkg/rpm/Makefile.wasm
@@ -0,0 +1,51 @@
+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 --include-path=\`pwd\`/pkg/contrib/wasmtime/crates/c-api/include --lib-path=\`pwd\`/pkg/contrib/wasmtime/target/release
+MODULE_MAKEARGS_wasm= wasm
+MODULE_INSTARGS_wasm= wasm-install
+
+MODULE_SOURCES_wasm=
+
+BUILD_DEPENDS_wasm=
+
+BUILD_DEPENDS+= $(BUILD_DEPENDS_wasm)
+
+define MODULE_PREBUILD_wasm
+%{__make} -C pkg/contrib .wasmtime
+endef
+export MODULE_PREBUILD_wasm
+
+define MODULE_PREINSTALL_wasm
+endef
+export MODULE_PREINSTALL_wasm
+
+define MODULE_POSTINSTALL_wasm
+%{__install} -m 755 -p pkg/contrib/wasmtime/target/release/libwasmtime.so %{buildroot}%{_libdir}/
+endef
+export MODULE_POSTINSTALL_wasm
+
+define MODULE_FILES_wasm
+%{_libdir}/libwasmtime.so
+%{_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
diff --git a/pkg/rpm/unit.module.spec.in b/pkg/rpm/unit.module.spec.in
index 04323afc..b3d5d94b 100644
--- a/pkg/rpm/unit.module.spec.in
+++ b/pkg/rpm/unit.module.spec.in
@@ -59,6 +59,7 @@ This package contains %%SUMMARY%%.
tar --strip-components=1 -zxf %{SOURCE0}
%build
+%%MODULE_PREBUILD%%
./configure \
%{CONFIGURE_ARGS} \
--modulesdir=%{_libdir}/unit/debug-modules \