This page contains the scripts/README.build-Windows
instructions and the scripts/build-w32.sh
and scripts/build-w64.h
files that describe cross-compiling Hamlib for MS Windows 32 and 64 bit versions on Debian GNU/Linux.
This file is a HOWTO for the cross-compiling of Windows 32 and 64 bit binary DLLs built from a tarball generated by 'make dist' in a Git checkout. The resulting DLLs are built with a cdecl interface compatible with MS VC++. Prerequisites ============= In these steps the release or daily snapshot tarball is unpacked in $HOME/builds for the Windows build and all operations are done from there unless otherwise noted. Under Linux you need at least the following packages: mingw-w64 cross-compiler zip create the archive tofrodos convert to DOS text format (CR/LF) groff convert nroff manual pages to HTML On Debian 8 (Jessie) and later versions the mingw-w64 package works and is being used to build the daily Windows 32/64 snapshots and stable releases. The release and daily snapshots are built in a Debian 10 (Buster) virtual machine. Finally, the Windows version of libusb 1.0 must be available for the USB backends to be built. Download the latest libusb-1.0 from: https://sourceforge.net/projects/libusb/files/libusb-1.0/ and unzip the archive in $HOME/builds. libusb 1.0.20 is known to work. Presumably, any 1.X.X version should work. Several variables may need to be set differently at the top of the script file depending on your system. The script now relies on a pair of environment variables to locate the needed libusb files. The script generates HTML documents for the included .EXE files using groff to convert the nroff formatted man pages. Build for Windows 32/64, cross-compile on Linux: ================================================ Extract the Hamlib tarball into $HOME/builds (if you prefer another directory be sure to edit the BUILD_DIR variable in the build-w[32|64].sh script): $ tar xvfz $HOME/Downloads/hamlib-4.2~git-???????-20210214.tar.gz Invoke the build-w[32|64].sh script (either requires a Bourne compatible shell, e.g. bash, dash, etc.) with the name of the directory/Hamlib version to build (you need not cd into the hamlib directory, although it won't hurt. The build-w[32|64].sh script uses absolute paths): $ build-w32.sh hamlib-4.2~git or: $ build-w64.sh hamlib-4.2~git Release Info ============ The structure of the archive is: $ tree -d . |-- bin |-- doc |-- include | `-- hamlib |-- lib |-- gcc `-- msvc 8 directories The bin/ directory is where the executables and DLL files are placed. Header files are under include/Hamlib/ and compiler specific files are under lib/*. HTML documents for the .EXE programs are in doc/ while text documents (READMEs and such) are in the main archive directory. The doc/ directory contains the classic Unix manual pages converted to HTML. The embedded README.w[32|64]-bin.txt file generated by the build-w[32|64].sh script describes setting the PATH environment variable in Windows 2000, Windows XP, and Windows 7. 73, Nate, N0NB
001: #!/bin/sh 002: 003: # Builds Hamlib 4.x W32 binary distribution. 004: 005: # A script to build a set of W32 binary DLLs and executables from a Hamlib 006: # source tarball. This script assumes that the Hamlib source tarball has been 007: # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has 008: # also been extracted to $BUILD_DIR. 009: 010: # See README.build-Windows for complete details. 011: 012: 013: # Set this to a desired directory 014: BUILD_DIR=~/builds 015: 016: # Set this to LibUSB archive extracted in $BUILD_DIR 017: LIBUSB_VER=libusb-1.0.24 018: 019: # Set to the correct HOST_ARCH= line for your MinGW installation 020: HOST_ARCH=i686-w64-mingw32 021: 022: # Set to the strip name for your version of MinGW 023: HOST_ARCH_STRIP=i686-w64-mingw32-strip 024: 025: # Set to the dlltool name for your version of MinGW 026: HOST_ARCH_DLLTOOL=i686-w64-mingw32-dlltool 027: 028: # Error return codes. See /usr/include/sysexits.h 029: EX_USAGE=64 030: EX_NOINPUT=66 031: 032: 033: # Pass name of Hamlib archive extracted in $BUILD_DIR 034: if test $# -ne 1 035: then 036: echo 037: echo "Usage: $(basename $0) hamlib-version" 038: echo "See README.build-Windows for more information." 039: echo 040: 041: exit ${EX_USAGE} 042: fi 043: 044: # Make sure the Hamlib archive is where we expect 045: if test -d ${BUILD_DIR}/$1 046: then 047: echo 048: echo "Building W32 binaries in ${BUILD_DIR}/$1" 049: echo 050: 051: cd ${BUILD_DIR}/$1 052: else 053: echo 054: echo "Build directory, ${BUILD_DIR}/$1 not found!" 055: echo "Check path for $1 or correct the version number." 056: echo 057: 058: exit ${EX_NOINPUT} 059: fi 060: 061: RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac) 062: HL_FILENAME=hamlib-w32-${RELEASE} 063: INST_DIR=$(pwd)/mingw32-inst 064: ZIP_DIR=$(pwd)/${HL_FILENAME} 065: LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} 066: 067: 068: # Create W32 specific README.w32-bin file 069: cat > README.w32-bin <<END_OF_README 070: What is it? 071: =========== 072: 073: This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE 074: cross-compiled for MS Windows 32 bit using MinGW under Debian GNU/Linux 10 075: (nice, heh!). 076: 077: This software is copyrighted. The library license is LGPL, and the *.EXE files 078: licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt, 079: COPYING.txt, and COPYING.LIB.txt files. 080: 081: Supporting documentation in the form of Unix manual pages have also been 082: included after being converted to HTML. 083: 084: 085: Installation and Configuration 086: ============================== 087: 088: Extract the ZIP archive into a convenient location, C:\Program Files is a 089: reasonable choice. 090: 091: Make sure *all* the .DLL files are in your PATH (leave them in the bin 092: directory and set the PATH). To set the PATH environment variable in Windows 093: 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the 094: following: 095: 096: * W2k/XP: Right-click on "My Computer" 097: Win7: Right-click on "Computer" 098: 099: * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog 100: Win7: Click the "Advanced system settings" link in the System dialog 101: 102: * Click the "Environment Variables" button of the pop-up dialog 103: 104: * Select "Path" in the "System variables" box of the "Environment Variables" 105: dialog 106: 107: NB: If you are not the administrator, system policy may not allow editing 108: the path variable. The complete path to an executable file will need to be 109: given to run one of the Hamlib programs. 110: 111: * Click the Edit button 112: 113: * Now add the Hamlib path in the "Variable Value:" edit box. Be sure to put 114: a semi-colon ';' after the last path before adding the Hamlib path (NB. The 115: entire path is highlighted and will be erased upon typing a character so 116: click in the box to unselect the text first. The PATH is important!!) 117: Append the Hamlib path, e.g. C:\Program Files\hamlib-w32-4.0~git\bin 118: 119: * Click OK for all three dialog boxes to save your changes. 120: 121: 122: Testing with the Hamlib Utilities 123: ================================= 124: 125: To continue, be sure you have read the README.betatester file, especially the 126: "Testing Hamlib" section. The primary means of testing is by way of the 127: rigctl utility for radios and rotctl utility for rotators. Each is a command 128: line program that is interactive or can act on a single command and exit. 129: 130: Documentation for each utility can be found as an HTML file in the doc 131: directory. 132: 133: In short, the command syntax is of the form: 134: 135: rigctl -m 1020 -r COM1 -vvvvv 136: 137: -m -> Radio model 1020, or Yaesu FT-817 (use 'rigctl -l' for a list) 138: -r -> Radio device, in this case COM1 139: -v -> Verbosity level. For testing four or five v characters are required. 140: Five 'v's set a debug level of TRACE which generates a lot of screen 141: output showing communication to the radio and values of important 142: variables. These traces are vital information for Hamlib rig backend 143: development. 144: 145: To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the 146: dialog). If text scrolls off the screen, you can scroll back with the mouse. 147: To copy output text into a mailer or editor (I recommend Notepad++, a free 148: editor also licensed under the GPL), highlight the text as a rectangle in the 149: cmd window, press <Enter> (or right-click the window icon in the upper left 150: corner and select Edit, then Copy), and paste it into your editor with Ctl-V 151: (or Edit|Paste from the typical GUI menu). 152: 153: All feedback is welcome to the mail address below. 154: 155: 156: Uninstall 157: ========= 158: 159: To uninstall, simply delete the Hamlib directory. You may wish to edit the 160: PATH as above to remove the Hamlib bin path, if desired. 161: 162: 163: Information for w32 Programmers 164: ================================= 165: 166: The DLL has a cdecl interface. 167: 168: There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in 169: lib/msvc. Refer to the sample commands below to generate a local 170: libhamlib-4.lib file for use with the VC++/VS linker. 171: 172: Simply #include <hamlib/rig.h> (add directory to include path), include 173: libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot 174: compile all the Hamlib code, but the API defined by rig.h has been made MSVC 175: friendly :-) 176: 177: As the source code for the library DLLs is licensed under the LGPL, your 178: program is not considered a "derivative work" when using the published Hamlib 179: API and normal linking to the front-end library, and may be of a license of 180: your choosing. 181: 182: As of 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. 183: If this file does not work for your project, follow the steps in the following 184: section: 185: 186: For linking the library with MS Visual C++ 2003, from the directory you 187: installed Hamlib run the following commands to generate the libhamlib-4.lib 188: file needed for linking with your MSVC project: 189: 190: cd lib\msvc 191: c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 192: 193: To do the same for Visual Studio 2017: 194: 195: cd lib\msvc 196: c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 197: 198: For VS 2019: 199: 200: cd lib\msvc 201: c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 202: 203: NOTE: feedback is requested on the previous two command examples! 204: 205: The published Hamlib API may be found at: 206: 207: http://hamlib.sourceforge.net/manuals/4.1/index.html 208: 209: 210: Thank You! 211: ========== 212: 213: Patches, feedback, and contributions are welcome. 214: 215: Please report problems or success to hamlib-developer@lists.sourceforge.net 216: 217: Cheers, 218: Stephane Fillod - F8CFE 219: Mike Black - W9MDB 220: Nate Bargmann - N0NB 221: http://www.hamlib.org 222: 223: END_OF_README 224: 225: 226: # Configure and build hamlib for i686-w64-mingw32, with libusb-1.0 227: 228: ./configure --host=${HOST_ARCH} \ 229: --prefix=${INST_DIR} \ 230: --without-cxx-binding \ 231: --disable-static \ 232: CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \ 233: LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW32/dll" 234: 235: 236: make -j 4 install 237: 238: mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc 239: cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def 240: todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def 241: cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. 242: todos ${ZIP_DIR}/include/hamlib/*.h 243: 244: # C++ binding is useless on w32 because of ABI 245: for f in *class.h 246: do 247: rm ${ZIP_DIR}/include/hamlib/${f} 248: done 249: 250: for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README.md README.betatester README.w32-bin THANKS 251: do 252: cp -a ${f} ${ZIP_DIR}/${f}.txt 253: todos ${ZIP_DIR}/${f}.txt 254: done 255: 256: # Generate HTML documents from nroff formatted man files 257: for f in doc/man1/*.1 doc/man7/*.7 258: do 259: /usr/bin/groff -mandoc -Thtml >${f}.html ${f} 260: cp -a ${f}.html ${ZIP_DIR}/doc/. 261: done 262: 263: cd ${BUILD_DIR}/$1 264: 265: # Copy build files into specific locations for Zip file 266: for f in *.exe 267: do 268: cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. 269: done 270: 271: cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. 272: cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. 273: 274: # NB: Strip Hamlib DLLs and EXEs 275: ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll 276: 277: # Copy needed third party DLLs 278: cp -a /usr/i686-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/. 279: cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW32/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll 280: 281: # Required for MinGW with GCC 6.3 (Debian 9) 282: FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" 283: if test -f "$FILE" 284: then 285: cp -a ${FILE} ${ZIP_DIR}/bin/. 286: fi 287: 288: # Required for MinGW with GCC 8.3 (Debian 10) 289: FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" 290: if test -f "$FILE" 291: then 292: cp -a ${FILE} ${ZIP_DIR}/bin/. 293: fi 294: 295: # Required for MinGW with GCC 10 (Debian 11) 296: FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" 297: if test -f "$FILE" 298: then 299: cp -a ${FILE} ${ZIP_DIR}/bin/. 300: fi 301: 302: # Required for MinGW with GCC 12 (Debian 12) 303: FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" 304: if test -f "$FILE" 305: then 306: cp -a ${FILE} ${ZIP_DIR}/bin/. 307: fi 308: 309: # Generate .lib file for MSVC 310: ${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/libhamlib-4.lib 311: 312: /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) 313:
001: #!/bin/sh 002: 003: # Builds Hamlib 4.x W64 binary distribution. 004: 005: # A script to build a set of W64 binary DLLs and executables from a Hamlib 006: # source tarball. This script assumes that the Hamlib source tarball has been 007: # extracted to the directory specified in $BUILD_DIR and that libusb-1.x.y has 008: # also been extracted to $BUILD_DIR. 009: 010: # See README.build-Windows for complete details. 011: 012: 013: # Set this to a desired directory 014: BUILD_DIR=~/builds 015: 016: # Set this to LibUSB archive extracted in $BUILD_DIR 017: LIBUSB_VER=libusb-1.0.24 018: 019: # Set to the correct HOST_ARCH= line for your MinGW installation 020: HOST_ARCH=x86_64-w64-mingw32 021: 022: # Set to the strip name for your version of MinGW 023: HOST_ARCH_STRIP=x86_64-w64-mingw32-strip 024: 025: # Set to the dlltool name for your version of MinGW 026: HOST_ARCH_DLLTOOL=x86_64-w64-mingw32-dlltool 027: 028: # Error return codes. See /usr/include/sysexits.h 029: EX_USAGE=64 030: EX_NOINPUT=66 031: 032: 033: # Pass name of Hamlib archive extracted in $BUILD_DIR 034: if test $# -ne 1 035: then 036: echo 037: echo "Usage: $(basename $0) hamlib-version" 038: echo "See README.build-Windows for more information." 039: echo 040: 041: exit ${EX_USAGE} 042: fi 043: 044: # Make sure the Hamlib archive is where we expect 045: if test -d ${BUILD_DIR}/$1 046: then 047: echo 048: echo "Building W64 binaries in ${BUILD_DIR}/$1" 049: echo 050: 051: cd ${BUILD_DIR}/$1 052: else 053: echo 054: echo "Build directory, ${BUILD_DIR}/$1 not found!" 055: echo "Check path for $1 or correct the version number." 056: echo 057: 058: exit ${EX_NOINPUT} 059: fi 060: 061: RELEASE=$(/usr/bin/awk 'BEGIN{FS="["; RS="]"} /\[4\./ {print $2;exit}' ./configure.ac) 062: HL_FILENAME=hamlib-w64-${RELEASE} 063: INST_DIR=$(pwd)/mingw64-inst 064: ZIP_DIR=$(pwd)/${HL_FILENAME} 065: LIBUSB_1_0_BIN_PATH=${BUILD_DIR}/${LIBUSB_VER} 066: 067: 068: # Create W64 specific README.w64-bin file 069: cat > README.w64-bin <<END_OF_README 070: What is it? 071: =========== 072: 073: This ZIP archive or Windows installer contains a build of Hamlib-$RELEASE 074: cross-compiled for MS Windows 64 bit using MinGW under Debian GNU/Linux 10 075: (nice, heh!). 076: 077: This software is copyrighted. The library license is LGPL, and the *.EXE files 078: licenses are GPL. Hamlib comes WITHOUT ANY WARRANTY. See the LICENSE.txt, 079: COPYING.txt, and COPYING.LIB.txt files. 080: 081: Supporting documentation in the form of Unix manual pages have also been 082: included after being converted to HTML. 083: 084: 085: Installation and Configuration 086: ============================== 087: 088: Extract the ZIP archive into a convenient location, C:\Program Files is a 089: reasonable choice. 090: 091: Make sure *all* the .DLL files are in your PATH (leave them in the bin 092: directory and set the PATH). To set the PATH environment variable in Windows 093: 2000, Windows XP, and Windows 7 (need info on Vista and Windows 8/10) do the 094: following: 095: 096: * W2k/XP: Right-click on "My Computer" 097: Win7: Right-click on "Computer" 098: 099: * W2k/XP: Click the "Advanced" tab of the "System Properties" dialog 100: Win7: Click the "Advanced system settings" link in the System dialog 101: 102: * Click the "Environment Variables" button of the pop-up dialog 103: 104: * Select "Path" in the "System variables" box of the "Environment Variables" 105: dialog 106: 107: NB: If you are not the administrator, system policy may not allow editing 108: the path variable. The complete path to an executable file will need to be 109: given to run one of the Hamlib programs. 110: 111: * Click the Edit button 112: 113: * Now add the Hamlib path in the "Variable Value:" edit box. Be sure to put 114: a semi-colon ';' after the last path before adding the Hamlib path (NB. The 115: entire path is highlighted and will be erased upon typing a character so 116: click in the box to unselect the text first. The PATH is important!!) 117: Append the Hamlib path, e.g. C:\Program Files\hamlib-w64-4.0~git\bin 118: 119: * Click OK for all three dialog boxes to save your changes. 120: 121: 122: Testing with the Hamlib Utilities 123: ================================= 124: 125: To continue, be sure you have read the README.betatester file, especially the 126: "Testing Hamlib" section. The primary means of testing is by way of the 127: rigctl utility for radios and rotctl utility for rotators. Each is a command 128: line program that is interactive or can act on a single command and exit. 129: 130: Documentation for each utility can be found as an HTML file in the doc 131: directory. 132: 133: In short, the command syntax is of the form: 134: 135: rigctl -m 1020 -r COM1 -vvvvv 136: 137: -m -> Radio model 1020, or Yaesu FT-817 (use 'rigctl -l' for a list) 138: -r -> Radio device, in this case COM1 139: -v -> Verbosity level. For testing four or five v characters are required. 140: Five 'v's set a debug level of TRACE which generates a lot of screen 141: output showing communication to the radio and values of important 142: variables. These traces are vital information for Hamlib rig backend 143: development. 144: 145: To run rigctl or rotctl open a cmd window (Start|Run|enter 'cmd' in the 146: dialog). If text scrolls off the screen, you can scroll back with the mouse. 147: To copy output text into a mailer or editor (I recommend Notepad++, a free 148: editor also licensed under the GPL), highlight the text as a rectangle in the 149: cmd window, press <Enter> (or right-click the window icon in the upper left 150: corner and select Edit, then Copy), and paste it into your editor with Ctl-V 151: (or Edit|Paste from the typical GUI menu). 152: 153: All feedback is welcome to the mail address below. 154: 155: 156: Uninstall 157: ========= 158: 159: To uninstall, simply delete the Hamlib directory. You may wish to edit the 160: PATH as above to remove the Hamlib bin path, if desired. 161: 162: 163: Information for w64 Programmers 164: ================================= 165: 166: The DLL has a cdecl interface. 167: 168: There is a libhamlib-4.def definition file for MS Visual C++/Visual Studio in 169: lib/msvc. Refer to the sample commands below to generate a local 170: libhamlib-4.lib file for use with the VC++/VS linker. 171: 172: Simply #include <hamlib/rig.h> (add directory to include path), include 173: libhamlib-4.lib in your project and you are done. Note: VC++/VS cannot 174: compile all the Hamlib code, but the API defined by rig.h has been made MSVC 175: friendly :-) 176: 177: As the source code for the library DLLs is licensed under the LGPL, your 178: program is not considered a "derivative work" when using the published Hamlib 179: API and normal linking to the front-end library, and may be of a license of 180: your choosing. 181: 182: As of 08 Sep 2022 a .lib file is generated using the MinGW dlltool utility. 183: If this file does not work for your project, follow the steps in the following 184: section: 185: 186: For linking the library with MS Visual C++ 2003, from the directory you 187: installed Hamlib run the following commands to generate the libhamlib-4.lib 188: file needed for linking with your MSVC project: 189: 190: cd lib\msvc 191: c:\Program Files\Microsoft Visual C++ Toolkit 2003\bin\link.exe /lib /machine:amd64 /def:libhamlib-4.def 192: 193: To do the same for Visual Studio 2017: 194: 195: cd lib\msvc 196: c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.16.27023\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 197: 198: and for VS 2019: 199: 200: cd lib\msvc 201: c:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.25.28610\bin\Hostx64\x86\bin\link.exe /lib /machine:i386 /def:libhamlib-4.def 202: 203: NOTE: feedback is requested on the previous two command examples as these do 204: not appear to be correct to generate a 64 bit libhamlib-4.lib file! 205: 206: For VS 2022: 207: 208: cd lib/msvc 209: c:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.32.31326\bin\Hostx64\x86\lib.exe /lib /machine:i386 /def:libhamlib-4.def 210: 211: The published Hamlib API may be found at: 212: 213: http://hamlib.sourceforge.net/manuals/4.1/index.html 214: 215: 216: Thank You! 217: ========== 218: 219: Patches, feedback, and contributions are welcome. 220: 221: Please report problems or success to hamlib-developer@lists.sourceforge.net 222: 223: Cheers, 224: Stephane Fillod - F8CFE 225: Mike Black - W9MDB 226: Nate Bargmann - N0NB 227: http://www.hamlib.org 228: 229: END_OF_README 230: 231: 232: # Configure and build hamlib for x86_64-w64-mingw32, with libusb-1.0 233: 234: ./configure --host=${HOST_ARCH} \ 235: --prefix=${INST_DIR} \ 236: --without-cxx-binding \ 237: --disable-static \ 238: CPPFLAGS="-I${LIBUSB_1_0_BIN_PATH}/include" \ 239: LDFLAGS="-L${LIBUSB_1_0_BIN_PATH}/MinGW64/dll" 240: 241: 242: make -j 4 install 243: 244: mkdir -p ${ZIP_DIR}/bin ${ZIP_DIR}/lib/msvc ${ZIP_DIR}/lib/gcc ${ZIP_DIR}/include ${ZIP_DIR}/doc 245: cp -a src/libhamlib.def ${ZIP_DIR}/lib/msvc/libhamlib-4.def 246: todos ${ZIP_DIR}/lib/msvc/libhamlib-4.def 247: cp -a ${INST_DIR}/include/hamlib ${ZIP_DIR}/include/. 248: todos ${ZIP_DIR}/include/hamlib/*.h 249: 250: # C++ binding is useless on w64 because of ABI 251: for f in *class.h 252: do 253: rm ${ZIP_DIR}/include/hamlib/${f} 254: done 255: 256: for f in AUTHORS ChangeLog COPYING COPYING.LIB LICENSE README.md README.betatester README.w64-bin THANKS 257: do 258: cp -a ${f} ${ZIP_DIR}/${f}.txt 259: todos ${ZIP_DIR}/${f}.txt 260: done 261: 262: # Generate HTML documents from nroff formatted man files 263: for f in doc/man1/*.1 doc/man7/*.7 264: do 265: /usr/bin/groff -mandoc -Thtml >${f}.html ${f} 266: cp -a ${f}.html ${ZIP_DIR}/doc/. 267: done 268: 269: cd ${BUILD_DIR}/$1 270: 271: # Copy build files into specific locations for Zip file 272: for f in *.exe 273: do 274: cp -a ${INST_DIR}/bin/${f} ${ZIP_DIR}/bin/. 275: done 276: 277: cp -a ${INST_DIR}/bin/libhamlib-?.dll ${ZIP_DIR}/bin/. 278: cp -a ${INST_DIR}/lib/libhamlib.dll.a ${ZIP_DIR}/lib/gcc/. 279: 280: # NB: Strip Hamlib DLLs and EXEs 281: ${HOST_ARCH_STRIP} ${ZIP_DIR}/bin/*.exe ${ZIP_DIR}/bin/*hamlib-*.dll 282: 283: # Copy needed third party DLLs 284: cp -a /usr/x86_64-w64-mingw32/lib/libwinpthread-1.dll ${ZIP_DIR}/bin/. 285: cp -a ${LIBUSB_1_0_BIN_PATH}/MinGW64/dll/libusb-1.0.dll ${ZIP_DIR}/bin/libusb-1.0.dll 286: 287: # Required for MinGW with GCC 6.3 (Debian 9) 288: FILE="/usr/lib/gcc/i686-w64-mingw32/6.3-posix/libgcc_s_sjlj-1.dll" 289: if test -f "$FILE" 290: then 291: cp -a ${FILE} ${ZIP_DIR}/bin/. 292: fi 293: 294: # Required for MinGW with GCC 8.3 (Debian 10) 295: FILE="/usr/lib/gcc/i686-w64-mingw32/8.3-posix/libgcc_s_sjlj-1.dll" 296: if test -f "$FILE" 297: then 298: cp -a ${FILE} ${ZIP_DIR}/bin/. 299: fi 300: 301: # Required for MinGW with GCC 10 (Debian 11) 302: FILE="/usr/lib/gcc/i686-w64-mingw32/10-posix/libgcc_s_dw2-1.dll" 303: if test -f "$FILE" 304: then 305: cp -a ${FILE} ${ZIP_DIR}/bin/. 306: fi 307: 308: # Required for MinGW with GCC 12 (Debian 12) 309: FILE="/usr/lib/gcc/i686-w64-mingw32/12-posix/libgcc_s_dw2-1.dll" 310: if test -f "$FILE" 311: then 312: cp -a ${FILE} ${ZIP_DIR}/bin/. 313: fi 314: 315: # Generate .lib file for MSVC 316: ${HOST_ARCH_DLLTOOL} --input-def ${ZIP_DIR}/lib/msvc/libhamlib-4.def --output-lib ${ZIP_DIR}/lib/msvc/libhamlib-4.lib 317: 318: /usr/bin/zip -r ${HL_FILENAME}.zip $(basename ${ZIP_DIR}) 319: