Skip to content

cmake/build: cryptopp-modern support + packager-friendly flags - #169

Merged
got3nks merged 5 commits into
amule-org:masterfrom
got3nks:chore/cmake-cryptopp-modern-packager-flags
Jun 17, 2026
Merged

cmake/build: cryptopp-modern support + packager-friendly flags#169
got3nks merged 5 commits into
amule-org:masterfrom
got3nks:chore/cmake-cryptopp-modern-packager-flags

Conversation

@got3nks

@got3nks got3nks commented Jun 15, 2026

Copy link
Copy Markdown

Summary

Five small, related changes. Four of these come from freebsd/freebsd-ports/tree/main/net-p2p/amule/files — FreeBSD ports has been carrying them as local patches and asked them rolled upstream so the port can drop them. The fifth is the cryptopp-modern fix from #167.

  1. cmake/cryptopp.cmake — accept cryptopp-modern's calendar CRYPTOPP_VERSION encoding. The previous regex parsed 20260600 as 2.0.26.0.600 and tripped MIN_CRYPTOPP_VERSION ("5.6"). Threshold check disambiguates the two encodings without collision risk (classic max 999, calendar min ~20,240,000). Fixes cryptopp dependency alternative #167.

  2. CMakeLists.txtinstall(LICENSE.md ...) destination moves from CMAKE_INSTALL_DATADIR to CMAKE_INSTALL_DOCDIR. Matches FHS / GNUInstallDirs convention.

  3. src/DownloadListCtrl.cpp — when no video player is configured, fall back to the platform's native opener: open on macOS, cmd /c start "" on Windows, xdg-open elsewhere. Replaces the legacy xterm -e mplayer fallback that assumed both xterm and mplayer were installed. The warning text gains a %s placeholder so the per-platform helper name is shown in the dialog. The Windows helper-name ("the default Windows shell handler") is itself translatable; the Unix command names (open / xdg-open) stay as literal tool names.

  4. -DENABLE_CCACHE=AUTO/ON/OFF (new flag, default AUTO). AUTO preserves today's behaviour (use ccache if found). OFF skips the find_program(ccache) probe entirely — useful for distros / build systems that already chain ccache via their own compiler wrapper and don't want a second launcher injected. ON hard-fails configure if ccache isn't found.

  5. -DDEFAULT_VERSION_CHECK=ON/OFF (new flag, default ON). Plumbs a #cmakedefine01 macro into config.h that Preferences.cpp reads for the initial state of the "Check for new aMule version" toggle on fresh installs. OS-package builds typically want OFF so the in-app updater doesn't compete with the distro's package manager. Existing users' saved amule.conf is unaffected (only consulted at first-launch / config-reset).

docs/INSTALL.md gains rows for both flags.

Catalogs

Two new msgids land in po/amule.pot:

  • "...preferences (default is %s)." (now c-format, replaces "...preferences (default is mplayer).")
  • "the default Windows shell handler" (the helper-name substituted into %s on Windows)

A third po commit substitutes mplayer%s in 27 languages whose existing translation contained the literal token and drops their fuzzy flag — semantically the same sentence, so translators don't have to re-approve. The 11 languages with empty / non-literal msgstrs stay fuzzy for a translator's eye. The new Windows handler msgid is empty / fuzzy in all locales (Weblate will pick it up).

Test plan

  • Configure + build on macOS arm64 (Homebrew, classic Crypto++ 8.9.0). Configure shows crypto++ version 8.9.0 -- OK from the legacy branch.
  • ENABLE_CCACHE=AUTO with no ccache installed → -- ccache not found warn-only, configure succeeds.
  • LICENSE.md installs under share/doc/amule/ (DOCDIR) instead of share/amule/ (DATADIR).
  • Build links aMule.app + amuled + amulecmd + ed2k clean.
  • scripts/update-po.sh round-trip confirms both new msgids carry through to po/amule.pot.
  • Verify CI on Ubuntu / Windows.
  • (For a packager) confirm -DENABLE_CCACHE=OFF skips the find_program(ccache) probe entirely on a system that has ccache installed.
  • (For a packager) confirm -DDEFAULT_VERSION_CHECK=OFF produces a build where a fresh amule.conf has NewVersionCheck=0.

