Skip to content
⌘ NSIS Forum Archive

NSIS 3.0a0

66 posts

kichik#

NSIS 3.0a0

Yep. It's finally here.

Get your download at the usual place:



Among many bug fixes and new features, the biggest one is probably Jim Park's Unicode. Wizou and Anders have merged it back to the main version and it's now available as an optional Unicode true command. So thank you Jim, thank you Wizou for merging it back in and thank you Anders for wrapping it all up and making sure NSIS 3 happens.

Next on plan is fixing whatever we broke (like linux build) and x64 by David Golub (partially already available in SVN and on David's BitBucket).

Please let us know of any broken parts of loose screws 🙂

P.S.

Check out our Twitter feed by Yathosho.
MSG#
Absolutely awesome! Many thanks to the NSIS team for putting in so many hours, and congratulations for reaching this important milestone. I'm hoping to go play with it soon!
T.Slappy#
Awesoooooooooome!!!

Quick question for plug-ins: all old plug-ins are now automatically treated as x86, aren't they?

Second question: Is .chm manual working for you correctly?
aerDNA#
I'm an eternal optimist but I admit I was worried we'd seen the last major build, as the project really seemed to be losing momentum. I love NSIS, this is frelling great news! Thank you devs for all your work! 👍
TaleTN#
Cool, thanks! 🙂

I have just quickly tried 3.0a0, and a simple project compiled, but another, somewhat larger one wouldn't because !searchparse and !searchreplace failed. I then reinstalled 2.46, and then the project compiles just fine, so it would seem !searchparse and !searchreplace are broken.

!searchparse error:
!searchparse: starting string "#define VERSIONINFO_VERSION    " not found in file!
Failing NSIS source code line:
!searchparse /file ../resource.h '#define VERSIONINFO_VERSION    ' VER_MAJR ',' VER_MN ',' VER_BG ','
Relevant line from ../resource.h:
#define VERSIONINFO_VERSION    1,3,0,0 // 1.3.0
!searchreplace error:
Usage: !searchreplace [/ignorecase] output_name source_string substring replacestring
Failing NSIS source code line:
!searchreplace VER_FN "${VER_STR}" "." ""
Anders#
Originally Posted by T.Slappy View Post
Quick question for plug-ins: all old plug-ins are now automatically treated as x86, aren't they?
If you mean Ansi vs Unicode then yes, everything starts out as Ansi but NSIS\Plugins\*.dll is not searched anymore, you would have to move them into the correct subdirectory...

Originally Posted by T.Slappy View Post
Second question: Is .chm manual working for you correctly?
What do you mean?


Originally Posted by TaleTN View Post
I have just quickly tried 3.0a0, and a simple project compiled, but another, somewhat larger one wouldn't because !searchparse and !searchreplace failed. I then reinstalled 2.46, and then the project compiles just fine, so it would seem !searchparse and !searchreplace are broken.
They are stricter in what they accept but it is of course possible that there is a bug in the new code.
T.Slappy#
Hmm I cannot edit my previous post so I am adding found issues here, most of them are from manual:

UnsafeStrCpy command is not documented (however I suppose the same behaviour as StrCpy)

The 'new' ReserveFile explanation is very vague:
Plugins in ${NSISDIR}\Plugins have to be reserved with ReserveFile /plugin
Maybe it is better to say "use /plugin switch anytime you use ReserveFile for reserving the .dll file".
Also plug-ins are now stored in ${NSISDIR}\Plugins\<architecture>-<Charset> so this may be confusing for users.

And again thanks for the great work!
jpderuiter#
Great work!

Maybe it is a good idea to copy already installed plugin's from a NSIS 2.x installation to the new plugin location (at least the ansi plugin's) in the NSIS installer?

jpderuiter
TaleTN#
Originally Posted by Anders View Post
They are stricter in what they accept but it is of course possible that there is a bug in the new code.
Then I guess there is a bug in the !searchparse code, because I have this very simple text file (meh.h):

#define APP_VERSION 1,2,3
#define LONG_VERSION 1,2,3,4
Which I fails to parse correctly with this equally simple NSIS script:

!searchparse /file meh.h `#define APP_VERSION ` VER_MAJOR `,` VER_MINOR `,`
# Bug: Found "#define APP_VERSION 1,2,", so VER_MAJOR should be "1" and
# VER_MINOR "2". However, VER_MINOR is "2,3".

!searchparse /file meh.h `#define LONG_VERSION ` LONG_MAJOR `,` LONG_MINOR `,` LONG_BG `,`
# Bug: Should have found "#define LONG_VERSION 1,2,3,", but instead says
# "#define LONG_VERSION " not found.

Name "meh ${VER_MAJOR}.${VER_MINOR} (${LONG_MAJOR}.${LONG_MINOR}.${LONG_BG})"
OutFile "meh.exe"
Section
SectionEnd
Yathosho#
didn't think i'd live to see this, good job everybody!

i'm glad that the anchors for commands in the html help finally changed from chapters to something more readable. would've been better though to use the literal command names - #StrCpy rather than #strcpy, #!ifdef rather than #if. i can think of several scenarios where this could be come useful, for instance a command lookup from an editor.
Yathosho#
Originally Posted by jiake View Post
Maybe able to upgrade LZMA(LZMA2)?
there has been a discussion about that
jiake#
Originally Posted by Yathosho View Post
there has been a discussion about that
Thank you.
Compression code does look outdated.
Anders#
I think I fixed searchparse

