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 11372Sdefan@nginx.comMODULE_INSTARGS_go= go-install 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 28562Sdefan@nginx.comBuildRequires: $(BUILD_DEPENDS_go) 29562Sdefan@nginx.com%define gopath /usr/share/go/contrib 30562Sdefan@nginx.comendef 31562Sdefan@nginx.comelse 32562Sdefan@nginx.comdefine MODULE_DEFINITIONS_go 33562Sdefan@nginx.comBuildRequires: $(BUILD_DEPENDS_go) 34372Sdefan@nginx.comendef 35562Sdefan@nginx.comendif 36372Sdefan@nginx.comexport MODULE_DEFINITIONS_go 37372Sdefan@nginx.com 38372Sdefan@nginx.comdefine MODULE_PREINSTALL_go 39372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1 40372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT 41372Sdefan@nginx.com 42372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app 43372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \ 44372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go 45372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \ 46372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config 47372Sdefan@nginx.comendef 48372Sdefan@nginx.comexport MODULE_PREINSTALL_go 49372Sdefan@nginx.com 50372Sdefan@nginx.comdefine MODULE_FILES_go 51399Smax.romanov@nginx.com%dir %{gopath}/src/nginx/unit 52399Smax.romanov@nginx.com%{gopath}/src/nginx/unit/* 53372Sdefan@nginx.comendef 54372Sdefan@nginx.comexport MODULE_FILES_go 55372Sdefan@nginx.com 56372Sdefan@nginx.comdefine MODULE_POST_go 57372Sdefan@nginx.comcat <<BANNER 58372Sdefan@nginx.com---------------------------------------------------------------------- 59372Sdefan@nginx.com 60372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed. 61372Sdefan@nginx.com 62372Sdefan@nginx.comTo check the sample app, run these commands: 63372Sdefan@nginx.com 64562Sdefan@nginx.com GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go 65372Sdefan@nginx.com sudo service unit start 66787Sdefan@nginx.com cd /usr/share/doc/%{name}/examples 67*912Sdefan@nginx.com sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config 68372Sdefan@nginx.com curl http://localhost:8500/ 69372Sdefan@nginx.com 70372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org 71372Sdefan@nginx.com 72372Sdefan@nginx.com---------------------------------------------------------------------- 73372Sdefan@nginx.comBANNER 74372Sdefan@nginx.comendef 75372Sdefan@nginx.comexport MODULE_POST_go 76