xref: /unit/pkg/rpm/Makefile.go (revision 788:5e8b61d5e99e)
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)
29BuildArch: noarch
30%define gopath /usr/share/go/contrib
31endef
32else
33define MODULE_DEFINITIONS_go
34BuildRequires: $(BUILD_DEPENDS_go)
35BuildArch: noarch
36endef
37endif
38export MODULE_DEFINITIONS_go
39
40define MODULE_PREINSTALL_go
41QA_SKIP_BUILD_ROOT=1
42export QA_SKIP_BUILD_ROOT
43
44%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit-go/examples/go-app
45%{__install} -m 644 -p %{SOURCE100} \
46    %{buildroot}%{_datadir}/doc/unit-go/examples/go-app/let-my-people.go
47%{__install} -m 644 -p %{SOURCE101} \
48    %{buildroot}%{_datadir}/doc/unit-go/examples/unit.config
49endef
50export MODULE_PREINSTALL_go
51
52define MODULE_FILES_go
53%dir %{gopath}/src/nginx/unit
54%{gopath}/src/nginx/unit/*
55endef
56export MODULE_FILES_go
57
58define MODULE_POST_go
59cat <<BANNER
60----------------------------------------------------------------------
61
62The $(MODULE_SUMMARY_go) has been installed.
63
64To check the sample app, run these commands:
65
66 GOPATH=%{gopath} go build -o /tmp/go-app /usr/share/doc/unit-go/examples/go-app/let-my-people.go
67 sudo service unit start
68 cd /usr/share/doc/%{name}/examples
69 sudo curl -X PUT --data-binary @unit.config --unix-socket /var/run/control.unit.sock :/config
70 curl http://localhost:8500/
71
72Online documentation is available at https://unit.nginx.org
73
74----------------------------------------------------------------------
75BANNER
76endef
77export MODULE_POST_go
78