I can read and use the env var with NSIS:
!define var "$%envvar%"
For example envvar contains some string "word anotherword thirdword" so I need to split it by this words and use it while compiling.
!if $"var1" == "word"
...some code
!else if $"var2" == "anotherword"
...some code
!endif
Can I do it with NSIS?
String handling in the pre-compiler is somewhat limited but this works:
!define var "word anotherword thirdword"
!searchparse /noerrors "IGNORED ${var}" ' ' var1 ' ' var2 ' ' var3
!warning "Debug: 1=${var1}"
!warning "Debug: 2=${var2}"
!warning "Debug: 3=${var3}"
!if "${var1}" == "word"
!else if "${var2}" == "anotherword"
!endif
Anything more advanced might require calling batch for
with !system
and outputting to a .nsh you can include.