xref: /unit/pkg/rpm/Makefile.go (revision 787)
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)
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
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.comBuildArch: noarch
30562Sdefan@nginx.com%define gopath /usr/share/go/contrib
31562Sdefan@nginx.comendef
32562Sdefan@nginx.comelse
33562Sdefan@nginx.comdefine MODULE_DEFINITIONS_go
34562Sdefan@nginx.comBuildRequires: $(BUILD_DEPENDS_go)
35399Smax.romanov@nginx.comBuildArch: noarch
36372Sdefan@nginx.comendef
37562Sdefan@nginx.comendif
38372Sdefan@nginx.comexport MODULE_DEFINITIONS_go
39372Sdefan@nginx.com
40372Sdefan@nginx.comdefine MODULE_PREINSTALL_go
41372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1
42372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT
43372Sdefan@nginx.com
44372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app
45372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \
46372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go
47372Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE101} \
48372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config
49372Sdefan@nginx.comendef
50372Sdefan@nginx.comexport MODULE_PREINSTALL_go
51372Sdefan@nginx.com
52372Sdefan@nginx.comdefine MODULE_FILES_go
53399Smax.romanov@nginx.com%dir %{gopath}/src/nginx/unit
54399Smax.romanov@nginx.com%{gopath}/src/nginx/unit/*
55372Sdefan@nginx.comendef
56372Sdefan@nginx.comexport MODULE_FILES_go
57372Sdefan@nginx.com
58372Sdefan@nginx.comdefine MODULE_POST_go
59372Sdefan@nginx.comcat <<BANNER
60372Sdefan@nginx.com----------------------------------------------------------------------
61372Sdefan@nginx.com
62372Sdefan@nginx.comThe $(MODULE_SUMMARY_go) has been installed.
63372Sdefan@nginx.com
64372Sdefan@nginx.comTo check the sample app, run these commands:
65372Sdefan@nginx.com
66562Sdefan@nginx.com GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go
67372Sdefan@nginx.com sudo service unit start
68*787Sdefan@nginx.com cd /usr/share/doc/%{name}/examples
69*787Sdefan@nginx.com sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock :/config
70372Sdefan@nginx.com curl http://localhost:8500/
71372Sdefan@nginx.com
72372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org
73372Sdefan@nginx.com
74372Sdefan@nginx.com----------------------------------------------------------------------
75372Sdefan@nginx.comBANNER
76372Sdefan@nginx.comendef
77372Sdefan@nginx.comexport MODULE_POST_go
78