Skip to content

Instantly share code, notes, and snippets.

@jollyroger
Last active August 4, 2016 18:31
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jollyroger/f89c9a5954009a2254667e00ca0d0219 to your computer and use it in GitHub Desktop.
Save jollyroger/f89c9a5954009a2254667e00ca0d0219 to your computer and use it in GitHub Desktop.
RPM SPEC file to build glie package manager for Golang
--- Makefile 2016-08-04 13:07:27.501588143 -0400
+++ Makefile 2016-08-04 13:07:35.035595718 -0400
@@ -1,13 +1,17 @@
GLIDE_GO_EXECUTABLE ?= go
-VERSION := $(shell git describe --tags)
+VERSION_GIT := $(shell git describe --tags)
+VERSION ?= ${VERSION_GIT}
DIST_DIRS := find * -type d -exec
+PREFIX ?= /usr/local
-build:
+build: glide
+
+glide:
${GLIDE_GO_EXECUTABLE} build -o glide -ldflags "-X main.version=${VERSION}" glide.go
install: build
- install -d ${DESTDIR}/usr/local/bin/
- install -m 755 ./glide ${DESTDIR}/usr/local/bin/glide
+ install -d ${DESTDIR}${PREFIX}/bin/
+ install -m 755 ./glide ${DESTDIR}${PREFIX}/bin/glide
test:
${GLIDE_GO_EXECUTABLE} test . ./gb ./path ./action ./tree ./util ./godep ./godep/strip ./gpm ./cfg ./dependency ./importer ./msg ./repo
%define debug_package %{nil}
%global glide_version 0.11.1
Name: glide
Version: %{glide_version}
Release: 1%{?dist}
Summary: Vendor Package Management for Golang
Group: devel
License: Development/Libraries
URL: https://github.com/Masterminds/glide
Source0: v%{glide_version}.tar.gz
Patch0: glide-support-common-make-vars.patch
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: golang
BuildRequires: rsync
#Requires:
%description
Glide is a tool for managing the vendor directory within a Go package. This
feature, first introduced in Go 1.5, allows each package to have a vendor
directory containing dependent packages for the project. These vendor packages
can be installed by a tool (e.g. glide), similar to go get or they can be
vendored and distributed with the package.
%prep
%setup -q
%patch0
%build
mkdir -p gopath/src/github.com/Masterminds/glide
export GOPATH=${PWD}/gopath
export PATH=${GOPATH}:${PATH}
rsync -az --exclude=gopath/ ./ gopath/src/github.com/Masterminds/glide/
cd gopath/src/github.com/Masterminds/glide
make %{?_smp_mflags} VERSION=${RPM_PACKAGE_VERSION}
%install
export GOPATH=${PWD}/gopath
export PATH=${GOPATH}:${PATH}
rm -rf %{buildroot}
cd gopath/src/github.com/Masterminds/glide
make install DESTDIR=%{buildroot} PREFIX=/usr VERSION=${RPM_PACKAGE_VERSION}
%clean
rm -rf %{buildroot}
%check
export GOPATH=${PWD}/gopath
export PATH=${GOPATH}:${PATH}
cd gopath/src/github.com/Masterminds/glide
make test
%files
%defattr(-,root,root,-)
/usr/bin/glide
%doc
%changelog
* Thu Aug 4 2016 Andrii Senkovych <jolly_roger@itblog.org.ua> - 0.11.1-1
- Initial commit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment