From 32f0f2dfab85bee41aae4fee66380461e6bcde3d Mon Sep 17 00:00:00 2001 From: Martin Simon Date: Fri, 17 Apr 2020 21:50:20 +0200 Subject: [PATCH] v0.4.2 - first release using alacritty-debian --- .github/workflows/main.yml | 53 ++++++++++++++++++++++++++++++++++++++ LICENSE | 14 ++++++++++ README.md | 50 ++++++++++++++++++++++++++++++++++- build.sh | 37 ++++++++++++++++++++++++++ debian/changelog | 5 ++++ debian/compat | 1 + debian/control | 31 ++++++++++++++++++++++ debian/copyright | 26 +++++++++++++++++++ debian/postinst | 6 +++++ debian/prerm | 4 +++ debian/rules | 21 +++++++++++++++ debian/source/format | 1 + debian/watch | 3 +++ entrypoint.sh | 49 +++++++++++++++++++++++++++++++++++ target/.gitkeep | 0 15 files changed, 300 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml create mode 100644 LICENSE create mode 100755 build.sh create mode 100644 debian/changelog create mode 100644 debian/compat create mode 100644 debian/control create mode 100644 debian/copyright create mode 100644 debian/postinst create mode 100644 debian/prerm create mode 100755 debian/rules create mode 100644 debian/source/format create mode 100644 debian/watch create mode 100644 entrypoint.sh create mode 100644 target/.gitkeep diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..8e18bca --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,53 @@ +name: Build alacritty Debian packages + +on: + push: + tags: + - "*" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Build packages + run: | + set -xe + mkdir -p assets + ./build.sh -i debian:buster-slim + rename.ul .deb _debian_buster.deb target/alacritty_*.deb + mv -n target/alacritty_*.deb assets/ + + ./build.sh -i debian:testing-slim + rename.ul .deb _debian_testing.deb target/alacritty_*.deb + mv -n target/alacritty_*.deb assets/ + + ./build.sh -i debian:unstable-slim + rename.ul .deb _debian_unstable.deb target/alacritty_*.deb + mv -n target/alacritty_*.deb assets/ + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + draft: false + prerelease: false + - name: Upload packages + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + ID: ${{ steps.create_release.outputs.id }} + run: | + set -xe + for asset in assets/* + do + UPLOAD_URL="https://uploads.github.com/repos/$GITHUB_REPOSITORY/releases/$ID/assets" + curl \ + -X POST \ + -H "Authorization: token $GITHUB_TOKEN" \ + -H "Content-Type: application/octet-stream" \ + --data-binary @"$asset" \ + "${UPLOAD_URL}?name=$(basename $asset)" + done diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..394a953 --- /dev/null +++ b/LICENSE @@ -0,0 +1,14 @@ +Copyright 2020 Martin Simon + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + diff --git a/README.md b/README.md index 535c69a..abe5088 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,50 @@ # alacritty-debian -Debian packages for alacritty. + +This repository contains the source to build a Debian package for [alacritty](https://github.com/alacritty/alacritty). + +## Usage + +If you have [Docker](https://www.docker.com/) installed locally, just run the following: + +```bash +user@hostname$ ./build.sh +``` +By default this will build alacritty 0.4.2 on Debian Buster. + +If you want to customize the build at runtime, use the following: + +```bash +user@hostname$ ./build.sh -i debian:unstable-slim -v 0.3.3 +``` +Don't forget to update `debian/changelog` so your package is generated with the correct version. + +## Release + +To publish a new package version to Github, follow these steps: + * update the `VERSION` variable in `build.sh` + * add a new entry in `debian/changelog` + * create a new tag with the Debian package version + +## License + +``` +Copyright 2020 Martin Simon + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + +``` + + +## References + +* [ayosec/polybar-debian](https://github.com/ayosec/polybar-debian) diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..0f9bece --- /dev/null +++ b/build.sh @@ -0,0 +1,37 @@ +#!/bin/bash + +set -eu + +IMAGE="debian:buster-slim" +TARGET="$(dirname "$0" | xargs realpath)" +VERSION="v0.4.2" + +while getopts "v:i:h" opt +do + case "$opt" in + v) + VERSION="$OPTARG" + ;; + i) + IMAGE="$OPTARG" + ;; + h) + echo "Usage: $0 [-i image] [-v version]" + exit 0 + ;; + *) + exit 1 + ;; + esac +done + +main() { + docker run --rm --name alacritty-build-$$ \ + --volume "$TARGET:/target" \ + --workdir /target \ + --env "VERSION=$VERSION" \ + --user root "$IMAGE" \ + sh entrypoint.sh +} + +main diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 0000000..4a7feef --- /dev/null +++ b/debian/changelog @@ -0,0 +1,5 @@ +alacritty (0.4.2-1) unstable; urgency=medium + + * Version 0.4.2 + + -- Martin Simon Mon, 13 Apr 2020 00:00:00 +0000 diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..b4de394 --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +11 diff --git a/debian/control b/debian/control new file mode 100644 index 0000000..72edf65 --- /dev/null +++ b/debian/control @@ -0,0 +1,31 @@ +Source: alacritty +Section: x11 +Priority: optional +Maintainer: Martin Simon +Build-Depends: + cargo:native, + debhelper (>= 11), + help2man, + libfreetype6-dev, + libfontconfig1-dev, + libxcb1-dev, + libxcb-render0-dev, + libxcb-shape0-dev, + libxcb-xfixes0-dev, + rustc:native, + python3, +Standards-Version: 4.3.0 +Homepage: https://github.com/alacritty/alacritty + +Package: alacritty +Architecture: amd64 +Depends: + ${misc:Depends}, + ${shlibs:Depends}, +Recommends: + xclip +Provides: + x-terminal-emulator +Description: GPU-accelerated terminal emulator + Alacritty is the fastest terminal emulator in existence. Using the GPU for + rendering enables optimizations that simply aren't possible without it. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 0000000..f79491d --- /dev/null +++ b/debian/copyright @@ -0,0 +1,26 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: alacritty +Source: https://github.com/alacritty/alacritty + +Files: * +Copyright: 2016 Joe Wilm, The Alacritty Project Contributors +License: Apache-2.0 + +Files: debian/* +Copyright: 2020 Martin Simon +License: Apache-2.0 + +License: Apache-2.0 + Copyright 2016 Joe Wilm, The Alacritty Project Contributors + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..8f218ea --- /dev/null +++ b/debian/postinst @@ -0,0 +1,6 @@ +#!/bin/sh +set -e + +update-alternatives --install /usr/bin/x-terminal-emulator x-terminal-emulator /usr/bin/alacritty 20 \ + --slave /usr/share/man/man1/x-terminal-emulator.1.gz x-terminal-emulator.1.gz /usr/local/share/man/man1/alacritty.1.gz + diff --git a/debian/prerm b/debian/prerm new file mode 100644 index 0000000..dbbe491 --- /dev/null +++ b/debian/prerm @@ -0,0 +1,4 @@ +#!/bin/sh +set -e + +update-alternatives --remove x-terminal-emulator /usr/bin/alacritty diff --git a/debian/rules b/debian/rules new file mode 100755 index 0000000..fa9eee1 --- /dev/null +++ b/debian/rules @@ -0,0 +1,21 @@ +#!/usr/bin/make -f + +%: + dh $@ + +override_dh_auto_clean: + cargo clean + +override_dh_auto_build: + cargo build --release + +override_dh_auto_install: + mkdir -p debian/alacritty/usr/share/man/man1/ + help2man "target/release/alacritty" | gzip > "debian/alacritty/usr/share/man/man1/alacritty.1.gz" + install -Dm04755 "target/release/alacritty" "debian/alacritty/usr/bin/alacritty" + install -Dm0644 "extra/completions/alacritty.bash" "debian/alacritty/usr/share/bash-completion/completions/alacritty" + install -Dm0644 "extra/completions/alacritty.fish" "debian/alacritty/usr/share/fish/completions/alacritty.fish" + install -Dm0644 "extra/completions/_alacritty" "debian/alacritty/usr/share/vendor-completions/_alacritty" + install -Dm0644 "extra/logo/alacritty-term.svg" "debian/alacritty/usr/share/pixmaps/com.alacritty.Alacritty.svg" + install -Dm0644 "extra/linux/Alacritty.desktop" "debian/alacritty/usr/share/applications/com.alacritty.Alacritty.desktop" + sed -i 's/Icon=Alacritty/Icon=com.alacritty.Alacritty/g' "debian/alacritty/usr/share/applications/com.alacritty.Alacritty.desktop" 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) diff --git a/debian/watch b/debian/watch new file mode 100644 index 0000000..b075545 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/-$1\.tar\.gz/ \ + https://github.com/alacritty/alacritty/tags .*/v?(\d\S+)\.tar\.gz diff --git a/entrypoint.sh b/entrypoint.sh new file mode 100644 index 0000000..bd74fd5 --- /dev/null +++ b/entrypoint.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +set -xeu + +BRANCH="$VERSION" +DEBIAN_FRONTEND=noninteractive +DEB_BUILD_OPTIONS=parallel=$(nproc) +OS_VERSION=$(sed 's/\..*//' /etc/debian_version) +TARGET="$PWD" + +export DEBIAN_FRONTEND DEB_BUILD_OPTIONS + +dependencies() { + apt update && apt install -y devscripts equivs git + if [ "$OS_VERSION" = 10 ]; then + apt install -y curl + curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + . ~/.cargo/env + fi +} + +get_sources() { + cd "$(mktemp -d)" + git clone -b "$BRANCH" https://github.com/alacritty/alacritty.git alacritty + cd alacritty +} + +build() { + cp -a "$TARGET/debian" . + yes | mk-build-deps --install + dpkg-source --before-build . + debian/rules build + debian/rules binary +} + +copy() { + TARGET_UID="$(stat --printf %u "$TARGET")" + TARGET_GID="$(stat --printf %g "$TARGET")" + install -o "$TARGET_UID" -g "$TARGET_GID" -t "$TARGET/target" ../*.deb +} + +main() { + dependencies + get_sources + build + copy +} + +main diff --git a/target/.gitkeep b/target/.gitkeep new file mode 100644 index 0000000..e69de29