Skip to content

Commit

Permalink
[Scripts] Add activate.sh
Browse files Browse the repository at this point in the history
Signed-off-by: Wojtek Porczyk <[email protected]>
  • Loading branch information
woju authored and Dmitrii Kuvaiskii committed Sep 3, 2024
1 parent 649a8f5 commit a20d5b8
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
11 changes: 11 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -311,3 +311,14 @@ if enable_libgomp
endif

run_target('clang-format', command: [meson_clang_format_prog])

conf = configuration_data()
conf.set('PATH', get_option('prefix') / get_option('bindir'))
conf.set('LD_LIBRARY_PATH', get_option('prefix') / get_option('libdir'))
conf.set('PKG_CONFIG_PATH', get_option('prefix') / get_option('libdir') / 'pkgconfig')
conf.set('PYTHONPATH', python3_platlib)
configure_file(
input: 'scripts/activate.sh.in',
output: 'activate.sh',
configuration: conf,
)
24 changes: 24 additions & 0 deletions scripts/activate.sh.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/sh

set -xe

case "@PATH@" in
@*)
echo This script is intended for running from builddir after being templated by Meson. >&2
exit 1
;;
esac

pathmunge() {
eval "var=\$$1"
case "$var" in *"$2"*) return;; esac
eval "$1=\$2\${$1:+:\$$1}"
eval "export $1"
}

pathmunge PATH "@PATH@"
pathmunge LD_LIBRARY_PATH "@LD_LIBRARY_PATH@"
pathmunge PKG_CONFIG_PATH "@PKG_CONFIG_PATH@"
pathmunge PYTHONPATH "@PYTHONPATH@"

exec $SHELL

0 comments on commit a20d5b8

Please sign in to comment.