xref: /unit/pkg/rpm/Makefile.go (revision 561)
1372Sdefan@nginx.comMODULES+=		go
2*561Sdefan@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)
7372Sdefan@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
18557Sdefan@nginx.comelse
19489Sdefan@nginx.comBUILD_DEPENDS_go=	golang
20557Sdefan@nginx.comendif
21557Sdefan@nginx.com
22489Sdefan@nginx.comBUILD_DEPENDS+=		$(BUILD_DEPENDS_go)
23372Sdefan@nginx.com
24372Sdefan@nginx.comdefine MODULE_DEFINITIONS_go
25372Sdefan@nginx.com
26372Sdefan@nginx.comBuildRequires: golang
27399Smax.romanov@nginx.comBuildArch: noarch
28372Sdefan@nginx.comendef
29372Sdefan@nginx.comexport MODULE_DEFINITIONS_go
30372Sdefan@nginx.com
31372Sdefan@nginx.comdefine MODULE_PREINSTALL_go
32372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1
33372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT
34372Sdefan@nginx.com
35372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app
36372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \
37372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go
38372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \
39372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config
40372Sdefan@nginx.comendef
41372Sdefan@nginx.comexport MODULE_PREINSTALL_go
42372Sdefan@nginx.com
43372Sdefan@nginx.comdefine MODULE_FILES_go
44399Smax.romanov@nginx.com%dir %{gopath}/src/nginx/unit
45399Smax.romanov@nginx.com%{gopath}/src/nginx/unit/*
46372Sdefan@nginx.comendef
47372Sdefan@nginx.comexport MODULE_FILES_go
48372Sdefan@nginx.com
49372Sdefan@nginx.comdefine MODULE_POST_go
50372Sdefan@nginx.comcat <<BANNER
51372Sdefan@nginx.com----------------------------------------------------------------------
52372Sdefan@nginx.com
53372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed.
54372Sdefan@nginx.com
55372Sdefan@nginx.comTo check the sample app, run these commands:
56372Sdefan@nginx.com
57399Smax.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
58372Sdefan@nginx.com sudo service unit start
59372Sdefan@nginx.com sudo service unit loadconfig /usr/share/doc/unit-go/examples/unit.config
60372Sdefan@nginx.com curl http://localhost:8500/
61372Sdefan@nginx.com
62372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org
63372Sdefan@nginx.com
64372Sdefan@nginx.com----------------------------------------------------------------------
65372Sdefan@nginx.comBANNER
66372Sdefan@nginx.comendef
67372Sdefan@nginx.comexport MODULE_POST_go
68