From 1b007615f99117b7f9d98edcbc331a5a4bcd1ec2 Mon Sep 17 00:00:00 2001 From: aunetx Date: Sun, 10 Oct 2021 14:51:24 +0200 Subject: [PATCH] Fix #1, add comments --- .gitignore | 4 ++-- Makefile | 47 ++++++++++++++++++++++++++++++++++------------- 2 files changed, 36 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 623926a..2c24559 100644 --- a/.gitignore +++ b/.gitignore @@ -4,9 +4,9 @@ build /dist source app +extra app-32.7z deezer-*.exe package-lock.json package.json -app.7z -systray.png \ No newline at end of file +app.7z \ No newline at end of file diff --git a/Makefile b/Makefile index 3c6528d..1c071b8 100644 --- a/Makefile +++ b/Makefile @@ -5,7 +5,7 @@ PKGVER = 5.30.0 BASE_URL = https://www.deezer.com/desktop/download/artifact/win32/x86/$(PKGVER) EXE_NAME = $(PKGNAME)-$(PKGVER)-setup.exe -json_add = '},\ +pkg_json_append = '},\ "scripts": {\ "dist": "electron-builder",\ "start": "electron ."\ @@ -20,7 +20,16 @@ json_add = '},\ ],\ "directories": {\ "buildResources": "build"\ - }\ + },\ + "extraResources": [\ + {\ + "from": "../extra/",\ + "to": ".",\ + "filter": [\ + "**"\ + ]\ + }\ + ]\ }\ }' @@ -31,35 +40,47 @@ install_build_deps: prepare: install_build_deps - wget -c $(BASE_URL) -O $(EXE_NAME) - # Extract app from installer - 7z x -so $(EXE_NAME) '$$PLUGINSDIR/app-32.7z' > app-32.7z - # Extract app archive - 7z x -y -bsp0 -bso0 app-32.7z -osource - + mkdir -p source + # Download installer + wget -c $(BASE_URL) -O source/$(EXE_NAME) + # Extract app archive from installer + cd source && 7z x -so $(EXE_NAME) '$$PLUGINSDIR/app-32.7z' > app-32.7z + # Extract app from app archive + cd source && 7z x -y -bsp0 -bso0 app-32.7z + # Extract app sources from the app asar extract source/resources/app.asar app - cp source/resources/win/systray.png . + # Add extra resources to be used at runtime + mkdir -p extra/linux + cp source/resources/win/systray.png extra/linux/ + # Prettier the sources to patch successfully prettier --write "app/build/*.js" - # Hide to tray (https://github.com/SibrenVasse/deezer/issues/4) + # Patch hide to tray (https://github.com/SibrenVasse/deezer/issues/4) patch -p1 -dapp < quit.patch # Add start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12) patch -p1 -dapp < start-hidden-in-tray.patch + # Append `pkg_json_append` to the `package.json` of the app + # Adds electron, elecron-builder dependencies, and build directives head -n -2 app/package.json > tmp.txt && mv tmp.txt app/package.json - echo $(json_add) | tee -a app/package.json + echo $(pkg_json_append) | tee -a app/package.json build_flatpak: prepare + # Generate npm sources (without installing them) npm i --prefix=app --package-lock-only + # Package the sources to use them in flatpak-builder offline ./flatpak-node-generator.py npm app/package-lock.json -o flatpak/generated-sources.json --electron-node-headers --xdg-layout + # Build the Flatpak app cd flatpak && flatpak-builder build dev.aunetx.deezer.yml --install --force-clean --user build_appimage: prepare - npm install --prefix=app + # Install required dependencies to pack them with AppImage + npm i --prefix=app + # Build the AppImage package npm run dist --prefix=app @@ -68,4 +89,4 @@ run_flatpak: clean: - rm -rf app flatpak/{.flatpak-builder,build} node_modules source app-32.7z app.7z deezer-*.exe package-lock.json systray.png \ No newline at end of file + rm -rf app extra flatpak/{.flatpak-builder,build} node_modules source app-32.7z app.7z deezer-*.exe package-lock.json \ No newline at end of file