depot/pkgs/applications/editors/emacs/build-support/wrapper.sh
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

53 lines
1.4 KiB
Bash

#!@bash@
IFS=:
newLoadPath=()
newNativeLoadPath=()
addedNewLoadPath=
addedNewNativeLoadPath=
if [[ -n $EMACSLOADPATH ]]
then
while read -rd: entry
do
if [[ -z $entry && -z $addedNewLoadPath ]]
then
newLoadPath+=(@wrapperSiteLisp@)
addedNewLoadPath=1
fi
newLoadPath+=("$entry")
done <<< "$EMACSLOADPATH:"
else
newLoadPath+=(@wrapperSiteLisp@)
newLoadPath+=("")
fi
# NOTE: Even though we treat EMACSNATIVELOADPATH like EMACSLOADPATH in
# this wrapper, empty elements in EMACSNATIVELOADPATH have no special
# meaning for Emacs. Only non-empty elements in EMACSNATIVELOADPATH
# will be prepended to native-comp-eln-load-path.
# https://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/startup.el?id=3685387e609753293c4518be75e77c659c3b2d8d#n599
if [[ -n $EMACSNATIVELOADPATH ]]
then
while read -rd: entry
do
if [[ -z $entry && -z $addedNewNativeLoadPath ]]
then
newNativeLoadPath+=(@wrapperSiteLispNative@)
addedNewNativeLoadPath=1
fi
newNativeLoadPath+=("$entry")
done <<< "$EMACSNATIVELOADPATH:"
else
newNativeLoadPath+=(@wrapperSiteLispNative@)
newNativeLoadPath+=("")
fi
export EMACSLOADPATH="${newLoadPath[*]}"
export emacsWithPackages_siteLisp=@wrapperSiteLisp@
export EMACSNATIVELOADPATH="${newNativeLoadPath[*]}"
export emacsWithPackages_siteLispNative=@wrapperSiteLispNative@
exec @prog@ "$@"