Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

Commit

Permalink
v0.4.2 - first release using alacritty-debian
Browse files Browse the repository at this point in the history
  • Loading branch information
barnumbirr committed Apr 17, 2020
1 parent 2f03341 commit 32f0f2d
Show file tree
Hide file tree
Showing 15 changed files with 300 additions and 1 deletion.
53 changes: 53 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -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
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -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.

50 changes: 49 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
37 changes: 37 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -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
5 changes: 5 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
alacritty (0.4.2-1) unstable; urgency=medium

* Version 0.4.2

-- Martin Simon <[email protected]> Mon, 13 Apr 2020 00:00:00 +0000
1 change: 1 addition & 0 deletions debian/compat
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
11
31 changes: 31 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Source: alacritty
Section: x11
Priority: optional
Maintainer: Martin Simon <[email protected]>
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.
26 changes: 26 additions & 0 deletions debian/copyright
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
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.
6 changes: 6 additions & 0 deletions debian/postinst
Original file line number Diff line number Diff line change
@@ -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

4 changes: 4 additions & 0 deletions debian/prerm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
set -e

update-alternatives --remove x-terminal-emulator /usr/bin/alacritty
21 changes: 21 additions & 0 deletions debian/rules
Original file line number Diff line number Diff line change
@@ -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"
1 change: 1 addition & 0 deletions debian/source/format
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.0 (quilt)
3 changes: 3 additions & 0 deletions debian/watch
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
version=4
opts=filenamemangle=s/.+\/v?(\d\S+)\.tar\.gz/<project>-$1\.tar\.gz/ \
https://github.com/alacritty/alacritty/tags .*/v?(\d\S+)\.tar\.gz
49 changes: 49 additions & 0 deletions entrypoint.sh
Original file line number Diff line number Diff line change
@@ -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
Empty file added target/.gitkeep
Empty file.

0 comments on commit 32f0f2d

Please sign in to comment.