cd "${SOURCE_DIRECTORY}/src" &&
find . | cpio --pass-through --make-directories --unconditional --verbose \
              "${INSTALL_ROOT}/usr/lib/crystal/" &&

cd "${SOURCE_DIRECTORY}" &&
install -D "${SOURCE_DIRECTORY}/.build/crystal" "${INSTALL_ROOT}/usr/bin/crystal" &&

if is_depends_enabled $SPELL bash-completion; then
  install -D "etc/completion.bash" "${INSTALL_ROOT}/usr/share/bash-completion/completions/crystal"
fi &&

if is_depends_enabled $SPELL zsh; then
  install -D "etc/completion.zsh" "${INSTALL_ROOT}/usr/share/zsh/site-functions/_crystal"
fi &&

if is_depends_enabled $SPELL fish; then
  install -D "etc/completion.fish" "${INSTALL_ROOT}/usr/share/fish/vendor_completions.d/crystal.fish"
fi &&

if is_depends_enabled $SPELL man; then
  install -D "man/crystal.1" "${INSTALL_ROOT}/usr/share/man/man1/crystal.1"
fi &&

if [[ $SAMPLES == "y" ]]; then
  cd "${SOURCE_DIRECTORY}/samples" &&
  find . | cpio --pass-through --make-directories --unconditional --verbose \
                "${INSTALL_ROOT}/usr/share/doc/samples/"
fi
