Skip to content

Commit 7e0a347

Browse files
Improve building and releasing documentation and process
* Updates release documentation in developer docs * Creates a new `GAMBIT_VERSION` file as the single place where version number needs to be updated. * Organises build support files in a single directory with OS-specific subdirectories. Closes #560
1 parent af1314e commit 7e0a347

24 files changed

Lines changed: 153 additions & 128 deletions

.github/workflows/tools.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ jobs:
9191
run: |
9292
mkdir installer
9393
cp gambit* installer
94-
"${WIX}bin/candle" gambit.wxs
94+
"${WIX}bin/candle" build_support/msw/gambit.wxs
9595
"${WIX}bin/light" -ext WixUIExtension gambit.wixobj
9696
- uses: actions/upload-artifact@v5
9797
with:

Makefile.am

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,9 @@
2323
ACLOCAL_AMFLAGS = -I m4
2424

2525
EXTRA_DIST = \
26-
gambit.spec \
27-
gambit.desktop \
28-
gambit.wxs \
29-
contrib/mac/Info.plist \
30-
contrib/mac/gambit.icns \
26+
build_support/msw/gambit.wxs.in \
27+
build_support/osx/Info.plist.in \
28+
build_support/osx/gambit.icns \
3129
src/labenski/README.txt \
3230
src/labenski/art/grab.xpm \
3331
src/labenski/art/hand.xpm \
@@ -374,9 +372,12 @@ if WITH_GUI
374372
bin_PROGRAMS += gambit
375373
endif
376374

377-
EXTRA_PROGRAMS = gambit-enumpoly gambit
375+
# Read version from GAMBIT_VERSION file for use in compilation
376+
GAMBIT_VERSION = $(shell cat $(top_srcdir)/build_support/GAMBIT_VERSION)
377+
378+
# Define VERSION for all C++ compilations and set include paths
379+
AM_CPPFLAGS = -I$(top_srcdir)/src -DVERSION=\"$(GAMBIT_VERSION)\"
378380

379-
AM_CPPFLAGS = -I$(top_srcdir)/src -I$(top_srcdir)/src/labenski/include ${WX_CXXFLAGS}
380381
AM_CXXFLAGS = ${LLVM_CXXFLAGS}
381382

382383
## Command-line tools
@@ -604,6 +605,9 @@ gambit_SOURCES = \
604605
src/gui/valnumber.cc \
605606
src/gui/valnumber.h
606607

608+
# Add wxWidgets compilation flags for the GUI program
609+
gambit_CXXFLAGS = $(AM_CXXFLAGS) $(WX_CXXFLAGS)
610+
gambit_CPPFLAGS = $(AM_CPPFLAGS) $(WX_CXXFLAGS) -I$(top_srcdir)/src/labenski/include
607611

608612
if IS_WIN32
609613
gambit_LDADD = $(RC_OBJECT_PATH) $(WX_LIBS_STATIC) -ldeflate -lzstd -llerc -lWebP
@@ -619,8 +623,8 @@ osx-bundle:
619623
-mkdir Gambit.app/Contents
620624
-mkdir Gambit.app/Contents/MacOS
621625
-mkdir Gambit.app/Contents/Resources
622-
cp ${top_srcdir}/contrib/mac/Info.plist Gambit.app/Contents
623-
cp ${top_srcdir}/contrib/mac/gambit.icns Gambit.app/Contents/Resources/gambit.icns
626+
cp build_support/osx/Info.plist Gambit.app/Contents
627+
cp ${top_srcdir}/build_support/osx/gambit.icns Gambit.app/Contents/Resources/gambit.icns
624628
echo -n 'APPL????' > Gambit.app/Contents/PkgInfo
625629
cp gambit Gambit.app/Contents/MacOS/gambit
626630
cp ${bin_PROGRAMS} Gambit.app/Contents/MacOS
@@ -635,11 +639,11 @@ osx-dmg: osx-bundle
635639
msw-msi:
636640
-mkdir installer
637641
cp gambit* installer
638-
candle gambit.wxs
642+
candle build_support/msw/gambit.wxs
639643
light -ext WixUIExtension gambit.wixobj
640644

641645
clang-tidy:
642-
clang-tidy ${top_srcdir}/src/core/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=""
643-
clang-tidy ${top_srcdir}/src/games/*.cc ${top_srcdir}/src/games/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=""
644-
clang-tidy ${top_srcdir}/src/solvers/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=""
645-
clang-tidy ${top_srcdir}/src/tools/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=""
646+
clang-tidy ${top_srcdir}/src/core/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\"
647+
clang-tidy ${top_srcdir}/src/games/*.cc ${top_srcdir}/src/games/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\"
648+
clang-tidy ${top_srcdir}/src/solvers/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\"
649+
clang-tidy ${top_srcdir}/src/tools/*/*.cc -- --std=c++17 -I ${top_srcdir}/src -DVERSION=\"$(GAMBIT_VERSION)\"