Refs: #167

@got3nks

got3nks commented Jun 15, 2026

Copy link
Copy Markdown
Author

Follow-up commit 2846e7d4 — keeping /share/doc out of the flatpak cleanup so the new LICENSE.md location (share/doc/amule/ per commit 1a90abd) actually ships in the bundle. Without it, the top-level cleanup rule would strip aMule's licence along with the third-party READMEs it was originally targeting.

Both manifests updated: the Flathub submission yaml gets a clean one-line removal; the local .yaml.in template carries an inline comment so a future maintainer doesn't re-add the rule.

@got3nks
got3nks force-pushed the chore/cmake-cryptopp-modern-packager-flags branch from 2846e7d to 11c66d7 Compare June 16, 2026 08:14
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 16, 2026
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- Added ccache BUILD_DEPENDS to check that ccache is really OFF
- pkg-plist was forced created to match default options (testing proposes)
- a tarball was created from pull 169 for testing
- there's a log in files dir for checking

See also: amule-org/amule#169
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 16, 2026
- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- Added ccache BUILD_DEPENDS to check that ccache is really OFF
- pkg-plist was forced created to match default options (testing proposes)
- a tarball was created from pull 169 for testing
- there's a log in files dir for checking

See also: amule-org/amule#169
@got3nks
got3nks force-pushed the chore/cmake-cryptopp-modern-packager-flags branch from 11c66d7 to 807686d Compare June 16, 2026 10:08
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 16, 2026
- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- Added ccache BUILD_DEPENDS to check that ccache is really OFF
- pkg-plist was forced created to match default options (testing proposes)
- a tarball was created from pull 169 for testing
- there's a log in files dir for checking

See also: amule-org/amule#169

@nunotexbsd nunotexbsd left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi!

