Skip to content

Commit

Permalink
Basic setup to build Picard AppImage with appimagecraft
Browse files Browse the repository at this point in the history
  • Loading branch information
phw committed Aug 17, 2023
0 parents commit cf4f2c6
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
*~
*.AppImage
*.AppImage.zsync
/build/
/source/
11 changes: 11 additions & 0 deletions AppRun
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

export PATH="$APPDIR/usr/bin/:$PATH"

# Prevent Qt to load plugins from system directories
unset QT_PLUGIN_PATH

# Set the original working dir as the working dir.
# Ensures relative path arguments are resolved as expected.
cd $OWD
"$APPDIR"/usr/conda/bin/python "$APPDIR"/usr/conda/bin/picard "$@"
15 changes: 15 additions & 0 deletions appimage.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
diff --git a/scripts/picard.in b/scripts/picard.in
index ab04f5546..fc53fdc7e 100644
--- a/scripts/picard.in
+++ b/scripts/picard.in
@@ -1,8 +1,9 @@
#!/usr/bin/env python3

try:
+ import os
from picard.tagger import main
- main('%(localedir)s', %(autoupdate)s)
+ main(os.path.join(os.environ.get('APPDIR', '/'), 'usr/conda/share/locale'), autoupdate=False)
except SystemExit:
raise # Just continue with a normal application exit
except: # noqa: E722,F722 # pylint: disable=bare-except
52 changes: 52 additions & 0 deletions appimagecraft.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
version: 1

project:
name: org.musicbrainz.Picard
# version: 2.9.1
version_command: cd "$PROJECT_ROOT/source" && python -c "import picard; print(picard.__version__)"

build:
null:

scripts:
post_build:
- | # Link AppStream metadata
mkdir -p "$BUILD_DIR"/AppDir/usr/share/metainfo/
cd "$BUILD_DIR"/AppDir/usr/share/metainfo/
ln -s ../../conda/share/metainfo/org.musicbrainz.Picard.appdata.xml .
- | # Fetch fpcalc
FPCALC_VERSION=1.5.1
FPCALC_PACKAGE=chromaprint-fpcalc-${FPCALC_VERSION}-linux-x86_64
cd "$BUILD_DIR"
curl -Lo chromaprint-fpcalc.tar.gz "https://github.com/acoustid/chromaprint/releases/download/v${FPCALC_VERSION}/${FPCALC_PACKAGE}.tar.gz"
tar xzf chromaprint-fpcalc.tar.gz
mv ${FPCALC_PACKAGE}/ chromaprint-fpcalc
- | # Build libdiscid
LIBDISCID_VERSION=0.6.4
LIBDISCID_PACKAGE=libdiscid-${LIBDISCID_VERSION}
cd "$BUILD_DIR"
curl -Lo libdiscid.tar.gz "https://github.com/metabrainz/libdiscid/releases/download/v${LIBDISCID_VERSION}/${LIBDISCID_PACKAGE}.tar.gz"
tar xzf libdiscid.tar.gz
mkdir ${LIBDISCID_PACKAGE}/build
cd ${LIBDISCID_PACKAGE}/build
cmake -DCMAKE_INSTALL_PREFIX=/usr/conda ..
make
make DESTDIR="$BUILD_DIR"/AppDir/ install
- | # Clean AppDir
rm -rf "$BUILD_DIR"/AppDir/usr/conda/include
appimage:
linuxdeploy:
plugins:
- conda
extra_args: |
--icon-file "$PROJECT_ROOT"/source/resources/images/256x256/org.musicbrainz.Picard.png \
--desktop-file "$PROJECT_ROOT"/source/org.musicbrainz.Picard.desktop \
--custom-apprun "$PROJECT_ROOT"/AppRun \
--executable "$BUILD_DIR"/chromaprint-fpcalc/fpcalc \
environment:
PIP_REQUIREMENTS: .
raw_environment:
- PIP_WORKDIR="$PROJECT_ROOT/source/"
- OUTPUT=MusicBrainz-Picard-"$VERSION"-"$ARCH".AppImage
- UPD_INFO="gh-releases-zsync|phw|picard-daily|continuous|MusicBrainz-Picard-*$ARCH.AppImage.zsync"
18 changes: 18 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/bin/sh

APPIMAGECRAFT_URL="https://github.com/TheAssassin/appimagecraft/releases/download/continuous/appimagecraft-x86_64.AppImage"
ROOT_DIR=$(dirname "$0")
BUILD_DIR="$ROOT_DIR/build/"
SOURCE_DIR="$ROOT_DIR/source/"

cd "$ROOT_DIR"

wget -q "$APPIMAGECRAFT_URL"
chmod +x appimagecraft-x86_64.AppImage

[ ! -d "$SOURCE_DIR" ] || rm -rf "$SOURCE_DIR"
git clone --depth 1 --branch master "https://github.com/metabrainz/picard.git" "$SOURCE_DIR"

mkdir -p "$BUILD_DIR"
rm -rf "$BUILD_DIR"/*
./appimagecraft-x86_64.AppImage -d "$BUILD_DIR"

0 comments on commit cf4f2c6

Please sign in to comment.