xref: /unit/pkg/rpm/Makefile.go (revision 399)
1372Sdefan@nginx.comMODULES+=		go
2372Sdefan@nginx.com
3372Sdefan@nginx.comMODULE_SUMMARY_go=	Go module for NGINX Unit
4372Sdefan@nginx.com
5372Sdefan@nginx.comMODULE_VERSION_go=	$(VERSION)
6372Sdefan@nginx.comMODULE_RELEASE_go=	1
7372Sdefan@nginx.com
8*399Smax.romanov@nginx.comMODULE_CONFARGS_go=	go --go-path=%{gopath}
9372Sdefan@nginx.comMODULE_MAKEARGS_go=	go
10372Sdefan@nginx.comMODULE_INSTARGS_go=	go-install
11372Sdefan@nginx.com
12372Sdefan@nginx.comMODULE_SOURCES_go=	unit.example-go-app \
13372Sdefan@nginx.com			unit.example-go-config
14372Sdefan@nginx.com
15372Sdefan@nginx.comBUILD_DEPENDS+=		golang
16372Sdefan@nginx.com
17372Sdefan@nginx.comdefine MODULE_DEFINITIONS_go
18372Sdefan@nginx.com
19372Sdefan@nginx.comBuildRequires: golang
20*399Smax.romanov@nginx.comBuildArch: noarch
21372Sdefan@nginx.comendef
22372Sdefan@nginx.comexport MODULE_DEFINITIONS_go
23372Sdefan@nginx.com
24372Sdefan@nginx.comdefine MODULE_PREINSTALL_go
25372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1
26372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT
27372Sdefan@nginx.com
28372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app
29372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \
30372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go
31372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \
32372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config
33372Sdefan@nginx.comendef
34372Sdefan@nginx.comexport MODULE_PREINSTALL_go
35372Sdefan@nginx.com
36372Sdefan@nginx.comdefine MODULE_FILES_go
37*399Smax.romanov@nginx.com%dir %{gopath}/src/nginx/unit
38*399Smax.romanov@nginx.com%{gopath}/src/nginx/unit/*
39372Sdefan@nginx.comendef
40372Sdefan@nginx.comexport MODULE_FILES_go
41372Sdefan@nginx.com
42372Sdefan@nginx.comdefine MODULE_POST_go
43372Sdefan@nginx.comcat <<BANNER
44372Sdefan@nginx.com----------------------------------------------------------------------
45372Sdefan@nginx.com
46372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed.
47372Sdefan@nginx.com
48372Sdefan@nginx.comTo check the sample app, run these commands:
49372Sdefan@nginx.com
50*399Smax.romanov@nginx.com GOPATH=/usr/share/gocode go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go
51372Sdefan@nginx.com sudo service unit start
52372Sdefan@nginx.com sudo service unit loadconfig /usr/share/doc/unit-go/examples/unit.config
53372Sdefan@nginx.com curl http://localhost:8500/
54372Sdefan@nginx.com
55372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org
56372Sdefan@nginx.com
57372Sdefan@nginx.com----------------------------------------------------------------------
58372Sdefan@nginx.comBANNER
59372Sdefan@nginx.comendef
60372Sdefan@nginx.comexport MODULE_POST_go
61