Skip to content

Doubao-powered voice input for Linux, Wayland and Omarchy

2.6 KB
Raw Blame
#!/usr/bin/make -f

# Minimal rules: install the source tree + supplementary files into
# the standard Debian package layout. We avoid dh-python / pybuild to
# keep the build environment dependency-free (we already verified
# the source runs under the system Python 3.13 with system-site
# packages).

%:
	dh $@

override_dh_auto_build:
	# No build step; we install pre-built sources.

override_dh_auto_install:
	# Install Python package into dist-packages
	python3 -m installer --destdir=debian/doubao-say \
	    --prefix=/usr --no-compile-bytecode dist/*.whl 2>/dev/null || \
	install -d debian/doubao-say/usr/lib/python3/dist-packages
	cp -r src/doubao_input debian/doubao-say/usr/lib/python3/dist-packages/
	# Strip __pycache__ from the installed tree (don't ship .pyc on
	# disk; Python will regenerate as needed, and shipping them makes
	# the .deb larger and version-mismatched).
	find debian/doubao-say/usr/lib/python3 -type d -name __pycache__ \
	    -exec rm -rf {} + 2>/dev/null || true
	find debian/doubao-say/usr/lib/python3 -name '*.pyc' -delete || true

	# Wrapper script (avoid make's per-line shell; use printf)
	install -d debian/doubao-say/usr/bin
	printf '%s\n' \
	    '#!/bin/sh' \
	    '# Wrapper for the doubao-say voice IME.' \
	    'exec /usr/bin/python3 -m doubao_input "$$@"' \
	    > debian/doubao-say/usr/bin/doubao-say
	chmod 0755 debian/doubao-say/usr/bin/doubao-say

	# Systemd user service
	install -d debian/doubao-say/usr/lib/systemd/user
	install -m 0644 debian/doubao-say.service \
	    debian/doubao-say/usr/lib/systemd/user/doubao-say.service

	# Desktop entry
	install -d debian/doubao-say/usr/share/applications
	install -m 0644 debian/doubao-say.desktop \
	    debian/doubao-say/usr/share/applications/doubao-say.desktop

	# App icon — hicolor theme (size 128 covers most uses including
	# GNOME shell, app grid, and our own Gtk.Image buttons).
	install -d debian/doubao-say/usr/share/icons/hicolor/128x128/apps
	install -m 0644 src/doubao_input/resources/logo-128.png \
	    debian/doubao-say/usr/share/icons/hicolor/128x128/apps/doubao-say.png
	install -d debian/doubao-say/usr/share/icons/hicolor/scalable/apps
	# Use the full-resolution PNG as the "scalable" placeholder; if a
	# proper SVG is ever produced it should replace this file.
	install -m 0644 src/doubao_input/resources/logo.png \
	    debian/doubao-say/usr/share/icons/hicolor/scalable/apps/doubao-say.png

	# Docs
	install -d debian/doubao-say/usr/share/doc/doubao-say
	install -m 0644 README.md LICENSE NOTICE \
	    debian/doubao-say/usr/share/doc/doubao-say/

override_dh_missing:
	dh_missing --fail-missing