-
Notifications
You must be signed in to change notification settings - Fork 2
/
champ
executable file
·78 lines (64 loc) · 2.31 KB
/
champ
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
66
67
68
69
70
71
72
73
74
75
76
77
78
#!/bin/bash
#
# CHAMP (CHerednik Algebra Magma Package)
# Copyright (C) 2013–2021 Ulrich Thiel
# Licensed under GNU GPLv3, see COPYING.
# thiel@mathematik.uni-kl.de
# https://ulthiel.com/math
#
################################################################################
# Set CHAMP directory
################################################################################
CHAMP_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
export CHAMP_DIR=$CHAMP_DIR
################################################################################
# Set OS Type
################################################################################
export CHAMP_OS="Unix"
################################################################################
# Find Magma (first user defined path, then environment path, then trying
# some directories, then give up).
################################################################################
MAGMA_EXEC=""
if [ ! -z ${CHAMP_MAGMA_DIR+x} ]; then
export MAGMA_DIR=$CHAMP_MAGMA_DIR
export MAGMA_EXEC=$MAGMA_DIR/magma
fi
if [ "$MAGMA_EXEC" == "" ]; then
if command -v "magma" >/dev/null 2>&1; then
MAGMA_EXEC="magma"
fi
fi
if [ "$MAGMA_EXEC" == "" ]; then
if [ -f "/Applications/Magma/magma" ]; then
MAGMA_EXEC="/Applications/Magma/magma"
fi
fi
if [ "$MAGMA_EXEC" == "" ]; then
if [ -f "/usr/local/bin/magma" ]; then
MAGMA_EXEC="/usr/local/bin/magma"
fi
fi
if [ "$MAGMA_EXEC" == "" ]; then
if [ -f "/usr/local/magma/magma" ]; then
MAGMA_EXEC="/usr/local/magma/magma"
fi
fi
if [ "$MAGMA_EXEC" == "" ]; then
if [ -f "/usr/bin/magma" ]; then
MAGMA_EXEC="/usr/bin/magma"
fi
fi
if [ "$MAGMA_EXEC" == "" ]; then
echo -e "\033[0;31mError: cannot find Magma."
echo -e "Either add Magma installation directory in the Config file or in the PATH environment variable.\033[0m"
exit 1
fi
################################################################################
# Now, start Magma with the Startup script from the Config directory
################################################################################
# Add the CHAMP spec file to the Magma startup spec variable
export MAGMA_USER_SPEC=$CHAMP_DIR/Source/CHAMP/CHAMP.s.m:$MAGMA_USER_SPEC
# Set the CHAMP startup file as Magma startup file
export MAGMA_STARTUP_FILE=$CHAMP_DIR/Source/CHAMP/CHAMP.m
$MAGMA_EXEC -b "$@"