From 4c5927c98c4f673b23240c7cd18a1c096512669b Mon Sep 17 00:00:00 2001 From: Andreas Källberg Date: Wed, 30 Jun 2021 14:33:03 +0800 Subject: Update scripts to use `cabal v1-...` so they work on newer cabal Fixes build failures like https://github.com/GrammaticalFramework/gf-core/runs/2949099280?check_suite_focus=true --- Makefile | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 93a8dc20b..aee576d60 100644 --- a/Makefile +++ b/Makefile @@ -6,24 +6,24 @@ VERSION=$(shell sed -ne "s/^version: *\([0-9.]*\).*/\1/p" gf.cabal) all: build dist/setup-config: gf.cabal Setup.hs WebSetup.hs - cabal configure + cabal v1-configure build: dist/setup-config - cabal build + cabal v1-build install: - cabal copy - cabal register + cabal v1-copy + cabal v1-register doc: - cabal haddock + cabal v1-haddock clean: - cabal clean + cabal v1-clean bash bin/clean_html gf: - cabal build rgl-none + cabal v1-build rgl-none strip dist/build/gf/gf html:: -- cgit v1.2.3 From 0474a37af6dceb7d1e2d35ff2ed875fa23c3b08c Mon Sep 17 00:00:00 2001 From: "John J. Camilleri" Date: Fri, 2 Jul 2021 11:05:30 +0200 Subject: Make Makefile compatible with stack and old/new cabal (with v1- prefix when necessary) --- Makefile | 41 +++++++++++++++++++++++++++++------------ 1 file changed, 29 insertions(+), 12 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index aee576d60..cdb35e49a 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,48 @@ -.PHONY: all build install doc clean gf html deb pkg bintar sdist +.PHONY: all build install doc clean html deb pkg bintar sdist # This gets the numeric part of the version from the cabal file VERSION=$(shell sed -ne "s/^version: *\([0-9.]*\).*/\1/p" gf.cabal) +# Check if stack is installed +STACK=$(shell if hash stack 2>/dev/null; then echo "1"; else echo "0"; fi) + +# Check if cabal >= 2.4 is installed (with v1- and v2- commands) +CABAL_NEW=$(shell if cabal v1-repl --help >/dev/null 2>&1 ; then echo "1"; else echo "0"; fi) + +ifeq ($(STACK),1) + CMD=stack +else + CMD=cabal + ifeq ($(CABAL_NEW),1) + CMD_PFX=v1- + endif +endif + all: build dist/setup-config: gf.cabal Setup.hs WebSetup.hs - cabal v1-configure +ifneq ($(STACK),1) + cabal ${CMD_PFX}configure +endif build: dist/setup-config - cabal v1-build + ${CMD} ${CMD_PFX}build install: - cabal v1-copy - cabal v1-register +ifeq ($(STACK),1) + stack install +else + cabal ${CMD_PFX}copy + cabal ${CMD_PFX}register +endif doc: - cabal v1-haddock + ${CMD} ${CMD_PFX}haddock clean: - cabal v1-clean + ${CMD} ${CMD_PFX}clean bash bin/clean_html -gf: - cabal v1-build rgl-none - strip dist/build/gf/gf - html:: bash bin/update_html @@ -35,7 +52,7 @@ html:: deb: dpkg-buildpackage -b -uc -# Make an OS X Installer package +# Make a macOS installer package pkg: FMT=pkg bash bin/build-binary-dist.sh -- cgit v1.2.3