Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installer support #22

Merged
merged 11 commits into from
Sep 13, 2018
Merged

Installer support #22

merged 11 commits into from
Sep 13, 2018

Conversation

bpintea
Copy link
Collaborator

@bpintea bpintea commented Sep 12, 2018

This PR implements some changes needed by the MSI installer:

  • adds a resource file with various meta properties like version numbers, descriptions, company name, file icon etc.
  • replaces the .txt license with a .rtf, which can then be rendered as is by the installer.

It also contains some remotely related fixes:

  • WideCharToMultiByte() string conversion function requires a specific flag for conversion to UTF8, as per documentation. (Interestingly, failure to comply seems to get different treatment in different CRTs, varying from correct functioning to failure with error reporting, but also failure with no error reporting.)
  • the build.bat will service the setup argument before clean/proper, since these two need to make use of MSBuild.
  • the HOMEPAGE_URL cmake variable has been a late addition, so not supported by all our CI hosts (some running 3.10 versions vs. latest 3.12).

Various changes for the MSI installer:
- resource def file added;
- sample DSN no longer added by driver; this is done now by the
  installer.
- driver file name changed to fit in 8 chars.
- the license is renamed to .rtf extention.
'clean' uses MSBuild to invoke cleaning target, so it needs the
environment set up.
- ..helpful with troubleshooting.
- remove old and unused "copying" "function".
- conversion to UTF8 requires WC_ERR_INVALID_CHARS flag (as per
documentation). On some CRT versions, failure to use it would result in
function failure, but with no detailed error reporting (GetLastError()
== 0).
@bpintea bpintea mentioned this pull request Sep 12, 2018
Closed
@droberts195
Copy link
Contributor

(Interestingly, failure to comply seems to get different treatment in different CRTs, varying from correct functioning to failure with error reporting, but also failure with no error reporting.)

WideCharToMultiByte() is in kernel32.dll, not the CRT, so I guess its behaviour could vary between different versions of Windows. I would have thought the CRT makes no difference.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most of my comments are about the possibility of replacing magic numbers in the resource file with symbols defined in windows.h.

LICENSE.rtf Outdated
@@ -1,223 +1,228 @@
ELASTIC LICENSE AGREEMENT
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the repo should still contain the text version of the license as well as the RTF version. The text version doesn't need to be touched by the build system, but should exist for consistency with the other Elastic repos.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the .txt version back (chose to install it as well for readability convenience, hope that's not too redundant).

PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could use VS_FF_DEBUG instead of 0x1L

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, that's a good idea.
I've used VS's delegating editor, removed the unnecessary parts and modified the relevant ones. The editor uses the defines, but generated .rc uses the values directly (since it doesn't include windows.h originally).

#else
FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use VOS_NT_WINDOWS32

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

FILEFLAGS 0x0L
#endif
FILEOS 0x40004L
FILETYPE 0x2L
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could use VFT_DLL

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

VALUE "FileDescription", "ODBC @ENCODING_VERBOSE@ driver for Elasticsearch"
VALUE "FileVersion", "@DRV_VERSION@"
VALUE "InternalName", "@DRV_NAME@@CMAKE_SHARED_LIBRARY_SUFFIX@"
VALUE "LegalCopyright", "Copyright (C) perpetual, Elasticsearch B.V."
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure this should have the word "perpetual" in it. In other places we don't give a specific year we just say "Copyright (C) Elasticsearch B.V.".

Maybe check with @legalastic.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed it to the suggested wording, I suppose that got their blessing.

VS_VERSION_INFO VERSIONINFO
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
FILEFLAGSMASK 0x3fL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can use VS_FFI_FILEFLAGSMASK

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@bpintea
Copy link
Collaborator Author

bpintea commented Sep 12, 2018

WideCharToMultiByte() is in kernel32.dll, not the CRT, so I guess its behaviour could vary between different versions of Windows. I would have thought the CRT makes no difference.

Indeed, you're correct.

Copy link
Contributor

@droberts195 droberts195 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@bpintea
Copy link
Collaborator Author

bpintea commented Sep 13, 2018

closes #21 .

@bpintea bpintea merged commit 87e782e into elastic:master Sep 13, 2018
@bpintea bpintea deleted the feature/installer_support branch September 13, 2018 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants