File: swipl-activate

package info (click to toggle)
swi-prolog 9.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 82,408 kB
  • sloc: ansic: 387,503; perl: 359,326; cpp: 6,613; lisp: 6,247; java: 5,540; sh: 3,147; javascript: 2,668; python: 1,900; ruby: 1,594; yacc: 845; makefile: 428; xml: 317; sed: 12; sql: 6
file content (65 lines) | stat: -rwxr-xr-x 1,563 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash
#
# Simple script to activate swipl from the current cmake build directory
# by linking it from $HOME/bin. May  be   called  as below to activate a
# version that was installed  from  the   current  directory  using  the
# command below:
#
#     swipl-activate --installed
#
# This can be combined by setting the following in ~/.bashrc, which will
# install each configuration into a different directory.
#
#     export SWIPL_INSTALL_PREFIX=$HOME/cmake/swipl/@builddir@

swipl=
swiplwin=
swiplld=

if [ "$1" = "--installed" ]; then

  prefix=$(grep CMAKE_INSTALL_PREFIX CMakeCache.txt | sed 's/.*=//')
  if [ -x $prefix/bin/swipl ]; then
    swipl=$prefix/bin/swipl
    if [ -x $prefix/bin/swipl-win ]; then
      swiplwin=$prefix/bin/swipl-win
    fi
    if [ -x $prefix/bin/swipl-ld ]; then
      swiplld=$prefix/bin/swipl-ld
    fi
  else
    echo "Cannot find swipl in $prefix/bin"
    exit 1
  fi

else

  if [ -x src/swipl ]; then
    swipl=$(pwd)/src/swipl
    if [ -x src/swipl-ld ]; then
      swiplld=$(pwd)/src/swipl-ld
    fi
    if [ -x packages/swipl-win/swipl-win ]; then
      swiplwin=$(pwd)/packages/swipl-win/swipl-win
    fi
  else
    echo "Please run from Cmake build directory"
    exit 1
  fi

fi

echo "Activating $swipl"

rm -f $HOME/bin/swipl
(cd $HOME/bin && ln -s $swipl)
if [ ! -z "$swiplld" ]; then
  echo "       and $swiplld"
  rm -f $HOME/bin/swipl-ld
  (cd $HOME/bin && ln -s $swiplld)
fi
if [ ! -z "$swiplwin" ]; then
  echo "       and $swiplwin"
  rm -f $HOME/bin/swipl-win
  (cd $HOME/bin && ln -s $swiplwin)
fi