338.7. xnec2c-4.4.18
GTK antenna modelling with NEC2: patterns, impedance, gain and SWR over frequency
| Version | 4.4.18, release 1 |
| Shelf | eda — Electronics: schematic and PCB, circuit simulation, antenna modelling, FPGA synthesis and simulation, logic analysers and bench instruments |
| Phase | 44_apps (Applications), 74 of 422 in build order |
| Licence | GPL-2.0-or-later |
| Homepage | https://www.xnec2c.org/ |
| Build time | 0.4 SBU |
| Installed size | 3.3 MiB in 174 files |
| Recipe | ports/core/eda/xnec2c/kpkgbuild |
About
xnec2c models antennas with the NEC2 method of moments: it reads a .nec description of the wires and patches, computes currents, radiation patterns, impedance, gain and SWR over a frequency sweep, and draws them in a GTK 3 window.
Sources
xnec2c-4.4.18.tar.gz(1.5 MiB)
sha2560e1b05dddee94854c32955b8189a7f0a9e0281c7f5888dc96c1a154a882f1116
upstream: https://www.xnec2c.org/releases/xnec2c-v4.4.18.tar.gz
archive copy: sources-2/eda--xnec2c-4.4.18.tar.gz
Dependencies
Depends on: autoconf, automake, libtool, gettext, pkgconf, glib, gtk3, librsvg, openblas.
Required by: no port names it.
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 xnec2c'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/eda/xnec2c.
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/eda/xnec2c
echo '0e1b05dddee94854c32955b8189a7f0a9e0281c7f5888dc96c1a154a882f1116 xnec2c-4.4.18.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/xnec2c
SRC=$SRC_ROOT/xnec2c-4.4.18
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf xnec2c-4.4.18.tar.gz -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:
export CFLAGS="$CFLAGS -g0"
autoreconf -fi
./configure \
--prefix=/usr \
--libdir=/usr/lib \
--sysconfdir=/etc \
--disable-nls
make
make DESTDIR=$PKG install
for s in 48 64 128; do
install -d "$PKG/usr/share/icons/hicolor/${s}x${s}/apps"
rsvg-convert -w $s -h $s resources/xnec2c.svg \
-o "$PKG/usr/share/icons/hicolor/${s}x${s}/apps/xnec2c.png"
done
cat > "$PKG/usr/share/applications/xnec2c.desktop" <<'DESKTOP'
[Desktop Entry]
Type=Application
Name=xnec2c
GenericName=Antenna Simulator
Comment=Model antennas with NEC2: radiation patterns, impedance and SWR sweeps
Exec=xnec2c %f
Icon=xnec2c
Terminal=false
StartupWMClass=xnec2c
MimeType=application/x-nec2;
Categories=Science;Electronics;HamRadio;
Keywords=nec2;antenna;simulator;swr;radiation;pattern;ham;radio;
DESKTOP
chmod 644 "$PKG/usr/share/applications/xnec2c.desktop"
test -x "$PKG/usr/bin/xnec2c"
test -e "$PKG/usr/share/mime/packages/x-nec2.xml"
The switches, and why each is set:
-g0— Appended toCFLAGSto cancel the-O2 -gthatsrc/Makefile.amputs in its ownxnec2c_CFLAGS. automake places a target’s own flags ahead ofCFLAGSon the compile line, so the last-goption wins and the program carries no DWARF (see What kpkg does around build.sh).
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/xnec2c, 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 xnec2c-4.4.18-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/xnec2c, and runs the triggers its paths call for.
Contents
Installed programs: xnec2c.
Installed directories: /usr/share/doc/xnec2c, /usr/share/licenses/xnec2c, /usr/share/xnec2c.
Short descriptions
xnec2c |
a GTK+ graphical interactive version of nec2c, a translation to C of the FORTRAN application NEC2 |
Notes
The release archive carries configure.ac and autogen.sh but no configure script, so build.sh runs autoreconf -fi first. That needs autoconf, automake, libtool and, for the gettext macros, autopoint from gettext.
The linear-algebra backend, openblas, is not linked: xnec2c dlopens it when the user chooses it in the program. It is in depends so that the choice works.
build.sh writes its own menu entry over upstream’s, which has no StartupWMClass. It claims application/x-nec2, the type files/x-nec2.xml defines; make install puts that file in /usr/share/mime/packages, and the last line of build.sh checks that it did. make install installs the icon as one 256×256 PNG and the SVG in /usr/share/pixmaps; build.sh rasterises the SVG to PNG at 48, 64 and 128 pixels in the hicolor theme.