Skip to content

Commit ad992b1

Browse files
Updated build script for Linux
1 parent 4384970 commit ad992b1

1 file changed

Lines changed: 35 additions & 3 deletions

File tree

build.py

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,21 @@ def _install_macos(self) -> None:
6161
# The multimedia module ships with qt on macOS
6262

6363
def _install_linux(self) -> None:
64-
run("sudo apt-get update")
64+
run("apt-get update")
6565
run(
66-
"sudo apt-get install -y cmake libsndfile1-dev pkg-config "
66+
"apt-get install -y cmake libsndfile1-dev pkg-config wget"
6767
"qt6-base-dev qt6-multimedia-dev libgl1-mesa-dev"
6868
)
6969

70+
if shutil.which("linuxdeployqt") is None:
71+
url = (
72+
"https://github.com/probonopd/linuxdeployqt/releases/download/"
73+
"continuous/linuxdeployqt-continuous-x86_64.AppImage"
74+
)
75+
run(f"wget -nv {url} -O linuxdeployqt.AppImage")
76+
run("chmod +x linuxdeployqt.AppImage")
77+
run("mv linuxdeployqt.AppImage /usr/local/bin/linuxdeployqt")
78+
7079
def _install_windows(self) -> None:
7180
run("choco install -y cmake")
7281
run("choco install -y libsndfile")
@@ -123,11 +132,34 @@ def _package_linux(self) -> Path:
123132
cfg = self.cfg
124133
app_dir = cfg.dist_dir / "AppDir"
125134
app_dir.mkdir(parents=True, exist_ok=True)
126-
shutil.copy(cfg.build_dir / "tmsexpress", app_dir / "tmsexpress")
135+
136+
exe = app_dir / "tmsexpress"
137+
shutil.copy(cfg.build_dir / "tmsexpress", exe)
138+
139+
desktop = app_dir / "tmsexpress.desktop"
140+
desktop.write_text(
141+
"[Desktop Entry]\n"
142+
"Type=Application\n"
143+
"Name=TMS Express\n"
144+
"Exec=tmsexpress\n"
145+
"Icon=tmsexpress\n"
146+
"Categories=Utility;\n"
147+
)
148+
149+
icon_src = cfg.root / "doc" / "screenshot.png"
150+
icon_dst = app_dir / "tmsexpress.png"
151+
if icon_src.exists():
152+
shutil.copy(icon_src, icon_dst)
153+
154+
run(
127155
run(
128156
f"linuxdeployqt {app_dir/'tmsexpress'} -appimage -verbose=1 "
157+
f"linuxdeployqt {desktop} -appimage -verbose=1 "
158+
f"-qmldir={cfg.root / 'src'}"
129159
f"-qmldir={cfg.root / 'src'}"
130160
)
161+
)
162+
131163
appimage = cfg.dist_dir / "tmsexpress-x86_64.AppImage"
132164
return appimage
133165

0 commit comments

Comments
 (0)