[arch-commits] Commit in shards/trunk (PKGBUILD fix_build.patch)

Anatol Pomozov anatolik at archlinux.org
Sun May 3 19:03:46 UTC 2020


    Date: Sunday, May 3, 2020 @ 19:03:45
  Author: anatolik
Revision: 624606

upgpkg: shards 0.10.0-1

Pull some of the Makefile fixes from upstream

Added:
  shards/trunk/fix_build.patch
Modified:
  shards/trunk/PKGBUILD

-----------------+
 PKGBUILD        |   26 ++++++++++++---------
 fix_build.patch |   64 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 79 insertions(+), 11 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2020-05-03 18:26:21 UTC (rev 624605)
+++ PKGBUILD	2020-05-03 19:03:45 UTC (rev 624606)
@@ -2,8 +2,8 @@
 # Contributor: Jonne Haß <me at jhass.eu>
 
 pkgname=shards
-pkgver=0.9.0
-pkgrel=2
+pkgver=0.10.0
+pkgrel=1
 pkgdesc='The package manager for the Crystal language'
 arch=(x86_64)
 url='https://github.com/crystal-lang/shards'
@@ -10,25 +10,29 @@
 license=(Apache)
 depends=(libyaml git pcre libevent gc)
 makedepends=(crystal)
-source=(shards-$pkgver.tar.gz::https://github.com/crystal-lang/shards/archive/v$pkgver.tar.gz)
-sha256sums=('90f230c87cc7b94ca845e6fe34f2523edcadb562d715daaf98603edfa2a94d65')
+source=(shards-$pkgver.tar.gz::https://github.com/crystal-lang/shards/archive/v$pkgver.tar.gz
+        fix_build.patch) # a few upstream changes to fix the build
+sha256sums=('3aea420df959552d1866d473c878ab1ed0b58489c4c9881ef40a170cfb775459'
+            '61f1a81bd3d6e386de8746fffd7f9bc1ac6db6b5a82f18fd901fd5c5edf7a09c')
 
+prepare() {
+  cd shards-$pkgver
+  patch -p1 < ../fix_build.patch
+}
+
 build() {
   cd shards-$pkgver
-  crystal build --release -o bin/shards src/shards.cr
+  CRYSTAL_OPTS=--release make -j1
 }
 
 check() {
   cd shards-$pkgver
-  ./bin/shards install
-  # currently tests fail because they try to write to read-only directory
-  #make test
+  # tests are currently failing. TODO: fix it
+  # make test -j1 # https://github.com/crystal-lang/shards/issues/347
 }
 
 package() {
   cd shards-$pkgver
-
-  install -Dm755 bin/shards "$pkgdir/usr/bin/shards"
-  install -Dm755 man/shards.1 "$pkgdir/usr/share/man/man1/shards.1"
+  PREFIX=/usr DESTDIR="$pkgdir" make install
   install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
 }

Added: fix_build.patch
===================================================================
--- fix_build.patch	                        (rev 0)
+++ fix_build.patch	2020-05-03 19:03:45 UTC (rev 624606)
@@ -0,0 +1,64 @@
+diff --git a/Makefile b/Makefile
+index 0d0b989..35d5543 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,26 +1,29 @@
+ .POSIX:
+ 
+ CRYSTAL = crystal
+-CRFLAGS =
++SHARDS = shards
+ SHARDS_SOURCES = $(shell find src -name '*.cr')
+-MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr')
++MOLINILLO_SOURCES = $(shell find lib/molinillo -name '*.cr' 2> /dev/null)
+ SOURCES = $(SHARDS_SOURCES) $(MOLINILLO_SOURCES)
+ TEMPLATES = src/templates/*.ecr
+ 
+-DESTDIR =
+-PREFIX = /usr/local
+-BINDIR = $(DESTDIR)$(PREFIX)/bin
+-MANDIR = $(DESTDIR)$(PREFIX)/share/man
+-INSTALL = /usr/bin/install
++DESTDIR ?=
++PREFIX ?= /usr/local
++BINDIR ?= $(DESTDIR)$(PREFIX)/bin
++MANDIR ?= $(DESTDIR)$(PREFIX)/share/man
++INSTALL ?= /usr/bin/install
++
++MOLINILLO_VERSION = $(shell $(CRYSTAL) eval 'require "yaml"; puts YAML.parse(File.read("shard.lock"))["shards"]["molinillo"]["version"]')
++MOLINILLO_URL = "https://github.com/crystal-lang/crystal-molinillo/archive/v$(MOLINILLO_VERSION).tar.gz"
+ 
+ all: bin/shards
+ 
+ clean: phony
+ 	rm -f bin/shards
+ 
+-bin/shards: $(SOURCES) $(TEMPLATES)
++bin/shards: $(SOURCES) $(TEMPLATES) lib
+ 	@mkdir -p bin
+-	$(CRYSTAL) build src/shards.cr -o bin/shards $(CRFLAGS)
++	$(CRYSTAL) build src/shards.cr -o bin/shards
+ 
+ install: bin/shards phony
+ 	$(INSTALL) -m 0755 -d "$(BINDIR)" "$(MANDIR)/man1" "$(MANDIR)/man5"
+@@ -35,10 +38,17 @@ uninstall: phony
+ 
+ test: test_unit test_integration
+ 
+-test_unit: phony
+-	$(CRYSTAL) spec ./spec/unit/*_spec.cr
++test_unit: phony lib
++	$(CRYSTAL) spec ./spec/unit/
+ 
+ test_integration: bin/shards phony
+-	$(CRYSTAL) spec ./spec/integration/*_spec.cr
++	$(CRYSTAL) spec ./spec/integration/
++
++lib: shard.lock
++	mkdir -p lib/molinillo
++	$(SHARDS) install || (curl -L $(MOLINILLO_URL) | tar -xzf - -C lib/molinillo --strip-components=1)
++
++shard.lock: shard.yml
++	$(SHARDS) update
+ 
+ phony:



More information about the arch-commits mailing list