From 8af56a5a3460f08f91d941fe8b72ee35530c36d9 Mon Sep 17 00:00:00 2001 From: Ian Douglas Scott Date: Fri, 20 Jan 2023 15:25:00 -0800 Subject: [PATCH] Initial debian packaging --- Makefile | 49 ++++++++++++++++++++++++++++++++++++++++++++ debian/changelog | 5 +++++ debian/control | 20 ++++++++++++++++++ debian/rules | 24 ++++++++++++++++++++++ debian/source/format | 1 + 5 files changed, 99 insertions(+) create mode 100644 Makefile create mode 100644 debian/changelog create mode 100644 debian/control create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..6d995a3 --- /dev/null +++ b/Makefile @@ -0,0 +1,49 @@ +prefix ?= /usr/local +bindir = $(prefix)/bin +libdir = $(prefix)/lib +includedir = $(prefix)/include +datarootdir = $(prefix)/share +datadir = $(datarootdir) + +TARGET = debug +DEBUG ?= 0 +ifeq ($(DEBUG),0) + TARGET = release + ARGS += --release +endif + +VENDOR ?= 0 +ifneq ($(VENDOR),0) + ARGS += --frozen +endif + +BIN = cosmic-workspaces + +all: $(BIN) + +clean: + rm -rf target + +distclean: clean + rm -rf .cargo vendor vendor.tar + +$(BIN): Cargo.toml Cargo.lock src/main.rs vendor-check + cargo build $(ARGS) --bin ${BIN} + +install: + install -Dm0755 target/$(TARGET)/$(BIN) $(DESTDIR)$(bindir)/$(BIN) + +## Cargo Vendoring + +vendor: + rm .cargo -rf + mkdir -p .cargo + cargo vendor | head -n -1 > .cargo/config + echo 'directory = "vendor"' >> .cargo/config + tar cf vendor.tar vendor + rm -rf vendor + +vendor-check: +ifeq ($(VENDOR),1) + rm vendor -rf && tar xf vendor.tar +endif diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..f2efbfc --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +cosmic-workspaces (0.1.0) jammy; urgency=medium + + * Initial release. + + -- Ian Scott Fri, 20 Jan 2023 15:21:34 -0800 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..e0ffcba --- /dev/null +++ b/debian/control @@ -0,0 +1,20 @@ +Source: cosmic-workspaces +Section: admin +Priority: optional +Maintainer: System76 +Build-Depends: + debhelper (>= 11), + debhelper-compat (= 11), + cargo, + libudev-dev, + libxkbcommon-dev, + pkg-config, +Standards-Version: 4.3.0 +Homepage: https://github.com/pop-os/cosmic-workspaces-epoch + +Package: cosmic-workspaces +Architecture: amd64 arm64 +Depends: + ${misc:Depends}, + ${shlibs:Depends} +Description: Cosmic workspaces diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..6267d72 --- /dev/null +++ b/debian/rules @@ -0,0 +1,24 @@ +#!/usr/bin/make -f + +CLEAN ?= 1 +VENDOR ?= 1 + +%: + dh $@ + +override_dh_auto_clean: +ifeq ($(CLEAN),1) + make clean +endif +ifeq ($(VENDOR),1) + if ! ischroot; then \ + make vendor; \ + fi +endif + +override_dh_auto_build: + env CARGO_HOME="$$(pwd)/target/cargo" \ + make all VENDOR=$(VENDOR) prefix=/usr + +override_dh_auto_install: + dh_auto_install -- prefix=/usr diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..89ae9db --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (native)