Skip to content

Commit

Permalink
added nim
Browse files Browse the repository at this point in the history
  • Loading branch information
zerothi committed Dec 9, 2020
1 parent faffaad commit 68a27ab
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 0 deletions.
1 change: 1 addition & 0 deletions bbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file added nim-install.bash
Empty file.
79 changes: 79 additions & 0 deletions nim.bash
Original file line number Diff line number Diff line change
@@ -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
Empty file added nim/nim-mods.bash
Empty file.

0 comments on commit 68a27ab

Please sign in to comment.