Building from Source¶
ngspice-bin is built inside a manylinux_2_28 (or manylinux_2_34) Docker
container so the resulting binaries work on a wide range of Linux
distributions.
Prerequisites¶
Docker (any recent version)
gitwith the repository clonedNetwork access (the build downloads the NGSpice source tarball from SourceForge)
Local container build¶
Use the provided helper script:
./scripts/run_docker.sh [ngspice_version] [image]
For example:
# Build the latest release (46) in the default manylinux_2_28_x86_64 image
./scripts/run_docker.sh
# Build a specific version
./scripts/run_docker.sh 46
# Build in a different image
./scripts/run_docker.sh 46 manylinux_2_34_x86_64
Or invoke Docker directly:
docker run --rm \
--volume "$(pwd):/io" \
--env ngspice_version=46 \
--env image=manylinux_2_28_x86_64 \
--workdir /io \
quay.io/pypa/manylinux_2_28_x86_64 \
/io/scripts/build.sh
The output tarball is written to release/.
Build script steps¶
scripts/build.sh performs the following steps:
System dependencies — installs build tools (
wget,bison,flex,gcc,gcc-c++,readline-devel,ncurses-devel,patchelf) viayum.Download — fetches
ngspice-<version>.tar.gzfrom SourceForge.Configure — runs
./configurewith--with-x=no,--enable-xspice, and--enable-cider.Build & install —
make -j$(nproc) && make installinto a local prefix.Bundle libs — copies non-standard shared libraries (
libreadline,libtinfo,libgomp,libstdc++,libgcc_s) intoinstall/lib/.Fix RPATH — uses
patchelfto set$ORIGIN-relative RPATHs on the binary and all XSPICE plugins so the tarball is fully self-contained.Strip — strips the binary and shared libraries to reduce tarball size.
Verify — runs a quick batch-mode smoke test (
echo '.end' | ngspice -b -).Package — moves the install prefix to
ngspice/, addsexport.envrc, and createsrelease/ngspice-<image>-<version>.tar.gz.
Environment variables¶
Variable |
Description |
|---|---|
|
NGSpice version number to build (e.g. |
|
manylinux image name; used as the platform string in the tarball name.
Defaults to |
|
Appended to |
|
Override the full release version string (used by the manual Release
workflow to produce clean |
CI / GitHub Actions¶
Two workflows are provided:
ci.ymlTriggered on every push, via
workflow_dispatch, and on a weekly schedule (Sunday 12:00 UTC). Automatically detects the latest NGSpice version from SourceForge, builds onmanylinux_2_28_x86_64andmanylinux_2_34_x86_64, and publishes a GitHub pre-release with the tarballs.release.ymlManually triggered via
workflow_dispatchwith an explicitngspice_versioninput. Produces a proper (non-pre-release) GitHub Release.
Release layout¶
The unpacked release directory contains:
bin/
ngspice
lib/
libreadline.so.7
libtinfo.so.6
libgomp.so.1
libstdc++.so.6
libgcc_s.so.1
ngspice/
analog.cm
digital.cm
tlines.cm
xtradev.cm
xtraevt.cm
spice2poly.cm
table.cm
ivlng.so
share/
ngspice/
scripts/
export.envrc