summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: cc62a42f5028c15a6eccf329e80f318e9cc4bb51 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# Maintainer: justforlxz <justforlxz@gmail.com>

pkgname=golang-deepin-gir-git
pkgver=2.2.0.r4.g1a60448
pkgrel=1
pkgdesc='Generate static golang bindings for GObject'
arch=('any')
url="https://github.com/linuxdeepin/go-gir-generator"
license=('GPL3')
depends=('gtk3' 'libgudev')
makedepends=('git' 'go' 'gobject-introspection')
checkdepends=('golang-gopkg-check.v1')
provides=('golang-deepin-gir')
conflicts=('golang-deepin-gir')
groups=('deepin-git')
source=("$pkgname::git+https://github.com/linuxdeepin/go-gir-generator")
sha512sums=('SKIP')

pkgver() {
    cd $pkgname
    git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

prepare() {
  cd $pkgname
  if [[ ! -z ${sha} ]];then
    git checkout -b $sha
  fi

  mkdir -p "$srcdir"/build/src/github.com/linuxdeepin/

  # Should be fixed upstream
  mkdir -p out/src/github.com/linuxdeepin/go-gir/{glib-2.0,gobject-2.0,gio-2.0,gudev-1.0}

  # https://github.com/linuxdeepin/developer-center/issues/955
  sed -i "s/'Can'tFind'/“Can'tFind”/" lib.in/glib-2.0/keyfile_test.go
}

build() {
  export GOPATH="$srcdir/build:/usr/share/gocode"
  export GOFLAGS="-buildmode=pie -trimpath -mod=readonly -modcacherw"
  export GO111MODULE=off
  cd $pkgname
  rm -r gogtk-demo
  make

  mv out/src/github.com/linuxdeepin/go-gir "$srcdir"/build/src/github.com/linuxdeepin/
}

check() {
  # https://github.com/linuxdeepin/developer-center/issues/955
  export GOPATH="$srcdir/build:/usr/share/gocode"
  cd "$srcdir"/build/src/github.com/linuxdeepin/go-gir
  go test -v $(go list ./...)

  cd "$srcdir/$pkgname"
  go run test/memory.go
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin
  cp -a "$srcdir"/build/src/github.com/linuxdeepin/go-gir "$pkgdir"/usr/share/gocode/src/github.com/linuxdeepin
}