Created
December 20, 2017 17:22
-
-
Save fd0/03a4fbf88f2d07bf835cdc2ccb3c8821 to your computer and use it in GitHub Desktop.
This file contains 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
# Maintainer: Egor Kovetskiy <[email protected]> | |
pkgname=gtm | |
pkgver=20171203.337_6ee3a02 | |
pkgrel=1 | |
pkgdesc="git time metrics" | |
arch=('i686' 'x86_64') | |
license=('GPL') | |
depends=( | |
) | |
makedepends=( | |
'go' | |
'git' | |
'libgit2' | |
) | |
source=( | |
"git2go::git://github.com/libgit2/git2go#branch=v26" | |
"gtm::git://github.com/git-time-metric/gtm#branch=${BRANCH:-master}" | |
) | |
md5sums=( | |
'SKIP' | |
'SKIP' | |
) | |
backup=( | |
) | |
pkgver() { | |
if [[ "$PKGVER" ]]; then | |
echo "$PKGVER" | |
return | |
fi | |
cd "$srcdir/$pkgname" | |
local date=$(git log -1 --format="%cd" --date=short | sed s/-//g) | |
local count=$(git rev-list --count HEAD) | |
local commit=$(git rev-parse --short HEAD) | |
echo "$date.${count}_$commit" | |
} | |
build() { | |
export GOPATH="$srcdir/.go" | |
mkdir -p "$GOPATH/src/github.com/git-time-metric/" | |
mkdir -p "$GOPATH/src/github.com/libgit2/" | |
mv "$srcdir/git2go" "$GOPATH/src/github.com/libgit2/" | |
mv "$srcdir/gtm" "$GOPATH/src/github.com/git-time-metric/" | |
cd "$GOPATH/src/github.com/libgit2/git2go" | |
echo ":: git2go: switching next branch..." | |
git checkout v26 | |
echo ":: git2go: initializing submodules..." | |
git submodule update --init | |
echo ":: git2go: go get..." | |
go get -t -d ./... | |
echo ":: git2go: making..." | |
make install-static | |
cd "$GOPATH/src/github.com/git-time-metric/gtm" | |
echo ":: gtm: go get..." | |
go get -t -v ./... | |
echo ":: gtm: go build..." | |
go build --tags static -v \ | |
-gcflags "-trimpath $GOPATH/src" \ | |
-ldflags "-X main.Version=${pkgver} " | |
} | |
package() { | |
find "$srcdir/.go/bin/" -type f -executable | while read filename; do | |
install -DT "$filename" "$pkgdir/usr/bin/$(basename $filename)" | |
done | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment