diff --git a/bbuild b/bbuild index e7b9e479..9036f73b 100755 --- a/bbuild +++ b/bbuild @@ -286,6 +286,7 @@ source libs.bash source python${_python_version}.bash source R.bash source julia.bash +source nim.bash # We have installed all libraries needed for doing application installs source apps.bash diff --git a/nim-install.bash b/nim-install.bash new file mode 100644 index 00000000..e69de29b diff --git a/nim.bash b/nim.bash new file mode 100644 index 00000000..9668a823 --- /dev/null +++ b/nim.bash @@ -0,0 +1,79 @@ +nV=1.4 +InV=$nV.2 +add_package -package nim \ + -directory nim-$InV \ + 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 boot -d:release" +pack_cmd "./koch tools" +pack_cmd "./koch install $(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 diff --git a/nim/nim-mods.bash b/nim/nim-mods.bash new file mode 100644 index 00000000..e69de29b