tools: start generating cabal files with hpack

hakyll-std's cabal file is now generated by hpack from an easier yaml
config file, which looks like a valuable timesaver. "make gencabalfiles"
will regenerate this cabal file (and soon the others) when needed.
This commit is contained in:
Simon Michael 2015-07-14 15:19:05 -07:00
parent 9a93a2b5f5
commit 4a3b09e1ed
4 changed files with 111 additions and 51 deletions

View File

@ -15,6 +15,7 @@
# - shelltestrunner (latest version from hackage or possibly git), runs functional tests
# - hasktags, generates tag files for code navigation
# - profiteur, renders profiles as interactive html
# - hpack, generates cabal files from package.yaml files
# - hakyll-std, my generic site-building hakyll script
#
# Kinds of hledger builds:
@ -112,7 +113,10 @@ SOURCEFILES:= \
CABALFILES:= \
hledger/hledger.cabal \
hledger-*/*.cabal
hledger-*/*.cabal \
CABALFILESFROMHPACK:= \
doc/site/hakyll-std.cabal
WEBFILES:= \
hledger-web/templates/* \
@ -820,9 +824,7 @@ $(call def-help-subsection,DOCUMENTATION:)
doc/site/hakyll-std hakyll-std: \
doc/site/hakyll-std.hs \
doc/site/TableOfContents.hs \
doc/site/hakyll-std.cabal \
doc/site/stack.yaml \
$(call def-help,hakyll-std, build a generic hakyll site builder script )
$(call def-help,hakyll-std, build a generic hakyll site builder script )
cd doc/site; stack ghc hakyll-std
site: doc/site/hakyll-std \
@ -1275,13 +1277,34 @@ tagrelease: \
###############################################################################
$(call def-help-subsection,MISCELLANEOUS:)
# allow automatic variables in the prerequisites of subsequent rules
.SECONDEXPANSION:
gencabalfiles: $$(CABALFILESFROMHPACK) \
$(call def-help,gencabalfiles, regenerate cabal files from their package.yaml definitions )
%.cabal: $$(dir $$@)package.yaml \
$(call def-help-hide,PATH/SOME.cabal, regenerate a cabal file from its package.yaml definition with hpack )
cd $(dir $*) && \
hpack && \
touch $(notdir $@) && \
cabal check
cabal%: \
$(call def-help,cabalCMD, run cabal CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; cabal $*); done
all%: \
$(call def-help,all"CMD", run CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; $*); done
usage: cabalusage stackusage \
$(call def-help,usage, show size of various dirs )
du -sh .git bin data doc extra
du -sh .
stackusage: \
$(call def-help,stackusage, show size of stack working dirs )
$(call def-help,stackusage, show size of stack working dirs if any )
-du -shc `find . -name '.stack*'`
cabalusage: \
@ -1322,14 +1345,6 @@ Clean: stackclean cabalclean cleanghc cleantags \
# reverse = $(if $(wordlist 2,2,$(1)),$(call reverse,$(wordlist 2,$(words $(1)),$(1))) $(firstword $(1)),$(1))
cabal%: \
$(call def-help,cabalCMD, run cabal CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; cabal $*); done
all%: \
$(call def-help,all"CMD", run CMD inside each hledger package directory )
for p in $(PACKAGES); do (cd $$p; $*); done
###############################################################################
# LOCAL UNTRACKED CUSTOMISATIONS

View File

@ -209,10 +209,10 @@ and the default view given by [bugs.hledger.org](http://bugs.hledger.org) exclud
$ cd hledger
```
3. Install optional extra tools (see the Makefile for a list):
3. Install [GNU Make](http://www.gnu.org/software/make) and other optional extra tools (see the Makefile for a list):
```shell
$ stack install shelltestrunner hasktags profiteur
$ stack install shelltestrunner hasktags profiteur hpack
```
4. Run `make` or `stack --help` to see some suggested commands:

View File

@ -1,39 +1,45 @@
name: hakyll-std
version: 0.1.0
synopsis: Generic hakyll site builder script.
description: Generic hakyll site builder script.
homepage: http://github.com/simonmichael/hledger
license: BSD3
license-file: LICENSE
author: Simon Michael
maintainer: simon@joyful.com
-- copyright:
category: Web
build-type: Simple
-- extra-source-files:
cabal-version: >=1.10
-- This file has been generated from package.yaml by hpack version 0.5.2.
--
-- see: https://github.com/sol/hpack
-- library
-- hs-source-dirs: src
-- build-depends: base >= 4.7 && < 5
-- default-language: Haskell2010
name: hakyll-std
version: 0.1.0
synopsis: Generic hakyll site builder script (shipped with hledger)
description: A simple hakyll website builder suitable for (eg) software-related websites, intended to be used as-is without recompilation. Features:
.
- renders markdown and common web file types found in standard places
- a site.tmpl template will be used when rendering markdown files
- "- toc" in markdown files is replaced by a table of contents
- fenced code blocks are appropriately syntax-highlighted by highlighting-kate
(you should provide a syntax.css)
.
See the module doc (follow homepage link) for precise details.
category: Web
homepage: https://github.com/simonmichael/hledger/blob/master/doc/site/hakyll-std.hs
bug-reports: https://github.com/simonmichael/hledger/issues
author: Simon Michael
maintainer: -
license: BSD3
license-file: LICENSE
build-type: Simple
cabal-version: >= 1.10
source-repository head
type: git
location: https://github.com/simonmichael/hledger
executable hakyll-std
default-language: Haskell2010
ghc-options: -threaded -rtsopts -with-rtsopts=-N
hs-source-dirs: .
main-is: hakyll-std.hs
other-modules: TableOfContents
build-depends: base >= 4.7 && < 5
,hakyll >=4.7
,pandoc >=1.15
,pandoc-types
,process
,directory
,data-default
,blaze-html
,containers
-- source-repository head
-- type: git
-- location: https://github.com/simonmichael/hledger
main-is: hakyll-std.hs
build-depends:
base >= 4.7 && < 5
, hakyll >=4.7
, pandoc
, pandoc-types
, process
, directory
, data-default
, blaze-html
, containers
other-modules:
TableOfContents
default-language: Haskell2010

39
doc/site/package.yaml Normal file
View File

@ -0,0 +1,39 @@
# hpack specification for generating the cabal file
# (run "hpack" in this directory)
name : hakyll-std
version : 0.1.0
license : BSD3
synopsis : Generic hakyll site builder script (shipped with hledger)
description : |
A simple hakyll website builder suitable for (eg) software-related websites, intended to be used as-is without recompilation. Features:
- renders markdown and common web file types found in standard places
- a site.tmpl template will be used when rendering markdown files
- "- toc" in markdown files is replaced by a table of contents
- fenced code blocks are appropriately syntax-highlighted by highlighting-kate
(you should provide a syntax.css)
See the module doc (follow homepage link) for precise details.
category : Web
github : simonmichael/hledger
homepage : https://github.com/simonmichael/hledger/blob/master/doc/site/hakyll-std.hs
author : Simon Michael
maintainer : '-'
dependencies:
- base >= 4.7 && < 5
- hakyll >=4.7
- pandoc #>=1.15
- pandoc-types
- process
- directory
- data-default
- blaze-html
- containers
executables:
hakyll-std:
main: hakyll-std.hs
other-modules: TableOfContents