julia-nix/genSysImage.sh
2020-12-02 14:03:20 +13:00

16 lines
697 B
Bash
Executable File

set -e
julia --project --trace-compile=precompile.jl -q ./src/Example.jl >> /dev/null
unset packageList;
unset finalList;
unset prepedColon;
packageList=$(julia --project -E 'using Pkg; Pkg.status(mode=PKGMODE_PROJECT)' | sed 1,2d | head -n -1 | sed 's/.*\]\ //g' | sed 's/\ .*//g')
prependColon=$(for p in $packageList; do echo ":"${p}", "; done)
finalList="["${prependColon::-2}"]"
julia --project -q -E "using Pkg; Pkg.add(url=\"https://github.com/JuliaLang/PackageCompiler.jl\", rev=\"v1.2.3\"); Pkg.instantiate(); Pkg.activate(); using PackageCompiler; create_sysimage(${finalList}; sysimage_path=\"generatedSysImage.so\", precompile_statements_file=\"precompile.jl\")"
rm precompile.jl