build_support/GAMBIT_VERSION

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
16.4.0

gambit.wxs renamed to build_support/msw/gambit.wxs.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
3-
<Product Id="8EE11AE3-2B91-4870-895B-44C46D648BD6" Name="Gambit 16" Language="1033" Version="16.4.0" Manufacturer="The Gambit Project" UpgradeCode="135FFB28-DA7C-427C-A3DA-783B805BCC22">
3+
<Product Id="8EE11AE3-2B91-4870-895B-44C46D648BD6" Name="Gambit 16" Language="1033" Version="@GAMBIT_VERSION@" Manufacturer="The Gambit Project" UpgradeCode="135FFB28-DA7C-427C-A3DA-783B805BCC22">
44
<Package Description="Gambit" Comments="Software Tools for Game Theory" InstallerVersion="200" Compressed="yes" />
55
<Media Id="1" Cabinet="gambit.cab" EmbedCab="yes" />
66

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
<key>CFBundleSignature</key>
2020
<string>????</string>
2121
<key>CFBundleVersion</key>
22-
<string>16.4.0</string>
22+
<string>@GAMBIT_VERSION@</string>
2323
<key>CFBundleShortVersionString</key>
24-
<string>16.4.0</string>
24+
<string>@GAMBIT_VERSION@</string>
2525
<key>CFBundleGetInfoString</key>
26-
<string>Gambit version 16.4.0, (c) 1994-2025 The Gambit Project</string>
26+
<string>Gambit version @GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
2727
<key>CFBundleLongVersionString</key>
28-
<string>16.4.0, (c) 1994-2025 The Gambit Project</string>
28+
<string>@GAMBIT_VERSION@, (c) 1994-2025 The Gambit Project</string>
2929
<key>NSHumanReadableCopyright</key>
3030
<string>Copyright 1994-2025 The Gambit Project</string>
3131
<key>LSRequiresCarbon</key>

configure.ac

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ dnl along with this program; if not, write to the Free Software
2020
dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
2121
dnl
2222

23-
AC_INIT([gambit],[16.4.0])
23+
AC_INIT([gambit],[m4_esyscmd_s([cat build_support/GAMBIT_VERSION])])
2424
AC_CONFIG_SRCDIR([src/gambit.h])
2525
AM_INIT_AUTOMAKE([subdir-objects foreign])
2626
dnl AC_CONFIG_MACRO_DIR([m4])
@@ -145,5 +145,8 @@ AC_SUBST(WX_CXXFLAGS)
145145
REZFLAGS=`echo $CXXFLAGS $WX_CXXFLAGS | sed 's/-mthreads//g' | sed 's/-g//g' | sed 's/-O. / /g' | sed 's/-I/--include-dir /g'`
146146
AC_SUBST(REZFLAGS)
147147

148-
AC_CONFIG_FILES([Makefile])
148+
GAMBIT_VERSION=`cat build_support/GAMBIT_VERSION`
149+
AC_SUBST(GAMBIT_VERSION)
150+
151+
AC_CONFIG_FILES([Makefile build_support/osx/Info.plist build_support/msw/gambit.wxs])
149152
AC_OUTPUT

doc/conf.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import pathlib
2+
13
#
24
# Gambit documentation build configuration file, created by
35
# sphinx-quickstart on Sun Mar 21 14:35:06 2010.
@@ -53,10 +55,17 @@
5355
# |version| and |release|, also used in various other places throughout the
5456
# built documents.
5557
#
56-
# The short X.Y version.
57-
version = "16.4"
58-
# The full version, including alpha/beta/rc tags.
59-
release = "16.4.0"
58+
59+
_version_file = pathlib.Path(__file__).parent.parent / "build_support/GAMBIT_VERSION"
60+
if _version_file.exists():
61+
_full_version = _version_file.read_text().strip()
62+
# The short X.Y version.
63+
version = ".".join(_full_version.split(".")[:2])
64+
# The full version, including alpha/beta/rc tags.
65+
release = _full_version
66+
else:
67+
# Throw error if GAMBIT_VERSION file not found
68+
raise FileNotFoundError("GAMBIT_VERSION file not found")
6069

