1372Sdefan@nginx.comMODULES+= go 2561Sdefan@nginx.comMODULE_SUFFIX_go= go 3372Sdefan@nginx.com 4372Sdefan@nginx.comMODULE_SUMMARY_go= Go module for NGINX Unit 5372Sdefan@nginx.com 6372Sdefan@nginx.comMODULE_VERSION_go= $(VERSION) 7821Svbart@nginx.comMODULE_RELEASE_go= 1 8372Sdefan@nginx.com 9399Smax.romanov@nginx.comMODULE_CONFARGS_go= go --go-path=%{gopath} 10372Sdefan@nginx.comMODULE_MAKEARGS_go= go 111314Smax.romanov@nginx.comMODULE_INSTARGS_go= go-install-src 12372Sdefan@nginx.com 13372Sdefan@nginx.comMODULE_SOURCES_go= unit.example-go-app \ 14372Sdefan@nginx.com unit.example-go-config 15372Sdefan@nginx.com 16557Sdefan@nginx.comifeq ($(OSVER), centos6) 17557Sdefan@nginx.comBUILD_DEPENDS_go= epel-release golang 18562Sdefan@nginx.comelse ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed)) 19562Sdefan@nginx.comBUILD_DEPENDS_go= go1.9 20557Sdefan@nginx.comelse 21489Sdefan@nginx.comBUILD_DEPENDS_go= golang 22557Sdefan@nginx.comendif 23557Sdefan@nginx.com 24489Sdefan@nginx.comBUILD_DEPENDS+= $(BUILD_DEPENDS_go) 25372Sdefan@nginx.com 26562Sdefan@nginx.comifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed)) 27372Sdefan@nginx.comdefine MODULE_DEFINITIONS_go 281314Smax.romanov@nginx.comBuildArch: noarch 291314Smax.romanov@nginx.comRequires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx 30562Sdefan@nginx.comBuildRequires: $(BUILD_DEPENDS_go) 31562Sdefan@nginx.com%define gopath /usr/share/go/contrib 32562Sdefan@nginx.comendef 33562Sdefan@nginx.comelse 34562Sdefan@nginx.comdefine MODULE_DEFINITIONS_go 351314Smax.romanov@nginx.comBuildArch: noarch 361314Smax.romanov@nginx.comRequires: unit-devel == $(VERSION)-$(RELEASE)%{?dist}.ngx 37562Sdefan@nginx.comBuildRequires: $(BUILD_DEPENDS_go) 38372Sdefan@nginx.comendef 39562Sdefan@nginx.comendif 40372Sdefan@nginx.comexport MODULE_DEFINITIONS_go 41372Sdefan@nginx.com 42372Sdefan@nginx.comdefine MODULE_PREINSTALL_go 43372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1 44372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT 45372Sdefan@nginx.com 46372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app 47372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \ 48372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go 49372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \ 50372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config 51372Sdefan@nginx.comendef 52372Sdefan@nginx.comexport MODULE_PREINSTALL_go 53372Sdefan@nginx.com 54372Sdefan@nginx.comdefine MODULE_FILES_go 55*1329Smax.romanov@nginx.com%dir %{gopath}/src/unit.nginx.org/go 56*1329Smax.romanov@nginx.com%{gopath}/src/unit.nginx.org/go/* 57372Sdefan@nginx.comendef 58372Sdefan@nginx.comexport MODULE_FILES_go 59372Sdefan@nginx.com 60372Sdefan@nginx.comdefine MODULE_POST_go 61372Sdefan@nginx.comcat <<BANNER 62372Sdefan@nginx.com---------------------------------------------------------------------- 63372Sdefan@nginx.com 64372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed. 65372Sdefan@nginx.com 66372Sdefan@nginx.comTo check the sample app, run these commands: 67372Sdefan@nginx.com 68562Sdefan@nginx.com GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go 69372Sdefan@nginx.com sudo service unit start 70787Sdefan@nginx.com cd /usr/share/doc/%{name}/examples 71912Sdefan@nginx.com sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config 72372Sdefan@nginx.com curl http://localhost:8500/ 73372Sdefan@nginx.com 74372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org 75372Sdefan@nginx.com 76372Sdefan@nginx.com---------------------------------------------------------------------- 77372Sdefan@nginx.comBANNER 78372Sdefan@nginx.comendef 79372Sdefan@nginx.comexport MODULE_POST_go 80