335.3. octave-11.3.0
MATLAB-compatible numerical computing, with its Qt 6 desktop
| Version | 11.3.0, release 1 |
| Shelf | math — Mathematics applications and libraries: computer algebra, arbitrary precision, solvers, calculators, statistics and plotting apps |
| Phase | 44_apps (Applications), 286 of 422 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://octave.org/ |
| Build time | 24.3 SBU |
| Installed size | 82.4 MiB in 1975 files |
| Recipe | ports/core/math/octave/kpkgbuild |
About
GNU Octave is a numerical computing language largely compatible with MATLAB, with an interpreter for the terminal and a Qt 6 desktop (octave --gui) that has a QScintilla editor, a variable browser and plot windows. Figures are drawn by its qt graphics toolkit, an OpenGL widget, and printed to PDF, EPS and SVG through gl2ps; gnuplot is the second graphics toolkit, run as a separate program.
Sources
octave-11.3.0.tar.xz(26.6 MiB)
sha2562b80f3149b2de6d1f4f2fcb4fe6515a17eb363b52111bf57b90f37bf6f5e12e1
upstream: https://ftp.gnu.org/gnu/octave/octave-11.3.0.tar.xz
archive copy: sources-3/math--octave-11.3.0.tar.xz
Dependencies
Depends on: gcc, openblas, suitesparse, arpack-ng, qrupdate, sundials, fftw, glpk, qhull, hdf5, curl, openssl, pcre2, readline, ncurses, zlib, bzip2, rapidjson, graphicsmagick, libsndfile, portaudio, freetype2, fontconfig, libglvnd, mesa, glu, gl2ps, qt6-qtbase, qt6-qttools, qt6-qt5compat, qscintilla, wayland, texinfo, gnuplot, ghostscript, perl, bison, flex, gperf.
Required by: no port names it.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
--without-fltk, line 31: fltk (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
abs.patch— addsabsoverloads for the unsigned and narrow integer types (unsigned int,unsigned long,unsigned long long,unsigned short,unsigned char,signed charandshort) tolibinterp/corefcn/pr-output.cc, ahead of the template that prints integer arrays and calls an unqualifiedabson each element’s value. The patch is Alpine’s, which describes it only as needed on Alpine.app-id.patch— Set the desktop file name before the welcome wizard is shownmain_window sets org.octave.Octave in its constructor, after the first-run welcome wizard has taken the executable's name, octave-gui, as its Wayland app id. Set it when the application object is made.
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 octave'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/math/octave.
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/math/octave
echo '2b80f3149b2de6d1f4f2fcb4fe6515a17eb363b52111bf57b90f37bf6f5e12e1 octave-11.3.0.tar.xz' | 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/octave
SRC=$SRC_ROOT/octave-11.3.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf octave-11.3.0.tar.xz -C "$SRC" --strip-components=1
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/abs.patch"
patch -p1 -i "$PORT_SRC/app-id.patch"
./configure --prefix=/usr --sysconfdir=/etc --libdir=/usr/lib \
--infodir=/usr/share/info --mandir=/usr/share/man \
--localstatedir=/var \
--enable-shared \
--disable-static \
--disable-rpath \
--disable-java \
--enable-openmp \
--enable-fftw-threads \
--enable-rapidjson \
--enable-readline \
--with-qt=6 \
--with-blas=-lopenblas \
--with-lapack=-lopenblas \
--with-magick=GraphicsMagick++ \
--with-openssl \
--without-fltk \
--without-x \
--with-wayland-client
for m in HAVE_UMFPACK HAVE_CHOLMOD HAVE_CXSPARSE HAVE_KLU HAVE_SPQR \
HAVE_ARPACK HAVE_QRUPDATE HAVE_FFTW3 HAVE_FFTW3F HAVE_GLPK HAVE_QHULL \
HAVE_SUNDIALS HAVE_SUNDIALS_SUNLINSOL_KLU HAVE_HDF5 HAVE_MAGICK \
HAVE_SNDFILE HAVE_PORTAUDIO HAVE_CURL HAVE_RAPIDJSON HAVE_RAPIDJSON_PRETTYWRITER HAVE_QSCINTILLA \
HAVE_GL2PS_H HAVE_QT6 HAVE_OPENGL HAVE_FREETYPE HAVE_FONTCONFIG \
HAVE_READLINE; do
grep -q "^#define $m 1" config.h || { echo "octave: configure left out $m" >&2; exit 1; }
done
make
make DESTDIR=$PKG install
ls "$PKG"/usr/libexec/octave/$version/exec/*/octave-gui >/dev/null
test -e "$PKG"/usr/share/info/octave.info
rm -rf "$PKG"/usr/share/octave/$version/etc/tests
cat > "$PKG/usr/share/applications/org.octave.Octave.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=GNU Octave
GenericName=Numerical Computing
Comment=Interactive programming environment for numerical computations
TryExec=octave
Exec=octave --gui %f
Icon=octave
Terminal=false
StartupNotify=false
StartupWMClass=org.octave.Octave
Categories=Education;Science;Math;
MimeType=text/x-octave;text/x-matlab;
Keywords=science;math;matrix;numerical;computation;plotting;matlab;octave;
DESKTOP
chmod 644 "$PKG/usr/share/applications/org.octave.Octave.desktop"
test -e "$PKG"/usr/share/icons/hicolor/48x48/apps/octave.png
The switches, and why each is set:
--enable-shared— build Octave’s own libraries (liboctave,liboctinterp,liboctgui) shared, which is upstream’s default; compiled.octextensions link them.--disable-rpath— write no run path into the libraries and programs; everything is found in/usr/lib.--disable-java— leave out the Java interface (javaObject,javaMethodand the rest), so the build does not look for a JDK.--enable-openmp— with--enable-fftw-threads,--enable-rapidjsonand--enable-readline: OpenMP threading, multi-threaded FFTW,jsondecode/jsonencodethrough rapidjson, and command-line editing through readline. Each is upstream’s default. The switch only lets configure look; a missing library is still a warning, and theconfig.hcheck in the Notes is what stops the build.--with-qt=6— build the GUI against Qt 6.--with-blas=-lopenblas— with--with-lapack=-lopenblas: take BLAS and LAPACK from openblas, which provides both, instead of letting configure search for a library.--with-magick=GraphicsMagick++—imread,imwriteandimfinfothrough graphicsmagick’s C++ library. It is upstream’s default, named.--with-openssl— use libcrypto’s MD5 and SHA routines for Octave’shashfunction.--without-fltk— no FLTK graphics toolkit; the Qt toolkit takes its place.--without-x— with--with-wayland-client: Octave talks to the display through the Wayland client library instead of Xlib, so its own code links no Xlib. Theoctavelauncher connects to the display to decide whether the GUI can start, and runsoctave-cliwith “disabling GUI features” when it cannot; built with neither library, it finds no display and never starts the GUI. The interpreter reads the screen’s size and resolution (the root figure’sscreensizeandscreenpixelsperinch) the same way.
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/octave, 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 octave-11.3.0-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/octave, and runs the triggers its paths call for.
Contents
Installed programs: mkoctfile, mkoctfile-11.3.0, octave, octave-11.3.0, octave-cli, octave-cli-11.3.0, octave-config, octave-config-11.3.0.
Installed directories: /usr/include/octave-11.3.0, /usr/lib/octave, /usr/libexec/octave, /usr/share/licenses/octave, /usr/share/octave.
Short descriptions
mkoctfile |
Compile dynamic-load modules for GNU Octave |
octave |
A high-level interactive programming language for numerical computations |
octave-cli |
A high-level interactive programming language for numerical computations |
octave-config |
GNU Octave component and library information retrieval |
octave.pc |
C++ interface to GNU Octave underlying library. |
octinterp.pc |
C++ interface to GNU Octave interpreter. |
octmex.pc |
C interface (MEX) to GNU Octave interpreter. |
Notes
Octave’s configure answers a missing optional library with a warning and builds without the functions it backs, so after the configure build.sh checks config.h for the HAVE_ macro of each library in its loop and stops on the first that is missing. The loop covers suitesparse (UMFPACK, CHOLMOD, CXSparse, KLU, SPQR, for sparse algebra), arpack-ng (eigs), qrupdate, fftw in both precisions, glpk, qhull (convhulln, delaunayn), sundials with KLU (ode15s, ode15i), hdf5 (save -hdf5), GraphicsMagick, libsndfile and portaudio (audioread, audioplayer), curl (urlread, webread), RapidJSON, QScintilla, gl2ps, Qt 6, OpenGL, FreeType, Fontconfig and readline. A dependency added to depends without a line in that loop can be dropped by the configure unnoticed.
The tarball carries the manual already built, as Info, HTML, PDF and a Qt help collection, and it is installed as it is; build.sh checks that octave.info and the octave-gui program were installed. It removes the test files under /usr/share/octave/<version>/etc/tests.
The desktop entry is KDOS’s own, written over upstream’s for StartupWMClass=org.octave.Octave, and the file is named after it, which is the only name KWin looks a window’s icon up by. That desktop file name is also every Octave window’s Wayland app id. Upstream sets it in the main window’s constructor, after the first-run welcome wizard has already opened under the executable’s name, octave-gui, so the wizard’s window would match no entry and show no icon; app-id.patch sets it when the application object is made, before any window exists.