Add debian packaging

This commit is contained in:
Jeremy Soller 2023-10-27 14:59:41 -06:00
parent 7d4d25ef85
commit c0d2f235e4
No known key found for this signature in database
GPG key ID: DCFCA852D3906975
9 changed files with 133 additions and 2 deletions

9
.gitignore vendored
View file

@ -1 +1,8 @@
/target
/.cargo/
/debian/*debhelper*
/debian/cosmic-greeter.substvars
/debian/cosmic-greeter/
/debian/files
/target/
/vendor.tar
/vendor/

5
debian/changelog vendored Normal file
View file

@ -0,0 +1,5 @@
cosmic-edit (0.1.0) jammy; urgency=medium
* Initial release.
-- Jeremy Soller <jeremy@system76.com> Tue, 03 Oct 2023 07:37:28 -0600

19
debian/control vendored Normal file
View file

@ -0,0 +1,19 @@
Source: cosmic-edit
Section: admin
Priority: optional
Maintainer: Jeremy Soller <jeremy@system76.com>
Build-Depends:
debhelper-compat (=13),
just (>= 1.13.0),
libclang-dev,
libwayland-dev,
libxkbcommon-dev,
pkg-config,
rust-all,
Standards-Version: 4.6.2
Homepage: https://github.com/pop-os/cosmic-edit
Package: cosmic-edit
Architecture: amd64 arm64
Depends: ${misc:Depends}, ${shlibs:Depends}
Description: Cosmic Text Editor

7
debian/copyright vendored Normal file
View file

@ -0,0 +1,7 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: cosmic-edit
Upstream-Contact: Jeremy Soller <jeremy@system76.com>
Source: https://github.com/pop-os/cosmic-edit
Files: *
Copyright: System76 <info@system76.com>
License: GPL-3.0

22
debian/rules vendored Executable file
View file

@ -0,0 +1,22 @@
#!/usr/bin/make -f
export DESTDIR = debian/cosmic-edit
export VENDOR ?= 1
%:
dh $@
override_dh_auto_clean:
if ! ischroot && test "${VENDOR}" = "1"; then \
mkdir -p .cargo; \
cargo vendor | head -n -1 > .cargo/config; \
echo 'directory = "vendor"' >> .cargo/config; \
tar pcf vendor.tar vendor; \
rm -rf vendor; \
fi
override_dh_auto_build:
just build-vendored
override_dh_auto_install:
just rootdir=$(DESTDIR) install

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (native)

4
debian/source/options vendored Normal file
View file

@ -0,0 +1,4 @@
tar-ignore=.github
tar-ignore=.vscode
tar-ignore=vendor
tar-ignore=target

66
justfile Normal file
View file

@ -0,0 +1,66 @@
name := 'cosmic-edit'
export APPID := 'com.system76.CosmicEdit'
rootdir := ''
prefix := '/usr'
base-dir := absolute_path(clean(rootdir / prefix))
export INSTALL_DIR := base-dir / 'share'
bin-src := 'target' / 'release' / name
bin-dst := base-dir / 'bin' / name
# Default recipe which runs `just build-release`
default: build-release
# Runs `cargo clean`
clean:
cargo clean
# `cargo clean` and removes vendored dependencies
clean-dist: clean
rm -rf .cargo vendor vendor.tar
# Compiles with debug profile
build-debug *args:
cargo build {{args}}
# Compiles with release profile
build-release *args: (build-debug '--release' args)
# Compiles release profile with vendored dependencies
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
# Runs a clippy check
check *args:
cargo clippy --all-features {{args}} -- -W clippy::pedantic
# Runs a clippy check with JSON message format
check-json: (check '--message-format=json')
# Run with debug logs
run *args:
env RUST_LOG=debug RUST_BACKTRACE=full cargo run --release {{args}}
# Installs files
install:
install -Dm0755 {{bin-src}} {{bin-dst}}
# Uninstalls installed files
uninstall:
rm {{bin-dst}}
# Vendor dependencies locally
vendor:
mkdir -p .cargo
cargo vendor --sync Cargo.toml \
| head -n -1 > .cargo/config
echo 'directory = "vendor"' >> .cargo/config
tar pcf vendor.tar vendor
rm -rf vendor
# Extracts vendored dependencies
vendor-extract:
rm -rf vendor
tar pxf vendor.tar

View file

@ -269,7 +269,7 @@ impl cosmic::Application for App {
type Message = Message;
/// The unique application ID to supply to the window manager.
const APP_ID: &'static str = "com.system76.CosmicTextEditor";
const APP_ID: &'static str = "com.system76.CosmicEdit";
fn core(&self) -> &Core {
&self.core