# This is the source.sh script. It is executed by BPM in a temporary directory when compiling a source package # BPM Expects the source code to be extracted into the automatically created 'source' directory which can be accessed using $BPM_SOURCE # BPM Expects the output files to be present in the automatically created 'output' directory which can be accessed using $BPM_OUTPUT # The build function is executed in the source directory # This function is used to compile the source code build() { export CGO_CPPFLAGS="${CPPFLAGS}" export CGO_CFLAGS="${CFLAGS}" export CGO_CXXFLAGS="${CXXFLAGS}" export CGO_LDFLAGS="${LDFLAGS}" export GOFLAGS="-buildmode=pie -trimpath -ldflags=-linkmode=external -mod=readonly -modcacherw" python3 setup.py linux-package --update-check-interval=0 } # The package function is executed in the source directory # This function is used to move the compiled files into the output directory package_kitty() { cp -r linux-package "$BPM_OUTPUT"/usr # Install shell completions linux-package/bin/kitten __complete__ setup bash | install -Dm644 /dev/stdin "$BPM_OUTPUT"/usr/share/bash-completion/completions/kitty linux-package/bin/kitten __complete__ setup fish | install -Dm644 /dev/stdin "$BPM_OUTPUT"/usr/share/fish/vendor_completions.d/kitty.fish linux-package/bin/kitten __complete__ setup zsh | install -Dm644 /dev/stdin "$BPM_OUTPUT"/usr/share/zsh/site-functions/_kitty # Remove files rm -r "$BPM_OUTPUT"/usr/share/terminfo rm -r "$BPM_OUTPUT"/usr/lib/kitty/shell-integration # Install package license install -Dm644 "$BPM_SOURCE"/LICENSE "$BPM_OUTPUT"/usr/share/licenses/kitty/LICENSE } package_kitty-terminfo() { install -d "$BPM_OUTPUT"/usr/share/terminfo tic -x -o "$BPM_OUTPUT"/usr/share/terminfo terminfo/kitty.terminfo # Install package license install -d "$BPM_OUTPUT"/usr/share/licenses/ ln -sf kitty "$BPM_OUTPUT"/usr/share/licenses/kitty } package_kitty-shell-integration() { install -d "$BPM_OUTPUT"/usr/lib/kitty cp -r shell-integration "$BPM_OUTPUT"/usr/lib/kitty # Install package license install -d "$BPM_OUTPUT"/usr/share/licenses/ ln -sf kitty "$BPM_OUTPUT"/usr/share/licenses/kitty }