2017-10-19 15:23:31 +00:00
|
|
|
MODULES+= go
|
2018-03-01 20:03:03 +00:00
|
|
|
MODULE_SUFFIX_go= go
|
2017-10-19 15:23:31 +00:00
|
|
|
|
|
|
|
MODULE_SUMMARY_go= Go module for NGINX Unit
|
|
|
|
|
|
|
|
MODULE_VERSION_go= $(VERSION)
|
2018-10-25 14:49:10 +00:00
|
|
|
MODULE_RELEASE_go= 1
|
2017-10-19 15:23:31 +00:00
|
|
|
|
2017-12-01 13:59:41 +00:00
|
|
|
MODULE_CONFARGS_go= go --go-path=%{gopath}
|
2017-10-19 15:23:31 +00:00
|
|
|
MODULE_MAKEARGS_go= go
|
2019-12-24 14:59:44 +00:00
|
|
|
MODULE_INSTARGS_go= go-install-src
|
2017-10-19 15:23:31 +00:00
|
|
|
|
|
|
|
MODULE_SOURCES_go= unit.example-go-app \
|
|
|
|
unit.example-go-config
|
|
|
|
|
2018-03-01 20:23:31 +00:00
|
|
|
ifeq ($(OSVER), centos6)
|
|
|
|
BUILD_DEPENDS_go= epel-release golang
|
2018-03-01 20:03:03 +00:00
|
|
|
else ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed))
|
|
|
|
BUILD_DEPENDS_go= go1.9
|
2018-03-01 20:23:31 +00:00
|
|
|
else
|
2018-01-22 13:39:31 +00:00
|
|
|
BUILD_DEPENDS_go= golang
|
2018-03-01 20:23:31 +00:00
|
|
|
endif
|
|
|
|
|
2018-01-22 13:39:31 +00:00
|
|
|
BUILD_DEPENDS+= $(BUILD_DEPENDS_go)
|
2017-10-19 15:23:31 +00:00
|
|
|
|
2018-03-01 20:03:03 +00:00
|
|
|
ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed))
|
2017-10-19 15:23:31 +00:00
|
|
|
define MODULE_DEFINITIONS_go
|
2019-12-24 14:59:44 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
Requires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx
|
2018-03-01 20:03:03 +00:00
|
|
|
BuildRequires: $(BUILD_DEPENDS_go)
|
|
|
|
%define gopath /usr/share/go/contrib
|
|
|
|
endef
|
|
|
|
else
|
|
|
|
define MODULE_DEFINITIONS_go
|
2019-12-24 14:59:44 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
Requires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx
|
2018-03-01 20:03:03 +00:00
|
|
|
BuildRequires: $(BUILD_DEPENDS_go)
|
2017-10-19 15:23:31 +00:00
|
|
|
endef
|
2018-03-01 20:03:03 +00:00
|
|
|
endif
|
2017-10-19 15:23:31 +00:00
|
|
|
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
|
2017-12-01 13:59:41 +00:00
|
|
|
%dir %{gopath}/src/nginx/unit
|
|
|
|
%{gopath}/src/nginx/unit/*
|
2017-10-19 15:23:31 +00:00
|
|
|
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:
|
|
|
|
|
2018-03-01 20:03:03 +00:00
|
|
|
GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go
|
2017-10-19 15:23:31 +00:00
|
|
|
sudo service unit start
|
2018-09-27 12:04:49 +00:00
|
|
|
cd /usr/share/doc/%{name}/examples
|
2019-01-24 12:18:19 +00:00
|
|
|
sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config
|
2017-10-19 15:23:31 +00:00
|
|
|
curl http://localhost:8500/
|
|
|
|
|
|
|
|
Online documentation is available at https://unit.nginx.org
|
|
|
|
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
BANNER
|
|
|
|
endef
|
|
|
|
export MODULE_POST_go
|