Update to v5.30.160-1, better Makefile

This commit is contained in:
aunetx 2022-02-01 00:05:16 +01:00
parent 6e509f731d
commit 2fd6d7b4f5
2 changed files with 83 additions and 58 deletions

140
Makefile
View File

@ -1,104 +1,128 @@
# Maintainer: Aurélien Hamy <aunetx@yandex.com> # Maintainer: Aurélien Hamy <aunetx@yandex.com>
APPNAME = dev.aunetx.deezer APPNAME = dev.aunetx.deezer
PKGVER = 5.30.150 PKGVER = 5.30.160
BASE_URL = https://www.deezer.com/desktop/download/artifact/win32/x86/$(PKGVER) BASE_URL = https://www.deezer.com/desktop/download/artifact/win32/x86/$(PKGVER)
GPG_KEY_ID = 5A7D3B06F15FB60238941027EB3A799E7EE716EB GPG_KEY_ID = 5A7D3B06F15FB60238941027EB3A799E7EE716EB
VERSION_REGEX = ^v$(PKGVER)-[0-9]{1,}$$
install_build_deps: install_build_deps:
npm install --engine-strict asar @npm install --engine-strict asar
npm install prettier @npm install prettier
prepare: install_build_deps prepare: clean install_build_deps
mkdir -p source @mkdir -p source
# Download installer
wget -nv -c $(BASE_URL) -O source/deezer-setup-$(PKGVER).exe
# Extract app archive from installer
cd source && 7z x -so deezer-setup-$(PKGVER).exe '$$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
node_modules/asar/bin/asar.js extract source/resources/app.asar app
# Prettier the sources to patch successfully @echo "Download installer"
node_modules/prettier/bin-prettier.js --write "app/build/*.js" @wget -nv -c $(BASE_URL) -O source/deezer-setup-$(PKGVER).exe
# Apply patches from ./patches, default ones: @echo "Extract app archive from installer"
# Hide to tray when closing (https://github.com/SibrenVasse/deezer/issues/4) @cd source && 7z x -so deezer-setup-$(PKGVER).exe '$$PLUGINSDIR/app-32.7z' > app-32.7z
# Start in tray cli option (https://github.com/SibrenVasse/deezer/pull/12)
@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)"
$(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);) $(foreach p, $(wildcard ./patches/*), patch -p1 -dapp < $(p);)
# Append `package-append.json` to the `package.json` of the app @echo "Append `package-append.json` to the `package.json` of the app"
# Adds electron, elecron-builder dependencies, and build directives @echo "Adds electron, elecron-builder dependencies, and build directives"
head -n -1 app/package.json > tmp.txt && mv tmp.txt app/package.json @head -n -1 app/package.json > tmp.txt && mv tmp.txt app/package.json
cat package-append.json | tee -a app/package.json @cat package-append.json | tee -a app/package.json
#! FLATPAK #! FLATPAK
prepare_flatpak: prepare prepare_flatpak: prepare
# Generate yarn sources (without installing them) @echo "Generate yarn sources (without installing them)"
yarn --cwd=app install --mode update-lockfile @yarn --cwd=app install --mode update-lockfile
# Package the sources to use them in flatpak-builder offline
mkdir -p flatpak @echo "Package the sources to use them in flatpak-builder offline"
./flatpak-node-generator.py yarn app/yarn.lock -o flatpak/generated-sources.json --electron-node-headers --xdg-layout @mkdir -p flatpak
@./flatpak-node-generator.py yarn app/yarn.lock -o flatpak/generated-sources.json --electron-node-headers --xdg-layout
build_flatpak: prepare_flatpak build_flatpak: prepare_flatpak
# Build the flatpak image @echo "Build the flatpak image"
flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder flatpak/build $(APPNAME).yml @flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder flatpak/build $(APPNAME).yml
export_flatpak: prepare_flatpak export_flatpak: prepare_flatpak
# Build the flatpak package and export it to the repo @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-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 @flatpak build-update-repo --generate-static-deltas --gpg-sign=$(GPG_KEY_ID) docs
flatpak_bundle: build_flatpak flatpak_bundle: build_flatpak
# Create a flatpak bundle @echo "Create a flatpak bundle"
flatpak build-bundle --gpg-sign=$(GPG_KEY_ID) --state-dir=flatpak/flatpak-builder docs deezer.flatpak $(APPNAME) @flatpak build-bundle --gpg-sign=$(GPG_KEY_ID) --state-dir=flatpak/flatpak-builder docs deezer.flatpak $(APPNAME)
install_flatpak: prepare_flatpak install_flatpak: prepare_flatpak
# Build and install locally the flatpak image @echo "Build and install locally the flatpak image"
flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder --user --install flatpak/build $(APPNAME).yml @flatpak-builder --force-clean --state-dir=flatpak/flatpak-builder --user --install flatpak/build $(APPNAME).yml
run_flatpak: run_flatpak:
flatpak run $(APPNAME) @flatpak run $(APPNAME)
#! PACKAGES #! PACKAGES
install_deps: prepare install_deps: prepare
# Install yarn dependencies to pack them later @echo "Install yarn dependencies to pack them later"
yarn --cwd=app install @yarn --cwd=app install
build_pkgs: install_deps
# Build everything
yarn --cwd=app run build-rpm
yarn --cwd=app run build-deb
yarn --cwd=app run build-snap
yarn --cwd=app run build-appimage
yarn --cwd=app run build-7z
build_deb: build_deb:
# Build deb package @echo "Build deb package"
yarn --cwd=app run build-deb @yarn --cwd=app run build-deb
build_rpm: build_rpm:
# Build rpm package @echo "Build rpm package"
yarn --cwd=app run build-rpm @yarn --cwd=app run build-rpm
build_snap: build_snap:
# Build deb package @echo "Build snap package"
yarn --cwd=app run build-snap @yarn --cwd=app run build-snap
build_appimage: build_appimage:
# Build the AppImage package @echo "Build AppImage binary"
yarn --cwd=app run build-appimage @yarn --cwd=app run build-appimage
build_7z: build_7z:
# Build 7z archive @echo "Build 7z archive"
yarn --cwd=app run build-7z @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
clean: clean:
rm -rf app flatpak node_modules source artifacts package-lock.json package.json @rm -rf app flatpak node_modules source artifacts package-lock.json package.json

View File

@ -20,6 +20,7 @@
<kudo>HiDpiIcon</kudo> <kudo>HiDpiIcon</kudo>
</kudos> </kudos>
<releases> <releases>
<release version="5.30.160-1" date="2022-2-1" />
<release version="5.30.150-1" date="2022-1-30" /> <release version="5.30.150-1" date="2022-1-30" />
<release version="5.30.130-1" date="2021-12-28" /> <release version="5.30.130-1" date="2021-12-28" />
<release version="5.30.120-1" date="2021-12-9" /> <release version="5.30.120-1" date="2021-12-9" />