-
Notifications
You must be signed in to change notification settings - Fork 1
/
nim.bash
81 lines (65 loc) · 2.45 KB
/
nim.bash
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
79
80
81
nV=1.4
InV=$nV.2
add_package -package nim \
https://nim-lang.org/download/nim-$InV.tar.xz
# The settings
pack_set -s $MAKE_PARALLEL -s $IS_MODULE
pack_set -module-requirement pcre
pack_set -module-requirement openssl
pack_set -install-query $(pack_get -prefix)/bin/nim
# Create building nim
pack_cmd "sh build.sh"
pack_cmd "bin/nim c koch"
pack_cmd "./koch docs -d:release"
pack_cmd "./koch boot -d:release"
pack_cmd "./koch tools -d:release"
pack_cmd "./koch geninstall $(pack_get -prefix)"
pack_cmd "sed -i -e '/case/,/esac/{s:/nim::g}' install.sh"
pack_cmd "sh install.sh $(pack_get -prefix)"
# Create a new build with this module
new_build -name _internal-nim$InV \
-module-path $(build_get -module-path)-nim/$InV \
-source $(build_get -source) \
$(list -prefix "-default-module " $(pack_get -mod-req-module) nim[$InV]) \
-installation-path $(dirname $(pack_get -prefix $(get_parent)))/packages \
-build-module-path "-package -version" \
-build-installation-path "$InV -package -version" \
-build-path $(build_get -build-path)/nim-$nV
mkdir -p $(build_get -module-path[_internal-nim$InV])-apps
build_set -default-setting[_internal-nim$InV] $(build_get -default-setting)
# Now add options to ensure that loading this module will enable the path for the *new build*
pack_set -module-opt "-use-path $(build_get -module-path[_internal-nim$InV])"
case $_mod_format in
$_mod_format_ENVMOD)
;;
*)
pack_set -module-opt "-use-path $(build_get -module-path[_internal-nim$InV])-apps"
;;
esac
pack_install
create_module \
-module-path $(build_get -module-path)-apps \
-n $(pack_get -alias).$(pack_get -version) \
-W "Script for loading $(pack_get -package): $(get_c)" \
-v $(pack_get -version) \
-M $(pack_get -alias).$(pack_get -version) \
-P "/directory/should/not/exist" \
$(list -prefix '-L ' $(pack_get -module-requirement)) \
-L $(pack_get -alias)
# The lookup name in the list for version number etc...
set_parent $(pack_get -alias)[$InV]
set_parent_exec $(pack_get -prefix)/bin/nim
# Save the default build index
def_idx=$(build_get -default-build)
# Change to the new build default
build_set -default-build _internal-nim$InV
# Install all nim packages
source nim-install.bash
clear_parent
# Initialize the module read path
old_path=$(build_get -module-path)
build_set -module-path $old_path-apps
source nim/nim-mods.bash
build_set -module-path $old_path
# Reset default build
build_set -default-build $def_idx