From df81c148711ee9b8716466f531c7b1f13769b88f Mon Sep 17 00:00:00 2001 From: "Brian J. Tarricone" Date: Wed, 11 May 2022 22:37:38 -0700 Subject: [PATCH] Add debian packaging files This doesn't quite work, since the debuild stuff refuses to see the rustup-installed cargo/rustc, which is required for our build. --- .gitignore | 7 +++++++ Dockerfile | 30 ++++++++++++++++++++++++++++++ Makefile | 38 +++++++++++++++++++++++++++++--------- debian/changelog | 5 +++++ debian/compat | 1 + debian/control | 27 +++++++++++++++++++++++++++ debian/copyright | 26 ++++++++++++++++++++++++++ debian/rules | 26 ++++++++++++++++++++++++++ debian/source/format | 1 + 9 files changed, 152 insertions(+), 9 deletions(-) create mode 100644 Dockerfile create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100755 debian/rules create mode 100644 debian/source/format diff --git a/.gitignore b/.gitignore index 81e2005..1ea3cb0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,9 @@ target/ .tags + +debian/.debhelper/ +debian/bscreensaver.debhelper.log +debian/bscreensaver.substvars +debian/bscreensaver/ +debian/debhelper-build-stamp +debian/files diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d0492d0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM debian:bullseye-slim + +ARG RUST_VERSION=1.60 + +WORKDIR /bscreensaver + +RUN apt-get update && \ + apt-get -y full-upgrade && \ + apt-get -y install curl devscripts && \ + mkdir -p /build + +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly + +# Do this first to get our build deps cached. +COPY debian ./debian +RUN apt-get build-dep -y . + +# Copy only what we need, to avoid bloating the image with e.g. the target/ dir +COPY async-xcb ./async-xcb +COPY command ./command +COPY dbus-service ./dbus-service +COPY dialog-gtk3 ./dialog-gtk3 +COPY locker ./locker +COPY settings ./settings/ +COPY systemd ./systemd +COPY util ./util +COPY xcb-xembed ./xcb-xembed +COPY bscreensaver.toml.example Cargo.* Makefile ./ + +CMD bash diff --git a/Makefile b/Makefile index c76b2da..331dce4 100644 --- a/Makefile +++ b/Makefile @@ -1,15 +1,14 @@ -.PHONY: all release dev manpages install clean uninstall run run-dialog +.PHONY: all release dev manpages install deb-pkg clean uninstall run run-dialog DESTDIR ?= = PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin LIBEXECDIR ?= $(PREFIX)/libexec -SYSCONFDIR ?= $(PREFIX)/etc DATADIR ?= $(PREFIX)/share MANDIR ?= $(DATADIR)/man APPLICATIONS_DIR = $(DATADIR)/applications -CONFIG_DIR = $(SYSCONFDIR)/xdg/bscreensaver +DOC_DIR = $(DATADIR)/doc/bscreensaver HELPER_DIR = $(LIBEXECDIR)/bscreensaver HELPERS := \ @@ -54,7 +53,7 @@ endif DEV_LOG_LEVEL = debug -all: release manpages +all: release manpages $(RELEASE_OUT)/bscreensaver-settings.desktop release: $(RELEASE_TARGETS) @@ -62,12 +61,12 @@ dev: $(DEV_TARGETS) manpages: $(RELEASE_MANPAGES) -install: release manpages - $(INSTALL) -m 0755 -d $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(CONFIG_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1) +install: all + $(INSTALL) -m 0755 -d $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(DOC_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1) $(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(BINARIES)) $(DESTDIR)$(BINDIR) $(INSTALL) -m 0755 $(addprefix $(RELEASE_OUT)/,$(HELPERS)) $(DESTDIR)$(HELPER_DIR) - $(INSTALL) -m 0644 bscreensaver.toml.example $(DESTDIR)$(CONFIG_DIR) - $(INSTALL) -m 0644 settings/bscreensaver-settings.desktop $(DESTDIR)$(APPLICATIONS_DIR) + $(INSTALL) -m 0644 bscreensaver.toml.example $(DESTDIR)$(DOC_DIR) + $(INSTALL) -m 0644 $(RELEASE_OUT)/bscreensaver-settings.desktop $(DESTDIR)$(APPLICATIONS_DIR) $(INSTALL) -m 0644 $(RELEASE_MANPAGES) $(DESTDIR)$(MANDIR)/man1 $(DEV_TARGETS): $(SOURCES) @@ -77,18 +76,39 @@ $(RELEASE_TARGETS): $(SOURCES) HELPER_DIR=$(HELPER_DIR) cargo $(RUST_RELEASE_CHANNEL_ARG) build $(FEATURES_ARGS) --release $(RELEASE_OUT)/%.1.gz: $(RELEASE_OUT)/%.1 + mkdir -p $(dir $@) gzip -c -k $< > $@ $(RELEASE_OUT)/%.1: $(RELEASE_TARGETS) + mkdir -p $(dir $@) $(HELP2MAN) --no-info $(subst .1,,$@) > $@ +$(RELEASE_OUT)/bscreensaver-settings.desktop: settings/bscreensaver-settings.desktop.in + mkdir -p $(dir $@) + sed -e 's:@BINDIR@:$(BINDIR):g' $< > $@ + +deb-pkg: + @[ "$(RELEASE_VERSION)" ] || { echo "RELEASE_VERSION not set >&2"; exit 1; } + docker build -t bscreensaver-build:latest . + sudo rm -rf docker-out + mkdir docker-out + docker run --rm -v $(shell pwd)/docker-out:/build:rw bscreensaver-build:latest bash -c '\ + cp -a /bscreensaver /build/bscreensaver-$(RELEASE_VERSION) && \ + cd /build && \ + tar cvzf bscreensaver_$(RELEASE_VERSION).orig.tar.gz bscreensaver-$(RELEASE_VERSION) && \ + cd bscreensaver-$(RELEASE_VERSION) && \ + debuild --prepend-path=/root/.cargo/bin -uc -us && \ + rm -rf /build/bscreensaver' + clean: cargo $(RUST_RELEASE_CHANNEL_ARG) clean uninstall: rm -f $(addprefix $(DESTDIR)$(BINDIR),$(BINARIES)) $(addprefix $(HELPER_DIR)/,$(HELPERS))) || true rm -f $(addprefix $(DESTDIR)$(MANDIR)/man1/,$(MANPAGES)) - rmdir -p $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(APPLICATIONS_DIR) $(MANDIR)/man1) || true + rm -f $(DESTDIR)$(APPLICATIONS_DIR)/bscreensaver-settings.desktop + rm -f $(DESTDIR)$(DOC_DIR)/bscreensaver.toml.example + rmdir -p $(addprefix $(DESTDIR),$(BINDIR) $(HELPER_DIR) $(APPLICATIONS_DIR) $(DOC_DIR) $(MANDIR)/man1) || true run: $(DEV_TARGETS) BSCREENSAVER_LOCAL_DEV=1 \ diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..949f7a1 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +bscreensaver (0.1.0-1) UNRELEASED; urgency=medium + + * Initial release. + + -- Brian Tarricone Thu, 05 May 2022 01:22:57 -0700 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b1bd38b --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +13 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..df7ad75 --- /dev/null +++ b/debian/control @@ -0,0 +1,27 @@ +Source: bscreensaver +Maintainer: Brian Tarricone +Section: x11 +Priority: optional +Standards-Version: 3.9.2 +Build-Depends: + debhelper (>= 13), + pkg-config, + libxcb-randr0-dev, + libxcb-xfixes0-dev, + libxcb1-dev, + libgtk-3-dev, + libpam0g-dev, + cargo, + rustc, + help2man + +Package: bscreensaver +Architecture: any +Depends: ${shlibs:Depends}, ${misc:Depends} +Description: secure X11 screen locker + BScreensaver is a privilege-separated screen locker that attempts to + be as secure as possible, meaning that a crash one one of its + non-critical components will not cause the screen to unlock. + . + It is fairly barebones so far, and only supports blanking the screen. + There is a single unlock dialog implementation that uses GTK3. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..64d3da0 --- /dev/null +++ b/debian/copyright @@ -0,0 +1,26 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: bscreensaver +Upstream-Contact: Brian Tarricone +Source: https://github.com/kelnos/bscreensaver + +Files: * +Copyright: 2022 Brian Tarricone +License: GPL-3 + +License: GPL-3 + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + . + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + . + You should have received a copy of the GNU General Public License + along with this program. If not, see . + . + On Debian systems, the full text of the GNU General Public + License version 3 can be found in the file + '/usr/share/common-licenses/GPL-3'. diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..fad658d --- /dev/null +++ b/debian/rules @@ -0,0 +1,26 @@ +#!/usr/bin/make -f + + +RUST_RELEASE_CHANNEL = nightly + +MAKE_ARGS = \ + RUST_RELEASE_CHANNEL=$(RUST_RELEASE_CHANNEL) \ + PREFIX=/usr \ + SYSCONFDIR=/etc \ + DESTDIR=debian/bscreensaver + +%: + dh $@ + +override_dh_auto_clean: + @echo "HOME=$$HOME" + @echo "PATH=$$PATH" + ls $$HOME/.rustup + ls $$HOME/.cargo + dh_auto_clean -- $(MAKE_ARGS) + +override_dh_auto_build: + dh_auto_build -- $(MAKE_ARGS) + +override_dh_auto_install: + dh_auto_install -- $(MAKE_ARGS) diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 0000000..163aaf8 --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt)