0bcd7f3e31405218783561704117a49584d0d15d
[dotfiles.git] / clean / .local / bin / install_clean.sh
1 #!/bin/bash
2 set -e
3
4 DISTRO="https://ftp.cs.ru.nl/Clean/builds/linux-x64/clean-bundle-complete-linux-x64-latest.tgz"
5 TAGS="https://gitlab.science.ru.nl/cloogle/cloogle-tags/-/jobs/artifacts/master/raw/cloogletags?job=build"
6 CLM="https://gitlab.science.ru.nl/mlubbers/clm/builds/artifacts/master/raw/clm?job=compile"
7 CLM1="https://gitlab.science.ru.nl/mlubbers/clm/builds/artifacts/master/raw/clm.1?job=compile"
8 CLEAN_HOME="${CLEAN_HOME:-/opt/clean}"
9
10 echo "Cleaning up the old distro"
11 rm -rf "$CLEAN_HOME"/*
12 echo "Downloading clean"
13 curl -sSL "$DISTRO" | tar -C "$CLEAN_HOME" --strip-components=1 -xz
14 echo "Replacing clm"
15 curl -sSLo "$CLEAN_HOME/bin/clm" "$CLM"
16 echo "Installing manpages"
17 mkdir -p ~/.local/man/man1
18 curl -sSLo ~/.local/man/man1/clm.1 "$CLM1"
19 echo "Downloading cloogletags"
20 curl -sSLo "$CLEAN_HOME"/bin/cloogletags "$TAGS"
21 chmod +x "$CLEAN_HOME"/bin/cloogletags
22 echo "Generating tags"
23 cloogletags -a -c -d "$CLEAN_HOME"/lib -o "$CLEAN_HOME"/lib/tags 2>/dev/null
24
25 echo "Patching StdEnv for binumap"
26 patch /opt/clean/lib/StdEnv/StdGeneric.dcl <<EOPATCH
27 --- StdGeneric.dcl 2018-12-17 02:43:55.000000000 +0100
28 +++ StdGeneric.dcl 2018-12-17 11:06:09.196234236 +0100
29 @@ -64,6 +64,16 @@
30 derive bimap FIELD
31 derive bimap (->)
32
33 +generic binumap a b | binumap b a :: a -> b
34 +derive binumap c
35 +derive binumap PAIR
36 +derive binumap EITHER
37 +derive binumap OBJECT
38 +derive binumap CONS
39 +derive binumap RECORD
40 +derive binumap FIELD
41 +derive binumap (->)
42 +
43 // HACK: dictionaries for all generics.
44 // It works since all generic classes have only one method and do not inherit
45 // from other classes
46 EOPATCH
47
48 patch /opt/clean/lib/StdEnv/StdGeneric.icl <<EOPATCH
49 --- StdGeneric.icl 2018-12-17 02:43:55.000000000 +0100
50 +++ StdGeneric.icl 2018-12-17 11:06:09.196234236 +0100
51 @@ -21,6 +21,23 @@
52
53 bimap{|(->)|} _ ba fr _ f = comp3 fr f ba
54
55 +binumap{|c|} x = x
56 +
57 +binumap{|PAIR|} fx _ fy _ (PAIR x y) = PAIR (fx x) (fy y)
58 +
59 +binumap{|EITHER|} fl _ fr _ (LEFT x) = LEFT (fl x)
60 +binumap{|EITHER|} fl _ fr _ (RIGHT x) = RIGHT (fr x)
61 +
62 +binumap{|CONS|} fx _ (CONS x) = CONS (fx x)
63 +
64 +binumap{|RECORD|} fx _ (RECORD x) = RECORD (fx x)
65 +
66 +binumap{|FIELD|} fx _ (FIELD x) = FIELD (fx x)
67 +
68 +binumap{|OBJECT|} fx _ (OBJECT x) = OBJECT (fx x)
69 +
70 +binumap{|(->)|} _ ba fr _ f = comp3 fr f ba
71 +
72 comp3 :: !(.a -> .b) u:(.c -> .a) !(.d -> .c) -> u:(.d -> .b)
73 comp3 f g h
74 | is_id f
75 EOPATCH
76
77 echo "Adding the iTasks-git environment"
78 patch /opt/clean/etc/IDEEnvs <<EOPATCH
79 --- IDEEnvs 2018-12-17 11:58:48.876039159 +0100
80 +++ IDEEnvs 2018-12-17 12:00:52.384066455 +0100
81 @@ -35,13 +35,44 @@
82 Path: {Application}/lib/StdEnv
83 Path: {Application}/lib/Dynamics
84 Path: {Application}/lib/TCPIP
85 + Path: {Application}/lib/Gast
86 Path: {Application}/lib/Platform
87 Path: {Application}/lib/Platform/Deprecated/Generics
88 + Path: {Application}/lib/Platform/Deprecated/ArgEnv
89 + Path: {Application}/lib/Platform/Deprecated/MersenneTwister
90 Path: {Application}/lib/Platform/Deprecated/StdLib
91 Path: {Application}/lib/Sapl
92 Path: {Application}/lib/GraphCopy
93 Path: {Application}/lib/iTasks
94 - EnvironmentCompiler: lib/exe/cocl::-dynamics -sapl
95 + EnvironmentCompiler: lib/exe/cocl:-h 500m -s 20m:-dynamics -sapl
96 + EnvironmentCodeGen: lib/exe/cg
97 + EnvironmentLinker: lib/exe/linker|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
98 + EnvironmentDynLink: lib/exe/linker
99 + EnvironmentVersion: 920
100 + EnvironmentRedirect: False
101 + EnvironmentCompileMethod: Pers
102 + EnvironmentProcessor: I386
103 + Environment64BitProcessor: True
104 + Environment
105 + EnvironmentName: iTasks-git
106 + EnvironmentPaths
107 + Path: {Application}/lib/StdEnv
108 + Path: {Application}/lib/Dynamics
109 + Path: {Application}/lib/TCPIP
110 + Path: {Application}/lib/Sapl
111 + Path: {Application}/lib/GraphCopy
112 + Path: {Application}/lib/Gast
113 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/Platform-x86
114 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Posix
115 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Linux
116 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Linux-64
117 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent
118 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/Generics
119 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/StdLib
120 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/ArgEnv
121 + Path: /home/mrl/projects/clean/clean-platform/src/libraries/OS-Independent/Deprecated/MersenneTwister
122 + Path: /home/mrl/projects/clean/iTasks-SDK/Libraries
123 + EnvironmentCompiler: lib/exe/cocl:-h 500m -s 20m:-dynamics -sapl
124 EnvironmentCodeGen: lib/exe/cg
125 EnvironmentLinker: lib/exe/linker|lib/exe/sapl-collector-linker|lib/exe/itasks-web-collector
126 EnvironmentDynLink: lib/exe/linker
127 EOPATCH