1*372Sdefan@nginx.comMODULES+= go 2*372Sdefan@nginx.com 3*372Sdefan@nginx.comMODULE_SUMMARY_go= Go module for NGINX Unit 4*372Sdefan@nginx.com 5*372Sdefan@nginx.comMODULE_VERSION_go= $(VERSION) 6*372Sdefan@nginx.comMODULE_RELEASE_go= 1 7*372Sdefan@nginx.com 8*372Sdefan@nginx.comMODULE_CONFARGS_go= go --go-path=%{goroot} 9*372Sdefan@nginx.comMODULE_MAKEARGS_go= go 10*372Sdefan@nginx.comMODULE_INSTARGS_go= go-install 11*372Sdefan@nginx.com 12*372Sdefan@nginx.comMODULE_SOURCES_go= unit.example-go-app \ 13*372Sdefan@nginx.com unit.example-go-config 14*372Sdefan@nginx.com 15*372Sdefan@nginx.comBUILD_DEPENDS+= golang 16*372Sdefan@nginx.com 17*372Sdefan@nginx.comdefine MODULE_DEFINITIONS_go 18*372Sdefan@nginx.com%define goroot %(go env GOROOT) 19*372Sdefan@nginx.com%define goos %(go env GOOS) 20*372Sdefan@nginx.com%define goarch %(go env GOARCH) 21*372Sdefan@nginx.com 22*372Sdefan@nginx.comBuildRequires: golang 23*372Sdefan@nginx.comendef 24*372Sdefan@nginx.comexport MODULE_DEFINITIONS_go 25*372Sdefan@nginx.com 26*372Sdefan@nginx.comdefine MODULE_PREINSTALL_go 27*372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1 28*372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT 29*372Sdefan@nginx.com 30*372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app 31*372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \ 32*372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go 33*372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \ 34*372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config 35*372Sdefan@nginx.comendef 36*372Sdefan@nginx.comexport MODULE_PREINSTALL_go 37*372Sdefan@nginx.com 38*372Sdefan@nginx.comdefine MODULE_FILES_go 39*372Sdefan@nginx.com%dir %{goroot}/src/unit 40*372Sdefan@nginx.com%{goroot}/src/unit/* 41*372Sdefan@nginx.com%{goroot}/pkg/%{goos}_%{goarch}/unit.a 42*372Sdefan@nginx.comendef 43*372Sdefan@nginx.comexport MODULE_FILES_go 44*372Sdefan@nginx.com 45*372Sdefan@nginx.comdefine MODULE_POST_go 46*372Sdefan@nginx.comcat <<BANNER 47*372Sdefan@nginx.com---------------------------------------------------------------------- 48*372Sdefan@nginx.com 49*372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed. 50*372Sdefan@nginx.com 51*372Sdefan@nginx.comTo check the sample app, run these commands: 52*372Sdefan@nginx.com 53*372Sdefan@nginx.com go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go 54*372Sdefan@nginx.com sudo service unit start 55*372Sdefan@nginx.com sudo service unit loadconfig /usr/share/doc/unit-go/examples/unit.config 56*372Sdefan@nginx.com curl http://localhost:8500/ 57*372Sdefan@nginx.com 58*372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org 59*372Sdefan@nginx.com 60*372Sdefan@nginx.com---------------------------------------------------------------------- 61*372Sdefan@nginx.comBANNER 62*372Sdefan@nginx.comendef 63*372Sdefan@nginx.comexport MODULE_POST_go 64