deezer-linux/Makefile

126 lines
4.1 KiB
Makefile
Raw Normal View History

2021-10-09 20:26:33 +02:00
# Maintainer: Aurélien Hamy <aunetx@yandex.com>
2021-10-13 00:53:38 +02:00
APPNAME = dev.aunetx.deezer
2022-05-01 17:35:51 +02:00
PKGVER = 5.30.220
2021-10-09 20:26:33 +02:00
BASE_URL = https://www.deezer.com/desktop/download/artifact/win32/x86/$(PKGVER)
2021-10-13 00:53:38 +02:00
GPG_KEY_ID = 5A7D3B06F15FB60238941027EB3A799E7EE716EB
2022-02-01 00:05:16 +01:00
VERSION_REGEX = ^v$(PKGVER)-[0-9]{1,}$$
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:
2022-02-01 00:05:16 +01:00
@npm install --engine-strict asar
@npm install prettier
prepare: clean install_build_deps
@mkdir -p source
@echo "Download installer"
@wget -nv -c $(BASE_URL) -O source/deezer-setup-$(PKGVER).exe
@echo "Extract app archive from installer"
@cd source && 7z x -so deezer-setup-$(PKGVER).exe '$$PLUGINSDIR/app-32.7z' > app-32.7z
@echo "Extract app from app archive"
@cd source && 7z x -y -bsp0 -bso0 app-32.7z
@echo "Extract app sources from the app"
@node_modules/asar/bin/asar.js extract source/resources/app.asar app
@echo "Prettier the sources to patch successfully"
@node_modules/prettier/bin-prettier.js --write "app/build/*.js"
@echo "Apply patches from ./patches, default ones:"
@echo "Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4)"
@echo "Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)"
@echo "Remove kernel version from User-Agent (https://github.com/aunetx/deezer-linux/pull/9)"
2021-10-13 00:14:07 +02:00
$(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);)
2021-10-09 20:26:33 +02:00
2022-02-01 00:05:16 +01:00
@echo "Append `package-append.json` to the `package.json` of the app"
@echo "Adds electron, elecron-builder dependencies, and build directives"
@head -n -1 app/package.json > tmp.txt && mv tmp.txt app/package.json
@cat package-append.json | tee -a app/package.json
2021-10-09 20:26:33 +02:00
2021-10-13 20:19:59 +02:00
#! FLATPAK
2021-11-15 19:38:57 +01:00
2021-10-12 18:59:27 +02:00
prepare_flatpak: prepare
2022-02-01 00:05:16 +01:00
@echo "Generate yarn sources (without installing them)"
@yarn --cwd=app install --mode update-lockfile
@echo "Package the sources to use them in flatpak-builder offline"
@mkdir -p flatpak
@./flatpak-node-generator.py yarn app/yarn.lock -o flatpak/generated-sources.json --electron-node-headers --xdg-layout
2021-10-09 20:26:33 +02:00
2021-10-12 18:59:27 +02:00
build_flatpak: prepare_flatpak
2022-02-01 00:05:16 +01:00
@echo "Build the flatpak image"
@flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder flatpak/build $(APPNAME).yml
2021-10-12 18:59:27 +02:00
export_flatpak: prepare_flatpak
2022-02-01 00:05:16 +01:00
@echo "Build the flatpak package and export it to the repo"
@flatpak-builder --gpg-sign=$(GPG_KEY_ID) --repo=docs --state-dir=flatpak/flatpak-builder --force-clean flatpak/build $(APPNAME).yml
@flatpak build-update-repo --generate-static-deltas --gpg-sign=$(GPG_KEY_ID) docs
2021-10-10 11:57:39 +02:00
2022-05-01 16:23:47 +02:00
bundle_flatpak: build_flatpak
2022-02-01 00:05:16 +01:00
@echo "Create a flatpak bundle"
@flatpak build-bundle --gpg-sign=$(GPG_KEY_ID) --state-dir=flatpak/flatpak-builder docs deezer.flatpak $(APPNAME)
2021-10-12 18:59:27 +02:00
install_flatpak: prepare_flatpak
2022-02-01 00:05:16 +01:00
@echo "Build and install locally the flatpak image"
@flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder --user --install flatpak/build $(APPNAME).yml
2021-10-10 11:57:39 +02:00
2021-10-13 20:19:59 +02:00
2021-11-15 19:38:57 +01:00
#! PACKAGES
2021-10-13 20:19:59 +02:00
install_deps: prepare
2022-02-01 00:05:16 +01:00
@echo "Install yarn dependencies to pack them later"
@yarn --cwd=app install
2021-10-13 20:19:59 +02:00
2021-11-15 17:28:36 +01:00
build_deb:
2022-02-01 00:05:16 +01:00
@echo "Build deb package"
@yarn --cwd=app run build-deb
2021-10-13 20:19:59 +02:00
2021-11-15 17:28:36 +01:00
build_rpm:
2022-02-01 00:05:16 +01:00
@echo "Build rpm package"
@yarn --cwd=app run build-rpm
2021-10-13 22:58:10 +02:00
2021-11-15 17:28:36 +01:00
build_snap:
2022-02-01 00:05:16 +01:00
@echo "Build snap package"
@yarn --cwd=app run build-snap
2021-11-15 17:14:41 +01:00
2021-11-15 17:28:36 +01:00
build_appimage:
2022-02-01 00:05:16 +01:00
@echo "Build AppImage binary"
@yarn --cwd=app run build-appimage
2021-11-15 17:14:41 +01:00
2021-11-15 17:28:36 +01:00
build_7z:
2022-02-01 00:05:16 +01:00
@echo "Build 7z archive"
@yarn --cwd=app run build-7z
build_pkgs: install_deps build_deb build_rpm build_snap build_appimage build_7z
#! UTILS
prepare-release:
@echo $(DEEZER_RELEASE) | egrep "$(VERSION_REGEX)" > /dev/null || \
(echo "$(DEEZER_RELEASE) is not a correct release version of v$(PKGVER)" && false)
@cat $(APPNAME).appdata.xml | egrep "$(PKGVER)" > /dev/null || \
(echo "$(APPNAME).appdata.xml should contain version $(DEEZER_RELEASE)" && false)
@desktop-file-validate $(APPNAME).desktop || \
(echo "Desktop file validation failed" && false)
@appstream-util validate-relax $(APPNAME).appdata.xml > /dev/null || \
(echo "Appstream file validation failed" && false)
release: prepare-release
@echo "Updating to $(DEEZER_RELEASE)..."
git tag -s $(DEEZER_RELEASE) -m ""
git push origin $(DEEZER_RELEASE)
git push
2021-10-13 22:58:10 +02:00
2021-10-09 20:26:33 +02:00
clean:
2022-02-01 00:05:16 +01:00
@rm -rf app flatpak node_modules source artifacts package-lock.json package.json