X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=Goalfile.in;h=ca38d2436d2e34a25dd6adb22792248fab08c381;hb=5feb7a1fb1634ea649328c1787f786adeb8a50d1;hp=0fd2b5b9e03d51eae7e3d6d09a568c14c430e1f2;hpb=f2758f9e55a2b4d4a30e362f2b7a7a51cd515c78;p=goals.git diff --git a/Goalfile.in b/Goalfile.in index 0fd2b5b..ca38d24 100644 --- a/Goalfile.in +++ b/Goalfile.in @@ -1,6 +1,7 @@ # Goalfile -# Copyright (C) 2019 Richard W.M. Jones -# Copyright (C) 2019 Red Hat Inc. +# @configure_input@ +# Copyright (C) 2019-2020 Richard W.M. Jones +# Copyright (C) 2019-2020 Red Hat Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,6 +19,8 @@ include "ocaml.gl" +let version = "@PACKAGE_VERSION@" + let subdirs = [ "m4", "src", "stdlib", "docs", "man", "tests" ] goal all = : "Goalfile", tool, documentation; @@ -120,9 +123,10 @@ goal depend = # Documentation. let POD2MAN = "@POD2MAN@" +let POD2TEXT = "@POD2TEXT@" -goal documentation = : pod2man ("goals", "1"), - pod2man ("Goalfile", "5") +goal documentation = : pod2man ("goals", "1"), pod2man ("Goalfile", "5"), + pod2text ("goals", "1"), pod2text ("Goalfile", "5") goal pod2man (page, section) = "man/%page.%section" : "docs/%page.pod" { @@ -131,11 +135,19 @@ goal pod2man (page, section) = %POD2MAN \ -u \ -c "goals" \ - --release "@PACKAGE_NAME@-@PACKAGE_VERSION@" \ + --release goals-%version \ --section %section %< > %@-t mv %@-t %@ } +goal pod2text (page, section) = +"man/%page.%section.txt" : "docs/%page.pod" { + rm -f %@ %@-t + mkdir -p man + %POD2TEXT -u %< > %@-t + mv %@-t %@ +} + #---------------------------------------------------------------------- # Tests. @@ -153,3 +165,183 @@ goal test (name) = @{ exit 1 fi } + +#---------------------------------------------------------------------- +# Install. + +# DESTDIR can be overridden on the command line to install into +# a subdirectory. +let DESTDIR = "" + +let stdlibfiles = [wildcard ("stdlib/*.gl"), wildcard ("stdlib/*.sh")] + +goal install = { + # exec_prefix die die die + bindir="@prefix@/bin" + datadir="@prefix@/share" + mkdir -p %DESTDIR"$bindir" + mkdir -p %DESTDIR"$datadir/goals" + install src/goals %DESTDIR"$bindir" -m 0755 + install %stdlibfiles %DESTDIR"$datadir"/goals -m 644 +} + +#---------------------------------------------------------------------- +# Distribution. + +let sources = [ + "src/ast.ml", + "src/ast.mli", + "src/cmdline.ml", + "src/cmdline.mli", + "src/config.ml.in", + "src/config.mli", + "src/deps.ml", + "src/deps.mli", + "src/eval.ml", + "src/eval.mli", + "src/jobs.ml", + "src/jobs.mli", + "src/lexer.mli", + "src/lexer.mll", + "src/main.ml", + "src/parse.ml", + "src/parse.mli", + "src/parser.mly", + "src/run.ml", + "src/run.mli", + "src/utils-c.c", + "src/utils.ml", + "src/utils.mli", +] + +let distfiles = [ + ".gitignore", + "COPYING", + "Goalfile.in", + "Makefile.in", + "README", + "TODO", + "autogen.sh", + "config.h.in", + "configure", + "configure.ac", + wildcard ("docs/*.pod"), + "goals.spec.in", + "install-sh", + "m4/ocaml.m4", + "run.in", + "src/.depend", + sources, + "stamp-h.in", + wildcard ("stdlib/*.gl"), + wildcard ("stdlib/*.sh"), + wildcard ("tests/*.data"), + wildcard ("tests/*.data[0-9]"), + wildcard ("tests/*.expected"), + wildcard ("tests/*.gl"), + wildcard ("tests/*.sh"), + wildcard ("tests/10-function-wildcard.d/*"), +] + +let tarfile = "goals-%version.tar.gz" + +goal dist = "%tarfile" : { + d=goals-%version + o=%tarfile + rm -rf "$d" + rm -f "$o" "$o-t" + + mkdir "$d" + for f in %distfiles; do + subdir="$(dirname "$f")" + mkdir -p "$d/$subdir" + cp -a "$f" "$d/$subdir" + done + # Replace $d/install-sh with a real file + if [ -L "$d/install-sh" ]; then + rm "$d/install-sh" + cp -L "install-sh" "$d/install-sh" + fi + tar zcf "$o-t" "$d" + mv "$o-t" "$o" + rm -rf "$d" +} + +goal distcheck = : dist { + d=goals-%version + tar zxf %tarfile + pushd "$d" + ./configure + make + make check + popd + rm -rf "$d" + print_green "PASS: distcheck" +} + +#---------------------------------------------------------------------- +# Maintainer rules. + +# Easy way to commit and tag a release. +goal maintainer-commit = { + git commit -a -m "Version "%version"." +} + +goal maintainer-tag = { + git tag -a v%version -m "Version "%version -f +} + +# Check no files are missing from distfiles above by unpacking the +# distribution tarball and comparing it to git. +goal maintainer-check-extra-dist = : dist @{ + tar ztf %tarfile | sort | + sed 's,^goals-'%version'/,,' > tarfiles + git ls-files | sort > gitfiles + comm -13 tarfiles gitfiles > comm.out + cat comm.out + [ ! -s comm.out ] + rm tarfiles gitfiles comm.out + print_green "PASS: distfiles" +} + +# XXX This should also do a Fedora build. +goal maintainer-release = : dist, + maintainer-check-extra-dist, + distcheck, + maintainer-upload, + maintainer-srpm, + maintainer-fedora-copr + +let websitedir = "%HOME/d/websites/people.redhat.com/goals" + +# XXX Should actually use the *url tactic here. +goal maintainer-upload = : distcheck { + [ -d %websitedir ] + cp %tarfile %websitedir/files + cp README %websitedir/README + cp man/goals.1.txt man/Goalfile.5.txt %websitedir + cd %websitedir + git add files/%tarfile README goals.1.txt Goalfile.5.txt + git commit -m "goals "%version + cd .. + ./.rsync +} + +pure function get-fedora-dist () returning string = @{ + rpm --eval '%%dist' +} +let fedora-dist = get-fedora-dist () +# XXX Replace autoconf macro with %{version} in future. +let srpm = "goals-@PACKAGE_VERSION@-1%fedora-dist.src.rpm" + +goal maintainer-srpm = +"%srpm" : tarfile, "goals.spec" { + rpmbuild -bs \ + --define "%%_sourcedir $PWD" \ + --define "%%_srcrpmdir $PWD" \ + goals.spec +} + +goal maintainer-fedora-copr = : maintainer-upload, srpm { + copr build rjones/goals %srpm +} \ No newline at end of file