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