318.1. hydrogen-1.2.6
Pattern-based drum machine and sequencer with sample drum kits
| Version | 1.2.6, release 1 |
| Shelf | studio — Music production: DAWs, audio editors, trackers, drum machines and notation |
| Phase | 44_apps (Applications), 371 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://hydrogen-music.org/ |
| Build time | 12.9 SBU |
| Installed size | 26.6 MiB in 496 files |
| Recipe | ports/core/studio/hydrogen/kpkgbuild |
About
Hydrogen is a pattern-based drum machine: drum kits of samples are played from patterns in a step sequencer, and the patterns are arranged into songs. It is a Qt 6 program, plays through ALSA, PulseAudio or JACK, takes MIDI and OSC control, and loads LADSPA effects. Its user manual and tutorial come from a separate documentation repository, the second source of the recipe.
Sources
hydrogen-1.2.6.tar.gz(13.7 MiB)
sha256efba32610498acde76fa2e147017c91b20c13ec945e05e348cd4183fd1613be1
upstream: https://github.com/hydrogen-music/hydrogen/archive/refs/tags/1.2.6.tar.gz
archive copy: sources-4/studio--hydrogen-1.2.6.tar.gzhydrogen-doc-1.2.6.tar.gz(39.6 MiB)
sha256375ce7d460a8b33e451042330eff44ceffffd0ad220d50b2c49b057d2b01297f
upstream: https://github.com/hydrogen-music/documentation/archive/refs/tags/1.2.6.tar.gz
archive copy: sources-4/studio--hydrogen-doc-1.2.6.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, librsvg, qt6-qtbase, qt6-qtsvg, qt6-qttools, qt6-qtwayland, libsndfile, libarchive, alsa-lib, libpulse, pipewire, ladspa, lrdf, liblo.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
nodevel.patch— InCMakeLists.txt, setsIS_DEVEL_BUILDtofalsein the branch taken whengit describe --exact-match --tagsfinds no tag. A release tarball has no git history, so that branch is always taken, and a development build shows a “You’re using a development version of Hydrogen” message box at start-up. With the patch the tarball builds as the release it is.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/44_apps/phase.env && kpkg install hydrogen'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/studio/hydrogen.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/studio/hydrogen
echo 'efba32610498acde76fa2e147017c91b20c13ec945e05e348cd4183fd1613be1 hydrogen-1.2.6.tar.gz' | sha256sum -c -
echo '375ce7d460a8b33e451042330eff44ceffffd0ad220d50b2c49b057d2b01297f hydrogen-doc-1.2.6.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/hydrogen
SRC=$SRC_ROOT/hydrogen-1.2.6
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf hydrogen-1.2.6.tar.gz -C "$SRC" --strip-components=1
tar --no-same-permissions --warning=no-unknown-keyword -xf hydrogen-doc-1.2.6.tar.gz -C "$SRC_ROOT"
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/nodevel.patch"
rmdir data/doc
mv "$SRC_ROOT/documentation-$version" data/doc
export CMAKE_CXX_FLAGS="$CXXFLAGS"
cmake -S . -B build -G Ninja \
-D CMAKE_POLICY_VERSION_MINIMUM=3.5 \
-D CMAKE_INSTALL_PREFIX=/usr \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON \
-D DISPLAY_VERSION_PIPELINE=$version \
-D WANT_QT6=ON \
-D WANT_SHARED=ON \
-D WANT_DEBUG=OFF \
-D WANT_LIBARCHIVE=ON \
-D WANT_ALSA=ON \
-D WANT_PULSEAUDIO=ON \
-D WANT_LADSPA=ON \
-D WANT_LRDF=ON \
-D WANT_OSC=ON \
-D WANT_JACK=ON \
-D WANT_PORTAUDIO=OFF \
-D WANT_PORTMIDI=OFF \
-D WANT_OSS=OFF \
-D WANT_LASH=OFF \
-D WANT_RUBBERBAND=OFF \
-D WANT_APPIMAGE=OFF \
-D WANT_CPPUNIT=OFF \
-D WANT_INTEGRATION_TESTS=OFF \
-D WANT_CLANG_TIDY=OFF \
-Wno-dev
cmake --build build
DESTDIR=$PKG cmake --install build
rm -rf "$PKG/usr/share/hydrogen/data/i18n"
rm -f "$PKG"/usr/share/hydrogen/data/doc/tutorial_fr.html \
"$PKG"/usr/share/hydrogen/data/doc/tutorial_it.html
test -f "$PKG/usr/share/hydrogen/data/doc/manual_en.html"
for _size in 32 48 64 128; do
install -d "$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps"
rsvg-convert -w "$_size" -h "$_size" \
-o "$PKG/usr/share/icons/hicolor/${_size}x${_size}/apps/org.hydrogenmusic.Hydrogen.png" \
"$PKG/usr/share/icons/hicolor/scalable/apps/org.hydrogenmusic.Hydrogen.svg"
done
cat > "$PKG/usr/share/applications/org.hydrogenmusic.Hydrogen.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=Hydrogen
GenericName=Drum Machine
Comment=Create drum patterns and songs
TryExec=hydrogen
Exec=hydrogen %F
Icon=org.hydrogenmusic.Hydrogen
Terminal=false
StartupNotify=true
StartupWMClass=hydrogen
Categories=AudioVideo;Audio;Midi;Sequencer;Qt;
Keywords=audio;sound;drum;drums;machine;sequencer;sampler;beat;hydrogen;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.hydrogenmusic.Hydrogen.desktop"
The switches, and why each is set:
-D CMAKE_DISABLE_FIND_PACKAGE_Doxygen=ON— when configure finds Doxygen it adds adoctarget for the API documentation and two directory-making targets to every build; disabled, the build is the same whether or not Doxygen is installed.-D DISPLAY_VERSION_PIPELINE— set to the release, the version the About dialog shows and the songs and drum kits Hydrogen writes record. Without it, configure composes the version from git, and a tarball has no git history, so it appends a-and an empty revision (1.2.6-). Upstream’s cache entry for the variable is misspelled,DISLPAY_VERSION_PIPELINE, but the test reads the correct name, which-Dsets.-D WANT_QT6=ON— build against Qt 6; upstream’s default is Qt 5. Configure falls back to Qt 5 if Qt 6 is not found.-D WANT_SHARED=ON— build the core library,hydrogen-core, as a shared library, as upstream does by default on Linux.-D WANT_DEBUG=OFF— upstream’s default isON, which compiles with-O0. Off, it compiles with-O3 -ffast-math(see Notes).-D WANT_LIBARCHIVE=ON— read and write drum-kit archives with libarchive instead of libtar.-D WANT_ALSA=ON— andWANT_PULSEAUDIO,WANT_JACK: the three audio drivers. JACK is the JACK API that pipewire provides.-D WANT_LADSPA=ON— LADSPA effect plugins (ladspa), with-D WANT_LRDF=ONfor lrdf, which reads the plugins’ RDF descriptions to sort them into categories.-D WANT_OSC=ON— Open Sound Control remote control through liblo.-D WANT_PORTAUDIO=OFF— withWANT_PORTMIDIandWANT_OSS: the PortAudio, PortMidi and OSS drivers, which upstream’s defaults turn on only on Windows (PortAudio, PortMidi) or NetBSD (OSS).-D WANT_LASH=OFF— no LASH session-handler support; LASH is not a port.-D WANT_RUBBERBAND=OFF— no linking of the Rubber Band time-stretching library. Upstream marks that support experimental, says it produces wrong timing, and asks for the option to stay off; Hydrogen uses therubberbandcommand-line program instead when it finds one.-D WANT_APPIMAGE=OFF— no AppImage-specific behaviour.-D WANT_CPPUNIT=OFF— no CppUnit test suite, which upstream builds by default;-D WANT_INTEGRATION_TESTS=OFFand-D WANT_CLANG_TIDY=OFFleave out the integration tests and the clang-tidy checks.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/hydrogen, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf hydrogen-1.2.6-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/hydrogen, and runs the triggers its paths call for.
Contents
Installed programs: h2cli, h2player, hydrogen.
Installed libraries: libhydrogen-core-1.2.6.so.
Installed directories: /usr/include/hydrogen, /usr/share/hydrogen, /usr/share/licenses/hydrogen.
Short descriptions
hydrogen |
a simple drum machine/step sequencer. |
Notes
Hydrogen’s CMakeLists.txt builds CMAKE_CXX_FLAGS from the environment variable of that name, not from CXXFLAGS, and empties CMAKE_CXX_FLAGS_RELEASE. build.sh therefore exports CMAKE_CXX_FLAGS="$CXXFLAGS" before the configure; without it the tree’s compiler flags would not reach the compile.
The manual is a git submodule upstream, so the source tarball carries data/doc as an empty directory. build.sh removes it and moves the unpacked documentation tarball into its place, where CMakeLists.txt builds it when data/doc/CMakeLists.txt exists. After the install the French and Italian tutorials and the i18n directory of translations are deleted, and the build checks that manual_en.html was installed. Upstream installs its icon as SVG only, which the panel does not draw, so the recipe rasterises it to PNGs from 32 to 128 pixels. It also writes its own desktop entry: Hydrogen sets no desktop file name, so its Wayland app id is the executable’s name, hydrogen, which the entry names in StartupWMClass, and upstream’s entry claims the text/xml MIME type, every XML file on the system, which the replacement leaves out.