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.
This commit is contained in:
Brian Tarricone 2022-05-11 22:37:38 -07:00
parent 712467f433
commit df81c14871
9 changed files with 152 additions and 9 deletions

7
.gitignore vendored
View File

@ -1,2 +1,9 @@
target/
.tags
debian/.debhelper/
debian/bscreensaver.debhelper.log
debian/bscreensaver.substvars
debian/bscreensaver/
debian/debhelper-build-stamp
debian/files

30
Dockerfile Normal file
View File

@ -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

View File

@ -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 \

5
debian/changelog vendored Normal file
View File

@ -0,0 +1,5 @@
bscreensaver (0.1.0-1) UNRELEASED; urgency=medium
* Initial release.
-- Brian Tarricone <brian@tarricone.org> Thu, 05 May 2022 01:22:57 -0700

1
debian/compat vendored Normal file
View File

@ -0,0 +1 @@
13

27
debian/control vendored Normal file
View File

@ -0,0 +1,27 @@
Source: bscreensaver
Maintainer: Brian Tarricone <brian@tarricone.org>
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.

26
debian/copyright vendored Normal file
View File

@ -0,0 +1,26 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: bscreensaver
Upstream-Contact: Brian Tarricone <brian@tarricone.org>
Source: https://github.com/kelnos/bscreensaver
Files: *
Copyright: 2022 Brian Tarricone <brian@tarricone.org>
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 <http://www.gnu.org/licenses/>.
.
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'.

26
debian/rules vendored Executable file
View File

@ -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)

1
debian/source/format vendored Normal file
View File

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