Hello! A few weeks ago I have successfully built "Windows-v2.6.5-7" branch under MinGW. So, I decided to write document described all important issues and necessary steps. Here it is.
Notes: 1. I used Hyper-V virtual machine with Windows 2008R2 Standard Edition Server Core with Service Pack 1 installed. There is no Microsoft Visual Studio nor Platform SDK installation. 2. Some steps in this documents are related to Server Core only. Moreover, different operations can be performed by different ways. And remember: it is just draft document. 3. I do not know how original version of NUT for Windows has been built. It seems that some steps were very custom. Moreover, some libraries in original version are obsolete. I have tried to use the latest versions of software and libraries when possible, but I think that there are no problems with the elder ones. 4. I didn't test all compiled binaries and setup, just replaced some executable files (nut.exe, upsmon.exe, upsd.exe) in original installation and everything works fine. 5. I used some hard-coded file system paths in the document. If you will use other ones, please keep in mind that you need to modify the commands and patches which I have described. Any feedback would be very nice! Thanks, Denis HOW TO BUILD NUT WINDOWS PORT ============================= 1. MINGW INSTALLATION --------------------- Download MinGW network setup. URL: https://sourceforge.net/projects/mingw File: mingw-get-setup.exe Version: 0.6.2-beta-20131004-1 Run the setup and install MinGW into "C:\MinGW" directory with selected "Install support for graphical user interface" option. After installation of core files, deploy additional packages via MinGW Installation Manager: - mingw-developer-toolkit - mingw32-base - mingw32-gcc-g++ - mingw-base NOTES You will need to execute different commands in Windows Command Prompt to build NUT. Windows Command Prompt "cmd.exe" must be started with full administrator access token (Run as administrator). Hereinafter [cmd] marker means execution of one or more commands in Windows Command Prompt environment. Normalize MinGW and SYS installations: [cmd] C:\MinGW\msys\1.0\postinstall\pi.bat Accept all the questions and enter "C:/MinGW" value as MinGW installation. The normalization will create new mount point "/mingw" to "C:/MinGW" directory in "C:\MinGW\msys\1.0\etc\fstab" file. It is highly recommended to check the content of "fstab" file to be sure that everything has been done properly. Modify PATH-environment variable for MinGW binaries: [cmd] setx Path "%Path%;C:\MinGW\bin" /M NOTES You have to start MinGW Shell with full administrator access token and only under MINGW32 environment. Being stared under MSYS environment, the different errors may occur during NUT building. To start MinGW Shell you should use "C:\MinGW\msys\1.0\msys.bat" batch file. Please, keep in mind, that title of opened window must be "MINGW32:~", not "MSYS:~". Hereinafter [shell] marker means execution of one or more commands in MinGW shell under MINGW32 environment. 2. PYTHON INSTALLATION ---------------------- Download Python for Windows. URL: https://www.python.org/downloads File: python-2.7.11.msi Version: 2.7.11 NOTES Do not try to build Python from official sources, they do not support MinGW. Moreover, do not install nonofficial Python packages for MinGW, because this manual takes into account the specific of Python for Windows. Run the setup: [cmd] msiexec.exe /i python-2.7.11.msi Select "C:\Python26" as target directory and install all setup features except the following ones: - pip - Test suite Modify PATH-environment variable for Python binaries: [cmd] setx Path "%Path%;C:\Python27" /M Add mount point to Python installation: [shell] mount C:/Python27 /python 3. WIX INSTALLATION -------------------- Download WIX binaries. URL: https://wix.codeplex.com/releases File: wix310-binaries.zip Version: 3.10.2 NOTES Do not download WIX setup because it requires Microsoft Visual Studio. Unpack the binaries into "C:\Wix" directory. Install .NET Framework 2.0 (x64, x86): [cmd] dism /online /enable-feature /featurename:NetFx2-ServerCore dism /online /enable-feature /featurename:NetFx2-ServerCore-WOW64 Modify PATH-environment variable for WIX binaries: [cmd] setx Path "%Path%;C:\Wix" /M 4. DDK INSTALLATION ------------------- Download Windows Driver Kit. URL: https://www.microsoft.com/en-us/download/details.aspx?id=11800 File: GRMWDK_EN_7600_1.ISO Version: 7.1.0 Install WDK into "C:\WinDDK" directory with the following selected features: - Build environment - Tools 5. UNZIP INSTALLATION --------------------- Install unzip package: [shell] mingw-get install msys-unzip 6. PKG-CONFIG INSTALLATION -------------------------- Download pkg-config sources. URL: https://www.freedesktop.org/wiki/Software/pkg-config File: pkg-config-0.29.1.tar.gz Version: 0.29.1 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\pkg-config-0.29.1" directory and install pkg-config: [shell] cd /home/Administrator/pkg-config-0.29.1 ./configure --prefix=/mingw --with-internal-glib make make install 7. CPPUNIT INSTALLATION ----------------------- Download cppunit sources. URL: https://sourceforge.net/projects/cppunit File: cppunit-1.12.1.tar.gz Version: 1.12.1 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\cppunit-1.12.1" directory and install cppunit: [shell] cd /home/Administrator/cppunit-1.12.1 ./configure --prefix=/mingw make make install 8. REGEX INSTALLATION --------------------- Download regex sources. URL: https://sourceforge.net/projects/mingw/files/MSYS/Base/regex/regex-1.20090805-2 File: regex-1.20090805-2-msys-1.0.13-src.tar.lzma Version: 1.0.13 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\regex-1.0.13" directory and install regex: [shell] cd /home/Administrator/regex-1.0.13 ./configure --prefix=/mingw make make install 9. LIBXML INSTALLATION ---------------------- Download libxml sources. URL: http://www.xmlsoft.org/downloads.html File: libxml2-sources-2.9.3.tar.gz Version: 2.9.3 NOTES Do not try to build libxml from different sources or to install precompiled binaries. Most of them are incompatible with MinGW: xmlcatalog and xmllint programs will not work properly and will be regularly crashed (even MinGW version https://sourceforge.net/projects/mingw/files/MSYS/Extension/libxml2). Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\libxml2-2.7.6-1" directory. Patch "configure" file: BEGIN --- configure 2016-04-01 14:53:06 -0700 +++ configure-new 2016-04-01 14:43:29 -0700 @@ -15088,7 +15088,7 @@ if test "$PYTHON" != "" then PYTHON_VERSION=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_version())"` - PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"` +# PYTHON_INCLUDES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_inc())"` # does not work as it produce a /usr/lib/python path instead of/usr/lib64/python # # PYTHON_SITE_PACKAGES=`$PYTHON -c "from distutils import sysconfig; print(sysconfig.get_python_lib())"` END Install libxml: [shell] cd /home/Administrator/libxml2-2.7.6-1 ./configure --prefix=/mingw –with-python=/python make make install 10. LIBXSLT INSTALLATION ----------------------- Download libxslt sources. URL: http://xmlsoft.org/libxslt/downloads.html File: libxslt-1.1.28.zip Version: 1.1.28 NOTES You need to install libxslt by the same reasons as libxml: official MinGW version of xsltproc program works improperly. Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\libxslt-1.1.28" directory and install libxslt: [shell] cd /home/Administrator/libxslt-1.1.28 autogen.sh ./configure --prefix=/mingw --with-python=/python make make install 11. ZLIB INSTALLATION -------------------- Download zlib sources. URL: https://sourceforge.net/projects/mingw/files/MinGW/Extension/zlib File: zlib-1.2.7-1-mingw32-src.tar.lzma Version: 1.2.7-1 NOTES Installation of zlib library is optinal. If this step is skipped, you should not use "--with-zlib" switch during configure and have to remove "libz-1.dll" file from WIX project "NUT-Installer.xml" (described below). Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\zlib-1.2.8" directory. Patch "win32/makefile.gcc" file: BEGIN --- makefile.gcc 2012-05-02 20:17:59 -0700 +++ makefile-new.gcc 2016-04-03 12:48:45 -0700 @@ -30,7 +30,7 @@ # the DLL name should be changed from "zlib1.dll". STATICLIB = libz.a -SHAREDLIB = zlib1.dll +SHAREDLIB = libz-1.dll IMPLIB = libz.dll.a # @@ -64,7 +64,7 @@ INSTALL = $(CP) RM = rm -f -prefix ?= /usr/local +prefix ?= /mingw exec_prefix = $(prefix) OBJS = adler32.o compress.o crc32.o deflate.o gzclose.o gzlib.o gzread.o \ END Install zlib: [shell] cd /home/Administrator/zlib-1.2.8 make -fwin32/Makefile.gcc cp libz-1.dll /mingw/bin/ cp zlib.h /mingw/include/ cp libz.a /mingw/lib/ cp libz.dll.a /mingw/lib/ 12. NEON INSTALLATION --------------------- Download neon sources. URL: http://www.webdav.org/neon File: neon-0.30.1.tar.gz Version: 0.30.1 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\neon-0.30.1" directory and install neon: [shell] cd /home/Administrator/neon-0.30.1 autogen.sh ./configure --prefix=/mingw –enable-shared make make install 13. NET-SNMP INSTALLATION ------------------------- Download net-snmp sources. URL: http://www.net-snmp.org/download.html File: net-snmp-5.7.3.zip Version: 5.7.3 NOTES It is not possible to build shared version of net-snmp library by default. It seems that original setup of NUT for Windows 2.6.5-7 contains "libnetsnmp-30.dll" library what has been compiled manually. So, we need the same trick. Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\net-snmp-5.7.3" directory and install net-snmp: [shell] cd /home/Administrator/net-snmp-5.7.3 ./configure --prefix=/mingw --with-zlib --with-mibdirs=/mingw/share/snmp/mibs --with-mib-modules="agentx disman/event-mib" --disable-embedded-perl --without-perl-modules make cd snmplib make LDFLAGS="-no-undefined -lws2_32 -lregex -Xlinker --ignore-unresolved-symbol=_app_name_long" cd .. make install 14. LIBUSB INSTALLATION ----------------------- Download libusb binaries. URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0 File: libusb-win32-bin-1.2.6.0.zip Version: 1.2.6 Unpack the binaries into "C:\MinGW\msys\1.0\home\Administrator\libusb-1.2.6.0" directory and copy files: [cmd] xcopy C:\MinGW\msys\1.0\home\Administrator\libusb-1.2.6.0\include\lusb0_usb.h C:\MinGW\include\usb.h xcopy C:\MinGW\msys\1.0\home\Administrator\libusb-1.2.6.0\lib\gcc\libusb.a C:\MinGW\lib\libusb.a 15. ASCIIDOC INSTALLATION ------------------------- Download asciidoc binaries. URL: http://lrn.no-ip.info/other/mingw/mingw32/asciidoc/8.6.8-1 File: asciidoc-8.6.8-1-mingw32-bin.tar.lzma Version: 8.6.8-1 Unpack the binaries into "C:\MinGW\msys\1.0\home\Administrator\asciidoc-8.6.8-1" directory. Patch "bin/a2x" file: BEGIN --- a2x 2016-03-27 13:22:51 -0700 +++ a2x-new 2012-09-26 20:43:33 -0700 @@ -40,7 +40,7 @@ ENV = None # External executables. -ASCIIDOC = 'asciidoc.' +ASCIIDOC = 'asciidoc.py' XSLTPROC = 'xsltproc' DBLATEX = 'dblatex' # pdf generation. FOP = 'fop' # pdf generation (--fop option). @@ -489,7 +489,7 @@ self.asciidoc_opts += ' --doctype %s' % self.doctype for attr in self.attributes: self.asciidoc_opts += ' --attribute "%s"' % attr -# self.xsltproc_opts += ' --nonet' + self.xsltproc_opts += ' --nonet' if self.verbose: self.asciidoc_opts += ' --verbose' self.dblatex_opts += ' -V' @@ -650,7 +650,6 @@ self.to_docbook() docbook_file = self.dst_path('.xml') xhtml_file = self.dst_path('.html') + xhtml_file = xhtml_file.replace(r'C:', '') opts = '%s --output "%s"' % (self.xsltproc_opts, xhtml_file) exec_xsltproc(self.xsl_stylesheet(), docbook_file, self.destination_dir, opts) src_dir = os.path.dirname(self.asciidoc_file) END Copy the files: [cmd] xcopy /E C:\MinGW\msys\1.0\home\Administrator\asciidoc-8.6.8-1\*.* C:\MinGW\ 16. DOCBOOK-XML INSTALLATION ---------------------------- Download docbook-xml sources. URL: http://lrn.no-ip.info/other/mingw/mingw32/docbook-xml/4.5-1 File: docbook-xml-4.5-1-mingw32-src.tar.lzma Version: 4.5-1 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\docbook-xml-4.5-1" directory and install docbook-xml: [shell] cd /home/Administrator/docbook-xml-4.5-1 pkgbuild.sh cp -r inst/mingw/* /mingw/ cd /mingw/var/lib/mingw-get/scripts docbook-xml-4.5-1-post-install.sh Patch "/mingw/etc/xml/catalog" file: BEGIN --- catalog 2016-04-02 01:59:08 -0700 +++ catalog-new 2016-04-02 02:00:24 -0700 @@ -3,9 +3,9 @@ <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <delegateSystem systemIdStartString="http://docbook.org/xml/" catalog="./docbook-xml.xml"/> <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/" catalog="./docbook-xml.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ELEMENTS DocBook" catalog="./docbook-xml.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD DocBook XML" catalog="./docbook-xml.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD XML Exchange Table Model 19990315" catalog="./docbook-xml.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ENTITIES DocBook" catalog="./docbook-xml.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD DocBook CALS Table Model" catalog="./docbook-xml.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ELEMENTS DocBook" catalog="./docbook-xml.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML" catalog="./docbook-xml.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD XML Exchange Table Model 19990315" catalog="./docbook-xml.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook" catalog="./docbook-xml.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD DocBook CALS Table Model" catalog="./docbook-xml.xml"/> </catalog> END Patch "/mingw/etc/xml/docbook-xml.xml" file: BEGIN --- docbook-xml.xml 2016-04-02 01:59:09 -0700 +++ docbook-xml-new.xml 2016-04-02 02:00:41 -0700 @@ -3,13 +3,13 @@ <catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"> <delegateSystem systemIdStartString="http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> <delegateSystem systemIdStartString="http://docbook.org/xml/4.5/docbookx.dtd" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ELEMENTS DocBook Information Pool V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ENTITIES DocBook Additional General Entities V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ENTITIES DocBook Notations V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ENTITIES DocBook Character Entities V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ELEMENTS DocBook XML HTML Tables V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD DocBook XML V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/ELEMENTS DocBook Document Hierarchy V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD DocBook CALS Table Model V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> - <delegatePublic publicIdStartString="-/C:/MinGW/msys/1.0/OASIS/DTD XML Exchange Table Model 19990315/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ELEMENTS DocBook Information Pool V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook Additional General Entities V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook Notations V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ENTITIES DocBook Character Entities V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ELEMENTS DocBook XML HTML Tables V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD DocBook XML V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/ELEMENTS DocBook Document Hierarchy V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD DocBook CALS Table Model V4.5/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> + <delegatePublic publicIdStartString="-//OASIS/DTD XML Exchange Table Model 19990315/EN" catalog="../../share/xml/docbook/schema/dtd/4.5/catalog.xml"/> </catalog> END 17. DOCBOOK-XLS INSTALLATION ---------------------------- Download docbook-xls sources. URL: http://lrn.no-ip.info/other/mingw/mingw32/docbook-xsl/1.76.1-2 File: docbook-xsl-1.76.1-2-mingw32-src.tar.lzma Version: 1.76.1-2 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\docbook-xsl-1.76.1-2" directory and install docbook-xls: [shell] cd /home/Administrator/docbook-xsl-1.76.1-2 pkgbuild.sh cp -r inst/mingw/* /mingw/ cd /mingw/var/lib/mingw-get/scripts docbook-xsl-1.76.1-2-post-install.sh 18. NUT BUILD ------------- Download NUT Windows Port sources. URL: https://github.com/networkupstools/nut/tree/Windows-v2.6.5-7 File: nut-Windows-v2.6.5-7.zip Version: 2.6.5-7 NOTES: It looks like the original binaries of NUT for Windows 2.6.5-7 were built using MinGW environment with Microsoft Platform SDK installed. The sources have included file "wspiapi.h" which is not presented in MinGW installation but exists in Microsoft Platform SDK. This include is not required and must be removed. Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7" directory. Patch "m4/nut_check_libneon.m4" file: BEGIN --- nut_check_libneon.m4 2015-12-29 01:00:17 -0800 +++ nut_check_libneon-new.m4 2016-04-03 04:31:44 -0700 @@ -52,7 +52,7 @@ dnl check if neon is usable AC_CHECK_HEADERS(ne_xmlreq.h, [nut_have_neon=yes], [nut_have_neon=no], [AC_INCLUDES_DEFAULT]) - AC_CHECK_FUNCS(ne_xml_dispatch_request, [], [nut_have_neon=no]) + dnl AC_CHECK_FUNCS(ne_xml_dispatch_request, [], [nut_have_neon=no]) if test "${nut_have_neon}" = "yes"; then dnl Check for connect timeout support in library (optional) END Patch "client/upsclient.c" file: BEGIN --- upsclient.c 2015-12-29 01:00:17 -0800 +++ upsclient-new.c 2016-04-02 02:26:45 -0700 @@ -45,7 +45,6 @@ /* Those 2 files for support of getaddrinfo, getnameinfo and freeaddrinfo on Windows 2000 and older versions */ #include <ws2tcpip.h> -#include <wspiapi.h> /* This override network system calls to adapt to Windows specificity */ #define W32_NETWORK_CALL_OVERRIDE #include "wincompat.h" END Patch "server/upsd.c" file: BEGIN --- upsd.c 2015-12-29 01:00:17 -0800 +++ upsd-new.c 2016-04-02 02:28:24 -0700 @@ -36,7 +36,6 @@ /* Those 2 files for support of getaddrinfo, getnameinfo and freeaddrinfo on Windows 2000 and older versions */ #include <ws2tcpip.h> -#include <wspiapi.h> /* This override network system calls to adapt to Windows specificity */ #define W32_NETWORK_CALL_OVERRIDE #include "wincompat.h" END Patch "tools/nut-scanner/nutscan-ip.c" file: BEGIN --- nutscan-ip.c 2015-12-29 01:00:17 -0800 +++ nutscan-ip-new.c 2016-04-02 02:29:54 -0700 @@ -28,7 +28,6 @@ /* Those 2 files for support of getaddrinfo, getnameinfo and freeaddrinfo on Windows 2000 and older versions */ #include <ws2tcpip.h> -#include <wspiapi.h> #define AI_NUMERICSERV NI_NUMERICSERV #include "wincompat.h" #endif END Patch "tools/nut-scanner/scan_xml_http.c" file: BEGIN --- scan_xml_http.c 2015-12-29 01:00:17 -0800 +++ scan_xml_http-new.c 2016-04-02 02:31:11 -0700 @@ -33,7 +33,6 @@ /* Those 2 files for support of getaddrinfo, getnameinfo and freeaddrinfo on Windows 2000 and older versions */ #include <ws2tcpip.h> -#include <wspiapi.h> #endif #include <string.h> END Build NUT: [shell] cd /home/Administrator/nut-2.6.5-7 autogen.sh ./configure --with-doc=html-single CPPFLAGS="-DWINVER=0x0501 -D_WIN32_WINNT=0x0501" export XML_CATALOG_FILES=/mingw/etc/xml/catalog make cd /docs/man make html-man 19. LIBWDI INSTALLATION ----------------------- Download libwdi sources. URL: https://sourceforge.net/projects/libwdi/files/releases File: libwdi-1.2.5.tar.gz Version: 1.2.5 Unpack the sources into "C:\MinGW\msys\1.0\home\Administrator\libwdi-1.2.5" directory. Copy "wdi-simple.c" file from NUT sources directory: [shell] cd /home/administrator/libwdi-1.2.5 cp /home/Administrator/nut-2.6.5-7/scripts/Windows/DriverInstaller/wdi-simple.c examples/ Patch "msvc/config.h" file: BEGIN --- config.h 2016-01-22 09:50:46 -0800 +++ config-new.h 2016-04-02 13:34:35 -0700 @@ -21,26 +21,26 @@ * match your WinUSB redist directrories */ #ifndef DDK_DIR -#define DDK_DIR "C:/Program Files (x86)/Windows Kits/10" +#define DDK_DIR "C:/WinDDK/7600.16385.1" #endif /* DDK WDF coinstaller version */ -#define WDF_VER 1011 +#define WDF_VER 1009 /* CoInstaller subdirectory for WinUSB redist files ("winusb" or "wdf") */ -#define COINSTALLER_DIR "wdf" +#define COINSTALLER_DIR "winusb" /* 64bit subdirectory for WinUSB redist files ("x64" or "amd64") */ -#define X64_DIR "x64" +#define X64_DIR "amd64" /* embed libusb0 driver files from the following location */ #ifndef LIBUSB0_DIR -#define LIBUSB0_DIR "D:/libusb-win32" +#define LIBUSB0_DIR "C:/MinGW/msys/1.0/home/Administrator/libusb-1.2.6.0" #endif /* embed libusbK driver files from the following location */ #ifndef LIBUSBK_DIR -#define LIBUSBK_DIR "D:/libusbK/bin" +// #define LIBUSBK_DIR "D:/libusbK/bin" #endif /* embed user defined driver files from the following location */ END Patch "libwdi/.msvc/libwdi_sources" file: BEGIN --- libwdi_sources 2016-01-22 09:50:46 -0800 +++ libwdi_sources-new 2016-04-02 13:36:07 -0700 @@ -9,7 +9,7 @@ USE_MSVCRT=1 INCLUDES=..\msvc;$(DDK_INC_PATH) -C_DEFINES = $(C_DEFINES) /DDDKBUILD $(DLL_DEFINES) +C_DEFINES = $(C_DEFINES) /DDDKBUILD /DCALG_SHA_256=0x0000800C $(DLL_DEFINES) LINKER_FLAGS=/ignore:4006 # naked calls to 'build' ignores SOURCELIBS => we can't create a static lib END Patch "examples/.msvc/wdi-simple_sources" file: BEGIN --- wdi-simple_sources 2016-01-22 09:50:46 -0800 +++ wdi-simple_sources-new 2016-04-02 13:51:09 -0700 @@ -4,13 +4,13 @@ UMENTRY=main !IFNDEF MSC_WARNING_LEVEL -MSC_WARNING_LEVEL=/W3 +MSC_WARNING_LEVEL=/W1 !ENDIF USE_MSVCRT=1 -INCLUDES=..\msvc;..\libwdi;$(DDK_INC_PATH) -C_DEFINES = $(C_DEFINES) /DDDKBUILD +INCLUDES=..\msvc;..\libwdi;C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7\include;C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7\tools\nut-scanner;$(DDK_INC_PATH) +C_DEFINES = $(C_DEFINES) /Dbool=int /Dtrue=1 /Dfalse=0 /DDDKBUILD TARGETLIBS=$(SDK_LIB_PATH)\kernel32.lib \ $(SDK_LIB_PATH)\user32.lib \ END Patch "examples/.msvc/zadic_sources" file: BEGIN --- zadic_sources 2016-01-22 09:50:46 -0800 +++ zadic_sources-new 2016-04-02 13:45:08 -0700 @@ -4,7 +4,7 @@ UMENTRY=main !IFNDEF MSC_WARNING_LEVEL -MSC_WARNING_LEVEL=/W3 +MSC_WARNING_LEVEL=/W1 !ENDIF USE_MSVCRT=1 END Build libwdi: [cmd] C:\WinDDK\7600.16385.1\bin\setenv.bat C:\WinDDK\7600.16385.1 free WXP cd C:\MinGW\msys\1.0\home\Administrator\libwdi-1.2.5 ddk_build.cmd 20. NUT SETUP BUILD ------------------- Build NUT setup: [cmd] cd C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7\scripts\Windows\Installer xcopy C:\MinGW\msys\1.0\home\Administrator\libwdi-1.2.5\examples\wdi-simple.exe ImageFiles\Others\ xcopy C:\MinGW\bin\pthreadGC2.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libexpat-1.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libiconv-2.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libintl-8.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libgcc_s_dw2-1.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libltdl-7.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libneon-27.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libnetsnmp-30.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libregex-1.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libxml2-2.dll ImageFiles\Others\ xcopy C:\MinGW\bin\libz-1.dll ImageFiles\Others\ Patch "NUT-Installer.xml" file: BEGIN --- NUT-Installer.xml 2015-12-29 01:00:17 -0800 +++ NUT-Installer-new.xml 2016-04-08 13:38:48 -0700 @@ -1221,6 +1221,9 @@ <Component Id="libz_1.dll" Guid="9F8DFF6E-95D8-4084-83AA-9304D1E72BA1"> <File Id="libz_1.dll" Name="libz-1.dll" Source="ImageFiles\others\libz-1.dll" /> </Component> + <Component Id="libxml2_2.dll" Guid="595F6CD3-8158-4F2C-BE97-F7304590253B"> + <File Id="libxml2_2.dll" Name="libxml2-2.dll" Source="ImageFiles\others\libxml2-2.dll" /> + </Component> <Component Id="apcsmart.exe" Guid="BEDE6095-3FAF-49C4-8AF4-8F0A2EDB8EAE"> <File Id="apcsmart.exe" Name="apcsmart.exe" Source="..\..\..\drivers\.libs\apcsmart.exe" /> </Component> @@ -1837,6 +1840,7 @@ <ComponentRef Id="libiconv_2.dll" /> <ComponentRef Id="libintl_8.dll" /> <ComponentRef Id="libz_1.dll" /> + <ComponentRef Id="libxml2_2.dll" /> <ComponentRef Id="libneon_27.dll" /> <ComponentRef Id="libnetsnmp_30.dll" /> <ComponentRef Id="apcsmart.exe" /> END Build NUT setup: [cmd] cd C:\MinGW\msys\1.0\home\Administrator\nut-2.6.5-7\scripts\Windows\Installer BuildInstaller.bat "NUT-Installer.msi" file should be created. Check file "log.txt" for errors. _______________________________________________ Nut-upsdev mailing list Nut-upsdev@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/nut-upsdev