Skip to content

Commit

Permalink
Support version MANIFEST. Update release.md. (#1074)
Browse files Browse the repository at this point in the history
  • Loading branch information
fare authored Dec 5, 2023
1 parent b71a9fc commit 8f27b40
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 36 deletions.
43 changes: 38 additions & 5 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@
set -e
cd $(dirname "$0")

# There are two ways that Gerbil may get version information:
# 1. a version MANIFEST file, for git-less tarballs and builds (e.g. Nix, Guix)
# 2. git, for regular development
#
# The format of the version MANIFEST file is as generated by ./manifest.sh
# with quote-less shell definitions var=value for the following variables:
# gerbil_stamp_version gambit_stamp_version gambit_stamp_ymd gambit_stamp_hms

die() {
echo "configuration failed"
exit 1
Expand Down Expand Up @@ -57,7 +65,12 @@ package_out_of_tree() {
echo "It is now available as an external package: github.com/mighty-gerbils/gerbil-${pkg}"
}

readonly gerbil_version="$(git describe --tags --always)"
if [ -f MANIFEST ] ; then
. ./MANIFEST
readonly gerbil_version="$gerbil_stamp_version"
else
readonly gerbil_version="$(git describe --tags --always)"
fi
readonly gerbil_targets=""
readonly default_gambit_tag=8b18ab69504c2d41301f7fec16a5350db717a20e
readonly default_gambit_config="--enable-targets=${gerbil_targets} --enable-single-host --enable-dynamic-clib --enable-default-runtime-options=tE8,f8,-8 --enable-trust-c-tco"
Expand Down Expand Up @@ -213,14 +226,34 @@ else
fi
fi

git submodule init || die
git submodule update --force || die

(cd src/gambit && git fetch origin && git checkout "${gambit_tag}" && touch configure config.status) || die
if [ ! -f MANIFEST -o ! -f src/gambit/configure ] ; then
git submodule init || die
git submodule update --force || die
(cd src/gambit && git fetch origin && git checkout "${gambit_tag}" && touch configure config.status) || die
unset gambit_stamp_version
fi

gambit_config="--prefix=${gerbil_prefix} --enable-march=${gambit_march} ${gambit_shared} ${gambit_config}"
(export LDFLAGS="$LDFLAGS"; export CFLAGS="$CFLAGS"; cd src/gambit && ./configure $gambit_config ) || die

if [ -n "$gambit_stamp_version" ] ; then
sed -i -e "s/^stamp:/stamp-orig:/" src/gambit/include/makefile
echo stamp: >> src/gambit/include/makefile
cat >> src/gambit/include/stamp.h <<EOF
#ifndef ___STAMP_VERSION
#define ___STAMP_VERSION "${gambit_stamp_version}"
#endif
#ifndef ___STAMP_YMD
#define ___STAMP_YMD ${gambit_stamp_ymd}
#endif
#ifndef ___STAMP_HMS
#define ___STAMP_HMS ${gambit_stamp_hms}
#endif
EOF
fi

rm -f build-env.sh
cat > build-env.sh <<EOF
GERBIL_PREFIX=${gerbil_prefix}
Expand Down
50 changes: 32 additions & 18 deletions doc/reference/dev/release.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,26 @@ Linux x86-64, macOS ARM64.
[Ask for help on gitter](https://app.element.io/#/room/#gerbil-scheme_community:gitter.im)
regarding platforms you can't support yourself.

## Prepare a PR for the Release
## Merge Pre-Release PRs
- Update release scripts and release documentation
- Update homebrew (macOS) recipe (except exact commit) - ask @drewc for help
- Update Guix (Linux) recipe (except exact commit) - ask @drewc for help
- Update to Nix (Linux, macOS) recipe (except exact commit) - ask @fare for help
(the recipe is currently in a fork of nixpkgs, not in the gerbil repository)

## Merge a PR for the Release itself
- Update the version everywhere in documentation
- Update the version everywhere in in-repo release scripts (homebrew, guix)
- Generate a `src/gerbil/runtime/version.ss` for the release
- Temporarily remove `src/gerbil/runtime/version.ss` from the `.gitignore`
- Include a high-level summary of changes in the
[CHANGELOG.md](https://github.com/mighty-gerbils/gerbil/blob/master/CHANGELOG.md)
- Check that the release scripts work on macOS, etc.
Note that the website will be automatically re-generated from the PR.
- Generate a `MANIFEST` for the release with the following shell command
from the Gerbil repository top directory,
where the argument is the desired release name:
`./manifest.sh v0.19`

Note that:
- The release PR should not contain anything but this version bump.
Make any other necessary change in the pre-release PRs.
- The website will be automatically re-generated from the PR. No action needed.

## Create Official Announcements
Once the release PR is merged:
Expand All @@ -43,22 +54,25 @@ Once the release PR is merged:
Use that as the basis for the GitHub release note page.
See e.g. [this previous release](https://github.com/mighty-gerbils/gerbil/releases/tag/v0.18).

Note that creating the release on GitHub should create a git tag,
that you can pull in your local repository with: `git pull --tags`

## Update Tarballs
- Generate tarball for the source code, including Gambit module
- Generate binary tarball for Linux x86-64. - ask @ober for help
- Generate tarball for the Gerbil source code,
*including the Gambit submodule at the correct version* in `src/gambit`.
Mind that the tarball autogenerated by GitHub does not include Gambit.
- Generate a binary tarball for Linux x86-64. - ask @fare or @ober for help
- Generate a binary tarball for the shared objects that the above uses (e.g. `sqlite.so`),
so that e.g. the previous tarball can be deployed on Heroku. - ask @fare for help
- Generate rpm and deb packages for Linux x86-64. - ask @ober for help
- Publish the tarballs as artifacts on GitHub on the
- Publish each of these tarballs as artifacts on GitHub on the
[release page](https://github.com/mighty-gerbils/gerbil/releases/)

## Update Other Build Recipes
- Update Homebrew (macOS) — ask @drewc for help
- Update Nixpkgs (Linux, macOS) - ask @fare for help
- Update Guix (Linux) — ask @drewc for help

## Clean up PR after the Release
Assuming the release happened on the `master` branch, undo it:
- Remove the `src/gerbil/runtime/version.ss`
- Add it back to `.gitignore`
## Merge Post-Release PRs
- Remove the `MANIFEST` file.
- Update to homebrew (macOS) recipe - ask @drewc for help
- Update to Guix (Linux) recipe - ask @drewc for help
- Update to Nixpkgs (Linux, macOS) recipe - ask @fare for help

## Announce the Release to the World
Point to the announcement page on GitHub.
Expand Down
18 changes: 18 additions & 0 deletions manifest.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh
# Create a version MANIFEST so you can build a git-less tarball of Gerbil.
#
# Given an argument $1, use it as the gerbil_stamp_version, e.g. for a release.
# Otherwise, extract the gerbil_stamp_version from git.
#
# Commit the MANIFEST to git for a release and a release only.
# Delete it from git immediately after release.
# See doc/reference/dev/release.md for instructions.
#
# git grep MANIFEST will tell you which files care about the MANIFEST

cat > MANIFEST <<EOF
gerbil_stamp_version=${1:-$(git describe --tags --always)}
gambit_stamp_version=$(cd src/gambit ; git describe --tags --always)
gambit_stamp_ymd=$(cd src/gambit ; TZ=UTC git show --quiet --date='format-local:%Y%m%d' --format=%cd)
gambit_stamp_hms=$(cd src/gambit ; TZ=UTC git show --quiet --date='format-local:%H%M%S' --format=%cd)
EOF
37 changes: 24 additions & 13 deletions src/build/build-version.scm
Original file line number Diff line number Diff line change
@@ -1,19 +1,30 @@
(let* ((gerbil-version-path
(path-expand "gerbil/runtime/version.ss" (getenv "GERBIL_SOURCE")))
(git-version
(with-exception-catcher
(lambda (e) (display-exception e) #f)
(lambda ()
(let* ((proc (open-process
'(path: "git"
arguments: ("describe" "--tags" "--always")
show-console: #f)))
(version (read-line proc))
(status (process-status proc)))
(close-port proc)
(and (zero? status)
(string? version) ;; (not (eof-object? version))
version)))))
(if (file-exists? "../MANIFEST")
(call-with-input-file "../MANIFEST"
(lambda (port)
(let loop ()
(let ((line (read-line port))
(prefix "gerbil_stamp_version="))
(cond
((eof-object? line) #f)
((string-prefix? prefix line)
(substring line (string-length prefix) (string-length line)))
(else (loop)))))))
(with-exception-catcher
(lambda (e) (display-exception e) #f)
(lambda ()
(let* ((proc (open-process
'(path: "git"
arguments: ("describe" "--tags" "--always")
show-console: #f)))
(version (read-line proc))
(status (process-status proc)))
(close-port proc)
(and (zero? status)
(string? version) ;; (not (eof-object? version))
version))))))
(gerbil-version-text
(and git-version
(string-append "(def (gerbil-version-string) \"" git-version "\")\n"))))
Expand Down

0 comments on commit 8f27b40

Please sign in to comment.