Skip to content

Commit

Permalink
Merge pull request #864 from matty0ung/usability
Browse files Browse the repository at this point in the history
Various fixes and tidy-up
  • Loading branch information
matty0ung authored Oct 24, 2024
2 parents 28abda9 + 2fa2ae9 commit 7133992
Show file tree
Hide file tree
Showing 103 changed files with 2,535 additions and 2,547 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/linux-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,25 @@ jobs:
run: |
make test
#
# Note that, although we continue to support CMake for local builds and installs, we no longer support packaging
# with CPack/CMake. The bt build script packaging gives us better control over the packaging process.
#
# I did also have the idea of doing a subsequent step to try installing the package (eg via
# `sudo apt -f install ./brew*.deb`) but, in practice this gives errors about the following packages not being
# installable:
# libqt6core6t64
# libqt6gui6t64
# libqt6network6t64
# libqt6printsupport6t64
# libqt6sql6t64
# libqt6widgets6t64
# libxalan-c112t64
# libxerces-c3.2t64
#
# I suspect this is because there are restrictions on what you can install on GitHub action runners - presumably
# because they want you to not to do things other than builds with them.
#
- name: Package
working-directory: ${{github.workspace}}/mbuild
shell: bash
Expand Down
4 changes: 3 additions & 1 deletion CHANGES.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ Bug fixes and minor enhancements.
* None

### Bug Fixes

