-
Notifications
You must be signed in to change notification settings - Fork 78
Expand file tree
/
Copy pathMakefile
More file actions
65 lines (51 loc) · 2.78 KB
/
Makefile
File metadata and controls
65 lines (51 loc) · 2.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: build pin push test update regen-test-fixtures upload upload-docs
export NIX_CONFIG += extra-experimental-features = nix-command flakes
build:
nix build . .#static .#pandoc
pin:
nix build \
--no-link --narinfo-cache-negative-ttl 0 --print-out-paths \
.#packages.{x86_64,aarch64}-linux.{static,pandoc-with-crossref} \
| cachix push pandoc-crossref
cachix pin pandoc-crossref $$(git describe --tags)-x86_64 $$(nix eval --raw .#packages.x86_64-linux.static) -a bin/pandoc-crossref --keep-revisions 1
cachix pin pandoc-crossref $$(git describe --tags)-aarch64 $$(nix eval --raw .#packages.aarch64-linux.static) -a bin/pandoc-crossref --keep-revisions 1
cachix pin pandoc-crossref $$(git describe --tags)-x86_64-with-pandoc $$(nix eval --raw .#packages.x86_64-linux.pandoc-with-crossref) --keep-revisions 1
cachix pin pandoc-crossref $$(git describe --tags)-aarch64-with-pandoc $$(nix eval --raw .#packages.aarch64-linux.pandoc-with-crossref) --keep-revisions 1
push:
nix build . .#static .#pandoc .#pandoc-with-crossref --json \
| jq -r '.[].outputs | to_entries[].value' \
| cachix push pandoc-crossref
test:
nix run .#test && nix run .#test-integrative
regen-test-fixtures:
nix develop --command bash -c './mkcheck.sh && ./mkinttest.sh'
cabal.project.freeze: .github/workflows/haskell.yml
rm cabal.project.freeze || true
cabal freeze \
--with-compiler=ghc-$$(yq -r '.jobs.build.strategy.matrix.ghcver[0]' .github/workflows/haskell.yml) \
--constraint pandoc==$$(yq -r '.env.PANDOC_VERSION' .github/workflows/haskell.yml)
sed -ri '/ *\S+ [^=]/ s/ *[+-]pkg-config//' cabal.project.freeze
sed -ri '/pandoc-crossref/ d' cabal.project.freeze
stack.yaml: cabal.project.freeze stack.template.yaml .github/workflows/haskell.yml
echo "# THIS FILE IS GENERATED, DO NOT EDIT DIRECTLY" > stack.yaml
sed 's/\$$ghcver\$$/'"$$(yq -r '.jobs.build.strategy.matrix.ghcver[0]' .github/workflows/haskell.yml)"'/g' \
stack.template.yaml >> stack.yaml
grep -Ev 'any\.(ghc-boot-th|ghc-prim|rts|base) ' cabal.project.freeze \
| sed -rn 's/^\s*any.([^ ]*) ==([^, ]*)([^,]*),?$$/- \1-\2/p' \
>> stack.yaml
flake.lock: .github/workflows/haskell.yml
nix \
flake update
stack.yaml.lock: .github/workflows/haskell.yml stack.yaml
# need this to update stack.yaml.lock, feel free to kill after that
stack build --no-system-ghc --no-install-ghc --no-nix || true
pandoc-crossref.cabal: package.yaml
# just use stack to generate the cabalfile
stack build --no-system-ghc --no-install-ghc --no-nix || true
update: stack.yaml flake.lock stack.yaml.lock
upload:
cabal sdist
cabal upload --publish dist-newstyle/sdist/$$(yq -r '.name + "-" + .version' package.yaml).tar.gz
upload-docs:
cabal haddock --haddock-for-hackage
cabal upload --publish -d dist-newstyle/$$(yq -r '.name + "-" + .version' package.yaml)-docs.tar.gz