summaryrefslogtreecommitdiffhomepage
path: root/pkg/rpm
diff options
context:
space:
mode:
authorAndrei Belov <defan@nginx.com>2018-02-07 17:26:37 +0300
committerAndrei Belov <defan@nginx.com>2018-02-07 17:26:37 +0300
commit539caf0946d2a5881ffaa34481f63c1bc67be96d (patch)
tree829ffba6d9f84d94e5abe742a299521e41f38268 /pkg/rpm
parent78300263685f9e1037038a3d20ed15f41e52dd3d (diff)
downloadunit-539caf0946d2a5881ffaa34481f63c1bc67be96d.tar.gz
unit-539caf0946d2a5881ffaa34481f63c1bc67be96d.tar.bz2
Packages: added Perl package.
Diffstat (limited to 'pkg/rpm')
-rw-r--r--pkg/rpm/Makefile2
-rw-r--r--pkg/rpm/Makefile.perl50
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.example-perl-app12
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.example-perl-config17
-rw-r--r--pkg/rpm/rpmbuild/SOURCES/unit.example.config12
5 files changed, 93 insertions, 0 deletions
diff --git a/pkg/rpm/Makefile b/pkg/rpm/Makefile
index 03fa1574..2078fe3b 100644
--- a/pkg/rpm/Makefile
+++ b/pkg/rpm/Makefile
@@ -28,6 +28,7 @@ ifneq (,$(findstring $(OSVER),centos6 centos7 amazonlinux2))
include Makefile.php
include Makefile.python
include Makefile.go
+include Makefile.perl
endif
ifeq ($(OSVER), amazonlinux1)
@@ -37,6 +38,7 @@ include Makefile.python34
include Makefile.python35
include Makefile.python36
include Makefile.go
+include Makefile.perl
endif
CONFIGURE_ARGS=\
diff --git a/pkg/rpm/Makefile.perl b/pkg/rpm/Makefile.perl
new file mode 100644
index 00000000..b92ea6c7
--- /dev/null
+++ b/pkg/rpm/Makefile.perl
@@ -0,0 +1,50 @@
+MODULES+= perl
+
+MODULE_SUMMARY_perl= Perl module for NGINX Unit
+
+MODULE_VERSION_perl= $(VERSION)
+MODULE_RELEASE_perl= 1
+
+MODULE_CONFARGS_perl= perl
+MODULE_MAKEARGS_perl= perl
+MODULE_INSTARGS_perl= perl-install
+
+MODULE_SOURCES_perl= unit.example-perl-app \
+ unit.example-perl-config
+
+BUILD_DEPENDS_perl= perl-devel perl-libs
+BUILD_DEPENDS+= $(BUILD_DEPENDS_perl)
+
+define MODULE_PREINSTALL_perl
+%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-perl/examples/perl-app
+%{__install} -m 644 -p %{SOURCE100} \
+ %{buildroot}%{_datadir}/doc/unit-perl/examples/perl-app/index.pl
+%{__install} -m 644 -p %{SOURCE101} \
+ %{buildroot}%{_datadir}/doc/unit-perl/examples/unit.config
+endef
+export MODULE_PREINSTALL_perl
+
+define MODULE_FILES_perl
+%{_libdir}/unit/modules/*
+%{_libdir}/unit/debug-modules/*
+endef
+export MODULE_FILES_perl
+
+define MODULE_POST_perl
+cat <<BANNER
+----------------------------------------------------------------------
+
+The $(MODULE_SUMMARY_perl) has been installed.
+
+To check out the sample app, run these commands:
+
+ sudo service unit start
+ sudo service unit loadconfig /usr/share/doc/unit-perl/examples/unit.config
+ curl http://localhost:8600/
+
+Online documentation is available at https://unit.nginx.org
+
+----------------------------------------------------------------------
+BANNER
+endef
+export MODULE_POST_perl
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-app b/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-app
new file mode 100644
index 00000000..33be1d3e
--- /dev/null
+++ b/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-app
@@ -0,0 +1,12 @@
+#!/usr/bin/env perl
+
+use Data::Dumper;
+
+my $app = sub {
+ my $env = shift;
+ return [
+ '200',
+ [ 'Content-Type' => 'text/plain' ],
+ [ "Hello from Unit, Perl $^V, environment:\n\n", Dumper($env) ],
+ ];
+};
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-config b/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-config
new file mode 100644
index 00000000..0329b78a
--- /dev/null
+++ b/pkg/rpm/rpmbuild/SOURCES/unit.example-perl-config
@@ -0,0 +1,17 @@
+{
+ "applications": {
+ "example_perl": {
+ "type": "perl",
+ "user": "nobody",
+ "processes": 1,
+ "working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
+ "script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
+ }
+ },
+
+ "listeners": {
+ "*:8600": {
+ "application": "example_perl"
+ }
+ }
+}
diff --git a/pkg/rpm/rpmbuild/SOURCES/unit.example.config b/pkg/rpm/rpmbuild/SOURCES/unit.example.config
index 15fb86f1..a5f31ced 100644
--- a/pkg/rpm/rpmbuild/SOURCES/unit.example.config
+++ b/pkg/rpm/rpmbuild/SOURCES/unit.example.config
@@ -20,6 +20,14 @@
"type": "go",
"user": "nobody",
"executable": "/tmp/go-app"
+ },
+
+ "example_perl": {
+ "type": "perl",
+ "user": "nobody",
+ "processes": 1,
+ "working_directory": "/usr/share/doc/unit-perl/examples/perl-app",
+ "script": "/usr/share/doc/unit-perl/examples/perl-app/index.pl"
}
},
@@ -34,6 +42,10 @@
"*:8500": {
"application": "example_go"
+ },
+
+ "*:8600": {
+ "application": "example_perl"
}
}
}