add makefile
This commit is contained in:
@@ -17,6 +17,7 @@ Supersonic.app
|
|||||||
Supersonic.AppDir/
|
Supersonic.AppDir/
|
||||||
appimagetool-x86_64.AppImage
|
appimagetool-x86_64.AppImage
|
||||||
tmp/
|
tmp/
|
||||||
|
build/
|
||||||
|
|
||||||
|
|
||||||
# Test binary, built with `go test -c`
|
# Test binary, built with `go test -c`
|
||||||
|
|||||||
@@ -19,6 +19,8 @@ To build Supersonic from source, first clone the Git repo or download the source
|
|||||||
### Build
|
### Build
|
||||||
* clone the repo, CD into the repo root, and run ``make build``
|
* clone the repo, CD into the repo root, and run ``make build``
|
||||||
* (note that the first build will take some time as it will download and build the UI library)
|
* (note that the first build will take some time as it will download and build the UI library)
|
||||||
|
* run ``make user-install`` to install for the current user (including a Wofi-compatible desktop entry), or ``sudo make install`` for a system-wide installation
|
||||||
|
* use ``make user-uninstall`` or ``sudo make uninstall`` to remove the corresponding installation
|
||||||
|
|
||||||
### Generate installable .tar.xz bundle
|
### Generate installable .tar.xz bundle
|
||||||
* install the ``fyne`` packaging tool ``go install fyne.io/fyne/v2/cmd/fyne@latest``
|
* install the ``fyne`` packaging tool ``go install fyne.io/fyne/v2/cmd/fyne@latest``
|
||||||
|
|||||||
@@ -1,5 +1,70 @@
|
|||||||
|
GO ?= go
|
||||||
|
PREFIX ?= /usr/local
|
||||||
|
DESTDIR ?=
|
||||||
|
BUILD_DIR ?= build
|
||||||
|
APP_ID := io.github.dweymouth.supersonic
|
||||||
|
BINARY_NAME := supersonic-desktop
|
||||||
|
BINARY := $(BUILD_DIR)/$(BINARY_NAME)
|
||||||
|
|
||||||
|
BINDIR = $(DESTDIR)$(PREFIX)/bin
|
||||||
|
DATADIR = $(DESTDIR)$(PREFIX)/share
|
||||||
|
APPLICATIONSDIR = $(DATADIR)/applications
|
||||||
|
ICONDIR = $(DATADIR)/icons/hicolor
|
||||||
|
METAINFODIR = $(DATADIR)/metainfo
|
||||||
|
|
||||||
|
.PHONY: all build clean install install-bin install-desktop install-icons install-metainfo \
|
||||||
|
user-install uninstall user-uninstall refresh-desktop-cache lint \
|
||||||
|
package_macos bundledeps_macos_homebrew bundledeps_macos_macports \
|
||||||
|
bundledeps_macos_highsierra zip_macos package_windows package_linux
|
||||||
|
|
||||||
|
all: build
|
||||||
|
|
||||||
build:
|
build:
|
||||||
go build -tags migrated_fynedo
|
mkdir -p "$(BUILD_DIR)"
|
||||||
|
$(GO) build -tags migrated_fynedo -trimpath -o "$(BINARY)" .
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f "$(BINARY)"
|
||||||
|
rmdir "$(BUILD_DIR)" 2>/dev/null || true
|
||||||
|
|
||||||
|
install: build install-bin install-desktop install-icons install-metainfo refresh-desktop-cache
|
||||||
|
|
||||||
|
install-bin:
|
||||||
|
install -Dm755 "$(BINARY)" "$(BINDIR)/$(BINARY_NAME)"
|
||||||
|
|
||||||
|
install-desktop:
|
||||||
|
desktop-file-validate res/supersonic-desktop.desktop
|
||||||
|
install -Dm644 res/supersonic-desktop.desktop "$(APPLICATIONSDIR)/$(APP_ID).desktop"
|
||||||
|
|
||||||
|
install-icons:
|
||||||
|
install -Dm644 res/appicon-128.png "$(ICONDIR)/128x128/apps/$(APP_ID).png"
|
||||||
|
install -Dm644 res/appicon-256.png "$(ICONDIR)/256x256/apps/$(APP_ID).png"
|
||||||
|
install -Dm644 res/appicon-512.png "$(ICONDIR)/512x512/apps/$(APP_ID).png"
|
||||||
|
|
||||||
|
install-metainfo:
|
||||||
|
install -Dm644 res/io.github.dweymouth.supersonic.appdata.xml "$(METAINFODIR)/$(APP_ID).metainfo.xml"
|
||||||
|
|
||||||
|
# Installs into ~/.local, which Wofi and other XDG launchers scan without root.
|
||||||
|
user-install: PREFIX := $(HOME)/.local
|
||||||
|
user-install: install
|
||||||
|
|
||||||
|
uninstall:
|
||||||
|
rm -f "$(BINDIR)/$(BINARY_NAME)"
|
||||||
|
rm -f "$(APPLICATIONSDIR)/$(APP_ID).desktop"
|
||||||
|
rm -f "$(ICONDIR)/128x128/apps/$(APP_ID).png"
|
||||||
|
rm -f "$(ICONDIR)/256x256/apps/$(APP_ID).png"
|
||||||
|
rm -f "$(ICONDIR)/512x512/apps/$(APP_ID).png"
|
||||||
|
rm -f "$(METAINFODIR)/$(APP_ID).metainfo.xml"
|
||||||
|
$(MAKE) refresh-desktop-cache PREFIX="$(PREFIX)" DESTDIR="$(DESTDIR)"
|
||||||
|
|
||||||
|
user-uninstall: PREFIX := $(HOME)/.local
|
||||||
|
user-uninstall: uninstall
|
||||||
|
|
||||||
|
refresh-desktop-cache:
|
||||||
|
@if [ -z "$(DESTDIR)" ]; then \
|
||||||
|
command -v update-desktop-database >/dev/null 2>&1 && update-desktop-database "$(PREFIX)/share/applications" || true; \
|
||||||
|
command -v gtk-update-icon-cache >/dev/null 2>&1 && gtk-update-icon-cache -q -t -f "$(PREFIX)/share/icons/hicolor" || true; \
|
||||||
|
fi
|
||||||
|
|
||||||
# dylibbundler doesn't seem to pick up on the Python framework dependency,
|
# dylibbundler doesn't seem to pick up on the Python framework dependency,
|
||||||
# so the last 3 cmds move it over manually. This is a bit fragile though
|
# so the last 3 cmds move it over manually. This is a bit fragile though
|
||||||
@@ -30,6 +95,5 @@ package_windows:
|
|||||||
package_linux:
|
package_linux:
|
||||||
fyne package -os linux -tags migrated_fynedo
|
fyne package -os linux -tags migrated_fynedo
|
||||||
|
|
||||||
.PHONY: lint
|
|
||||||
lint:
|
lint:
|
||||||
golangci-lint run
|
golangci-lint run
|
||||||
|
|||||||
@@ -5,9 +5,8 @@ Name=Supersonic
|
|||||||
GenericName=Music Player
|
GenericName=Music Player
|
||||||
Comment=A lightweight cross-platform desktop client for Subsonic music servers
|
Comment=A lightweight cross-platform desktop client for Subsonic music servers
|
||||||
Keywords=music;audio;player;subsonic;navidrome;streaming;
|
Keywords=music;audio;player;subsonic;navidrome;streaming;
|
||||||
Path=/usr/bin
|
|
||||||
Exec=supersonic-desktop
|
Exec=supersonic-desktop
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Icon=supersonic-desktop
|
Icon=io.github.dweymouth.supersonic
|
||||||
StartupWMClass=Supersonic
|
StartupWMClass=Supersonic
|
||||||
Categories=Audio;AudioVideo;Music;Player;
|
Categories=Audio;AudioVideo;Music;Player;
|
||||||
|
|||||||
Reference in New Issue
Block a user