Originally Posted by TaleTN View Post
!searchreplace error:
Usage: !searchreplace [/ignorecase] output_name source_string substring replacestring
Failing NSIS source code line:
!searchreplace VER_FN "${VER_STR}" "." ""

!define VER_STR a.b.c.d
!searchreplace VER_FN "${VER_STR}" "." ""
!warning "|${VER_FN}|"

gives me:

!searchreplace: "VER_FN"="abcd"
warning: !warning: |abcd| (test.nsi:22)

so you need to provide a full example that actually fails for me to fix this
TaleTN#
Originally Posted by Anders View Post
so you need to provide a full example that actually fails for me to fix this
Here you go:

meh.h:
#define VERSIONINFO_STR "1.3.0"
meh.nsi:
# Sets VER_STR to "1.3.0".
!searchparse /file meh.h '#define VERSIONINFO_STR "' VER_STR '"'

# VER_FN should be "130", but returns usage error instead.
!searchreplace VER_FN "${VER_STR}" "." ""

Name "meh"
OutFile "meh.exe"
Section
SectionEnd
T.Slappy#
After a short work with NSIS 3 I noticed my favourite feature is still not implemented:

Var /GLOBAL myVariable "initial value"
I think this is often used: "initial value" could be optional parameter.
Anders#
Originally Posted by T.Slappy View Post
After a short work with NSIS 3 I noticed my favourite feature is still not implemented:
Var /GLOBAL myVariable "initial value"
I think this is often used: "initial value" could be optional parameter.
I believe there is a feature request for Var Foo, Bar, Baz but I don't think we found a good syntax to express this, /GLOBAL makes things confusing etc.

Setting an initial value is probably not going to happen, NSIS currently uses a PE section trick to allocate the variables with no code at runtime. If you want this feature so bad you can just use a macro in .onInit...
bnicer#
Very good to have it all in one place. I like also the streamlining since 2.46. Math.dll -- much smaller. Thanks. 🙂

I found a minor problem. (I hope minor.)

${NSIS_CHAR_SIZE} is always 1.

So,

!if "${NSIS_CHAR_SIZE}" = 2
  Unicode true
!endif 
does not work.
Anders#
Originally Posted by TaleTN View Post
Here you go:
With !searchparse fixed I get 130 as the result...
Anders#
Originally Posted by bnicer View Post
${NSIS_CHAR_SIZE} is always 1.
This is by design, ${NSIS_CHAR_SIZE} is mainly for code that interacts with the system plugin. ${NSIS_CHAR_SIZE} changes after "Unicode true"...
TaleTN#
Originally Posted by Anders View Post
With !searchparse fixed I get 130 as the result...
Yay, great! 👍 I guess there was nothing wrong with !searchreplace then, but it was also caused by a bug in !searchparse?
bnicer#
${NSIS_CHAR_SIZE} changes after "Unicode true"...
I should have tried it first. It isn't a problem, only different. Thanks.
Yathosho#
there's always a warning when a script contains ${NSIS_VERSION}, i guess it doesn't like the "a" in v3.0a0
Anders#
Originally Posted by Yathosho View Post
there's always a warning when a script contains ${NSIS_VERSION}, i guess it doesn't like the "a" in v3.0a0
Please post code examples and compiler warnings when reporting issues...
Yathosho#
Originally Posted by Anders View Post
Please post code examples and compiler warnings when reporting issues...
!if ${NSIS_VERSION} < "v3.0"
!endif
will produce

1 warning:
Invalid number: "v3.0a0" (C:\Users\jan\Desktop\test.nsi:1)
Afrow UK#
That warning is because it can't parse "v3.0a0" (or "v3.0") as an integer because it isn't.

Stu
Anders#
Originally Posted by Yathosho View Post
!if ${NSIS_VERSION} < "v3.0"
!endif
Like Afrow UK said, it gives you a warning because it failed to parse the input as a number. The warning is new but it will fail to parse under 2.46 as well.

Originally Posted by 2.46 fails this
!undef NSIS_VERSION
!define NSIS_VERSION "v3.0" ;a0"
!if ${NSIS_VERSION} < v4.0
!warning "${NSIS_VERSION} <"
!else
!warning "${NSIS_VERSION} >="
!endif
You probably want something like:
!if "${NSIS_PACKEDVERSION}" > 0x2046000
Unicode True
!else
!if "${NSIS_CHAR_SIZE}" < 2 ; This takes care of the Unicode fork?
!warning "Unicode not supported, creating ANSI installer"
!endif
!endif

When comparing NSIS_PACKEDVERSION you should check against the last version that did not have the feature you are after, if you do it this way you should be compatible all the way back to v2.15. If you do it the other way with !if ${NSIS_PACKEDVERSION} >= 0x3000000 it will be parsed as 0 >= 0 (true) on older versions!

It is important to note that unofficial svn builds might not set NSIS_VERSION nor NSIS_PACKEDVERSION at all.


!if 0x2046000 >= "${NSIS_PACKEDVERSION}"
!error "You need NSISv3+"
!endif
;Or
!if ! "${NSIS_PACKEDVERSION}" > 0x2046000
!error "You need NSISv3+"
!endif
I'm not sure what the fork will do in the future, you might even want to use !if ! "${NSIS_PACKEDVERSION}" > 0x2999999


The format of NSIS_VERSION was never set in stone, v3.4.5 would be a legal version and there can be a letter or word suffix etc...
Redo89#
Respected developers!
Please, make possibility of translation of the text for "NSIS Error".
It always in English.... Add opportunity to change the text of this error.
thanks.