Commit 0d25c19d authored by Lennart Spitzner's avatar Lennart Spitzner
Browse files

Replace haskell package handling (package-db -> sandbox)

parent 5a932640
...@@ -29,7 +29,9 @@ make.log ...@@ -29,7 +29,9 @@ make.log
curry2prolog/pakcsversion.pl curry2prolog/pakcsversion.pl
docs/src/version.tex docs/src/version.tex
lib/ lib/
pkg/ .cabal-sandbox/
cabal.sandbox.config
# binaries # binaries
*.state *.state
......
...@@ -46,10 +46,8 @@ export DOCDIR = $(ROOT)/docs ...@@ -46,10 +46,8 @@ export DOCDIR = $(ROOT)/docs
C2PVERSION=$(ROOT)/curry2prolog/pakcsversion.pl C2PVERSION=$(ROOT)/curry2prolog/pakcsversion.pl
# The version information file for the manual: # The version information file for the manual:
MANUALVERSION=$(DOCDIR)/src/version.tex MANUALVERSION=$(DOCDIR)/src/version.tex
# Directory where local package installations are stored # The sandbox directory used for installing haskell/cabal packages
export LOCALPKG = $(ROOT)/pkg export ROOTSANDBOX = $(ROOT)/.cabal-sandbox
# The path to the package database
export PKGDB = $(LOCALPKG)/pakcs.conf.d
# Various executables used in the installation # Various executables used in the installation
# -------------------------------------------- # --------------------------------------------
...@@ -70,32 +68,12 @@ MAKELOG=make.log ...@@ -70,32 +68,12 @@ MAKELOG=make.log
# ---------------------------------------------------------- # ----------------------------------------------------------
# The path to the Glasgow Haskell Compiler and Cabal # The path to the Glasgow Haskell Compiler and Cabal
export GHC := $(shell which ghc) export GHC := $(shell which ghc)
export GHC-PKG := $(shell dirname "$(GHC)")/ghc-pkg
export CABAL = cabal export CABAL = cabal
# Because of an API change in GHC 7.6,
# we need to distinguish GHC < 7.6 and GHC >= 7.6.
# GHC 7.6 renamed the option "package-conf" to "package-db".
# extract GHC version
GHC_MAJOR := $(shell "$(GHC)" --numeric-version | cut -d. -f1)
GHC_MINOR := $(shell "$(GHC)" --numeric-version | cut -d. -f2)
# Is the GHC version >= 7.6 ?
GHC_GEQ_76 = $(shell test $(GHC_MAJOR) -gt 7 -o \( $(GHC_MAJOR) -eq 7 \
-a $(GHC_MINOR) -ge 6 \) ; echo $$?)
# package-db (>= 7.6) or package-conf (< 7.6)?
ifeq ($(GHC_GEQ_76),0)
GHC_PKG_OPT = package-db
else
GHC_PKG_OPT = package-conf
endif
# Command to unregister a package # Command to unregister a package
export GHC_UNREGISTER = "$(GHC-PKG)" unregister --$(GHC_PKG_OPT)="$(PKGDB)" export PACKAGE_UNREGISTER = "$(CABAL)" sandbox hc-pkg -- unregister
# Command to install missing packages using cabal # Command to install missing packages using cabal
export CABAL_INSTALL = "$(CABAL)" install --with-compiler="$(GHC)" \ export CABAL_INSTALL = "$(CABAL)" install --with-compiler="$(GHC)" -O2
--with-hc-pkg="$(GHC-PKG)" --prefix="$(LOCALPKG)" \
--global --package-db="$(PKGDB)" -O2
######################################################################## ########################################################################
# The targets # The targets
...@@ -164,14 +142,13 @@ copylibs: ...@@ -164,14 +142,13 @@ copylibs:
@if [ -d lib-trunk ] ; then cd lib-trunk && $(MAKE) -f Makefile.$(CURRYSYSTEM).install ; fi @if [ -d lib-trunk ] ; then cd lib-trunk && $(MAKE) -f Makefile.$(CURRYSYSTEM).install ; fi
# create package database # create package database
$(PKGDB): $(ROOTSANDBOX):
"$(GHC-PKG)" init $@ $(CABAL) sandbox init
$(CABAL) update
# install front end (if sources are present): # install front end (if sources are present):
.PHONY: frontend .PHONY: frontend
frontend: frontend:
@if [ -d frontend ] ; then $(MAKE) $(PKGDB) && cd frontend && $(MAKE) ; fi @if [ -d frontend ] ; then $(MAKE) $(ROOTSANDBOX) && cd frontend && $(MAKE) ; fi
# compile the tools: # compile the tools:
.PHONY: tools .PHONY: tools
...@@ -306,6 +283,7 @@ distdated: dist ...@@ -306,6 +283,7 @@ distdated: dist
mv $(FULLNAME)-$(ARCH).tar.gz $(FULLNAME)-$(DIST_DATE)-$(ARCH).tar.gz mv $(FULLNAME)-$(ARCH).tar.gz $(FULLNAME)-$(DIST_DATE)-$(ARCH).tar.gz
# Clean all files that should not be included in a distribution # Clean all files that should not be included in a distribution
# DANGER; deletes .git (!)
.PHONY: cleandist .PHONY: cleandist
cleandist: cleandist:
rm -rf .git .gitmodules .gitignore rm -rf .git .gitmodules .gitignore
......
...@@ -5,25 +5,41 @@ ...@@ -5,25 +5,41 @@
# Retrieve all Haskell modules as dependencies for cymake # Retrieve all Haskell modules as dependencies for cymake
DEPS := $(shell find curry-base/src/ curry-frontend/src/ -type f) DEPS := $(shell find curry-base/src/ curry-frontend/src/ -type f)
# The sandbox config in curry-base linking to the root sandbox
SANDBOXBASECONF := curry-base/cabal.sandbox.config
# The sandbox config in curry-frontend linking to the root sandbox
SANDBOXFRONTENDCONF := curry-frontend/cabal.sandbox.config
# The sandbox config in . linking to the root sandbox
SANDBOXCONF := cabal.sandbox.config
# install the sources of the front end from its repository # install the sources of the front end from its repository
$(CYMAKE): $(DEPS) $(CYMAKE): $(DEPS) $(SANDBOXBASECONF) $(SANDBOXFRONTENDCONF)
$(MAKE) unregister $(MAKE) unregister
mkdir -p $(@D) mkdir -p $(@D)
cd curry-base && $(CABAL_INSTALL) cd curry-base && $(CABAL_INSTALL)
$(MAKE) transformers # see below $(MAKE) transformers # see below
cd curry-frontend && $(CABAL_INSTALL) --bindir=$(@D) cd curry-frontend && $(CABAL_INSTALL) --bindir=$(@D)
$(SANDBOXBASECONF):
cd curry-base && "$(CABAL)" sandbox init --sandbox="$(ROOTSANDBOX)"
$(SANDBOXFRONTENDCONF):
cd curry-frontend && "$(CABAL)" sandbox init --sandbox="$(ROOTSANDBOX)"
$(SANDBOXCONF):
"$(CABAL)" sandbox init --sandbox="$(ROOTSANDBOX)"
# Temporary workaround for https://github.com/haskell/cabal/issues/1855 # Temporary workaround for https://github.com/haskell/cabal/issues/1855
# see also http://www.haskell.org/pipermail/cabal-devel/2014-May/009795.html # see also http://www.haskell.org/pipermail/cabal-devel/2014-May/009795.html
.PHONY: transformers .PHONY: transformers
transformers: transformers: $(SANDBOXCONF)
$(CABAL_INSTALL) transformers-compat -f transformers3 $(CABAL_INSTALL) transformers-compat -f transformers3
# unregister previous version to avoid cabal install failures # unregister previous version to avoid cabal install failures
.PHONY: unregister .PHONY: unregister
unregister: unregister: $(SANDBOXCONF)
-$(GHC_UNREGISTER) curry-frontend -$(PACKAGE_UNREGISTER) curry-frontend
-$(GHC_UNREGISTER) curry-base -$(PACKAGE_UNREGISTER) curry-base
.PHONY: clean .PHONY: clean
clean: clean:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment