Archive: Passing parameters using -D on Linux


Passing parameters using -D on Linux
Hi all

I'm trying to pass a parameters at run time to an .NSI script but this doesn't seem to work.

The Documentation suggests

makensis /DVAR=value example.nsi

Which should be functionally equivalent to
!define VAR "value"

in example.nsi

But this doesn't work, the compiler treats the ${VAR} references as literal strings.

./makensis -? gives me this documentation:


$ ./makensis -?
MakeNSIS v25-Nov-2005.cvs - Copyright 1999-2005 Nullsoft, Inc.

Portions Copyright (C) 1995-1998 Jean-loup Gailly and Mark Adler (zlib).
Portions Copyright (C) 1996-2002 Julian R Seward (bzip2).
Portions Copyright (C) 1999-2003 Igor Pavlov (lzma).

Contributors: nnop-at=newmail.ru, Ryan Geiss, Andras Varga, Drew Davidson,
Peter Windridge, Dave Laundon, Robert Rainwater,
Yaroslav Faybishenko, Jeff Doozan, Amir Szekely,
Ximon Eighteen, et al.

Usage:
makensis [option | script.nsi | - [...]]
options are:
-CMDHELP item prints out help for 'item', or lists all commands
-HDRINFO prints information about what options makensis was compiled with
-LICENSE prints the makensis software license
-VERSION prints the makensis version and exits
-Vx verbosity where x is 4=all,3=no script,2=no info,1=no warnings,0=none
-Ofile specifies a text file to log compiler output (default is stdout)
-PAUSE pauses after execution
-NOCONFIG disables inclusion of <path to makensis.exe>/nsisconf.nsh
-NOCD disabled the current directory change to that of the .nsi file
-Ddefine[=value] defines the symbol "define" for the script [to value]
-Xscriptcmd executes scriptcmd in script (i.e. "-XOutFile poop.exe")
parameters are processed by order (-Ddef ins.nsi != ins.nsi -Ddef)
for script file name, you can use - to read from the standard input


So I tried the following for my project (if I place the nsi script call after the -D calls, compile doesn't even start).

$ ./makensis example.nsi -DVC_TAG=release_example_1.0 -DTMP_DIR=/var/tmp/


Unfortunately, this doesn't work either. The error I get is this:


File: "${TMP_DIR}${VC_TAG}/*" -> no files found.
Usage: File [/nonfatal] [/a] ([/r] [/x filespec [...]] filespec [...] |
/oname=outfile one_file_only)
Error in script "example.nsi" on line 52 -- aborting creation process




Does anyone have any pointers about how these params can be passed in to the nsi at run time?

Line 52 of the nsi looks like this:

File "${TMP_DIR}${VC_TAG}/*"


TIA
James

The command line parameters are parsed sequentially. Try:

$ ./makensis -DVC_TAG=release_example_1.0 -DTMP_DIR=/var/tmp/ example.nsi

hmm, that works fine. I'm sure i tried that on Friday. Put it down to Friday afternoons...