diff options
Diffstat (limited to 'pkg')
29 files changed, 495 insertions, 31 deletions
diff --git a/pkg/Makefile b/pkg/Makefile index 4cf9ff80..c252969b 100644 --- a/pkg/Makefile +++ b/pkg/Makefile @@ -29,11 +29,15 @@ docker: npm: @cd npm && VERSION=$(VERSION) RELEASE=$(RELEASE) make all +njs: + @cd contrib && make .njs + clean: @cd rpm && make clean @cd deb && make clean @cd docker && make clean @cd npm && make clean + @cd contrib && make clean rm -f unit-$(VERSION).tar.gz rm -f unit-$(VERSION).tar.gz.sha512 diff --git a/pkg/contrib/Makefile b/pkg/contrib/Makefile new file mode 100644 index 00000000..7e3b8b97 --- /dev/null +++ b/pkg/contrib/Makefile @@ -0,0 +1,140 @@ +all: install + +TOPSRC := $(dir $(abspath $(lastword $(MAKEFILE_LIST)))) +SRC := $(TOPSRC)/src +TARBALLS := $(TOPSRC)/tarballs +VPATH := $(TARBALLS) +PREFIX = $(TOPSRC)/local +PREFIX := $(abspath $(PREFIX)) + +PKGS_ALL := $(patsubst $(SRC)/%/Makefile,%,$(wildcard $(SRC)/*/Makefile)) + +# Common download locations +CONTRIB_NGINX := https://packages.nginx.org/contrib + +# +# Tools +# +NPROC := $(shell getconf _NPROCESSORS_ONLN) +_SMP_MFLAGS := -j$(NPROC) + +ifndef GIT +ifeq ($(shell git --version >/dev/null 2>&1 || echo FAIL),) +GIT = git +endif +endif +GIT ?= $(error git not found) + +ifeq ($(shell curl --version >/dev/null 2>&1 || echo FAIL),) +download = curl -f -L -- "$(1)" > "$@" +else ifeq ($(shell wget --version >/dev/null 2>&1 || echo FAIL),) +download = (rm -f $@.tmp && \ + wget --passive -c -p -O $@.tmp "$(1)" && \ + touch $@.tmp && \ + mv $@.tmp $@ ) +else ifeq ($(which fetch >/dev/null 2>&1 || echo FAIL),) +download = (rm -f $@.tmp && \ + fetch -p -o $@.tmp "$(1)" && \ + touch $@.tmp && \ + mv $@.tmp $@) +else +download = $(error Neither curl nor wget found) +endif + +download_pkg = $(call download,$(CONTRIB_NGINX)/$(2)/$(lastword $(subst /, ,$(@)))) || \ + ( $(call download,$(1)) && echo "Please upload $(lastword $(subst /, ,$(@))) to $(CONTRIB_NGINX)" ) + +ifeq ($(shell which xz >/dev/null 2>&1 || echo FAIL),) +XZ = xz +else +XZ ?= $(error XZ (LZMA) compressor not found) +endif + +ifeq ($(shell sha512sum --version >/dev/null 2>&1 || echo FAIL),) +SHA512SUM = sha512sum --check +else ifeq ($(shell shasum --version >/dev/null 2>&1 || echo FAIL),) +SHA512SUM = shasum -a 512 --check +else ifeq ($(shell openssl version >/dev/null 2>&1 || echo FAIL),) +SHA512SUM = openssl dgst -sha512 +else +SHA512SUM = $(error SHA-512 checksumming not found) +endif + +# +# Common helpers +# +download_git = \ + rm -Rf -- "$(@:.tar.xz=)" && \ + $(GIT) init --bare "$(@:.tar.xz=)" && \ + (cd "$(@:.tar.xz=)" && \ + $(GIT) remote add origin "$(1)" && \ + $(GIT) fetch origin "$(2)") && \ + (cd "$(@:.tar.xz=)" && \ + $(GIT) archive --prefix="$(notdir $(@:.tar.xz=))/" \ + --format=tar "$(3)") > "$(@:.xz=)" && \ + echo "$(3) $(@)" > "$(@:.tar.xz=.githash)" && \ + rm -Rf -- "$(@:.tar.xz=)" && \ + $(XZ) --stdout "$(@:.xz=)" > "$@.tmp" && \ + rm -f "$(@:.xz=)" && \ + mv -f -- "$@.tmp" "$@" +check_githash = \ + h=`sed -e "s,^\([0-9a-fA-F]\{40\}\) .*/$(notdir $<),\1,g" \ + < "$(<:.tar.xz=.githash)"` && \ + test "$$h" = "$1" + +checksum = \ + $(foreach f,$(filter $(TARBALLS)/%,$^), \ + grep -- " $(f:$(TARBALLS)/%=%)$$" \ + "$(SRC)/$(patsubst $(3)%,%,$@)/$(2)SUMS" |) \ + (cd $(TARBALLS) && $(1)) +CHECK_SHA512 = $(call checksum,$(SHA512SUM),SHA512,.sum-) +UNPACK = $(RM) -R $@ \ + $(foreach f,$(filter %.tar.gz %.tgz,$^), && tar xvzfo $(f)) \ + $(foreach f,$(filter %.tar.bz2,$^), && tar xvjfo $(f)) \ + $(foreach f,$(filter %.tar.xz,$^), && tar xvJfo $(f)) \ + $(foreach f,$(filter %.zip,$^), && unzip $(f)) +UNPACK_DIR = $(patsubst %.tar,%,$(basename $(notdir $<))) +APPLY = (cd $(UNPACK_DIR) && patch -fp1) < +MOVE = mv $(UNPACK_DIR) $@ && touch $@ + +# Per-package build rules +include $(SRC)/*/Makefile + +# Targets +PKGS_DEPS := $(sort $(foreach p,$(PKGS),$(DEPS_$(p)))) + +fetch: $(PKGS:%=.sum-%) +install: $(PKGS:%=.%) + +clean: + -$(RM) $(foreach p,$(PKGS),.$(p) .sum-$(p) .dep-$(p)) + -$(RM) -R $(foreach p,$(PKGS),$(p)) + -$(RM) -R "$(PREFIX)" + -$(RM) $(TARBALLS)/*.* + +list: + @echo Packages: + @echo ' $(PKGS)' | tr " " "\n" | sort | tr "\n" " " |fmt + @echo Depended-on packages: + @echo ' $(PKGS_DEPS)' | tr " " "\n" | sort | tr "\n" " " |fmt + +.PHONY: all fetch install clean list + +# Default pattern rules +.sum-%: $(SRC)/%/SHA512SUMS + $(CHECK_SHA512) + touch $@ + +.sum-%: + $(error Download and check target not defined for $*) + +# Real dependency on missing packages +$(patsubst %,.dep-%,$(PKGS)): .dep-%: .% + touch -r $< $@ + +.SECONDEXPANSION: + +# Dependency propagation (convert 'DEPS_foo = bar' to '.foo: .bar') +$(foreach p,$(PKGS),.$(p)): .%: $$(foreach d,$$(DEPS_$$*),.dep-$$(d)) + +.DELETE_ON_ERROR: diff --git a/pkg/contrib/src/njs/Makefile b/pkg/contrib/src/njs/Makefile new file mode 100644 index 00000000..54255aef --- /dev/null +++ b/pkg/contrib/src/njs/Makefile @@ -0,0 +1,19 @@ +# njs + +include $(dir $(abspath $(lastword $(MAKEFILE_LIST))))/version +NJS_URL := https://hg.nginx.org/njs/archive/$(NJS_VERSION).tar.gz + +PKGS += njs + +$(TARBALLS)/njs-$(NJS_VERSION).tar.gz: + $(call download_pkg,$(NJS_URL),njs) + +.sum-njs: njs-$(NJS_VERSION).tar.gz + +njs: njs-$(NJS_VERSION).tar.gz .sum-njs + $(UNPACK) + $(MOVE) + +.njs: njs + cd $< && ./configure && $(MAKE) libnjs + touch $@ diff --git a/pkg/contrib/src/njs/SHA512SUMS b/pkg/contrib/src/njs/SHA512SUMS new file mode 100644 index 00000000..1bddec9b --- /dev/null +++ b/pkg/contrib/src/njs/SHA512SUMS @@ -0,0 +1 @@ +dc73029e7b570a7fbc94e90deb1e17c9a3d85072dc0e060f11dd96bd173e11b7c823c57115369d3c68af7acd97fabe619b70dfd73280694f8b5dc8b7929d850b njs-0.7.9.tar.gz diff --git a/pkg/contrib/src/njs/version b/pkg/contrib/src/njs/version new file mode 100644 index 00000000..511715d0 --- /dev/null +++ b/pkg/contrib/src/njs/version @@ -0,0 +1 @@ +NJS_VERSION := 0.7.9 diff --git a/pkg/contrib/tarballs/.hgignore b/pkg/contrib/tarballs/.hgignore new file mode 100644 index 00000000..8d876d7b --- /dev/null +++ b/pkg/contrib/tarballs/.hgignore @@ -0,0 +1,3 @@ +syntax:glob +*.tar.* +*.githash diff --git a/pkg/deb/Makefile b/pkg/deb/Makefile index c4f085f8..580cb655 100644 --- a/pkg/deb/Makefile +++ b/pkg/deb/Makefile @@ -19,6 +19,21 @@ BUILD_DEPENDS = $(BUILD_DEPENDS_unit) MODULES= +# Ubuntu 22.10 +ifeq ($(CODENAME),kinetic) +include Makefile.php +include Makefile.python27 +include Makefile.python310 +include Makefile.go +include Makefile.perl +include Makefile.ruby +include Makefile.jsc-common +include Makefile.jsc11 +include Makefile.jsc17 +include Makefile.jsc18 +include Makefile.jsc19 +endif + # Ubuntu 22.04 ifeq ($(CODENAME),jammy) include Makefile.php @@ -100,7 +115,7 @@ include Makefile.jsc-common include Makefile.jsc11 endif -CONFIGURE_ARGS=\ +CONFIGURE_ARGS_COMMON=\ --prefix=/usr \ --state=/var/lib/unit \ --control="unix:/var/run/control.unit.sock" \ @@ -112,6 +127,10 @@ CONFIGURE_ARGS=\ --tests \ --openssl +CONFIGURE_ARGS=\ + $(CONFIGURE_ARGS_COMMON) \ + --njs + export CR=\\n default: @@ -156,6 +175,7 @@ debuild/$(SRCDIR)/debian: echo '3.0 (quilt)' > debuild/$(SRCDIR)/debian/source/format ; \ cat debian/control.in | sed \ -e "s#%%PACKAGE_VENDOR%%#$(PACKAGE_VENDOR)#g" \ + -e "s#%%UNIT_VERSION%%#$(VERSION)#g" \ > debuild/$(SRCDIR)/debian/control ; \ cat debian/rules.in | sed \ -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \ @@ -179,7 +199,7 @@ endif debuild/unit_$(VERSION).orig.tar.gz: | debuild/$(SRCDIR)/debian cd ../.. && tar -czf pkg/deb/debuild/$(SRCDIR).tar.gz \ --transform "s#^#$(SRCDIR)/#" \ - LICENSE NOTICE CHANGES README.md CONTRIBUTING.md configure auto src test version go docs/man/unitd.8.in + LICENSE NOTICE CHANGES README.md CONTRIBUTING.md configure auto src test version go pkg/contrib docs/man/unitd.8.in mv debuild/$(SRCDIR).tar.gz debuild/unit_$(VERSION).orig.tar.gz cd debuild && tar zxf unit_$(VERSION).orig.tar.gz @@ -241,7 +261,7 @@ endif -e "s#%%CODENAME%%#$(CODENAME)#g" \ -e "s#%%UNIT_VERSION%%#$(VERSION)#g" \ -e "s#%%UNIT_RELEASE%%#$(RELEASE)#g" \ - -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \ + -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS_COMMON)#g" \ -e "s#%%MODULE_CONFARGS%%#$(MODULE_CONFARGS_$*)#g" \ -e "s#%%MODULE_MAKEARGS%%#$(MODULE_MAKEARGS_$*)#g" \ -e "s#%%MODULE_INSTARGS%%#$(MODULE_INSTARGS_$*)#g" \ diff --git a/pkg/deb/Makefile.jsc19 b/pkg/deb/Makefile.jsc19 new file mode 100644 index 00000000..2a6ef7db --- /dev/null +++ b/pkg/deb/Makefile.jsc19 @@ -0,0 +1,71 @@ +MODULES+= jsc19 +MODULE_SUFFIX_jsc19= jsc19 + +MODULE_SUMMARY_jsc19= Java 19 module for NGINX Unit + +MODULE_VERSION_jsc19= $(VERSION) +MODULE_RELEASE_jsc19= 1 + +MODULE_CONFARGS_jsc19= java --module=java19 --home=/usr/lib/jvm/java-19-openjdk-$$\(DEB_HOST_ARCH\) --jars=/usr/share/unit-jsc-common/ +MODULE_MAKEARGS_jsc19= java19 +MODULE_INSTARGS_jsc19= java19-install + +MODULE_SOURCES_jsc19= unit.example-jsc-app \ + unit.example-jsc19-config + +BUILD_DEPENDS_jsc19= openjdk-19-jdk-headless openjdk-19-jre-headless +BUILD_DEPENDS+= $(BUILD_DEPENDS_jsc19) + +MODULE_BUILD_DEPENDS_jsc19=,openjdk-19-jdk-headless +MODULE_DEPENDS_jsc19=,openjdk-19-jre-headless,unit-jsc-common (= $(MODULE_VERSION_jsc_common)-$(MODULE_RELEASE_jsc_common)~$(CODENAME)) + +define MODULE_PREINSTALL_jsc19 + mkdir -p debian/unit-jsc19/usr/share/doc/unit-jsc19/examples/jsc-app + install -m 644 -p debian/unit.example-jsc-app debian/unit-jsc19/usr/share/doc/unit-jsc19/examples/jsc-app/index.jsp + install -m 644 -p debian/unit.example-jsc19-config debian/unit-jsc19/usr/share/doc/unit-jsc19/examples/unit.config + install -m 644 -p src/java/README.JSR-340 debian/unit-jsc19/usr/share/doc/unit-jsc19/ +endef +export MODULE_PREINSTALL_jsc19 + +define MODULE_POSTINSTALL_jsc19 + cd $$\(BUILDDIR_unit\) \&\& \ + DESTDIR=$$\(INSTALLDIR\) make java-shared-uninstall +endef +export MODULE_POSTINSTALL_jsc19 + +define MODULE_POST_jsc19 +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_jsc19) has been installed. + +To check out the sample app, run these commands: + + sudo service unit restart + cd /usr/share/doc/unit-$(MODULE_SUFFIX_jsc19)/examples + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock http://localhost/config + curl http://localhost:8800/ + +Online documentation is available at https://unit.nginx.org + +NOTICE: + +This version of Unit code is made available in support of the open source +development process. This is an intermediate build made available for +testing purposes only. This Unit code is untested and presumed incompatible +with the JSR 340 Java Servlet 3.1 specification. You should not deploy or +write to this code. You should instead deploy and write production +applications on pre-built binaries that have been tested and certified +to meet the JSR-340 compatibility requirements such as certified binaries +published for the JSR-340 reference implementation available at +https://javaee.github.io/glassfish/. + +Redistribution of any Intermediate Build must retain this notice. + +Oracle and Java are registered trademarks of Oracle and/or its affiliates. +Other names may be trademarks of their respective owners. + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_jsc19 diff --git a/pkg/deb/debian.module/control.in b/pkg/deb/debian.module/control.in index f5ce8ae4..f82362d1 100644 --- a/pkg/deb/debian.module/control.in +++ b/pkg/deb/debian.module/control.in @@ -14,7 +14,7 @@ Section: admin Architecture: any Depends: lsb-base, ${misc:Depends}, ${shlibs:Depends}, - unit (= %%UNIT_VERSION%%-%%UNIT_RELEASE%%~%%CODENAME%%)%%MODULE_DEPENDS%% + unit-r%%UNIT_VERSION%%%%MODULE_DEPENDS%% Description: %%SUMMARY%% NGINX Unit is a runtime and delivery environment for modern distributed applications. It runs the application code in multiple languages diff --git a/pkg/deb/debian.module/unit.example-jsc19-config b/pkg/deb/debian.module/unit.example-jsc19-config new file mode 100644 index 00000000..106b694b --- /dev/null +++ b/pkg/deb/debian.module/unit.example-jsc19-config @@ -0,0 +1,15 @@ +{ + "applications": { + "example_java19": { + "processes": 1, + "type": "java 19", + "webapp": "/usr/share/doc/unit-jsc19/examples/jsc-app" + } + }, + + "listeners": { + "*:8800": { + "pass": "applications/example_java19" + } + } +} diff --git a/pkg/deb/debian/control.in b/pkg/deb/debian/control.in index 691bafed..579f41e3 100644 --- a/pkg/deb/debian/control.in +++ b/pkg/deb/debian/control.in @@ -5,7 +5,8 @@ Maintainer: %%PACKAGE_VENDOR%% Build-Depends: debhelper (>= 11), linux-libc-dev, libssl-dev, - libpcre2-dev + libpcre2-dev, + pkg-config Standards-Version: 4.1.4 Homepage: https://unit.nginx.org @@ -14,6 +15,7 @@ Section: admin Architecture: any Depends: lsb-base, ${misc:Depends}, ${shlibs:Depends} +Provides: unit-r%%UNIT_VERSION%% Description: NGINX Unit NGINX Unit is a runtime and delivery environment for modern distributed applications. It runs the application code in multiple languages diff --git a/pkg/deb/debian/rules.in b/pkg/deb/debian/rules.in index d2e34796..23812926 100644 --- a/pkg/deb/debian/rules.in +++ b/pkg/deb/debian/rules.in @@ -20,7 +20,12 @@ BASEDIR = $(CURDIR) DOTESTS = 0 -config.env.%: +njs: + dh_testdir + cd pkg/contrib && make .njs + touch $@ + +config.env.%: njs dh_testdir mkdir -p $(BUILDDIR_$*) cp -Pa $(CURDIR)/auto $(BUILDDIR_$*)/ @@ -40,6 +45,7 @@ config.env.%: configure.unit: config.env.unit cd $(BUILDDIR_unit) && \ + PKG_CONFIG_PATH=$(CURDIR)/pkg/contrib/njs/build \ CFLAGS= ./configure \ %%CONFIGURE_ARGS%% \ --modules=/usr/lib/unit/modules \ @@ -50,6 +56,7 @@ configure.unit: config.env.unit configure.unit_debug: config.env.unit_debug cd $(BUILDDIR_unit_debug) && \ + PKG_CONFIG_PATH=$(CURDIR)/pkg/contrib/njs/build \ CFLAGS= ./configure \ %%CONFIGURE_ARGS%% \ --modules=/usr/lib/unit/debug-modules \ diff --git a/pkg/docker/Dockerfile.go1.19 b/pkg/docker/Dockerfile.go1.19 index 1625b64f..ec2b40da 100644 --- a/pkg/docker/Dockerfile.go1.19 +++ b/pkg/docker/Dockerfile.go1.19 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.jsc11 b/pkg/docker/Dockerfile.jsc11 index fe344d0e..b8391997 100644 --- a/pkg/docker/Dockerfile.jsc11 +++ b/pkg/docker/Dockerfile.jsc11 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.minimal b/pkg/docker/Dockerfile.minimal index c57379f7..ca3dec01 100644 --- a/pkg/docker/Dockerfile.minimal +++ b/pkg/docker/Dockerfile.minimal @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.node16 b/pkg/docker/Dockerfile.node18 index d341e43f..bdf968b2 100644 --- a/pkg/docker/Dockerfile.node16 +++ b/pkg/docker/Dockerfile.node18 @@ -1,4 +1,4 @@ -FROM node:16 as BUILDER +FROM node:18 as BUILDER LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>" @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ @@ -40,7 +40,7 @@ RUN set -ex \ && make -j $NCPU node node-install libunit-install \ && ldd /usr/sbin/unitd | awk '/=>/{print $(NF-1)}' | while read n; do dpkg-query -S $n; done | sed 's/^\([^:]\+\):.*$/\1/' | sort | uniq > /requirements.apt -FROM node:16 +FROM node:18 COPY docker-entrypoint.sh /usr/local/bin/ COPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd COPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug diff --git a/pkg/docker/Dockerfile.perl5.36 b/pkg/docker/Dockerfile.perl5.36 index d0b8006f..9c398c30 100644 --- a/pkg/docker/Dockerfile.perl5.36 +++ b/pkg/docker/Dockerfile.perl5.36 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.php8.1 b/pkg/docker/Dockerfile.php8.1 index c63e708e..76c7c428 100644 --- a/pkg/docker/Dockerfile.php8.1 +++ b/pkg/docker/Dockerfile.php8.1 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Dockerfile.python3.10 b/pkg/docker/Dockerfile.python3.11 index 6502f8a8..3a83ec57 100644 --- a/pkg/docker/Dockerfile.python3.10 +++ b/pkg/docker/Dockerfile.python3.11 @@ -1,4 +1,4 @@ -FROM python:3.10 as BUILDER +FROM python:3.11 as BUILDER LABEL maintainer="NGINX Docker Maintainers <docker-maint@nginx.com>" @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ @@ -40,7 +40,7 @@ RUN set -ex \ && make -j $NCPU python3-install \ && ldd /usr/sbin/unitd | awk '/=>/{print $(NF-1)}' | while read n; do dpkg-query -S $n; done | sed 's/^\([^:]\+\):.*$/\1/' | sort | uniq > /requirements.apt -FROM python:3.10 +FROM python:3.11 COPY docker-entrypoint.sh /usr/local/bin/ COPY --from=BUILDER /usr/sbin/unitd /usr/sbin/unitd COPY --from=BUILDER /usr/sbin/unitd-debug /usr/sbin/unitd-debug diff --git a/pkg/docker/Dockerfile.ruby3.1 b/pkg/docker/Dockerfile.ruby3.1 index f365bc96..1eb6ce5c 100644 --- a/pkg/docker/Dockerfile.ruby3.1 +++ b/pkg/docker/Dockerfile.ruby3.1 @@ -8,7 +8,7 @@ RUN set -ex \ && mkdir -p /usr/lib/unit/modules /usr/lib/unit/debug-modules \ && hg clone https://hg.nginx.org/unit \ && cd unit \ - && hg up 1.28.0 \ + && hg up 1.29.0 \ && NCPU="$(getconf _NPROCESSORS_ONLN)" \ && DEB_HOST_MULTIARCH="$(dpkg-architecture -q DEB_HOST_MULTIARCH)" \ && CC_OPT="$(DEB_BUILD_MAINT_OPTIONS="hardening=+all,-pie" DEB_CFLAGS_MAINT_APPEND="-Wp,-D_FORTIFY_SOURCE=2 -fPIC" dpkg-buildflags --get CFLAGS)" \ diff --git a/pkg/docker/Makefile b/pkg/docker/Makefile index 03723d1d..b08e885f 100644 --- a/pkg/docker/Makefile +++ b/pkg/docker/Makefile @@ -34,7 +34,7 @@ CONFIGURE_jsc ?= java --jars=/usr/share/unit-jsc-common/ INSTALL_jsc ?= java-shared-install java-install COPY_jsc = COPY --from=BUILDER /usr/share/unit-jsc-common/ /usr/share/unit-jsc-common/ -VERSION_node ?= 16 +VERSION_node ?= 18 CONTAINER_node ?= node:$(VERSION_node) CONFIGURE_node ?= nodejs --node-gyp=/usr/local/lib/node_modules/npm/bin/node-gyp-bin/node-gyp INSTALL_node ?= node node-install libunit-install @@ -56,7 +56,7 @@ CONFIGURE_php ?= php INSTALL_php ?= php-install COPY_php = RUN ldconfig -VERSION_python ?= 3.10 +VERSION_python ?= 3.11 CONTAINER_python ?= python:$(VERSION_python) CONFIGURE_python ?= python --config=/usr/local/bin/python3-config INSTALL_python ?= python3-install diff --git a/pkg/docker/docker-entrypoint.sh b/pkg/docker/docker-entrypoint.sh index 59529925..3d134ea2 100755 --- a/pkg/docker/docker-entrypoint.sh +++ b/pkg/docker/docker-entrypoint.sh @@ -1,11 +1,14 @@ -#!/usr/bin/env bash +#!/bin/sh set -e +WAITLOOPS=5 +SLEEPSEC=1 + curl_put() { - RET=`/usr/bin/curl -s -w '%{http_code}' -X PUT --data-binary @$1 --unix-socket /var/run/control.unit.sock http://localhost/$2` - RET_BODY=${RET::-3} + RET=$(/usr/bin/curl -s -w '%{http_code}' -X PUT --data-binary @$1 --unix-socket /var/run/control.unit.sock http://localhost/$2) + RET_BODY=$(echo $RET | /bin/sed '$ s/...$//') RET_STATUS=$(echo $RET | /usr/bin/tail -c 4) if [ "$RET_STATUS" -ne "200" ]; then echo "$0: Error: HTTP response status code is '$RET_STATUS'" @@ -18,7 +21,7 @@ curl_put() return 0 } -if [ "$1" = "unitd" -o "$1" = "unitd-debug" ]; then +if [ "$1" = "unitd" ] || [ "$1" = "unitd-debug" ]; then if /usr/bin/find "/var/lib/unit/" -mindepth 1 -print -quit 2>/dev/null | /bin/grep -q .; then echo "$0: /var/lib/unit/ is not empty, skipping initial configuration..." else @@ -55,9 +58,20 @@ if [ "$1" = "unitd" -o "$1" = "unitd-debug" ]; then done echo "$0: Stopping Unit daemon after initial configuration..." - kill -TERM `/bin/cat /var/run/unit.pid` + kill -TERM $(/bin/cat /var/run/unit.pid) - while [ -S /var/run/control.unit.sock ]; do echo "$0: Waiting for control socket to be removed..."; /bin/sleep 0.1; done + for i in $(/usr/bin/seq $WAITLOOPS); do + if [ -S /var/run/control.unit.sock ]; then + echo "$0 Waiting for control socket to be removed..." + /bin/sleep $SLEEPSEC + else + break + fi + done + if [ -S /var/run/control.unit.sock ]; then + kill -KILL $(/bin/cat /var/run/unit.pid) + rm -f /var/run/control.unit.sock + fi echo echo "$0: Unit initial configuration complete; ready for start up..." diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile index bbe44fe5..d00a25ac 100644 --- a/pkg/rpm/Makefile +++ b/pkg/rpm/Makefile @@ -18,8 +18,10 @@ else ifeq ($(shell rpm --eval "%{?rhel}"), 9) OSVER = centos9 else ifeq ($(shell rpm --eval "%{?amzn}"), 2) OSVER = amazonlinux2 -else ifeq ($(shell test `rpm --eval '0%{?fedora} -ge 35'`; echo $$?),0) +else ifeq ($(shell test `rpm --eval '0%{?fedora} -ge 35 -a 0%{?fedora} -le 36'`; echo $$?),0) OSVER = fedora +else ifeq ($(shell test `rpm --eval '0%{?fedora} -ge 37'`; echo $$?),0) +OSVER = fedora37 endif BUILD_DEPENDS_unit = gcc rpm-build rpmlint @@ -53,6 +55,8 @@ ifeq ($(OSVER), centos8) include Makefile.php include Makefile.python27 include Makefile.python36 +include Makefile.python38 +include Makefile.python39 include Makefile.go include Makefile.perl include Makefile.jsc-common @@ -91,7 +95,18 @@ include Makefile.jsc8 include Makefile.jsc11 endif -CONFIGURE_ARGS=\ +ifeq ($(OSVER), fedora37) +include Makefile.php +include Makefile.python311 +include Makefile.go +include Makefile.perl +include Makefile.ruby +include Makefile.jsc-common +include Makefile.jsc8 +include Makefile.jsc11 +endif + +CONFIGURE_ARGS_COMMON=\ --prefix=/usr \ --state=%{_sharedstatedir}/unit \ --control="unix:/var/run/unit/control.sock" \ @@ -103,6 +118,10 @@ CONFIGURE_ARGS=\ --tests \ --openssl +CONFIGURE_ARGS=\ + $(CONFIGURE_ARGS_COMMON) \ + --njs + export CR=\\n default: @@ -161,7 +180,7 @@ endif rpmbuild/SOURCES/unit-$(VERSION).tar.gz: cd ../.. && tar -czf pkg/rpm/rpmbuild/SOURCES/unit-$(VERSION).tar.gz \ --transform "s#^#unit-$(VERSION)/#" \ - LICENSE NOTICE CHANGES README.md CONTRIBUTING.md configure auto src test version go docs/man/unitd.8.in + LICENSE NOTICE CHANGES README.md CONTRIBUTING.md configure auto src test version go pkg/contrib docs/man/unitd.8.in unit: check-build-depends-unit rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz @echo "===> Building $@ package" ; \ @@ -197,7 +216,7 @@ rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuil -e "s#%%UNIT_RELEASE%%#$(RELEASE)#g" \ -e "s#%%PACKAGE_VENDOR%%#$(PACKAGE_VENDOR)#g" \ -e "s#%%MODULE_SOURCES%%#$${sources}#g" \ - -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \ + -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS_COMMON)#g" \ -e "s#%%MODULE_CONFARGS%%#$(MODULE_CONFARGS_$*)#g" \ -e "s#%%MODULE_MAKEARGS%%#$(MODULE_MAKEARGS_$*)#g" \ -e "s#%%MODULE_INSTARGS%%#$(MODULE_INSTARGS_$*)#g" \ diff --git a/pkg/rpm/Makefile.python311 b/pkg/rpm/Makefile.python311 new file mode 100644 index 00000000..a8bee943 --- /dev/null +++ b/pkg/rpm/Makefile.python311 @@ -0,0 +1,55 @@ +MODULES+= python311 +MODULE_SUFFIX_python311= python3.11 + +MODULE_SUMMARY_python311= Python 3.11 module for NGINX Unit + +MODULE_VERSION_python311= $(VERSION) +MODULE_RELEASE_python311= 1 + +MODULE_CONFARGS_python311= python --config=python3.11-config +MODULE_MAKEARGS_python311= python3.11 +MODULE_INSTARGS_python311= python3.11-install + +MODULE_SOURCES_python311= unit.example-python-app \ + unit.example-python311-config + +ifneq (,$(findstring $(OSVER),fedora37)) +BUILD_DEPENDS_python311= python3-devel +endif + +BUILD_DEPENDS+= $(BUILD_DEPENDS_python311) + +define MODULE_PREINSTALL_python311 +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-python311/examples/python-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-python311/examples/python-app/wsgi.py +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-python311/examples/unit.config +endef +export MODULE_PREINSTALL_python311 + +define MODULE_FILES_python311 +%{_libdir}/unit/modules/* +%{_libdir}/unit/debug-modules/* +endef +export MODULE_FILES_python311 + +define MODULE_POST_python311 +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_python311) has been installed. + +To check the sample app, run these commands: + + sudo service unit start + cd /usr/share/doc/%{name}/examples + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config + curl http://localhost:8400/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_python311 diff --git a/pkg/rpm/Makefile.python38 b/pkg/rpm/Makefile.python38 new file mode 100644 index 00000000..3f3657e2 --- /dev/null +++ b/pkg/rpm/Makefile.python38 @@ -0,0 +1,53 @@ +MODULES+= python38 +MODULE_SUFFIX_python38= python3.8 + +MODULE_SUMMARY_python38= Python 3.8 module for NGINX Unit + +MODULE_VERSION_python38= $(VERSION) +MODULE_RELEASE_python38= 1 + +MODULE_CONFARGS_python38= python --config=python3.8-config +MODULE_MAKEARGS_python38= python3.8 +MODULE_INSTARGS_python38= python3.8-install + +MODULE_SOURCES_python38= unit.example-python-app \ + unit.example-python38-config + +BUILD_DEPENDS_python38= python38-devel + +BUILD_DEPENDS+= $(BUILD_DEPENDS_python38) + +define MODULE_PREINSTALL_python38 +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-python38/examples/python-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-python38/examples/python-app/wsgi.py +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-python38/examples/unit.config +endef +export MODULE_PREINSTALL_python38 + +define MODULE_FILES_python38 +%{_libdir}/unit/modules/* +%{_libdir}/unit/debug-modules/* +endef +export MODULE_FILES_python38 + +define MODULE_POST_python38 +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_python38) has been installed. + +To check the sample app, run these commands: + + sudo service unit start + cd /usr/share/doc/%{name}/examples + sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config + curl http://localhost:8400/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_python38 diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example-python311-config b/pkg/rpm/rpmbuild/SOURCES/unit.example-python311-config new file mode 100644 index 00000000..ee653db6 --- /dev/null +++ b/pkg/rpm/rpmbuild/SOURCES/unit.example-python311-config @@ -0,0 +1,16 @@ +{ + "applications": { + "example_python": { + "type": "python 3.11", + "processes": 2, + "path": "/usr/share/doc/unit-python311/examples/python-app", + "module": "wsgi" + } + }, + + "listeners": { + "*:8400": { + "pass": "applications/example_python" + } + } +} diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example-python38-config b/pkg/rpm/rpmbuild/SOURCES/unit.example-python38-config new file mode 100644 index 00000000..c98d1a52 --- /dev/null +++ b/pkg/rpm/rpmbuild/SOURCES/unit.example-python38-config @@ -0,0 +1,16 @@ +{ + "applications": { + "example_python": { + "type": "python 3.8", + "processes": 2, + "path": "/usr/share/doc/unit-python38/examples/python-app", + "module": "wsgi" + } + }, + + "listeners": { + "*:8400": { + "pass": "applications/example_python" + } + } +} diff --git a/pkg/rpm/unit.module.spec.in b/pkg/rpm/unit.module.spec.in index 88a1c33e..bc68a254 100644 --- a/pkg/rpm/unit.module.spec.in +++ b/pkg/rpm/unit.module.spec.in @@ -39,7 +39,7 @@ BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: pcre2-devel -Requires: unit == %%UNIT_VERSION%%-%%UNIT_RELEASE%%%{?dist}.ngx +Requires: unit-r%%UNIT_VERSION%% %description NGINX Unit is a runtime and delivery environment for modern distributed diff --git a/pkg/rpm/unit.spec.in b/pkg/rpm/unit.spec.in index 01c08bb8..06880fcf 100644 --- a/pkg/rpm/unit.spec.in +++ b/pkg/rpm/unit.spec.in @@ -46,6 +46,9 @@ Requires(preun): systemd Requires(postun): systemd BuildRequires: pcre2-devel +BuildRequires: pkgconfig + +Provides: unit-r%{version} %description NGINX Unit is a runtime and delivery environment for modern distributed @@ -72,6 +75,9 @@ Library and include files required for NGINX Unit modules development. %setup -q %build +%{__make} %{?_smp_mflags} -C pkg/contrib .njs + +PKG_CONFIG_PATH=%{bdir}/pkg/contrib/njs/build \ ./configure \ %{CONFIGURE_ARGS} \ --modules=%{_libdir}/unit/debug-modules \ @@ -82,6 +88,8 @@ Library and include files required for NGINX Unit modules development. %{__make} %{?_smp_mflags} %{__make} %{?_smp_mflags} build/libunit.a %{__mv} build build-debug + +PKG_CONFIG_PATH=%{bdir}/pkg/contrib/njs/build \ ./configure \ %{CONFIGURE_ARGS} \ --modules=%{_libdir}/unit/modules \ |