]> granicus.if.org Git - vim/commitdiff
patch 8.2.4524: MS-Windows: cannot build with some sodium libraries v8.2.4524
authorK.Takata <kentkt@csc.jp>
Mon, 7 Mar 2022 15:16:15 +0000 (15:16 +0000)
committerBram Moolenaar <Bram@vim.org>
Mon, 7 Mar 2022 15:16:15 +0000 (15:16 +0000)
Problem:    MS-Windows: cannot build with some sodium libraries.
Solution:   Make the DLL name configuragle.  Add build instructions.
            (Ken Takata, closes #9905)

src/INSTALLpc.txt
src/Make_cyg_ming.mak
src/Make_mvc.mak
src/crypt.c
src/version.c

index b70758c9f7d8ad13408ccfd6fe2a7b791e30b232..51b315b234c5070276f30c7c03545e04bd762b3d 100644 (file)
@@ -34,10 +34,11 @@ Contents:
 11. Building with Ruby support
 12. Building with Tcl support
 13. Building with DirectX (DirectWrite) support
-14. Windows 3.1
-15. MS-DOS
+14. Building with libsodium support
+15. Windows 3.1
+16. MS-DOS
 
-16. Installing after building from sources
+17. Installing after building from sources
 
 
 The currently recommended way (that means it has been verified to work) is
@@ -247,9 +248,6 @@ MSYS2 has its own git package, and you can also install it via pacman:
 
     $ pacman -S git
 
-For enabling libsodium support, you also need to install the package
-
-    $ pacman -S mingw-w64-x86_64-libsodium
 
 2.3. Keep the build environment up-to-date
 
@@ -846,20 +844,55 @@ Just set DIRECTX to yes:
     mingw32-make -f Make_ming.mak DIRECTX=yes
 
 
-14. Windows 3.1x
+14. Building with libsodium support
+===================================
+
+For better encryption support, you can build Vim with libsodium.
+
+A) Using MSVC
+
+You can download the latest libsodium library from here:
+       https://download.libsodium.org/libsodium/releases/
+
+At this moment, libsodium-1.0.18-stable-msvc.zip is the latest package.
+Unpack it to anywhere you like, and specify the path to the SODIUM option:
+
+    nmake -f Make_mvc.mak SODIUM=C:/path/to/libsodium
+    (libsodium.dll will be used as the libsodium DLL name.)
+
+B) Using MinGW
+
+If you use msys2, you can install the libsodium package by pacman (or pacboy):
+
+    $ pacman -S mingw-w64-x86_64-libsodium     # for 64-bit Vim
+    $ pacman -S mingw-w64-i686-libsodium       # for 32-bit Vim
+    $ pacboy -S libsodium:m            # for both 32-bit and 64-bit Vim
+
+Then set SODIUM to yes:
+
+    mingw32-make -f Make_ming.mak SODIUM=yes
+    (libsodium-23.dll will be used as the libsodium DLL name.)
+
+Or you can set the path to libsodium explicitly:
+
+    mingw32-make -f Make_ming.mak SODIUM=C:/path/to/libsodium
+    (libsodium.dll will be used as the libsodium DLL name.)
+
+
+15. Windows 3.1x
 ================
 
 The Windows 3.1x support was removed in patch 7.4.1364.
 
 
-15. MS-DOS
+16. MS-DOS
 ==========
 
 The MS-DOS support was removed in patch 7.4.1399.  Only very old Vim versions
 work on MS-DOS because of the limited amount of memory available.
 
 
-16. Installing after building from sources
+17. Installing after building from sources
 ==========================================
 
 [provided by Michael Soyka, updated by Ken Takata]
index 7c1cbd9c9a92392015b7646c0d8b0aa24f79b006..a2d8f3b1e58ea62c9b1e4ede1a505959c98e9444 100644 (file)
@@ -670,14 +670,17 @@ endif
 
 ifdef SODIUM
 DEFINES += -DHAVE_SODIUM
- ifneq ($(SODIUM),yes)
+ ifeq ($(SODIUM),yes)
+SODIUM_DLL = libsodium-23.dll
+ else
+SODIUM_DLL = libsodium.dll
 CFLAGS += -I $(SODIUM)/include
  endif
  ifndef DYNAMIC_SODIUM
 DYNAMIC_SODIUM=yes
  endif
  ifeq ($(DYNAMIC_SODIUM),yes)
-DEFINES += -DDYNAMIC_SODIUM
+DEFINES += -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"$(SODIUM_DLL)\"
  else
 SODIUMLIB = -lsodium
  endif
index 7b16c59714826762496e207bb5ec0b728b4c9e03..aaaf5303ddab16fb752c8a6f287f57cb11f72a8f 100644 (file)
@@ -391,7 +391,8 @@ SODIUM = no
 !if "$(SODIUM)" != "no"
 SOD_INC                = /I "$(SODIUM)\include"
 ! if "$(DYNAMIC_SODIUM)" == "yes"
-SOD_DEFS       = -DHAVE_SODIUM -DDYNAMIC_SODIUM
+SODIUM_DLL     = libsodium.dll
+SOD_DEFS       = -DHAVE_SODIUM -DDYNAMIC_SODIUM -DDYNAMIC_SODIUM_DLL=\"$(SODIUM_DLL)\"
 SOD_LIB                =
 ! else
 SOD_DEFS       = -DHAVE_SODIUM
index d66e50cc48a8bdb39ade85834a1b4624a2cd2609..86f48463686647a25e199f4eb9bb711c3a95123a 100644 (file)
@@ -251,7 +251,7 @@ static struct {
 sodium_runtime_link_init(int verbose)
 {
     static HINSTANCE hsodium = NULL;
-    const char *libname = "libsodium.dll";
+    const char *libname = DYNAMIC_SODIUM_DLL;
     int i;
 
     if (hsodium != NULL)
@@ -270,7 +270,7 @@ sodium_runtime_link_init(int verbose)
        if ((*sodium_funcname_table[i].ptr = symbol_from_dll(hsodium,
                        sodium_funcname_table[i].name)) == NULL)
        {
-           FreeLibrary(hsodium);
+           close_dll(hsodium);
            hsodium = NULL;
            if (verbose)
                semsg(_(e_could_not_load_library_function_str), sodium_funcname_table[i].name);
index a2f9d297f296f959065e2ce32d180ccd14494b8b..450d49bf17928ac2214646b0e738c163caab71af 100644 (file)
@@ -750,6 +750,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    4524,
 /**/
     4523,
 /**/