Added cabal file scripts
Getty Ritter
7 years ago
10 | 10 |
EXENAME="$1"
|
11 | 11 |
TGT="$2"
|
12 | 12 |
else
|
13 | |
echo "USAGE: $0 [library name]" >&2
|
| 13 |
echo "USAGE: $0 [executable name]" >&2
|
14 | 14 |
exit 99
|
15 | 15 |
fi
|
16 | 16 |
|
|
19 | 19 |
USER="${NAME} <${EMAIL}>"
|
20 | 20 |
YEAR=$(date '+%Y')
|
21 | 21 |
|
22 | |
if [ "${CATEGORY}x" = "x" ]; then
|
23 | |
CAT_LINE="-- category:"
|
| 22 |
if [ -z "${CATEGORY}" ]; then
|
| 23 |
CAT_FIELD="-- category:"
|
24 | 24 |
else
|
25 | |
CAT_LINE="category: ${CATEGORY}"
|
| 25 |
CAT_FIELD="category: ${CATEGORY}"
|
| 26 |
fi
|
| 27 |
|
| 28 |
if [ -z "${SYNOPSIS}" ]; then
|
| 29 |
SYN_FIELD="-- synopsis:"
|
| 30 |
else
|
| 31 |
SYN_FIELD="synopsis: ${SYNOPSIS}"
|
| 32 |
fi
|
| 33 |
|
| 34 |
if [ -z "${DESCRIPTION}" ]; then
|
| 35 |
DESCR_FIELD="-- description:"
|
| 36 |
else
|
| 37 |
DESCR_FIELD="description: ${DESCRIPTION}"
|
26 | 38 |
fi
|
27 | 39 |
|
28 | 40 |
function cabal_file {
|
29 | 41 |
cat <<EOF
|
30 | 42 |
name: ${EXENAME}
|
31 | 43 |
version: 0.1.0.0
|
32 | |
-- synopsis:
|
33 | |
-- description:
|
| 44 |
${SYN_FIELD}
|
| 45 |
${DESCR_FIELD}
|
34 | 46 |
license: BSD3
|
35 | 47 |
license-file: LICENSE
|
36 | 48 |
author: ${USER}
|
37 | 49 |
maintainer: ${USER}
|
38 | 50 |
copyright: ©${YEAR} ${NAME}
|
39 | |
${CAT_LINE}
|
| 51 |
${CAT_FIELD}
|
40 | 52 |
build-type: Simple
|
41 | |
cabal-version: >= 1.12
|
| 53 |
cabal-version: >= 1.14
|
42 | 54 |
|
43 | 55 |
executable ${EXENAME}
|
44 | 56 |
hs-source-dirs: src
|
|
46 | 58 |
default-extensions: OverloadedStrings,
|
47 | 59 |
ScopedTypeVariables
|
48 | 60 |
ghc-options: -Wall
|
49 | |
build-depends: base >=4.7 && <4.9
|
| 61 |
build-depends: base >=4.7 && <4.10
|
50 | 62 |
default-language: Haskell2010
|
51 | 63 |
EOF
|
52 | 64 |
}
|
1 | 1 |
#!/bin/bash -e
|
2 | |
|
3 | |
if [ $# -lt 1 ]; then
|
4 | |
echo "USAGE: $0 [library name]" >&2
|
5 | |
exit 99
|
| 2 |
if [ $# -eq 0 ]; then
|
| 3 |
LIBNAME="$(basename $(pwd))"
|
| 4 |
TGT="-"
|
6 | 5 |
elif [ $# -eq 1 ]; then
|
7 | 6 |
LIBNAME="$1"
|
8 | 7 |
TGT='-'
|
9 | 8 |
elif [ $# -eq 2 ]; then
|
10 | 9 |
LIBNAME="$1"
|
11 | 10 |
TGT="$2"
|
| 11 |
else
|
| 12 |
echo "USAGE: $0 [library name]" >&2
|
| 13 |
exit 99
|
12 | 14 |
fi
|
13 | 15 |
|
14 | 16 |
NAME=$(git config user.name)
|
|
16 | 18 |
USER="${NAME} <${EMAIL}>"
|
17 | 19 |
YEAR=$(date '+%Y')
|
18 | 20 |
|
| 21 |
if [ -z "${CATEGORY}" ]; then
|
| 22 |
CAT_FIELD="-- category:"
|
| 23 |
else
|
| 24 |
CAT_FIELD="category: ${CATEGORY}"
|
| 25 |
fi
|
| 26 |
|
| 27 |
if [ -z "${SYNOPSIS}" ]; then
|
| 28 |
SYN_FIELD="-- synopsis:"
|
| 29 |
else
|
| 30 |
SYN_FIELD="synopsis: ${SYNOPSIS}"
|
| 31 |
fi
|
| 32 |
|
| 33 |
if [ -z "${DESCRIPTION}" ]; then
|
| 34 |
DESCR_FIELD="-- description:"
|
| 35 |
else
|
| 36 |
DESCR_FIELD="description: ${DESCRIPTION}"
|
| 37 |
fi
|
| 38 |
|
19 | 39 |
function cabal_file {
|
20 | 40 |
cat <<EOF
|
21 | 41 |
name: ${LIBNAME}
|
22 | 42 |
version: 0.1.0.0
|
23 | |
-- synopsis:
|
24 | |
-- description:
|
| 43 |
${SYN_FIELD}
|
| 44 |
${DESCR_FIELD}
|
25 | 45 |
license: BSD3
|
26 | 46 |
license-file: LICENSE
|
27 | 47 |
author: ${USER}
|
28 | 48 |
maintainer: ${USER}
|
29 | 49 |
copyright: ©${YEAR} ${NAME}
|
30 | |
-- category:
|
| 50 |
${CAT_FIELD}
|
31 | 51 |
build-type: Simple
|
32 | |
cabal-version: >= 1.12
|
| 52 |
cabal-version: >= 1.14
|
33 | 53 |
|
34 | 54 |
library
|
35 | 55 |
-- exposed-modules:
|
36 | 56 |
ghc-options: -Wall
|
37 | |
build-depends: base >=4.7 && <4.9
|
| 57 |
build-depends: base >=4.7 && <4.10
|
38 | 58 |
default-language: Haskell2010
|
39 | 59 |
default-extensions: OverloadedStrings,
|
40 | 60 |
ScopedTypeVariables
|