Repository navigation
Expand file tree
/
Copy pathbuild.js
More file actions
117 lines (115 loc) · 3.91 KB
/
Copy pathbuild.js
File metadata and controls
117 lines (115 loc) · 3.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
/*
* Garlmap - Gapless Almighty Rule-based Logical Mpv Audio Player
* Copyright (C) 2021-2026 Jelmer van Arnhem
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {build} from "electron-builder"
import {readdir, rmSync, unlinkSync} from "node:fs"
const ebuilder = {"config": {
/**
* Remove all locales except English US from the build.
* @param {import("electron-builder").AfterPackContext} context
*/
"afterPack": context => {
const localeDir = `${context.appOutDir}/locales/`
readdir(localeDir, (_err, files) => {
for (const file of files?.filter(f => !/en-US\.pak/.test(f)) ?? []) {
unlinkSync(localeDir + file)
}
})
},
"appId": "com.github.Jelmerro.garlmap",
"copyright": "Copyright @ Jelmer van Arnhem | "
+ "Licensed as free software (GPL-3.0 or later)",
"deb": {
"afterInstall": "./after-install.sh",
"fpm": ["--after-upgrade=./after-install.sh", "-d mpv"]
},
"files": [
"app/img/*.png",
"app/img/icon/1024x1024.png",
"app/*.js",
"app/renderer/*"
],
"linux": {
"category": "Audio;AudioVideo;Player;",
"executableArgs": ["--ozone-platform-hint=auto"],
"executableName": "garlmap",
"icon": "app/img/icon",
"maintainer": "Jelmer van Arnhem",
"publish": null,
"target": [
{"arch": ["arm64", "x64"], "target": "AppImage"},
{"arch": ["arm64", "x64"], "target": "deb"},
{"arch": ["arm64", "x64"], "target": "pacman"},
{"arch": ["arm64", "x64"], "target": "rpm"},
{"arch": ["x64"], "target": "snap"},
{"arch": ["arm64", "x64"], "target": "tar.gz"}
]
},
"mac": {
"category": "public.app-category.music",
"icon": "app/img/icon",
"publish": null,
"target": [
{"arch": ["arm64", "x64"], "target": "zip"}
]
},
"nsis": {
"differentialPackage": false,
"license": "LICENSE",
"oneClick": false
},
"pacman": {"fpm": ["-d mpv"]},
"productName": "Garlmap",
"rpm": {
"afterInstall": "./after-install.sh",
"fpm": [
"--rpm-rpmbuild-define=_build_id_links none",
"--after-upgrade=./after-install.sh",
"-d mpv"
]
},
"win": {
"icon": "app/img/icon/512x512.png",
"legalTrademarks": "Copyright @ Jelmer van Arnhem | "
+ "Licensed as free software (GPL-3.0 or later)",
"publish": null,
"target": [
{"arch": ["x64"], "target": "nsis"},
{"arch": ["x64"], "target": "portable"},
{"arch": ["arm64", "x64"], "target": "zip"}
]
}
}}
for (const a of process.argv.slice(2)) {
if (a === "--help") {
console.info("Basic Garlmap build script, these are its options:")
console.info(" --all, --linux, --win, --mac")
console.info("By default it will only build for the current platform.")
process.exit(0)
}
if (a === "--linux" || a === "--all") {
ebuilder.linux = []
}
if (a === "--win" || a === "--all") {
ebuilder.win = []
}
if (a === "--mac" || a === "--all") {
ebuilder.mac = []
}
}
rmSync("dist/", {"force": true, "recursive": true})
console.info(await build(ebuilder))