Skip to content

Instantly share code, notes, and snippets.

@fd0 fd0/PKGBUILD
Created Dec 20, 2017

Embed
What would you like to do?
# Maintainer: Egor Kovetskiy <e.kovetskiy@office.ngs.ru>
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
You can’t perform that action at this time.