#!/bin/bash
# dev/package/env - package development enviroment support

set -e

lib_load 'dev/package/load'


######
# Package development environment

package_env_bash() {
	local deactivate="${PKG}_env_deactivate"
	local path="$EXEC_PREFIX/bin"
	local PATH="${PATH/$path:/}"
	local PS1=$(bash -i -c 'echo $PS1')
	local PS2=$(bash -i -c 'echo $PS2')

	cat <<ENV
# Use this function to restore the old PATH and prompts
$deactivate() {
	export PATH='$PATH'
	export PS1='$PS1 '
	export PS2='$PS2 '
	unalias mcgrep mcsed mcinstall mcenv
	unset -f mcrepair mctest
	echo "$PKG environment deactivated.  Thank you, come again!"
}
# Add the installed scripts to the PATH and set the prompts
export PATH='$path:$PATH'
export PS1='($PKG) $PS1 '
export PS2='($PKG) $PS2 '

# Useful aliases:
alias mcgrep='d12 grep'
alias mcsed='d12 sed'
alias mcinstall='make -s install'
alias mcenv='eval "\$(make env)"'
alias mcdebug='mctest env debug=true'

mcrepair() { cp -av "libs/\$1.in" "install/share/$PKG/\$1.sh"; }
mctest() { mcinstall && "\$@"; }

echo "$PKG environment is now active.  Run '$deactivate' to deactivate it."

# If you can see this comment, trying running the command again, as the
# argument to 'eval' (e.g. 'eval "\$(make env)"' or 'eval "\$(i7 env)"').
ENV
}

package_env_python() { error "not implemented"; }

View the Developer Guide Index

View the Reference Manual Index


Generated on Thu May 4 18:59:44 PDT 2017 by mcsh i7 v0.19.0.