diff options
Diffstat (limited to '')
-rw-r--r-- | pkg/rpm/Makefile | 137 | ||||
-rw-r--r-- | pkg/rpm/Makefile.go | 63 | ||||
-rw-r--r-- | pkg/rpm/Makefile.php | 49 | ||||
-rw-r--r-- | pkg/rpm/Makefile.python | 49 |
4 files changed, 298 insertions, 0 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile new file mode 100644 index 00000000..2a839444 --- /dev/null +++ b/pkg/rpm/Makefile @@ -0,0 +1,137 @@ +#!/usr/bin/make + +DEFAULT_VERSION := $(shell grep 'define NXT_VERSION' ../../src/nxt_main.h \ + | sed -e 's/^.*"\(.*\)".*/\1/') + +DEFAULT_RELEASE := 1 + +VERSION ?= $(DEFAULT_VERSION) +RELEASE ?= $(DEFAULT_RELEASE) + +BUILD_DEPENDS = libxml2 libxslt rpm-build rpmlint + +MODULES= +-include Makefile.* + +CONFIGURE_ARGS=\ + --prefix=/usr \ + --state=%{_sharedstatedir}/unit \ + --control="unix:/var/run/control.unit.sock" \ + --pid=/var/run/unit.pid \ + --log=/var/log/unit.log \ + --tests + +export CR=\\n + +default: + @echo "valid targets: all modules unit $(addprefix unit-, $(MODULES)) rpmlint specs clean" + +all: check-build-depends unit modules + +modules: $(addprefix unit-, $(MODULES)) + +specs: $(addsuffix .spec, $(addprefix rpmbuild/SPECS/unit-, $(MODULES))) + +check-build-depends: + @{ \ + not_installed= ; \ + for pkg in $(BUILD_DEPENDS); do \ + rpm -qi $${pkg} >/dev/null 2>&1 ; \ + if [ $$? -ne 0 ]; then \ + not_installed="$${not_installed} $${pkg}" ; \ + fi ; \ + done ; \ + if test -n "$${not_installed}" ; then \ + echo "" >&2 ; \ + echo "The following packages are required in order to proceed:" >&2 ; \ + echo "" >&2 ; \ + echo $${not_installed} >&2 ; \ + echo "" >&2 ; \ + exit 1 ; \ + fi \ + } + +rpmbuild/SPECS: + mkdir -p rpmbuild/SPECS + +rpmbuild/SPECS/unit.spec: unit.spec.in ../../docs/changes.xml | rpmbuild/SPECS + cat unit.spec.in | \ + sed -e "s#%%VERSION%%#$(VERSION)#g" \ + -e "s#%%RELEASE%%#$(RELEASE)#g" \ + -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \ + > rpmbuild/SPECS/unit.spec + cd ../../docs && make ../build/unit.rpm-changelog +ifneq ($(DEFAULT_VERSION)$(DEFAULT_RELEASE), $(VERSION)$(RELEASE)) + cat ../../build/unit.rpm-changelog | sed -e \ + "s/> - $(DEFAULT_VERSION)-$(DEFAULT_RELEASE)/> - $(VERSION)-$(RELEASE)/" \ + >> rpmbuild/SPECS/unit.spec +else + cat ../../build/unit.rpm-changelog >> rpmbuild/SPECS/unit.spec +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 configure auto src test + +unit: rpmbuild/SPECS/unit.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz + @echo "===> Building $@ package" ; \ + rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/unit.spec && \ + ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@ + +rpmlint: + find rpmbuild/ -name "*.rpm" -print -exec rpmlint {} \; + +rpmbuild/SPECS/unit-%.spec: unit.module.spec.in ../../docs/changes.xml | rpmbuild/SPECS + @echo "===> Creating $@" + @{ \ + set -e ; \ + i=100 ; \ + sources= ; \ + for src in $(MODULE_SOURCES_$*); do \ + s="`printf "Source%d: %s\n" $${i} $${src}`" ; \ + sources="$${sources}\n$${s}" ; \ + i=$$(($${i}+1)) ; \ + done ; \ + pkgname=$(shell echo $@ | cut -d '/' -f 3 | cut -d '.' -f 1) ; \ + definitions=`echo "$$MODULE_DEFINITIONS_$*" | 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"` ; \ + files=`echo "$$MODULE_FILES_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \ + post=`echo "$$MODULE_POST_$*" | sed -e ':a' -e 'N' -e '$$!ba' -e "s/\n/\$$CR/g"` ; \ + cat unit.module.spec.in | sed \ + -e "s#%%NAME%%#$${pkgname}#g" \ + -e "s#%%SUMMARY%%#$(MODULE_SUMMARY_$*)#g" \ + -e "s#%%VERSION%%#$(MODULE_VERSION_$*)#g" \ + -e "s#%%RELEASE%%#$(MODULE_RELEASE_$*)#g" \ + -e "s#%%UNIT_VERSION%%#$(VERSION)#g" \ + -e "s#%%UNIT_RELEASE%%#$(RELEASE)#g" \ + -e "s#%%MODULE_SOURCES%%#$${sources}#g" \ + -e "s#%%CONFIGURE_ARGS%%#$(CONFIGURE_ARGS)#g" \ + -e "s#%%MODULE_CONFARGS%%#$(MODULE_CONFARGS_$*)#g" \ + -e "s#%%MODULE_MAKEARGS%%#$(MODULE_MAKEARGS_$*)#g" \ + -e "s#%%MODULE_INSTARGS%%#$(MODULE_INSTARGS_$*)#g" \ + -e "s#%%MODULE_DEFINITIONS%%#$${definitions}#g" \ + -e "s#%%MODULE_PREINSTALL%%#$${preinstall}#g" \ + -e "s#%%MODULE_FILES%%#$${files}#g" \ + -e "s#%%MODULE_POST%%#$${post}#g" \ + > $@.tmp ; \ + } + cd ../../docs && make ../build/unit-$*.rpm-changelog + cat ../../build/unit-$*.rpm-changelog | sed -e \ + "s/> - $(DEFAULT_VERSION)-$(DEFAULT_RELEASE)/> - $(MODULE_VERSION_$*)-$(MODULE_RELEASE_$*)/" \ + >> $@.tmp + mv $@.tmp $@ + +unit-%: rpmbuild/SPECS/unit-%.spec rpmbuild/SOURCES/unit-$(VERSION).tar.gz + @echo "===> Building $@ package" ; \ + rpmbuild -D "_topdir `pwd`/rpmbuild" -ba rpmbuild/SPECS/$@.spec && \ + ln -s rpmbuild/BUILD/$@-$(VERSION)/build $@ + +clean: + rm -rf rpmbuild/SPECS rpmbuild/BUILD rpmbuild/BUILDROOT rpmbuild/RPMS rpmbuild/SRPMS ../../build + rm -f rpmbuild/SOURCES/unit-*.tar.gz unit + find . -maxdepth 1 -type l -delete + +.PHONY: default all modules specs check-build-depends rpmlint clean + +.SECONDARY: diff --git a/pkg/rpm/Makefile.go b/pkg/rpm/Makefile.go new file mode 100644 index 00000000..9dfbca77 --- /dev/null +++ b/pkg/rpm/Makefile.go @@ -0,0 +1,63 @@ +MODULES+= go + +MODULE_SUMMARY_go= Go module for NGINX Unit + +MODULE_VERSION_go= $(VERSION) +MODULE_RELEASE_go= 1 + +MODULE_CONFARGS_go= go --go-path=%{goroot} +MODULE_MAKEARGS_go= go +MODULE_INSTARGS_go= go-install + +MODULE_SOURCES_go= unit.example-go-app \ + unit.example-go-config + +BUILD_DEPENDS+= golang + +define MODULE_DEFINITIONS_go +%define goroot %(go env GOROOT) +%define goos %(go env GOOS) +%define goarch %(go env GOARCH) + +BuildRequires: golang +endef +export MODULE_DEFINITIONS_go + +define MODULE_PREINSTALL_go +QA_SKIP_BUILD_ROOT=1 +export QA_SKIP_BUILD_ROOT + +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config +endef +export MODULE_PREINSTALL_go + +define MODULE_FILES_go +%dir %{goroot}/src/unit +%{goroot}/src/unit/* +%{goroot}/pkg/%{goos}_%{goarch}/unit.a +endef +export MODULE_FILES_go + +define MODULE_POST_go +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_go) has been installed. + +To check the sample app, run these commands: + + go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go + sudo service unit start + sudo service unit loadconfig /usr/share/doc/unit-go/examples/unit.config + curl http://localhost:8500/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_go diff --git a/pkg/rpm/Makefile.php b/pkg/rpm/Makefile.php new file mode 100644 index 00000000..dcaee2a8 --- /dev/null +++ b/pkg/rpm/Makefile.php @@ -0,0 +1,49 @@ +MODULES+= php + +MODULE_SUMMARY_php= PHP module for NGINX Unit + +MODULE_VERSION_php= $(VERSION) +MODULE_RELEASE_php= 1 + +MODULE_CONFARGS_php= php +MODULE_MAKEARGS_php= php +MODULE_INSTARGS_php= php-install + +MODULE_SOURCES_php= unit.example-php-app \ + unit.example-php-config + +BUILD_DEPENDS+= php-devel php-embedded + +define MODULE_PREINSTALL_php +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-php/examples/phpinfo-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-php/examples/phpinfo-app/index.php +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-php/examples/unit.config +endef +export MODULE_PREINSTALL_php + +define MODULE_FILES_php +%{_libdir}/unit/modules/* +%{_libdir}/unit/debug-modules/* +endef +export MODULE_FILES_php + +define MODULE_POST_php +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_php) has been installed. + +To check out the sample app, run these commands: + + sudo service unit start + sudo service unit loadconfig /usr/share/doc/unit-php/examples/unit.config + curl http://localhost:8300/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_php diff --git a/pkg/rpm/Makefile.python b/pkg/rpm/Makefile.python new file mode 100644 index 00000000..b954744e --- /dev/null +++ b/pkg/rpm/Makefile.python @@ -0,0 +1,49 @@ +MODULES+= python + +MODULE_SUMMARY_python= Python module for NGINX Unit + +MODULE_VERSION_python= $(VERSION) +MODULE_RELEASE_python= 1 + +MODULE_CONFARGS_python= python +MODULE_MAKEARGS_python= python +MODULE_INSTARGS_python= python-install + +MODULE_SOURCES_python= unit.example-python-app \ + unit.example-python-config + +BUILD_DEPENDS+= python-devel + +define MODULE_PREINSTALL_python +%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-python/examples/python-app +%{__install} -m 644 -p %{SOURCE100} \ + %{buildroot}%{_datadir}/doc/unit-python/examples/python-app/wsgi.py +%{__install} -m 644 -p %{SOURCE101} \ + %{buildroot}%{_datadir}/doc/unit-python/examples/unit.config +endef +export MODULE_PREINSTALL_python + +define MODULE_FILES_python +%{_libdir}/unit/modules/* +%{_libdir}/unit/debug-modules/* +endef +export MODULE_FILES_python + +define MODULE_POST_python +cat <<BANNER +---------------------------------------------------------------------- + +The $(MODULE_SUMMARY_python) has been installed. + +To check the sample app, run these commands: + + sudo service unit start + sudo service unit loadconfig /usr/share/doc/unit-python/examples/unit.config + curl http://localhost:8400/ + +Online documentation is available at https://unit.nginx.org + +---------------------------------------------------------------------- +BANNER +endef +export MODULE_POST_python |