Old 25th November 2005, 06:24   #1
webqs
Junior Member
 
Join Date: Nov 2005
Posts: 4
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
code:
makensis /DVAR=value example.nsi

Which should be functionally equivalent to
code:
!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:

code:

$ ./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).

code:
$ ./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:

code:

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:

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


TIA
James
webqs is offline   Reply With Quote
Old 25th November 2005, 09:58   #2
kichik
M.I.A.
[NSIS Dev, Mod]
 
kichik's Avatar
 
Join Date: Oct 2001
Location: Israel
Posts: 11,343
The command line parameters are parsed sequentially. Try:
code:
$ ./makensis -DVC_TAG=release_example_1.0 -DTMP_DIR=/var/tmp/ example.nsi

NSIS FAQ | NSIS Home Page | Donate $
"I hear and I forget. I see and I remember. I do and I understand." -- Confucius
kichik is offline   Reply With Quote
Old 28th November 2005, 03:39   #3
webqs
Junior Member
 
Join Date: Nov 2005
Posts: 4
hmm, that works fine. I'm sure i tried that on Friday. Put it down to Friday afternoons...
webqs is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump