Make static linking the default packaging path

This commit is contained in:
2026-06-13 13:47:15 +02:00
parent f8866be6d3
commit 0023baede0
3 changed files with 42 additions and 9 deletions
+35 -6
View File
@@ -52,7 +52,14 @@ make
```
This creates the `trimspNL` binary in the repository root. For packaged
Electron builds, copy or rebuild it into:
Electron builds, the default is now to use the static binary:
```bash
cd trimsp/fortran
make trimspNL-static
```
and copy or rebuild it into:
```text
resources/bin/trimspNL
@@ -71,6 +78,13 @@ example:
This reads `myrun.inp` and writes `myrun.out`, `myrun.rge`, and `myrun.err`.
If you need the dynamic binary explicitly, build:
```bash
cd trimsp/fortran
make trimspNL
```
###### Running the GUI ######
Install [Node.js] (`nodejs`, `nodejs-libs` and `npm`),
@@ -87,18 +101,33 @@ Next time you can simply run `npm start` only.
###### Building RPM and DEB packages ######
Install [Node.js] (`nodejs`, `nodejs-libs` and `npm`), then run:
Install [Node.js] (`nodejs`, `nodejs-libs` and `npm`), plus the Fortran toolchain
(`make` and `gfortran`), then run:
```bash
cd trimsp
cp trimspNL resources/bin/trimspNL
npm install
npm run make
```
This uses Electron Forge to build Linux packages from the current checkout.
The packaged application bundles `resources/bin/trimspNL` inside the app
resources, so make sure that file exists and is up to date before packaging.
This automatically compiles `fortran/trimspNL-static` and copies it to
`resources/bin/trimspNL` before Electron Forge builds the packages.
If static linking fails on a given machine, you can stage the dynamic binary
manually instead:
```bash
npm run build:fortran:dynamic
```
For Flatpak, build with the same default static Fortran binary:
```bash
npm run make:flatpak
```
This compiles `fortran/trimspNL-static` and stages it as
`resources/bin/trimspNL` before the Flatpak packaging step.
The generated files are written under:
+1 -2
View File
@@ -23,11 +23,10 @@ trimspNL : trimspNL.F
$(FC) $(FCFLAGS) -o $@ $<
clean:
rm -f *.o *~ \#* .#* trimspNL
rm -f *.o *~ \#* .#* trimspNL trimspNL-static
install:
mv trimspNL $(prefix)/bin/.
trimspNL-static : trimspNL.F
$(FC) $(FCFLAGS) -static -o $@ $<
+6 -1
View File
@@ -4,10 +4,15 @@
"description": "Trim.SP simulation to calculate stopping profile of implanted probes.",
"main": "main.js",
"scripts": {
"build:fortran": "make -C fortran trimspNL-static && cp fortran/trimspNL-static resources/bin/trimspNL",
"build:fortran:dynamic": "make -C fortran trimspNL && cp fortran/trimspNL resources/bin/trimspNL",
"build:fortran:static": "npm run build:fortran",
"start": "electron-forge start",
"prepackage": "npm run build:fortran",
"package": "electron-forge package",
"premake": "npm run build:fortran",
"make": "electron-forge make",
"make:flatpak": "FORGE_FLATPAK=1 electron-forge make --targets=@electron-forge/maker-flatpak",
"make:flatpak": "npm run build:fortran && FORGE_FLATPAK=1 electron-forge make --targets=@electron-forge/maker-flatpak",
"checksums:md5": "sh -c 'for d in out/make/deb/x64 out/make/rpm/x64 out/make/flatpak/x86_64; do [ -d \"$d\" ] || continue; for f in \"$d\"/*; do [ -f \"$f\" ] || continue; case \"$f\" in *.deb|*.rpm|*.flatpak) base=$(basename \"$f\"); (cd \"$d\" && md5sum \"$base\" > \"$base.md5\");; esac; done; done'",
"checksums:sha256": "sh -c 'for d in out/make/deb/x64 out/make/rpm/x64 out/make/flatpak/x86_64; do [ -d \"$d\" ] || continue; for f in \"$d\"/*; do [ -f \"$f\" ] || continue; case \"$f\" in *.deb|*.rpm|*.flatpak) base=$(basename \"$f\"); (cd \"$d\" && sha256sum \"$base\" > \"$base.sha256\");; esac; done; done'",
"checksums": "npm run checksums:md5 && npm run checksums:sha256"