diff --git a/forge.config.js b/forge.config.js index c06aba0..c869707 100644 --- a/forge.config.js +++ b/forge.config.js @@ -13,11 +13,78 @@ const linuxIconSet = { }; const linuxDesktopTemplate = path.resolve(__dirname, 'packaging/linux/trimsp.desktop.ejs'); +const includeFlatpak = process.env.FORGE_FLATPAK === '1'; // The upstream RPM maker assumes Fedora-style package names. Mageia provides // GTK 3 under lib64gtk+3_0, so allow either name in the generated Requires. redhatDependencies.dependencyMap.gtk3 = '(gtk3 or lib64gtk+3_0)'; +const makers = [ + { + name: '@electron-forge/maker-squirrel', + config: { + name: 'TrimSP', + }, + }, + { + name: '@electron-forge/maker-zip', + platforms: ['darwin'], + }, + { + name: '@electron-forge/maker-deb', + config: { + name: 'trimsp', + productName: 'TrimSP', + genericName: 'Ion implantation simulator', + description: 'TRIM.SP simulation GUI for ion implantation studies.', + categories: ['Science'], + icon: linuxIconSet, + desktopTemplate: linuxDesktopTemplate, + }, + }, + { + name: '@electron-forge/maker-rpm', + config: { + name: 'trimsp', + productName: 'TrimSP', + genericName: 'Ion implantation simulator', + description: 'TRIM.SP simulation GUI for ion implantation studies.', + categories: ['Science'], + icon: linuxIconSet, + desktopTemplate: linuxDesktopTemplate, + }, + }, +]; + +if (includeFlatpak) { + makers.push({ + name: '@electron-forge/maker-flatpak', + config: { + options: { + id: 'ch.psi.lem.TrimSP', + productName: 'TrimSP', + genericName: 'Ion implantation simulator', + description: 'TRIM.SP simulation GUI for ion implantation studies.', + baseVersion: '24.08', + runtimeVersion: '24.08', + extraFlatpakBuilderArgs: ['--state-dir=.flatpak-builder'], + icon: linuxIconSet, + modules: [], + categories: ['Science'], + finishArgs: [ + '--share=ipc', + '--share=network', + '--socket=x11', + '--socket=wayland', + '--device=dri', + '--filesystem=home', + '--filesystem=/tmp', + ], + }, + }, + }); +} + module.exports = { packagerConfig: { icon: 'appicons/icons/png/1024x1024.png', @@ -35,66 +102,5 @@ module.exports = { 'out-flatpak-test($|/)', ], }, - makers: [ - { - name: '@electron-forge/maker-squirrel', - config: { - name: 'TrimSP', - }, - }, - { - name: '@electron-forge/maker-zip', - platforms: ['darwin'], - }, - { - name: '@electron-forge/maker-deb', - config: { - name: 'trimsp', - productName: 'TrimSP', - genericName: 'Ion implantation simulator', - description: 'TRIM.SP simulation GUI for ion implantation studies.', - categories: ['Science'], - icon: linuxIconSet, - desktopTemplate: linuxDesktopTemplate, - }, - }, - { - name: '@electron-forge/maker-rpm', - config: { - name: 'trimsp', - productName: 'TrimSP', - genericName: 'Ion implantation simulator', - description: 'TRIM.SP simulation GUI for ion implantation studies.', - categories: ['Science'], - icon: linuxIconSet, - desktopTemplate: linuxDesktopTemplate, - }, - }, - { - name: '@electron-forge/maker-flatpak', - config: { - options: { - id: 'ch.psi.lem.TrimSP', - productName: 'TrimSP', - genericName: 'Ion implantation simulator', - description: 'TRIM.SP simulation GUI for ion implantation studies.', - baseVersion: '24.08', - runtimeVersion: '24.08', - extraFlatpakBuilderArgs: ['--state-dir=.flatpak-builder'], - icon: linuxIconSet, - modules: [], - categories: ['Science'], - finishArgs: [ - '--share=ipc', - '--share=network', - '--socket=x11', - '--socket=wayland', - '--device=dri', - '--filesystem=home', - '--filesystem=/tmp', - ], - }, - }, - }, - ], + makers: makers, };