2021-10-09 20:26:33 +02:00
|
|
|
# Maintainer: Aurélien Hamy <aunetx@yandex.com>
|
|
|
|
|
|
|
|
PKGNAME = deezer
|
|
|
|
PKGVER = 5.30.0
|
|
|
|
BASE_URL = https://www.deezer.com/desktop/download/artifact/win32/x86/$(PKGVER)
|
|
|
|
EXE_NAME = $(PKGNAME)-$(PKGVER)-setup.exe
|
|
|
|
|
2021-10-10 14:51:24 +02:00
|
|
|
pkg_json_append = '},\
|
2021-10-09 20:26:33 +02:00
|
|
|
"scripts": {\
|
|
|
|
"dist": "electron-builder",\
|
|
|
|
"start": "electron ."\
|
|
|
|
},\
|
|
|
|
"devDependencies": {\
|
2021-10-10 11:57:39 +02:00
|
|
|
"electron": "^13.5.1",\
|
2021-10-09 20:26:33 +02:00
|
|
|
"electron-builder": "^22.13.1"\
|
2021-10-09 22:32:28 +02:00
|
|
|
},\
|
|
|
|
"build": {\
|
|
|
|
"files": [\
|
|
|
|
"**"\
|
|
|
|
],\
|
|
|
|
"directories": {\
|
|
|
|
"buildResources": "build"\
|
2021-10-10 14:51:24 +02:00
|
|
|
},\
|
|
|
|
"extraResources": [\
|
|
|
|
{\
|
|
|
|
"from": "../extra/",\
|
|
|
|
"to": ".",\
|
|
|
|
"filter": [\
|
|
|
|
"**"\
|
|
|
|
]\
|
|
|
|
}\
|
2021-10-12 23:30:59 +02:00
|
|
|
],\
|
|
|
|
"linux": {\
|
|
|
|
"maintainer": "aunetx <me@aunetx.dev>",\
|
|
|
|
"icon": "../icons",\
|
|
|
|
"category": "Utility;AudioVideo;Audio;Player;Music;",\
|
|
|
|
"desktop": {\
|
|
|
|
"Name": "Deezer",\
|
|
|
|
"Type": "Application",\
|
|
|
|
"GenericName": "Online music streaming service",\
|
|
|
|
"Comment": "Listen and download all your favorite music",\
|
|
|
|
"MimeType": "x-scheme-handler/deezer;",\
|
|
|
|
"Keywords": "Music;Player;Streaming;Online;"\
|
|
|
|
}\
|
|
|
|
}\
|
2021-10-09 20:26:33 +02:00
|
|
|
}\
|
|
|
|
}'
|
|
|
|
|
2021-10-10 11:57:39 +02:00
|
|
|
|
2021-10-09 20:26:33 +02:00
|
|
|
install_build_deps:
|
|
|
|
npm install --engine-strict asar
|
2021-10-10 11:57:39 +02:00
|
|
|
npm install prettier
|
|
|
|
|
2021-10-09 20:26:33 +02:00
|
|
|
prepare: install_build_deps
|
2021-10-10 14:51:24 +02:00
|
|
|
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
|
2021-10-09 20:26:33 +02:00
|
|
|
asar extract source/resources/app.asar app
|
2021-10-13 00:14:07 +02:00
|
|
|
|
2021-10-10 14:51:24 +02:00
|
|
|
# Prettier the sources to patch successfully
|
2021-10-10 11:57:39 +02:00
|
|
|
prettier --write "app/build/*.js"
|
2021-10-13 00:14:07 +02:00
|
|
|
|
|
|
|
# Apply patches from ./patches, default ones:
|
|
|
|
# Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)
|
|
|
|
# Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)
|
|
|
|
$(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);)
|
2021-10-09 20:26:33 +02:00
|
|
|
|
2021-10-10 14:51:24 +02:00
|
|
|
# Append `pkg_json_append` to the `package.json` of the app
|
|
|
|
# Adds electron, elecron-builder dependencies, and build directives
|
2021-10-09 20:26:33 +02:00
|
|
|
head -n -2 app/package.json > tmp.txt && mv tmp.txt app/package.json
|
2021-10-10 14:51:24 +02:00
|
|
|
echo $(pkg_json_append) | tee -a app/package.json
|
2021-10-09 20:26:33 +02:00
|
|
|
|
2021-10-12 18:59:27 +02:00
|
|
|
prepare_flatpak: prepare
|
2021-10-10 14:51:24 +02:00
|
|
|
# Generate npm sources (without installing them)
|
2021-10-09 20:26:33 +02:00
|
|
|
npm i --prefix=app --package-lock-only
|
2021-10-10 14:51:24 +02:00
|
|
|
# Package the sources to use them in flatpak-builder offline
|
2021-10-09 20:26:33 +02:00
|
|
|
./flatpak-node-generator.py npm app/package-lock.json -o flatpak/generated-sources.json --electron-node-headers --xdg-layout
|
|
|
|
|
2021-10-12 18:59:27 +02:00
|
|
|
build_flatpak: prepare_flatpak
|
|
|
|
# Build the flatpak image
|
2021-10-13 00:19:42 +02:00
|
|
|
flatpak-builder --force-clean build dev.aunetx.deezer.yml
|
2021-10-12 18:59:27 +02:00
|
|
|
|
|
|
|
export_flatpak: prepare_flatpak
|
|
|
|
# Build the flatpak package and export it to the repo
|
2021-10-13 00:19:42 +02:00
|
|
|
flatpak-builder --gpg-sign=5A7D3B06F15FB60238941027EB3A799E7EE716EB --repo=repo --force-clean build dev.aunetx.deezer.yml
|
2021-10-10 11:57:39 +02:00
|
|
|
|
2021-10-12 18:59:27 +02:00
|
|
|
flatpak_bundle: build_flatpak
|
|
|
|
# Create a flatpak bundle
|
|
|
|
flatpak build-bundle --gpg-sign=5A7D3B06F15FB60238941027EB3A799E7EE716EB flatpak/repo deezer.flatpak dev.aunetx.deezer
|
|
|
|
|
|
|
|
install_flatpak: prepare_flatpak
|
|
|
|
# Build and install locally the flatpak image
|
2021-10-13 00:19:42 +02:00
|
|
|
flatpak-builder --force-clean --user --install build dev.aunetx.deezer.yml
|
2021-10-10 11:57:39 +02:00
|
|
|
|
|
|
|
build_appimage: prepare
|
2021-10-10 14:51:24 +02:00
|
|
|
# Install required dependencies to pack them with AppImage
|
|
|
|
npm i --prefix=app
|
|
|
|
# Build the AppImage package
|
2021-10-10 11:57:39 +02:00
|
|
|
npm run dist --prefix=app
|
2021-10-09 20:26:33 +02:00
|
|
|
|
2021-10-10 11:57:39 +02:00
|
|
|
run_flatpak:
|
|
|
|
flatpak run dev.aunetx.deezer
|
2021-10-09 20:26:33 +02:00
|
|
|
|
|
|
|
clean:
|
2021-10-13 00:19:42 +02:00
|
|
|
rm -rf app flatpak node_modules source package-lock.json
|