diff --git a/doc/installation.xml b/doc/installation.xml index 8533c22c..81bb9aab 100644 --- a/doc/installation.xml +++ b/doc/installation.xml @@ -11,7 +11,7 @@ Debian GNU/Linux, Ubuntu Linux, MAC OSX, - Windows 7. + Windows. @@ -285,13 +285,61 @@ &zebra; is shipped with "makefiles" for the NMAKE tool that comes with Microsoft Visual C++. - Version 2013 has been tested. + Visual Studio 2022 Build Tools has been tested. - Start a command prompt and switch the sub directory - WIN where the file makefile - is located. Customize the installation by editing the - makefile file (for example by using notepad). + Open a Visual Studio developer command prompt for the target + architecture, for example the x64 Native Tools Command Prompt. + Use the same architecture for &yaz;, &zebra;, and their dependencies. + The makefiles select BARCH from the Visual Studio + environment variable VSCMD_ARG_TGT_ARCH, falling + back to x64 if it is not set. You can override + this with nmake BARCH=x86 or + nmake BARCH=x64; the compiler environment must + match the selected architecture. + + + Install libxml2, libxslt, ICU, Expat, libiconv, and bzip2 with vcpkg. + For an x64 build with vcpkg installed in c:\vcpkg, + run: + + c:\vcpkg\vcpkg install libxml2:x64-windows libxslt:x64-windows icu:x64-windows expat:x64-windows libiconv:x64-windows bzip2:x64-windows + + For an x86 build, use x86-windows instead. + The makefiles use the DLL-based vcpkg triplets and expect headers, + import libraries, and DLLs under + c:\vcpkg\installed\$(BARCH)-windows. + If vcpkg is installed elsewhere, adjust the dependency paths in + both makefiles. + + + When building from Git, initialize the submodules in both source + repositories before compiling: + + git submodule update --init --recursive + + In particular, the m4 submodule supplies the + Tcl script that generates version information. Ensure that + tclsh is on your PATH, or set + TCL in the makefiles to its location. The default + &yaz; build also uses win_bison to generate its + CQL parser. + + + Place the &yaz; and &zebra; source directories next to each other, + named yaz and idzebra. + Build &yaz; first, then &zebra;, from their respective + win directories: + + cd yaz\win + nmake + cd ..\..\idzebra\win + nmake + + + + Customize the build by editing win\makefile + or overriding settings on the NMAKE command line. The following summarizes the most important settings in that file: @@ -306,13 +354,24 @@ + BARCH + + Target architecture, x86 or + x64. This also selects the vcpkg installation + directory, as described above. + + + YAZDIR - Directory of &yaz; source. &zebra;'s makefile expects to find - YAZ.lib, YAZ.dll - in yazdir/lib and - yazdir/bin respectively. + Directory of &yaz; source, defaulting to the sibling + yaz directory. &zebra;'s makefile expects + headers under src, import libraries such + as yaz5.lib and yaz_icu5.lib + under lib, and DLLs under + bin. Debug builds use the corresponding + names with a d suffix. @@ -323,21 +382,47 @@ If HAVE_EXPAT is set to 1, &zebra; is compiled with Expat support. - In this configuration, set - ZEBRA_DIR to the Expat source directory. - Windows version of Expat can be downloaded from - SourceForge. + EXPAT_DIR defaults to + c:\vcpkg\installed\$(BARCH)-windows, with + headers in include, + libexpat.lib in lib, + and libexpat.dll in bin. + + + + + HAVE_LIBXML2, LIBXML2_DIR, + HAVE_LIBXSLT, LIBXSLT_DIR + + Enable libxml2 and libxslt support, including the DOM XML and + ALVIS filters. Both are enabled by default, and both directories + default to c:\vcpkg\installed\$(BARCH)-windows. + + + + + HAVE_ICU, ICU_BASE, + ICU_VER + + Enable ICU support through &yaz;. ICU is enabled by default, + with ICU_BASE set to + c:\vcpkg\installed\$(BARCH)-windows. + Set ICU_VER to the major version installed + by vcpkg so the makefile copies the correct versioned DLLs. + Keep this setting consistent with the &yaz; makefile. - BZIP2INCLUDE, - BZIP2LIB, - BZIP2DEF - + HAVE_BZIP2, BZIP2_DIR - Define these symbols if &zebra; is to be compiled with - BZIP2 record compression support. + BZIP2 record compression support + is enabled by default. BZIP2_DIR defaults to + c:\vcpkg\installed\$(BARCH)-windows, with + bzlib.h in include, + bz2.lib in lib, and + bz2.dll in bin. + Set HAVE_BZIP2=0 to disable this support. @@ -348,7 +433,7 @@ The DEBUG setting in the makefile for &zebra; must be set to the same value as DEBUG setting in the makefile for &yaz;. - If not, the &zebra; server/indexer will crash. + The default is DEBUG=0 in both makefiles. @@ -360,11 +445,9 @@ If the nmake command is not found on your system - you probably haven't defined the environment variables required to - use that tool. To fix that, find and run the batch file - vcvars32.bat. You need to run it from within - the command prompt or set the environment variables "globally"; - otherwise it doesn't work. + open a Visual Studio developer command prompt with the C++ build + tools installed. This sets the compiler, linker, and Windows SDK + environment for the selected target architecture. @@ -392,6 +475,13 @@ + + These paths are relative to the &zebra; source directory. The build + also copies the &yaz; and vcpkg runtime DLLs into + bin, including the libxml2 dependencies zlib + and libiconv. Keep these DLLs alongside the executables when + running or copying them to another directory. + diff --git a/win/makefile b/win/makefile index 80bc4c2c..59dbd4de 100644 --- a/win/makefile +++ b/win/makefile @@ -5,7 +5,16 @@ ########################################################### DEBUG=0 # 0 for release, 1 for debug -BARCH = 32 + +# Target architecture: x86 or x64 +!IFNDEF BARCH +!IFDEF VSCMD_ARG_TGT_ARCH +BARCH = $(VSCMD_ARG_TGT_ARCH) +!ELSE +BARCH = x64 +!ENDIF +!ENDIF + USE_MANIFEST = 0 # TCL is optional - ONLY needed for source straight from Git @@ -19,24 +28,29 @@ ICONV_DIR=c:\iconv-1.9.2.win32 # EXPAT is optional. It's required for grs.xml-filters. HAVE_EXPAT=1 -EXPAT_DIR=c:\Program files (x86)\Expat 2.5.0 +EXPAT_DIR=c:\vcpkg\installed\$(BARCH)-windows # ICU support HAVE_ICU=1 -ICU_VER=68 -ICU_BASE=c:\icu4c-$(ICU_VER)_2-Win$(BARCH)-MSVC2019 +ICU_VER=78 +ICU_BASE=c:\vcpkg\installed\$(BARCH)-windows +ICU_BIN=$(ICU_BASE)\bin ICU_INCLUDE=$(ICU_BASE)\include # libxslt. For mod_dom and mod_alvis HAVE_LIBXSLT=1 -LIBXSLT_DIR=c:\libxslt-1.1.28.win$(BARCH) +LIBXSLT_DIR=c:\vcpkg\installed\$(BARCH)-windows # libxml2. Used by libxslt HAVE_LIBXML2=1 -LIBXML2_DIR=c:\libxml2-2.9.2.win$(BARCH) +LIBXML2_DIR=c:\vcpkg\installed\$(BARCH)-windows + +# BZIP2 record compression support +HAVE_BZIP2=1 +BZIP2_DIR=c:\vcpkg\installed\$(BARCH)-windows default: all -all: dirs generate expat iconv yaz dll zserver zebraidx tstflock +all: dirs generate expat iconv icu libxml2 libxslt bzip2 yaz dll zserver zebraidx tstflock # Directories # The current directory is supposed to be something like @@ -63,13 +77,6 @@ YAZ_DLL_SOURCE="$(YAZBINDIR)\yaz5.dll" YAZ_DLL_TARGET="$(BINDIR)\yaz5.dll" !endif -# BZIP2 settings. Uncomment and specify if you wish to use LIBBZIP2. -# (C) 1996-1999 Julian Seward http://www.bzip2.org - -#BZIP2INCLUDE=/I"$(ROOTDIR)\..\bzip2-0.9.5d" -#BZIP2LIB=$(ROOTDIR)\..\bzip2-0.9.5d\libbz2.lib -#BZIP2DEF=/D"HAVE_BZLIB_H=1" - # ZEBRA Include files, libraries, programs, etc. INCLDIR=$(ROOTDIR)\include # our includes LIBDIR=$(ROOTDIR)\lib # We produce .lib, .exp etc there @@ -111,7 +118,7 @@ dist: version.nsi nmake nsis nsis: version.nsi - $(NSIS) /DVSARCH=x86 zebra.nsi + $(NSIS) /DVSARCH=$(BARCH) zebra.nsi version.nsi: $(ROOTDIR)/IDMETA $(TCL) $(M4DIR)/mk_version.tcl $(ROOTDIR)/IDMETA version.nsi @@ -138,9 +145,24 @@ dll: $(DLL) # External libs and modules (enabled or disabled) +!if $(HAVE_BZIP2) +BZIP2INCLUDE=/I"$(BZIP2_DIR)\include" +BZIP2LIB="$(BZIP2_DIR)\lib\bz2.lib" +BZIP2DEF=/D HAVE_BZLIB_H=1 +bzip2: $(BINDIR)\bz2.dll + +$(BINDIR)\bz2.dll: + copy "$(BZIP2_DIR)\bin\bz2.dll" $(BINDIR) +!else +BZIP2INCLUDE= +BZIP2LIB= +BZIP2DEF=/D HAVE_BZLIB_H=0 +bzip2: +!endif + !if $(HAVE_EXPAT) -EXPAT_DEF= /D HAVE_EXPAT_H=1 /I"$(EXPAT_DIR)\source\lib" -EXPAT_LIB= "$(EXPAT_DIR)\bin\libexpat.lib" +EXPAT_DEF= /D HAVE_EXPAT_H=1 /I"$(EXPAT_DIR)\include" +EXPAT_LIB= "$(EXPAT_DIR)\lib\libexpat.lib" EXPAT_DLL_SOURCE= "$(EXPAT_DIR)\bin\libexpat.dll" EXPAT_DLL_TARGET= "$(BINDIR)\libexpat.dll" expat: $(EXPAT_DLL_TARGET) @@ -171,24 +193,45 @@ iconv: !if $(HAVE_LIBXML2) LIBXML2_LIB="$(LIBXML2_DIR)\lib\libxml2.lib" LIBXML2_DEF=/DYAZ_HAVE_XML2=1 /D HAVE_XML2=1 /I"$(LIBXML2_DIR)\include\libxml2" +libxml2: $(BINDIR)\libxml2.dll + +$(BINDIR)\libxml2.dll: + copy "$(LIBXML2_DIR)\bin\z.dll" $(BINDIR) + copy "$(LIBXML2_DIR)\bin\iconv-2.dll" $(BINDIR) + copy "$(LIBXML2_DIR)\bin\libxml2.dll" $(BINDIR) !else LIBXML2_LIB= LIBXML2_DEF=/D HAVE_XML2=0 +libxml2: !endif !if $(HAVE_LIBXSLT) LIBXSLT_LIB="$(LIBXSLT_DIR)\lib\libxslt.lib" LIBXSLT_DEF=/D HAVE_XSLT=1 /I"$(LIBXSLT_DIR)\include" +libxslt: $(BINDIR)\libxslt.dll + +$(BINDIR)\libxslt.dll: + copy "$(LIBXSLT_DIR)\bin\libxslt.dll" $(BINDIR) !else LIBXSLT_LIB= LIBXSLT_DEF=/D HAVE_XSLT=0 +libxslt: !endif !if $(HAVE_ICU) ICU_DEF= /DYAZ_HAVE_ICU=1 /I"$(ICU_INCLUDE)" +icu: $(BINDIR)\icudt$(ICU_VER).dll $(BINDIR)\icuin$(ICU_VER).dll $(BINDIR)\icuuc$(ICU_VER).dll + +$(BINDIR)\icudt$(ICU_VER).dll: + copy "$(ICU_BIN)\icudt$(ICU_VER).dll" $(BINDIR) +$(BINDIR)\icuin$(ICU_VER).dll: + copy "$(ICU_BIN)\icuin$(ICU_VER).dll" $(BINDIR) +$(BINDIR)\icuuc$(ICU_VER).dll: + copy "$(ICU_BIN)\icuuc$(ICU_VER).dll" $(BINDIR) !else ICU_DEF= /DYAZ_HAVE_ICU=0 +icu: !endif !if $(HAVE_LIBXSLT) @@ -276,7 +319,7 @@ MT=echo # wsock32.lib advapi32.lib \ LINK_LIBS= kernel32.lib advapi32.lib \ - $(ICONV_LIB) $(EXPAT_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB) + $(ICONV_LIB) $(EXPAT_LIB) $(LIBXML2_LIB) $(LIBXSLT_LIB) $(BZIP2LIB) COMMON_LNK_OPTIONS= /nologo /subsystem:windows /incremental:no @@ -309,7 +352,6 @@ LINK_PROGRAM= $(LINK) \ $(CLIENT_LINK_OPTIONS) \ $(IMPLIB) \ $(YAZLIB) \ - $(BZIP2LIB) \ $(LINK_LIBS)