xref: /unit/pkg/rpm/Makefile.go (revision 1144:b651ff72ffe0)
1MODULES+=		go
2MODULE_SUFFIX_go=	go
3
4MODULE_SUMMARY_go=	Go module for NGINX Unit
5
6MODULE_VERSION_go=	$(VERSION)
7MODULE_RELEASE_go=	2
8
9MODULE_CONFARGS_go=	go --go-path=%{gopath}
10MODULE_MAKEARGS_go=	go
11MODULE_INSTARGS_go=	go-install
12
13MODULE_SOURCES_go=	unit.example-go-app \
14			unit.example-go-config
15
16ifeq ($(OSVER), centos6)
17BUILD_DEPENDS_go=	epel-release golang
18else ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed))
19BUILD_DEPENDS_go=	go1.9
20else
21BUILD_DEPENDS_go=	golang
22endif
23
24BUILD_DEPENDS+=		$(BUILD_DEPENDS_go)
25
26ifneq (,$(findstring $(OSVER),opensuse-leap opensuse-tumbleweed))
27define MODULE_DEFINITIONS_go
28BuildRequires: $(BUILD_DEPENDS_go)
29%define gopath /usr/share/go/contrib
30endef
31else
32define MODULE_DEFINITIONS_go
33BuildRequires: $(BUILD_DEPENDS_go)
34endef
35endif
36export MODULE_DEFINITIONS_go
37
38define MODULE_PREINSTALL_go
39QA_SKIP_BUILD_ROOT=1
40export QA_SKIP_BUILD_ROOT
41
42%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app
43%{__install} -m 644 -p %{SOURCE100} \
44    %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go
45%{__install} -m 644 -p %{SOURCE101} \
46    %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config
47endef
48export MODULE_PREINSTALL_go
49
50define MODULE_FILES_go
51%dir %{gopath}/src/nginx/unit
52%{gopath}/src/nginx/unit/*
53endef
54export MODULE_FILES_go
55
56define MODULE_POST_go
57cat <<BANNER
58----------------------------------------------------------------------
59
60The $(MODULE_SUMMARY_go) has been installed.
61
62To check the sample app, run these commands:
63
64 GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go
65 sudo service unit start
66 cd /usr/share/doc/%{name}/examples
67 sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/unit/control.sock http://localhost/config
68 curl http://localhost:8500/
69
70Online documentation is available at https://unit.nginx.org
71
72----------------------------------------------------------------------
73BANNER
74endef
75export MODULE_POST_go
76