6170
# The language for content autogenerated by Sphinx. Refer to documentation
6271
# for a list of supported languages.

doc/developer.contributing.rst

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,3 +160,60 @@ To add a contributor, comment on a GitHub Issue or Pull Request, asking @all-con
160160
@all-contributors please add @<username> for <contributions>
161161

162162
Refer to the `emoji key <https://allcontributors.org/docs/en/emoji-key>`__ for a list of contribution types.
163+
164+
Releases & maintenance branches
165+
-------------------------------
166+
167+
Releases of Gambit are made by core developers.
168+
Details of previous releases can be found in the `GitHub releases page <https://github.com/gambitproject/gambit/releases>`__.
169+
170+
Branches labeled ``maintX`` and ``maintX_Y``, where ``X`` is the major version number and ``Y`` is the minor version number, are associated with releases and point to the latest commit on a stable version.
171+
Navigate to the Gambit repository on GitHub and select the `branches` tab to see the list of active maintenance branches.
172+
Be sure to delete any maintenance branches that are no longer being maintained.
173+
174+
.. _making-a-new-release:
175+
176+
Making a new release
177+
^^^^^^^^^^^^^^^^^^^^
178+
179+
When making a new release of Gambit, follow these steps:
180+
181+
1. Create a new branch from the latest commit on the ``master`` branch named ``maintX_Y``, where ``X`` is the major version number and ``Y`` is the minor version number of the new release.
182+
183+
2. Update the version number in the ``build_support/GAMBIT_VERSION`` file to ``X.Y.Z``.
184+
185+
All other files will automatically use the updated version number:
186+
187+
- `pyproject.toml` reads from GAMBIT_VERSION file at build time
188+
- `configure.ac` reads from GAMBIT_VERSION file and substitutes into `build_support/osx/Info.plist` and `build_support/msw/gambit.wxs`
189+
- `src/pygambit/__init__.py` reads from installed package metadata or GAMBIT_VERSION file
190+
- `doc/conf.py` reads from GAMBIT_VERSION file at documentation build time
191+
- Documentation pages reference the `|release|` substitution variable to automatically reflect the updated version number.
192+
193+
3. Update the `ChangeLog` file with a summary of changes
194+
195+
4. Once there are no further commits to be made for the release, create a tag for the release from the latest commit on the maintenance branch. ::
196+
197+
git tag -a vX.Y.Z -m "Gambit version X.Y.Z"
198+
199+
5. Push the maintenance branch and tags to the GitHub repository. ::
200+
201+
git push origin maintX_Y
202+
git push origin --tags
203+
204+
6. Create a new release on the `GitHub releases page <https://github.com/gambitproject/gambit/releases>`__, using the tag created in step 4.
205+
Include a summary of changes from the `ChangeLog` file in the release notes.
206+
207+
7. Currently there is no automated process for pushing the new release to PyPI. This must be done manually.
208+
209+
.. TODO: update this process to be automated via GitHub Actions: Issue #557
210+
211+
Patching maintained versions
212+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
213+
214+
If you have bug fixes that should be applied across maintained versions:
215+
216+
1. Make a branch from the oldest maintenance branch to which the change applies
217+
2. Apply the change and make a pull request to that maintenance branch
218+
3. After the pull request is merged, open new pull requests to each subsequent maintenance branch and finally to the master branch, merging each in turn
219+
4. Create new releases from each maintenance branch as needed, following the steps in :ref:`making-a-new-release`.

doc/tools.convert.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ outputting the strategic form of the game in one of these formats:
3636
Suppresses printing of the banner at program launch.
3737

3838

39-
Example invocation for HTML output::
39+
Example invocation for HTML output
4040

4141
$ gambit-convert -O html 2x2.nfg
4242
Convert games among various file formats
43-
Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project
43+
Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project
4444
This is free software, distributed under the GNU GPL
4545

4646
<center><h1>Two person 2 x 2 game with unique mixed equilibrium</h1></center>
@@ -51,11 +51,11 @@ Example invocation for HTML output::
5151
align=center>1,0</td></tr></table>
5252

5353

54-
Example invocation for LaTeX output::
54+
Example invocation for LaTeX output
5555

5656
$ gambit-convert -O sgame 2x2.nfg
5757
Convert games among various file formats
58-
Gambit version 16.4.0, Copyright (C) 1994-2025, The Gambit Project
58+
Gambit version |release|, Copyright (C) 1994-2025, The Gambit Project
5959
This is free software, distributed under the GNU GPL
6060

6161
\begin{game}{2}{2}[Player 1][Player 2]

0 commit comments

Comments
 (0)