Created
January 7, 2020 09:18
-
-
Save leowa/d1f52b0b7105c67b67f28bd2d862a0c6 to your computer and use it in GitHub Desktop.
golang example RPM spec template
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # https://fedoraproject.org/wiki/PackagingDrafts/Go | |
| %global commit 63fe64c471e7d76be96a625350468dfc65c06c31 | |
| %global shortcommit %(c=%{commit}; echo ${c:0:7}) | |
| Name: example-app | |
| Version: 1.0.0 | |
| Release: 6%{?dist} | |
| Summary: This application is an example for the golang binary RPM spec | |
| License: ASL 2.0 | |
| URL: http://www.example-app.io | |
| Source0: https://github.com/example/app/archive/v%{version}.tar.gz | |
| Source1: example-app.service | |
| Source2: example-app.sysconfig | |
| BuildRequires: gcc | |
| BuildRequires: golang >= 1.2-7 | |
| # pull in golang libraries by explicit import path, inside the meta golang() | |
| BuildRequires: golang(github.com/gorilla/mux) >= 0-0.13 | |
| [...] | |
| %description | |
| # include your full description of the application here. | |
| %prep | |
| %setup -q -n example-app-%{version} | |
| # many golang binaries are "vendoring" (bundling) sources, so remove them. Those dependencies need to be packaged independently. | |
| rm -rf vendor | |
| %build | |
| # set up temporary build gopath, and put our directory there | |
| mkdir -p ./_build/src/github.com/example | |
| ln -s $(pwd) ./_build/src/github.com/example/app | |
| export GOPATH=$(pwd)/_build:%{gopath} | |
| go build -o example-app . | |
| %install | |
| install -d %{buildroot}%{_bindir} | |
| install -p -m 0755 ./example-app %{buildroot}%{_bindir}/example-app | |
| %files | |
| %defattr(-,root,root,-) | |
| %doc AUTHORS CHANGELOG.md CONTRIBUTING.md FIXME LICENSE MAINTAINERS NOTICE README.md | |
| %{_bindir}/example-app | |
| %changelog | |
| * Tue Jul 01 2014 Jill User <[email protected]> - 1.0.0-6 | |
| - package the example-app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment