Skip to content

Commit 6199d43

Browse files
committed
patch 8.0.1191: MS-Windows: missing 32 and 64 bit files in installer
Problem: MS-Windows: missing 32 and 64 bit files in installer. Solution: Include both 32 and 64 bit GvimExt and related dll files. Remove old Windows code from the installer. (Ken Takata, closes #2144)
1 parent 2c33d7b commit 6199d43

File tree

8 files changed

+306
-370
lines changed

8 files changed

+306
-370
lines changed

Makefile

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,14 @@ MINOR = 0
120120
#
121121
# MS-Windows:
122122
# - Run make on Unix to update the ".mo" files.
123-
# - Get libintl-8.dll, libiconv-2.dll and libgcc_s_sjlj-1.dll. E.g. from
123+
# - Get 32 bit libintl-8.dll, libiconv-2.dll and libgcc_s_sjlj-1.dll. E.g. from
124124
# https://mlocati.github.io/gettext-iconv-windows/ .
125125
# Use the "shared-32.zip file and extract the archive to get the files.
126-
# Put them in the top directory, "make dosrt" uses them.
126+
# Put them in the gettext32 directory, "make dosrt" uses them.
127+
# - Get 64 bit libintl-8.dll and libiconv-2.dll. E.g. from
128+
# https://mlocati.github.io/gettext-iconv-windows/ .
129+
# Use the "shared-64.zip file and extract the archive to get the files.
130+
# Put them in the gettext64 directory, "make dosrt" uses them.
127131
# - > make dossrc
128132
# > make dosrt
129133
# Unpack dist/vim##rt.zip and dist/vim##src.zip on an MS-Windows PC.
@@ -461,9 +465,13 @@ dosrt_files: dist prepare no_title.vim
461465
cp $$i dist/vim/$(VIMRTDIR)/lang/$$n/LC_MESSAGES/vim.mo; \
462466
fi \
463467
done
464-
cp libintl-8.dll dist/vim/$(VIMRTDIR)/
465-
cp libiconv-2.dll dist/vim/$(VIMRTDIR)/
466-
cp libgcc_s_sjlj-1.dll dist/vim/$(VIMRTDIR)/
468+
mkdir dist/vim/$(VIMRTDIR)/gettext32
469+
cp gettext32/libintl-8.dll dist/vim/$(VIMRTDIR)/gettext32/
470+
cp gettext32/libiconv-2.dll dist/vim/$(VIMRTDIR)/gettext32/
471+
cp gettext32/libgcc_s_sjlj-1.dll dist/vim/$(VIMRTDIR)/gettext32/
472+
mkdir dist/vim/$(VIMRTDIR)/gettext64
473+
cp gettext64/libintl-8.dll dist/vim/$(VIMRTDIR)/gettext64/
474+
cp gettext64/libiconv-2.dll dist/vim/$(VIMRTDIR)/gettext64/
467475

468476

469477
# Used before uploading. Don't delete the AAPDIR/sign files!
@@ -490,7 +498,10 @@ dosbin_gvim: dist no_title.vim dist/$(COMMENT_GVIM)
490498
cp vimrun.exe dist/vim/$(VIMRTDIR)/vimrun.exe
491499
cp installw32.exe dist/vim/$(VIMRTDIR)/install.exe
492500
cp uninstalw32.exe dist/vim/$(VIMRTDIR)/uninstal.exe
493-
cp gvimext.dll dist/vim/$(VIMRTDIR)/gvimext.dll
501+
mkdir dist/vim/$(VIMRTDIR)/GvimExt32
502+
cp gvimext.dll dist/vim/$(VIMRTDIR)/GvimExt32/gvimext.dll
503+
mkdir dist/vim/$(VIMRTDIR)/GvimExt64
504+
cp gvimext64.dll dist/vim/$(VIMRTDIR)/GvimExt64/gvimext.dll
494505
cd dist && zip -9 -rD -z gvim$(VERSION).zip vim <$(COMMENT_GVIM)
495506
cp gvim.pdb dist/gvim$(VERSION).pdb
496507

nsis/README.txt

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
This builds a one-click install for Vim for Win32 using the Nullsoft
2-
Installation System (NSIS), available at http://www.nullsoft.com/free/nsis/
2+
Installation System (NSIS), available at http://nsis.sourceforge.net/
33

44
To build the installable .exe:
55

@@ -17,8 +17,14 @@ To build the installable .exe:
1717
uninstal.exe,
1818
xxd/xxd.exe,
1919

20+
Then execute tools/rename.bat to rename the executables. (mv command is
21+
required.)
22+
2023
3. Go to the GvimExt directory and build gvimext.dll (or get it from a binary
21-
archive).
24+
archive). Both 64- and 32-bit versions are needed and should be placed
25+
as follows:
26+
64-bit: src/GvimExt/gvimext64.dll
27+
32-bit: src/GvimExt/gvimext.dll
2228

2329
4. Go to the VisVim directory and build VisVim.dll (or get it from a binary
2430
archive).
@@ -27,13 +33,35 @@ To build the installable .exe:
2733
get them from a binary archive).
2834

2935
6. Get a "diff.exe" program and put it in the "../.." directory (above the
30-
"vim61" directory, it's the same for all Vim versions).
36+
"vim80" directory, it's the same for all Vim versions).
3137
You can find one in previous Vim versions or in this archive:
3238
http://www.mossbayeng.com/~ron/vim/diffutils.tar.gz
39+
Also put winpty32.dll and winpty-agent.exe there.
3340

3441
7. Do "make uganda.nsis.txt" in runtime/doc. This requires sed, you may have
3542
to do this on Unix. Make sure the file is in DOS file format!
3643

44+
8. Get gettext and iconv DLLs from the following site:
45+
https://github.com/mlocati/gettext-iconv-windows/releases
46+
Both 64- and 32-bit versions are needed.
47+
Download the files gettextX.X.X.X-iconvX.XX-shared-{32,64}.zip, extract
48+
DLLs and place them as follows:
49+
50+
<GETTEXT directory>
51+
|
52+
+ gettext32/
53+
| libintl-8.dll
54+
| libiconv-2.dll
55+
| libgcc_s_sjlj-1.dll
56+
|
57+
` gettext64/
58+
libintl-8.dll
59+
libiconv-2.dll
60+
61+
The default <GETTEXT directory> is "..", however, you can change it by
62+
passing /DGETTEXT=... option to the makensis command.
63+
64+
3765
Install NSIS if you didn't do that already.
3866
Also install UPX, if you want a compressed file.
3967

nsis/gvim.nsi

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,15 @@
2020
!define VIMTOOLS ..\..
2121
!endif
2222

23+
# Location of gettext.
24+
# It must contain two directories: gettext32 and gettext64.
25+
# See README.txt for detail.
26+
!ifndef GETTEXT
27+
!define GETTEXT ${VIMRT}
28+
!endif
29+
2330
# Comment the next line if you don't have UPX.
24-
# Get it at http://upx.sourceforge.net
31+
# Get it at https://upx.github.io/
2532
!define HAVE_UPX
2633

2734
# comment the next line if you do not want to add Native Language Support
@@ -328,24 +335,67 @@ Section "Add an Edit-with-Vim context menu entry"
328335
SetOutPath $0
329336
ClearErrors
330337
SetOverwrite try
338+
331339
${If} ${RunningX64}
340+
# Install 64-bit gvimext.dll into the GvimExt64 directory.
341+
SetOutPath $0\GvimExt64
342+
ClearErrors
332343
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext64.dll
333-
${Else}
334-
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
344+
!ifdef HAVE_NLS
345+
File ${GETTEXT}\gettext64\libintl-8.dll
346+
File ${GETTEXT}\gettext64\libiconv-2.dll
347+
!endif
348+
349+
IfErrors 0 GvimExt64Done
350+
351+
# Can't copy gvimext.dll, create it under another name and rename it
352+
# on next reboot.
353+
GetTempFileName $3 $0\GvimExt64
354+
File /oname=$3 ${VIMSRC}\GvimExt64\gvimext.dll
355+
Rename /REBOOTOK $3 $0\GvimExt64\gvimext.dll
356+
!ifdef HAVE_NLS
357+
GetTempFileName $3 $0\GvimExt64
358+
File /oname=$3 ${GETTEXT}\gettext64\libintl-8.dll
359+
Rename /REBOOTOK $3 $0\GvimExt64\libintl-8.dll
360+
GetTempFileName $3 $0\GvimExt64
361+
File /oname=$3 ${GETTEXT}\gettext64\libiconv-2.dll
362+
Rename /REBOOTOK $3 $0\GvimExt64\libiconv-2.dll
363+
!endif
335364
${EndIf}
336-
IfErrors 0 GvimExtDone
365+
366+
GvimExt64Done:
367+
368+
# Install 32-bit gvimext.dll into the GvimExt32 directory.
369+
SetOutPath $0\GvimExt32
370+
ClearErrors
371+
372+
File /oname=gvimext.dll ${VIMSRC}\GvimExt\gvimext.dll
373+
!ifdef HAVE_NLS
374+
File ${GETTEXT}\gettext32\libintl-8.dll
375+
File ${GETTEXT}\gettext32\libiconv-2.dll
376+
File ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
377+
!endif
378+
379+
IfErrors 0 GvimExt32Done
337380

338381
# Can't copy gvimext.dll, create it under another name and rename it on
339382
# next reboot.
340-
GetTempFileName $3 $0
341-
${If} ${RunningX64}
342-
File /oname=$3 ${VIMSRC}\GvimExt\gvimext64.dll
343-
${Else}
344-
File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
345-
${EndIf}
346-
Rename /REBOOTOK $3 $0\gvimext.dll
383+
GetTempFileName $3 $0\GvimExt32
384+
File /oname=$3 ${VIMSRC}\GvimExt\gvimext.dll
385+
Rename /REBOOTOK $3 $0\GvimExt32\gvimext.dll
386+
!ifdef HAVE_NLS
387+
GetTempFileName $3 $0\GvimExt32
388+
File /oname=$3 ${GETTEXT}\gettext32\libintl-8.dll
389+
Rename /REBOOTOK $3 $0\GvimExt32\libintl-8.dll
390+
GetTempFileName $3 $0\GvimExt32
391+
File /oname=$3 ${GETTEXT}\gettext32\libiconv-2.dll
392+
Rename /REBOOTOK $3 $0\GvimExt32\libiconv-2.dll
393+
GetTempFileName $3 $0\GvimExt32
394+
File /oname=$3 ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
395+
Rename /REBOOTOK $3 $0\GvimExt32\libgcc_s_sjlj-1.dll
396+
!endif
347397

348-
GvimExtDone:
398+
GvimExt32Done:
349399
SetOverwrite lastused
350400

351401
# We don't have a separate entry for the "Open With..." menu, assume
@@ -394,10 +444,10 @@ SectionEnd
394444
File ${VIMRT}\keymap\README.txt
395445
File ${VIMRT}\keymap\*.vim
396446
SetOutPath $0
397-
File ${VIMRT}\libintl-8.dll
398-
File ${VIMRT}\libiconv-2.dll
399-
File /nonfatal ${VIMRT}\libwinpthread-1.dll
400-
File /nonfatal ${VIMRT}\libgcc_s_sjlj-1.dll
447+
File ${GETTEXT}\gettext32\libintl-8.dll
448+
File ${GETTEXT}\gettext32\libiconv-2.dll
449+
#File /nonfatal ${VIMRT}\libwinpthread-1.dll
450+
File /nonfatal ${GETTEXT}\gettext32\libgcc_s_sjlj-1.dll
401451
SectionEnd
402452
!endif
403453

@@ -437,6 +487,11 @@ Section Uninstall
437487
$\nIt contains the Vim executables and runtime files." IDNO NoRemoveExes
438488

439489
Delete /REBOOTOK $0\*.dll
490+
Delete /REBOOTOK $0\GvimExt32\*.dll
491+
${If} ${RunningX64}
492+
Delete /REBOOTOK $0\GvimExt64\*.dll
493+
${EndIf}
494+
440495
ClearErrors
441496
# Remove everything but *.dll files. Avoids that
442497
# a lot remains when gvimext.dll cannot be deleted.

src/GvimExt/gvimext.cpp

Lines changed: 15 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ STGMEDIUM medium;
3838
HRESULT hres = 0;
3939
UINT cbFiles = 0;
4040

41-
/* The buffers size used to be MAX_PATH (256 bytes), but that's not always
41+
/* The buffers size used to be MAX_PATH (260 bytes), but that's not always
4242
* enough */
4343
#define BUFSIZE 1100
4444

@@ -203,7 +203,7 @@ dyn_libintl_init(char *dir)
203203
if (hLibintlDLL)
204204
return 1;
205205

206-
// Load gettext library from the Vim runtime directory.
206+
// Load gettext library from $VIMRUNTIME\GvimExt{64,32} directory.
207207
// Add the directory to $PATH temporarily.
208208
len = GetEnvironmentVariableW(L"PATH", NULL, 0);
209209
len2 = MAX_PATH + 1 + len;
@@ -212,7 +212,11 @@ dyn_libintl_init(char *dir)
212212
if (buf != NULL && buf2 != NULL)
213213
{
214214
GetEnvironmentVariableW(L"PATH", buf, len);
215-
_snwprintf(buf2, len2, L"%S;%s", dir, buf);
215+
#ifdef _WIN64
216+
_snwprintf(buf2, len2, L"%S\\GvimExt64;%s", dir, buf);
217+
#else
218+
_snwprintf(buf2, len2, L"%S\\GvimExt32;%s", dir, buf);
219+
#endif
216220
SetEnvironmentVariableW(L"PATH", buf2);
217221
hLibintlDLL = LoadLibrary(GETTEXT_DLL);
218222
#ifdef GETTEXT_DLL_ALT
@@ -883,37 +887,7 @@ BOOL CShellExt::LoadMenuIcon()
883887
return TRUE;
884888
}
885889

886-
#ifdef WIN32
887-
// This symbol is not defined in older versions of the SDK or Visual C++.
888-
889-
#ifndef VER_PLATFORM_WIN32_WINDOWS
890-
# define VER_PLATFORM_WIN32_WINDOWS 1
891-
#endif
892-
893-
static DWORD g_PlatformId;
894-
895-
//
896-
// Set g_PlatformId to VER_PLATFORM_WIN32_NT (NT) or
897-
// VER_PLATFORM_WIN32_WINDOWS (Win95).
898-
//
899-
static void
900-
PlatformId(void)
901-
{
902-
static int done = FALSE;
903-
904-
if (!done)
905-
{
906-
OSVERSIONINFO ovi;
907-
908-
ovi.dwOSVersionInfoSize = sizeof(ovi);
909-
GetVersionEx(&ovi);
910-
911-
g_PlatformId = ovi.dwPlatformId;
912-
done = TRUE;
913-
}
914-
}
915-
916-
# ifndef __BORLANDC__
890+
#ifndef __BORLANDC__
917891
static char *
918892
searchpath(char *name)
919893
{
@@ -922,28 +896,17 @@ searchpath(char *name)
922896

923897
// There appears to be a bug in FindExecutableA() on Windows NT.
924898
// Use FindExecutableW() instead...
925-
PlatformId();
926-
if (g_PlatformId == VER_PLATFORM_WIN32_NT)
899+
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)name, -1,
900+
(LPWSTR)widename, BUFSIZE);
901+
if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"",
902+
(LPWSTR)location) > (HINSTANCE)32)
927903
{
928-
MultiByteToWideChar(CP_ACP, 0, (LPCTSTR)name, -1,
929-
(LPWSTR)widename, BUFSIZE);
930-
if (FindExecutableW((LPCWSTR)widename, (LPCWSTR)"",
931-
(LPWSTR)location) > (HINSTANCE)32)
932-
{
933-
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1,
934-
(LPSTR)widename, 2 * BUFSIZE, NULL, NULL);
935-
return widename;
936-
}
937-
}
938-
else
939-
{
940-
if (FindExecutableA((LPCTSTR)name, (LPCTSTR)"",
941-
(LPTSTR)location) > (HINSTANCE)32)
942-
return location;
904+
WideCharToMultiByte(CP_ACP, 0, (LPWSTR)location, -1,
905+
(LPSTR)widename, 2 * BUFSIZE, NULL, NULL);
906+
return widename;
943907
}
944908
return (char *)"";
945909
}
946-
# endif
947910
#endif
948911

949912
STDMETHODIMP CShellExt::InvokeGvim(HWND hParent,

0 commit comments

Comments
 (0)