You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

68 lines
1.9 KiB
Bash

# -*- mode: sh; -*-
# Thanks <https://github.com/direnv/direnv/issues/73#issuecomment-152284914>
export_function()
{
local name=$1
local alias_dir=$PWD/.direnv/aliases
mkdir -p "$alias_dir"
PATH_add "$alias_dir"
local target="$alias_dir/$name"
if declare -f "$name" >/dev/null; then
echo "#!$SHELL" > "$target"
declare -f "$name" >> "$target" 2>/dev/null
# Notice that we add shell variables to the function trigger.
echo "$name \$*" >> "$target"
chmod +x "$target"
fi
}
use_guix()
{
# Recreate a garbage collector root.
gcroots="$HOME/.config/guix/gcroots"
mkdir -p "$gcroots"
gcroot="$gcroots/guix"
if [ -L "$gcroot" ]
then
rm -v "$gcroot"
fi
# Miscellaneous packages.
ENVIRONMENTS=(
weechat # Debug runs
)
# Environment packages.
PACKAGES=(
autoconf # Deps with autoreconf
autoconf-archive # Deps with m4 tooling
automake # Deps with automake
libtool # Deps with libtool
make # Makefile and deps with makefiles
cmake # Deps with cmake
gcc-toolchain # Compilation
pkg-config # Deps configuration and configuration of deps deps
patchelf # Fix linkage (guix)
bear # Generate compile_commands.json for language servers
universal-ctags # Generate tags (make tags)
weechat # Weechat includes
libxml2 # Dep (libxml2)
libstrophe # Dep (strophe)
libgcrypt # Dep (gcrypt)
libsignal-protocol-c # Dep (libsignal)
rnp # Dep (rnpgp)
)
# Thanks <https://lists.gnu.org/archive/html/guix-devel/2016-09/msg00859.html>
eval "$(guix environment --search-paths --root="$gcroot" ${ENVIRONMENTS[@]} --ad-hoc ${PACKAGES[@]} "$@")"
export CC=gcc
}
use guix \
--with-debug-info=weechat\
--with-debug-info=libstrophe\
--with-debug-info=libsignal-protocol-c\
--with-debug-info=rnp\
clang:extra gdb