* Clicking 'Generate Instructions' on the Brewday tab overwrites existing instructions without warning [862](https://github.com/Brewtarget/brewtarget/issues/862)
* Brewtarget 4.0.7 Qt6 issue on Ubuntu (libQt6Multimedia.so.6 missing) [861](https://github.com/Brewtarget/brewtarget/issues/861)
* Missing libb2-1.dll [863](https://github.com/Brewtarget/brewtarget/issues/863)

### Release Timestamp
Tue, 16 Oct 2024 04:00:08 +0100
Expand Down
5 changes: 1 addition & 4 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
project('brewtarget', 'cpp',
version: '4.0.8',
license: 'GPL-3.0-or-later',
meson_version: '>=0.60.0',
meson_version: '>=0.63.0',
default_options : ['cpp_std=c++20',
'warning_level=3',
# 'prefer_static=true', See comment above for why this is commented-out for now
Expand Down Expand Up @@ -614,7 +614,6 @@ commonSourceFiles = files([
'src/Html.cpp',
'src/HydrometerTool.cpp',
'src/IbuGuSlider.cpp',
'src/InstructionWidget.cpp',
'src/InventoryFormatter.cpp',
'src/Localization.cpp',
'src/Logging.cpp',
Expand Down Expand Up @@ -851,7 +850,6 @@ mocHeaders = files([
'src/HelpDialog.h',
'src/HydrometerTool.h',
'src/IbuGuSlider.h',
'src/InstructionWidget.h',
'src/MainWindow.h',
'src/MashDesigner.h',
'src/MashWizard.h',
Expand Down Expand Up @@ -1021,7 +1019,6 @@ uiFiles = files([
'ui/fermentationEditor.ui',
'ui/fermentationStepEditor.ui',
'ui/hopEditor.ui',
'ui/instructionWidget.ui',
'ui/mainWindow.ui',
'ui/mashDesigner.ui',
'ui/mashEditor.ui',
Expand Down
80 changes: 65 additions & 15 deletions packaging/linux/control.in
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,79 @@ Architecture: amd64
# binary and not maintain a separate build with its own makefile for the source code, then those tools won't help and
# we need to maintain things manually here. Fortunately our list of dependencies is not horrendous.
#
# We can get an initial list of shared libraries that a binary depends on in a number of ways (per
# https://stackoverflow.com/questions/6242761/determine-direct-shared-object-dependencies-of-a-linux-binary), but the
# following gives quite neat output:
#
# objdump -x myExecutable | grep NEEDED | sort
#
# For our binary, this (as of 2024-10-22) gives
# NEEDED ld-linux-x86-64.so.2
# NEEDED libc.so.6
# NEEDED libgcc_s.so.1
# NEEDED libm.so.6
# NEEDED libQt6Core.so.6
# NEEDED libQt6Gui.so.6
# NEEDED libQt6Multimedia.so.6
# NEEDED libQt6Network.so.6
# NEEDED libQt6PrintSupport.so.6
# NEEDED libQt6Sql.so.6
# NEEDED libQt6Widgets.so.6
# NEEDED libstdc++.so.6
# NEEDED libxalan-c.so.112
# NEEDED libxerces-c-3.2.so
#
# We then need to find which packages provide these shared libraries. Assuming we're on a system where all the
# dependencies are already installed (eg the one where we've just build the software), we can do this with dpkg, eg
# running `dpkg -S libQt6Core.so.6` gives:
#
# libqt6core6t64:amd64: /usr/lib/x86_64-linux-gnu/libQt6Core.so.6.4.2
# libqt6core6t64:amd64: /usr/lib/x86_64-linux-gnu/libQt6Core.so.6
#
# So, eg, for an executable called "brewken" we can put this all together into:
# objdump -x brewken | grep NEEDED | awk '{print $2}' | xargs dpgg -S | grep ^lib | awk -F: '{print $1}' | sort -u
#
# Note that you can see the version of a package libfoobar by running the following command from the shell:
# apt-cache show foobar | grep Version
#
# And we can combine this altogether in the following (linebreaks added for readability):
# objdump -x brewtarget | grep NEEDED | awk '{print $2}' | xargs dpkg -S | grep ^lib | awk -F: '{print $1}' |
# sort -u | while read ii
# do
# echo -e $ii '\t' $(apt-cache show $ii | grep Version | head -1 | sed 's/Version: //; s/ubuntu[^ ]*//; s/[^0-9\.].*//')
# done | sort
# which gives us nearly the output we want.
#
# The only remaining issue is that showing the currently-installed versions of packages on the build machine doesn't
# give us the _minimum_ required versions, so we may end up specifying more recent versions of things than are
# strictly required. Usually we can check for problems here by looking what the most recent available version of a
# package is for the oldest version of Ubuntu we support (via https://packages.ubuntu.com/ - though NB you sometimes
# have to knock the t64 off the end of the name to find a match).
#
# Normally, this field is (surprisingly) not allowed to be "folded" (ie split across multiple lines). However, we do
# our own folding in the bt build script, so the backslash line continuations are OK here!
#
# From trial-and-error, we discover which libraries have a "t64" version which is used instead of the "base" one (eg
# libqt6network6t64 instead of libqt6network6). This is to do with upgrades to 64-bit time (to fix the "year 2038
# problem") -- per https://wiki.debian.org/ReleaseGoals/64bit-time.
# Note that some libraries have a "t64" version which is used instead of the "base" one (eg libqt6network6t64 instead
# of libqt6network6). This is to do with upgrades to 64-bit time (to fix the "year 2038 problem") -- per
# https://wiki.debian.org/ReleaseGoals/64bit-time.
#
Depends: \
libc6 (>= 2.35 ), \
libgcc-s1 (>= 12.3 ), \
libqt6core6t64 (>= 6.2.4), \
libqt6gui6t64 (>= 6.2.4) | \
libqt6multimedia6 (>= 6.2.4), \
libqt6network6t64 (>= 6.2.4), \
libqt6printsupport6t64 (>= 6.2.4), \
libqt6sql6t64 (>= 6.2.4), \
libqt6widgets6t64 (>= 6.2.4), \
libstdc++6 (>= 12.3 ), \
libxalan-c112t64 (>= 1.12 ), \
libxerces-c3.2t64 (>= 3.2.3)
libc6 (>= 2.35 ), \
libc6-dev (>= 2.35 ), \
libc6-i386 (>= 2.35 ), \
lib32gcc-s1 (>= 12.3.0), \
lib32stdc++6 (>= 12.3.0), \
libgcc-s1 (>= 12.3.0), \
libstdc++6 (>= 12.3.0), \
libqt6core6t64 (>= 6.2.4 ), \
libqt6gui6t64 (>= 6.2.4 ), \
libqt6multimedia6 (>= 6.2.4 ), \
libqt6network6t64 (>= 6.2.4 ), \
libqt6printsupport6t64 (>= 6.2.4 ), \
libqt6sql6t64 (>= 6.2.4 ), \
libqt6widgets6t64 (>= 6.2.4 ), \
libxalan-c112t64 (>= 1.12 ), \
libxerces-c3.2t64 (>= 3.2.3 )
#
# Installed-Size (Optional) : an estimate of the total amount of disk space required to install the named package
# The disk space is given as the integer value of the estimated installed size in bytes, divided by 1024 and rounded
Expand Down
42 changes: 28 additions & 14 deletions packaging/linux/rpm.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,37 @@ BuildArch : x86_64
# Format is similar to Dependencies in Debian (.deb) package control file, but (a) without brackets around version
# numbers and (b) '-' and '.' are sometimes replaced by '_' in package names.
#
# You can search online for rpm packages at, eg, http://download.opensuse.org/tumbleweed/repo/oss/x86_64/
# You can search online for rpm packages at, eg, https://rpmfind.net/
#
# We essentially start with the Debian dependencies and look for RPM equivalents, which have similar, but often slightly
# different, names. (There would be a more direct way of doing things if we were building on an RPM-based distro, but
# we aren't.) Note that, per https://centoshelp.org/resources/faqs/yum-rpm-faq/, RPM package package names are
# case-sensitive. (We've ignored this in the past and made everything lower case without error or complaint, but it
# doesn't hurt to try to follow the standards!)
#
# We exclude the following RPM packages:
# - glibc-devel : Gives rpmlint error "devel-dependency" = " "Your package has a dependency on a devel package but
# it's not a devel package itself.
#
# As with .deb package control file, we do our own line folding in the bt build script, so the backslash line
# continuations are OK here!
#
Requires : \
libgcc_s1 >= 3.3 , \
libqt6core6 >= 6.2.4, \
libqt6gui6 >= 6.2.4, \
libqt6multimedia6 >= 6.2.4, \
libqt6network6 >= 6.2.4, \
libqt6printsupport6 >= 6.2.4, \
libqt6sql6 >= 6.2.4, \
libqt6widgets6 >= 6.2.4, \
libstdc++6 >= 11 , \
libxalan-c112 >= 1.12 , \
libxerces-c3_2 >= 3.2
glibc >= 2.35 , \
glibc-32bit >= 2.35 , \
libgcc_s1-32bit >= 12.3.0, \
libstdc++6-32bit >= 12.3.0, \
libgcc_s1 >= 12.3.0, \
libstdc++6 >= 12.3.0, \
libQt6Core6 >= 6.2.4 , \
libQt6Gui6 >= 6.2.4 , \
libQt6Multimedia6 >= 6.2.4 , \
libQt6Network6 >= 6.2.4 , \
libQt6PrintSupport6 >= 6.2.4 , \
libQt6Sql6 >= 6.2.4 , \
libQt6Widgets6 >= 6.2.4 , \
libxalan-c112 >= 1.12 , \
libxerces-c-3_2 >= 3.2.3

# Description is done in a different way, perhaps because it's a multi-line field
%description
Expand All @@ -86,8 +100,8 @@ makes the process of recipe formulation much easier.
%files
/usr/bin/*
/usr/share/applications/*
/usr/share/brewtarget/*
/usr/share/doc/brewtarget/*
/usr/share/@CONFIG_APPLICATION_NAME_LC@/*
/usr/share/doc/@CONFIG_APPLICATION_NAME_LC@/*
/usr/share/icons/hicolor/scalable/apps/*
/usr/share/man/man1/*

Expand Down
33 changes: 27 additions & 6 deletions scripts/buildTool.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,10 @@ def installDependencies():
'mingw-w64-' + arch + '-toolchain',
'mingw-w64-' + arch + '-xalan-c',
'mingw-w64-' + arch + '-xerces-c',
'mingw-w64-' + arch + '-angleproject'] # See comment above
'mingw-w64-' + arch + '-angleproject', # See comment above
'mingw-w64-' + arch + '-ntldd', # Dependency tool useful for running manually -- see below

]
for packageToInstall in installList:
log.debug('Installing ' + packageToInstall)
btUtils.abortOnRunFail(
Expand Down Expand Up @@ -1949,9 +1952,16 @@ def doPackage():
# in the paths listed in the PATH environment variable. It's a bit less painful than you might think to
# construct and maintain this list of libraries, because, for the most part, if you miss a needed DLL from the
# package, Windows will give you an error message at start-up telling you which DLL(s) it needed but could not
# find. (There are also various platform-specific free-standing tools that claim to examine an executable and
# tell you what shared libraries it depends on. None that I know of is easy to install in an automated way in
# MSYS2 however.)
# find.
#
# There are also various platform-specific free-standing tools that claim to examine an executable and
# tell you what shared libraries it depends on. In particular ntldd
# (see https://packages.msys2.org/packages/mingw-w64-x86_64-ntldd) seems useful. Note that you need to run it
# with the `-R` (recursive) option to catch all the dependencies. (Unlike with Linux packaging, we can't just
# specify the top level dependencies and rely on everything else to get pulled in automatically.) Eg, the
# following is a useful starting point:
#
# ntldd -R brewtarget.exe | grep -v "not found" | grep -v ext | grep -v WINDOWS | sed -e 's/^[\t ]*//; s/\.dll.*$//' | sort -u
#
# We assume that the library 'foo' has a dll called 'libfoo.dll' or 'libfoo-X.dll' or 'libfooX.dll' where X is
# a (possibly multi-digit) version number present on some, but not all, libraries. If we find more matches
Expand All @@ -1969,12 +1979,23 @@ def doPackage():
#
pathsToSearch = os.environ['PATH'].split(os.pathsep)
for extraLib in [
#
# Following should have been handled automatically by windeployqt
#
#'Qt6Core' ,
#'Qt6Gui' ,
#'Qt6Multimedia' ,
#'Qt6Network' ,
#'Qt6PrintSupport',
#'Qt6Sql' ,
#'Qt6Widgets' ,
'libb2', # BLAKE hash functions -- https://en.wikipedia.org/wiki/BLAKE_(hash_function)
'libbrotlicommon', # Brotli compression -- see https://en.wikipedia.org/wiki/Brotli
'libbrotlidec', # Brotli compression
'libbrotlienc', # Brotli compression
'libbz2', # BZip2 compression -- see https://en.wikipedia.org/wiki/Bzip2
'libdouble-conversion', # See https://github.com/google/double-conversion
'libfreetype', # See https://freetype.org/
'libdouble-conversion', # Binary-decimal & decimal-binary routines for IEEE doubles -- see https://github.com/google/double-conversion
'libfreetype', # Font rendering -- see https://freetype.org/
#
# 32-bit and 64-bit MinGW use different exception handling (see
# https://sourceforge.net/p/mingw-w64/wiki2/Exception%20Handling/) hence the different naming of libgcc in
Expand Down
4 changes: 2 additions & 2 deletions src/AncestorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ void AncestorDialog::buildAncestorBox() {
QList<Recipe *> recipes = ObjectStoreWrapper::getAllRaw<Recipe>();
std::sort(recipes.begin(), recipes.end(), AncestorDialog::recipeLessThan);

foreach (Recipe * recipe, recipes) {
for (auto recipe : recipes) {
if (recipe->display()) {
comboBox_ancestor->addItem(recipe->name(), recipe->key());
}
Expand All @@ -84,7 +84,7 @@ void AncestorDialog::buildDescendantBox(Recipe * ignore) {
std::sort(recipes.begin(), recipes.end(), recipeLessThan);

// The rules of what can be a target are complex
foreach (Recipe * recipe, recipes) {
for (auto recipe : recipes) {
// if we are ignoring the recipe, skip
if (recipe == ignore) {
continue;
Expand Down
Loading

0 comments on commit 7133992

Please sign in to comment.