fix: per-arch linux packages

This commit is contained in:
edde746
2026-02-08 19:13:45 +01:00
parent ce017da78b
commit d313ccbc84
5 changed files with 74 additions and 136 deletions
+4
View File
@@ -1,4 +1,8 @@
#!/bin/bash
# Ensure binaries are executable
chmod +x /usr/bin/plezy
chmod +x /opt/plezy/plezy
# Update icon cache
if command -v gtk-update-icon-cache &> /dev/null; then
gtk-update-icon-cache -f -t /usr/share/icons/hicolor || true
+21 -36
View File
@@ -8,11 +8,9 @@ from pathlib import Path
# Paths
SCRIPT_DIR = Path(__file__).parent.resolve()
PROJECT_ROOT = SCRIPT_DIR.parent.parent
BUILD_DIR = Path(os.environ["BUILD_DIR"]) if "BUILD_DIR" in os.environ else PROJECT_ROOT / "build/linux/x64/release/bundle"
OUTPUT_DIR = Path(os.environ.get("OUTPUT_DIR", PROJECT_ROOT))
# Build directories: use env vars if set, otherwise fall back to default Flutter paths
X64_BUILD_DIR = Path(os.environ["X64_BUILD_DIR"]) if "X64_BUILD_DIR" in os.environ else PROJECT_ROOT / "build/linux/x64/release/bundle"
ARM64_BUILD_DIR = Path(os.environ["ARM64_BUILD_DIR"]) if "ARM64_BUILD_DIR" in os.environ else PROJECT_ROOT / "build/linux/arm64/release/bundle"
ARCH_SUFFIX = os.environ.get("ARCH_SUFFIX", "x64")
# Package metadata
METADATA = {
@@ -27,11 +25,16 @@ METADATA = {
# Icon sizes to generate
ICON_SIZES = [16, 32, 48, 64, 128, 256, 512]
# Architecture mappings per package format
ARCH_MAP = {
"x64": {"deb": "amd64", "rpm": "x86_64", "pacman": "x86_64"},
"arm64": {"deb": "arm64", "rpm": "aarch64", "pacman": "aarch64"},
}
# Distro-specific configuration
DISTROS = {
"deb": {
"type": "deb",
"arch": "all",
"category": "video",
"ext": "deb",
"compression": ["--deb-compression", "xz", "--deb-priority", "optional"],
@@ -45,7 +48,6 @@ DISTROS = {
},
"rpm": {
"type": "rpm",
"arch": "noarch",
"category": "Multimedia",
"ext": "rpm",
"compression": ["--rpm-compression", "xzmt"],
@@ -59,7 +61,6 @@ DISTROS = {
},
"pacman": {
"type": "pacman",
"arch": "any",
"category": None,
"ext": "pkg.tar.zst",
"compression": ["--pacman-compression", "zstd"],
@@ -106,18 +107,11 @@ def generate_icons():
def get_file_mappings() -> list[str]:
"""Get file mappings for fpm."""
mappings = []
# Map each available architecture bundle
if X64_BUILD_DIR.exists():
mappings.append(f"{X64_BUILD_DIR}/=/opt/plezy/x64/")
if ARM64_BUILD_DIR.exists():
mappings.append(f"{ARM64_BUILD_DIR}/=/opt/plezy/arm64/")
mappings.extend([
mappings = [
f"{BUILD_DIR}/=/opt/plezy/",
f"{SCRIPT_DIR}/com.edde746.plezy.desktop=/usr/share/applications/com.edde746.plezy.desktop",
f"{SCRIPT_DIR}/plezy.sh=/usr/bin/plezy",
])
]
for size in ICON_SIZES:
mappings.append(
@@ -130,9 +124,10 @@ def get_file_mappings() -> list[str]:
def build_package(distro: str, version: str):
"""Build a package for the specified distro."""
config = DISTROS[distro]
output_file = OUTPUT_DIR / f"{METADATA['name']}-linux.{config['ext']}"
arch = ARCH_MAP[ARCH_SUFFIX][distro]
output_file = OUTPUT_DIR / f"{METADATA['name']}-linux-{ARCH_SUFFIX}.{config['ext']}"
print(f"Building .{config['ext']} package...")
print(f"Building .{config['ext']} package ({arch})...")
cmd = [
"fpm",
@@ -146,7 +141,7 @@ def build_package(distro: str, version: str):
"--maintainer", METADATA["maintainer"],
"--url", METADATA["url"],
"--description", METADATA["description"],
"--architecture", config["arch"],
"--architecture", arch,
]
if config["category"]:
@@ -170,24 +165,14 @@ def build_package(distro: str, version: str):
def main():
# Verify at least one build exists
has_x64 = X64_BUILD_DIR.exists()
has_arm64 = ARM64_BUILD_DIR.exists()
if not has_x64 and not has_arm64:
print(f"Error: No build directories found")
print(f" x64: {X64_BUILD_DIR}")
print(f" arm64: {ARM64_BUILD_DIR}")
print("Please run 'flutter build linux --release' first or set X64_BUILD_DIR/ARM64_BUILD_DIR")
# Verify build exists
if not BUILD_DIR.exists():
print(f"Error: Build directory not found at {BUILD_DIR}")
print("Please run 'flutter build linux --release' first or set BUILD_DIR")
exit(1)
if has_x64:
print(f"Found x64 build: {X64_BUILD_DIR}")
if has_arm64:
print(f"Found arm64 build: {ARM64_BUILD_DIR}")
version = get_version()
print(f"Building packages for {METADATA['name']} version {version}")
print(f"Building {ARCH_SUFFIX} packages for {METADATA['name']} version {version}")
# Make scripts executable
for script in ["plezy.sh", "after-install.sh", "after-remove.sh"]:
@@ -201,7 +186,7 @@ def main():
build_package(distro, version)
print("\nAll packages built successfully!")
for f in OUTPUT_DIR.glob(f"{METADATA['name']}-linux.*"):
for f in sorted(OUTPUT_DIR.glob(f"{METADATA['name']}-linux-{ARCH_SUFFIX}.*")):
print(f" {f}")
+1 -1
View File
@@ -2,7 +2,7 @@
Type=Application
Name=Plezy
Comment=A modern Plex client for desktop and mobile
Exec=/opt/plezy/plezy
Exec=plezy
Icon=plezy
Terminal=false
Categories=AudioVideo;Video;Player;
+2 -6
View File
@@ -1,7 +1,3 @@
#!/bin/bash
ARCH=$(uname -m)
case "$ARCH" in
x86_64) cd /opt/plezy/x64 && exec ./plezy "$@" ;;
aarch64) cd /opt/plezy/arm64 && exec ./plezy "$@" ;;
*) echo "Unsupported architecture: $ARCH" >&2; exit 1 ;;
esac
cd /opt/plezy
exec ./plezy "$@"