I wrote a NSIS installer script that builds fine on Windows, however I need it to build on *nix OSes too. When I run it on OS X I get the following error..
Usage: !define ([/date|/utcdate] symbol [value]) | (/file symbol filename) | (/math symbol val1 OP val2)
OP=(+ - * / % & | ^)
Error in script "/Users/john/Development/java/vordio/src/main/app-resources/win-installer.nsi" on line 6 -- aborting creation process
This is the line of the script that is failing..
!define VORDIO_ICON "${PROJECT_DIR}\src\main\app-resources\vordio_logo_64x64_win_icon.ico"
I can't see anything wrong with it but I tried adding /file which didn't help, nor did changing file path separators.
Anyone had this NSIS problem?
!define
will print that error if you are passing too many parameters. This can happen if quotes terminates the string early:
!define bar 'BAR" "oops'
!define foo "${bar}\baz" ; Expands to !define foo "BAR" "oops\baz"
I assume the problem is related to how you are using -D on the command-line to set PROJECT_DIR. You should not quote the value part (a path in your case), you should quote the entire name=value part. How you do that is controlled by the C library implementation, it is responsible for splitting the command-line into individual arguments (and possibly removing quotes). The official NSIS Windows build uses Visual C++ and it is quite forgiving and allows at least these 5 variations:
...and all of these should display
Command line defined: "name=value"
because the Microsoft implementation has some crazy quote handling.
Add !warning ">${PROJECT_DIR}<"
to your script and change the way you call makensis until there are no quotes between the angle brackets...