Last active
January 7, 2023 02:50
-
-
Save abuGit/ce60ce8c44281454eef4696be03b12dd to your computer and use it in GitHub Desktop.
alacritty - build/make debian package
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# | |
# builds alacritty debian package | |
# Copyright © 2023 Andreas Buslehner | |
# | |
# LICENSE-MIT | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the "Software"), | |
# to deal in the Software without restriction, including without limitation | |
# the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
# and/or sell copies of the Software, and to permit persons to whom the | |
# Software is furnished to do so, subject to the following conditions: | |
# The above copyright notice and this permission notice shall be included | |
# in all copies or substantial portions of the Software. | |
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, | |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES | |
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. | |
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, | |
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE | |
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | |
DEB_SEARCH_STRING="\[package.metadata.deb\]" | |
# Check if ./alacritty/Cargo.toml file exists | |
if [[ ! -f ./alacritty/Cargo.toml ]]; then | |
echo -e "No ./alacritty/Cargo.toml file exists!\n" && exit 1 | |
fi | |
# Modify ./alacritty/Cargo.toml file | |
if grep "$DEB_SEARCH_STRING" ./alacritty/Cargo.toml > /dev/null ; then | |
echo -e "Cargo.toml already includes debian package instructions.\n" | |
else | |
# make a backup to restore Cargo.toml file after build | |
cp ./alacritty/Cargo.toml{,_backup} | |
# insert debian instructions | |
cat << EOF >> ./alacritty/Cargo.toml | |
[package.metadata.deb] | |
name = "alacritty" | |
maintainer = "Christian Duerr <[email protected]>, Joe Wilm <[email protected]>" | |
depends = "$auto" | |
section = "admin" | |
priority = "optional" | |
assets = [ | |
["../target/release/alacritty", "usr/local/bin/", "755"], | |
["../extra/linux/Alacritty.desktop", "usr/share/applications/", "644"], | |
["../extra/logo/alacritty-term.svg", "usr/share/pixmaps/Alacritty.svg","664"], | |
["../extra/completions/alacritty.bash", "usr/share/bash-completions/completions/", "644"], | |
["../extra/completions/_alacritty", "usr/share/zsh/vendor-completions/", "644"], | |
["../extra/completions/alacritty.fish", "usr/share/fish/completions/", "664"], | |
["../extra/*.man", "usr/share/man/man1/", "644"], | |
["../extra/alacritty.man", "usr/share/man/man1/alacritty.1", "644"], | |
["../extra/alacritty-msg.man", "usr/share/man/man1/alacritty-msg.1", "644"], | |
["../README.md", "usr/share/doc/alacritty/", "644"], | |
["../alacritty.yml", "usr/share/doc/alacritty/", "644"], | |
["../LICENSE-APACHE", "usr/share/doc/alacritty/", "664"] | |
] | |
extended-description = """\ | |
Alacritty is a modern terminal emulator that comes with sensible defaults, but | |
allows for extensive configuration. By integrating with other | |
applications, rather than reimplementing their functionality, it manages to | |
provide a flexible set of features with high performan | |
The supported platforms currently consist of BSD, Linux, macOS and Windows. | |
The software is considered to be at a beta level of readiness; there are | |
a few missing features and bugs to be fixed, but it is already used by many as | |
a daily driver.""" | |
EOF | |
fi | |
# Check if rustup is available | |
if ! (command -v rustup) &> /dev/null | |
then | |
echo -e "rustup command not found!\n" | |
echo -e "Install from: https://rustup.rs \n\n" | |
exit 1 | |
fi | |
# Check for cargo deb | |
CARGO_DEB_VERSION=$(cargo deb --version) &> /dev/null | |
if [[ "$CARGO_DEB_VERSION" = "" ]]; then | |
echo -e "\"cargo deb\" package not found!\n" | |
echo -e "Install with: \n" | |
echo -e "cargo install cargo-deb\n\n" | |
exit 1 | |
else | |
echo -e "\ncargo deb found: version $CARGO_DEB_VERSION\n" | |
fi | |
# Install dependencies | |
sudo apt-get install cmake pkg-config libfreetype6-dev libfontconfig1-dev \ | |
libxcb-xfixes0-dev libxkbcommon-dev python3 | |
# Start building the deb package | |
echo -e "Start building debian package" | |
cd ./alacritty || exit 1 | |
cargo deb --strip || exit 1 | |
cd .. || exit 1 | |
# Restore Cargo.toml file | |
mv ./alacritty/Cargo.toml{_backup,} | |
chmod 777 ./target/debian/*.deb | |
# To make sure alacritty works correctly terminfo must be eventually updated | |
infocmp alacritty &> /dev/null || ( | |
echo -e "\nUpdating terminfo...\n" | |
sudo tic -xe alacritty,alacritty-direct extra/alacritty.info | |
) | |
# Install instructions | |
echo -e "\nYou may now install alacritty with following command:\n" | |
echo -e "sudo apt install ./target/debian/alacritty*.deb\n" | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Build Alacritty Debian Package
These bash script builds a debian package. Copy the script to the root of the alacritty git and run it with
Afterwards you can install it with apt, apt-get or dpkg. E.g:
sudo dpkg -i ./target/debian/alacritty*.deb