I tested your PR #169 in a clean FreeBSD Poudriere environment (packager).
I removed our 4 local patches, and everything works perfectly.

  • The Cryptopp-modern version check works great and is very clean.
  • The new flags (-DENABLE_CCACHE=OFF and -DDEFAULT_VERSION_CHECK=OFF) are perfect for package maintainers.
    (I've used ccache as a build depend to force is presence on env.)
  • The build and the run-test stage were both OK.

Thank you for the fast response and for this great cleanup.

Approve!

nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 17, 2026
- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- Added ccache BUILD_DEPENDS to check that ccache is really OFF
- pkg-plist was forced created to match default options (testing proposes)
- there's a log in files dir for checking

See also: amule-org/amule#169
got3nks added 5 commits June 17, 2026 20:13
Two CRYPTOPP_VERSION encodings exist in the wild:

  - Classic Crypto++ (weidai11/cryptopp/config_ver.h:53):
        MAJOR*100 + MINOR*10 + REVISION
    so 8.9.0 -> 890, max for v1.x..v9.x is 999.

  - cryptopp-modern (https://github.com/cryptopp-modern/cryptopp-modern,
    calendar versioning per config_ver.h:50):
        YEAR*10000 + MONTH*100 + INCREMENT
    so the 2026.6 build is 20260600. Always >= 20,240,000 for any
    release from 2024 onwards.

The previous regex pass parsed 20260600 as "2.0.26.0.600" and tripped
MIN_CRYPTOPP_VERSION ("5.6"), making cryptopp-modern unbuildable
against aMule -- the symptom reported in issue amule-project#167.

The gap between 9,999 and 20,000,000 makes a single magnitude check
enough to disambiguate the two encodings without collision risk now
or in any realistic future, and would also gracefully accept a
hypothetical classic Crypto++ 10.x.y in the 1000-9999 range as
"clearly newer than MIN_CRYPTOPP_VERSION".

Refs: amule-project#167
Four small changes packagers asked for (FreeBSD ports has carried
local patches for these for years; rolling them upstream so the port
can drop them):

1. Move LICENSE.md from CMAKE_INSTALL_DATADIR to CMAKE_INSTALL_DOCDIR.
   GNUInstallDirs convention puts copyright/licence files under
   share/doc/<pkg>/ rather than share/<pkg>/, matching every distro's
   FHS expectation.

2. Make the file-preview fallback platform-aware. The legacy command
   was 'xterm -T "aMule Preview" -iconic -e mplayer "$file"' which
   assumed both xterm and mplayer were installed; on macOS, modern
   Linux desktops, and Windows that's no longer a reasonable
   assumption. Replace with:

     - macOS  : 'open "$file"'                  -- LaunchServices opens
                                                  the user's registered
                                                  application for the
                                                  file type
     - Windows: 'cmd /c start "" "$file"'       -- same via shell
                                                  associations
     - else   : 'xdg-open "$file"'              -- XDG MIME handler

   The warning text now interpolates the per-platform helper name via
   CFormat / "%s" so a new translatable string lands in the catalog.
   The Windows helper-name string is itself translatable (it's English
   prose); the macOS / xdg-open names stay as literal command names.
   Preferences -> Misc -> Video player still takes precedence
   regardless of platform.

3. Add -DENABLE_CCACHE=AUTO/ON/OFF. AUTO (default) preserves today's
   behaviour: use ccache if find_program locates it, log "ccache not
   found" otherwise. OFF skips the probe entirely -- distros that
   already manage ccache via their own wrapper (FreeBSD ports,
   Gentoo) don't want a second launcher chained in front. ON
   hard-fails the configure if ccache isn't found, so CI that
   *requires* ccache for cache-hit metrics fails fast instead of
   silently building uncached.

4. Add -DDEFAULT_VERSION_CHECK=ON/OFF. Plumbs a #cmakedefine01 macro
   into config.h that Preferences.cpp consumes for the initial state
   of the "Check for new aMule version" toggle on fresh installs.
   Default ON preserves today's behaviour for standalone / portable /
   AppImage builds. OFF is what OS-package builds (apt, brew, ports)
   typically want so the in-app updater doesn't compete with the
   distro's package manager. Existing users' saved amule.conf is
   unaffected -- the macro is only consulted at first-launch /
   config-reset.

docs/INSTALL.md gains rows for both flags.
scripts/update-po.sh refresh. Two semantic changes:

  1. The preview-warning msgid changed from
       "...preferences (default is mplayer)."
     to
       "...preferences (default is %s)." (now c-format)

  2. New msgid "the default Windows shell handler" -- the platform-
     specific helper-name substituted into %s on Windows.

Everything else is location-comment churn from line shifts in
DownloadListCtrl.cpp and Preferences.cpp.
The previous commit refreshed po/*.po via scripts/update-po.sh after
the preview-warning msgid changed from "...default is mplayer)." to
"...default is %s).". msgmerge correctly carried each old translation
into the new (now c-format) entry but flagged the entries fuzzy --
which would force every translator who'd already done the work to
re-tap "approved" in Weblate for what is, semantically, the same
sentence.

For every language whose existing translation contained the literal
token "mplayer", substitute it for "%s" and drop the fuzzy flag. At
runtime CFormat fills %s with the per-platform default ("xdg-open" on
Linux/BSD, "open" on macOS, the translated "the default Windows shell
handler" string on Windows), so the visible sentence reads naturally
in each locale.

Languages whose translator never mentioned mplayer literally, or
whose msgstr was empty, stay fuzzy so a human reviews them.

27/40 updated: ast, ca, de, el, es, et_EE, eu, fi, fr, gl, hu, it,
it_CH, lt, nl, nn, pl, pt_BR, pt_PT, ro, ru, sl, sv, tr, uk, zh_CN,
zh_TW.

13/40 stay fuzzy (empty or non-literal msgstr): ar, bg, bn, cs, da,
en_GB, he, hr, ja, ko_KR, lv, sq, ta.
The earlier commit in this series moves LICENSE.md from share/ to
share/doc/amule/ (FHS / GNUInstallDirs convention). The flatpak
manifests' top-level 'cleanup: - /share/doc' rule would now strip
the licence file from the final bundle along with the third-party
README/licence files it was originally targeting (cryptopp, boost,
libupnp).

Drop /share/doc from the cleanup list in both manifests we ship:

  - packaging/flathub/org.amule.aMule.yaml          (Flathub submission)
  - packaging/linux/flatpak/org.amule.aMule.yaml.in (local-build template;
                                                    the generated .yaml is
                                                    gitignored)

The bundle grows by a few KB of third-party doc files -- negligible
next to losing the licence. The .in template carries an inline
comment so a future reader doesn't re-add the rule; the Flathub
manifest stays comment-free per submission hygiene.
@got3nks
got3nks force-pushed the chore/cmake-cryptopp-modern-packager-flags branch from 807686d to 5e0b786 Compare June 17, 2026 18:17
@got3nks
got3nks merged commit b4be0de into amule-org:master Jun 17, 2026
9 checks passed
@got3nks
got3nks deleted the chore/cmake-cryptopp-modern-packager-flags branch June 17, 2026 18:36
got3nks added a commit to amule-org/amule-org.github.io that referenced this pull request Jun 17, 2026
Brings the developer compilation docs in line with what landed in
amule-org/amule#169 (cryptopp-modern support + two packager-friendly
cmake flags).

* index.md: Crypto++ row in the Requirements table now notes "classic
  or cryptopp-modern", with a follow-up paragraph naming both upstreams
  and explaining the auto-detection. New rows in the Build Options
  table for `ENABLE_CCACHE` (AUTO/ON/OFF) and `DEFAULT_VERSION_CHECK`
  (ON/OFF).

* linux.md / bsd.md: troubleshooting section for "Crypto++ version too
  old" now mentions cryptopp-modern as an alternative install path.

Macos.md needs no change (its troubleshooting is about Homebrew path
discovery, not version). Windows.md just links back to the central
Build Options table and picks up the new rows automatically.
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 17, 2026
- now using main at 3.0.0-194-gb4be0deb4

Keeping some history here:

- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- Added ccache BUILD_DEPENDS to check that ccache is really OFF
- pkg-plist was forced created to match default options (testing proposes)
- there's a log in files dir for checking

See also: amule-org/amule#169
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 18, 2026
- now using main at 3.0.0-194-gb4be0deb4
- main port is updated to use new build depends.

Keeping some history here:

- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- pkg-plist was forced created to match default options (testing proposes)

See also: amule-org/amule#169
nunotexbsd added a commit to nunotexbsd/freebsd-ports-overlay that referenced this pull request Jun 22, 2026
- now using main at 3.0.0-194-gb4be0deb4
- main port is updated to use new build depends.

Keeping some history here:

- Using cryptopp-modern as build dep
- Added to CMAKE_OFF: DEFAULT_VERSION_CHECK ENABLE_CCACHE
  and deleting corresponding old patches
- pkg-plist was forced created to match default options (testing proposes)

See also: amule-org/amule#169
@got3nks

got3nks commented Jul 3, 2026

Copy link
Copy Markdown
Author

@nunotexbsd a quick update, we renamed the flag DEFAULT_VERSION_CHECK to ENABLE_VERSION_CHECK.

It now compiles the whole version-check feature out instead of just switching the default option to OFF.

@nunotexbsd

Copy link
Copy Markdown

@got3nks

Nice, thanks.

I'm running 3.0.1-42-g0db667ef0 (main) locally with ENABLE_VERSION_CHECK=OFF without git presence and result is OK.

2026-07-04-164107_375x136_scrot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cryptopp dependency alternative

2 participants