Date: Tuesday, February 21, 2023 @ 20:39:57
  Author: grawlinson
Revision: 1403301

archrelease: copy trunk to community-x86_64

Added:
  d2/repos/community-x86_64/
  d2/repos/community-x86_64/PKGBUILD
    (from rev 1403300, d2/trunk/PKGBUILD)

----------+
 PKGBUILD |   70 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 70 insertions(+)

Copied: d2/repos/community-x86_64/PKGBUILD (from rev 1403300, d2/trunk/PKGBUILD)
===================================================================
--- community-x86_64/PKGBUILD                           (rev 0)
+++ community-x86_64/PKGBUILD   2023-02-21 20:39:57 UTC (rev 1403301)
@@ -0,0 +1,70 @@
+# Maintainer: George Rawlinson <[email protected]>
+
+pkgname=d2
+pkgver=0.2.0
+pkgrel=1
+pkgdesc='A modern diagram scripting language that turns text to diagrams'
+arch=('x86_64')
+url='https://d2lang.com'
+license=('MPL2')
+depends=('gcc-libs')
+makedepends=('git' 'go')
+options=('!lto')
+_commit='1639f5623b540cc86792ad5fbec18a9a6b6f2c35'
+source=("$pkgname::git+https://github.com/terrastruct/d2#commit=$_commit";)
+b2sums=('SKIP')
+
+pkgver() {
+  cd "$pkgname"
+
+  git describe --tags | sed 's/^v//'
+}
+
+prepare() {
+  cd "$pkgname"
+
+  # create directory for build output
+  mkdir build
+
+  # download dependencies
+  export GOPATH="${srcdir}"
+  go mod download
+}
+
+build() {
+  cd "$pkgname"
+
+  # set Go flags
+  export CGO_CPPFLAGS="${CPPFLAGS}"
+  export CGO_CFLAGS="${CFLAGS}"
+  export CGO_CXXFLAGS="${CXXFLAGS}"
+  export GOPATH="${srcdir}"
+
+  go build -v \
+    -buildmode=pie \
+    -mod=readonly \
+    -modcacherw \
+    -ldflags "-compressdwarf=false \
+    -linkmode external \
+    -extldflags ${LDFLAGS} \
+    -X oss.terrastruct.com/d2/lib/version.Version=$pkgver" \
+    -o build \
+    .
+}
+
+package() {
+  cd "$pkgname"
+
+  # binary
+  install -vDm755 -t "$pkgdir/usr/bin" build/d2
+
+  # man page
+  install -vDm644 -t "$pkgdir/usr/share/man/man1" ci/release/template/man/d2.1
+
+  # documentation
+  install -vDm644 -t "$pkgdir/usr/share/doc/$pkgname" README.md
+  cp -vr docs "$pkgdir/usr/share/doc/$pkgname"
+
+  # license
+  install -vDm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
+}

Reply via email to